u
This commit is contained in:
@@ -56,17 +56,24 @@ WHERE id = @id
|
||||
AND manifest_id IN (SELECT m.id FROM manifest m WHERE m.company_id = @companyId)
|
||||
`;
|
||||
|
||||
export const CHECK_CARRIER = `
|
||||
SELECT TOP 1 id, name
|
||||
FROM carrier
|
||||
WHERE id = @carrierId AND company_id = @companyId;
|
||||
`;
|
||||
|
||||
export const SHIPPING_CREATE = `
|
||||
INSERT INTO shipping (manifest_id, [number], tracking_code, carrier, [type], [state])
|
||||
OUTPUT INSERTED.id, INSERTED.manifest_id, INSERTED.[number], INSERTED.tracking_code, INSERTED.carrier, INSERTED.[type], INSERTED.[state]
|
||||
VALUES (@manifestId, @number, @trackingCode, @carrier, @type, @state)
|
||||
INSERT INTO shipping (manifest_id, [number], tracking_code, carrier_id, [type], [state])
|
||||
OUTPUT INSERTED.id, INSERTED.manifest_id, INSERTED.[number], INSERTED.tracking_code, INSERTED.carrier_id, INSERTED.[type], INSERTED.[state]
|
||||
VALUES (@manifestId, @number, @trackingCode, @carrierId, @type, @state)
|
||||
`;
|
||||
|
||||
export const SHIPPING_LIST_BY_MANIFEST = `
|
||||
SELECT id, manifest_id, [number], tracking_code, carrier, [type], [state]
|
||||
FROM shipping
|
||||
WHERE manifest_id = @manifestId
|
||||
ORDER BY id ASC
|
||||
SELECT s.id, s.manifest_id, s.[number], s.tracking_code, s.carrier_id, c.name AS carrier, s.[type], s.[state]
|
||||
FROM shipping s
|
||||
LEFT JOIN carrier c ON c.id = s.carrier_id
|
||||
WHERE s.manifest_id = @manifestId
|
||||
ORDER BY s.id ASC
|
||||
`;
|
||||
|
||||
export const SHIPPING_DELETE = `
|
||||
@@ -76,16 +83,17 @@ WHERE id = @id
|
||||
`;
|
||||
|
||||
export const GET_SHIPPING_BY_ID = `
|
||||
SELECT s.id, s.manifest_id AS manifestId, s.[number], s.tracking_code, s.carrier, s.[type], s.[state]
|
||||
SELECT s.id, s.manifest_id AS manifestId, s.[number], s.tracking_code, s.carrier_id AS carrierId, c.name AS carrier, s.[type], s.[state]
|
||||
FROM shipping s
|
||||
INNER JOIN manifest m ON m.id = s.manifest_id
|
||||
LEFT JOIN carrier c ON c.id = s.carrier_id
|
||||
WHERE s.id = @id AND m.company_id = @companyId;
|
||||
`;
|
||||
|
||||
export const SHIPPING_UPDATE = `
|
||||
UPDATE shipping
|
||||
SET [type] = @type, [state] = @state, tracking_code = @trackingCode, carrier = @carrier
|
||||
OUTPUT INSERTED.id, INSERTED.manifest_id, INSERTED.[number], INSERTED.tracking_code, INSERTED.carrier, INSERTED.[type], INSERTED.[state]
|
||||
SET [type] = @type, [state] = @state, tracking_code = @trackingCode, carrier_id = @carrierId
|
||||
OUTPUT INSERTED.id, INSERTED.manifest_id, INSERTED.[number], INSERTED.tracking_code, INSERTED.carrier_id, INSERTED.[type], INSERTED.[state]
|
||||
WHERE id = @id;
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user