feat: Enhance outbound and receiving functionalities
- Updated inventory history insertion logic in both outbound and receiving controllers to use consistent field names and types. - Added a new endpoint for retrieving warehouse locations, improving the ability to manage inventory locations. - Enhanced the outbound page to include location selection based on the selected warehouse, improving user experience and data accuracy. - Implemented validation for warehouse code duplication during new warehouse registration in the warehouse management page. These changes aim to streamline inventory management processes and enhance the overall functionality of the logistics module.
This commit is contained in:
@@ -266,10 +266,10 @@ export async function create(req: AuthenticatedRequest, res: Response) {
|
||||
const afterQty = afterStockRes.rows[0]?.current_qty || String(inQty);
|
||||
await client.query(
|
||||
`INSERT INTO inventory_history (
|
||||
id, company_code, item_number, warehouse_code, location_code,
|
||||
history_type, history_date, change_qty, after_qty, reason,
|
||||
created_by, created_date
|
||||
) VALUES (gen_random_uuid()::text, $1, $2, $3, $4, '입고', NOW()::date, $5, $6, $7, $8, NOW())`,
|
||||
id, company_code, item_code, warehouse_code, location_code,
|
||||
transaction_type, transaction_date, quantity, balance_qty, remark,
|
||||
writer, created_date
|
||||
) VALUES (gen_random_uuid()::text, $1, $2, $3, $4, '입고', NOW(), $5, $6, $7, $8, NOW())`,
|
||||
[companyCode, itemCode, whCode, locCode, String(inQty), afterQty, item.inbound_type || '입고', userId]
|
||||
);
|
||||
}
|
||||
@@ -548,10 +548,10 @@ export async function deleteReceiving(req: AuthenticatedRequest, res: Response)
|
||||
const afterQty = afterStockRes.rows[0]?.current_qty || '0';
|
||||
await client.query(
|
||||
`INSERT INTO inventory_history (
|
||||
id, company_code, item_number, warehouse_code, location_code,
|
||||
history_type, history_date, change_qty, after_qty, reason,
|
||||
created_by, created_date
|
||||
) VALUES (gen_random_uuid()::text, $1, $2, $3, $4, '입고취소', NOW()::date, $5, $6, '입고 삭제에 의한 롤백', $7, NOW())`,
|
||||
id, company_code, item_code, warehouse_code, location_code,
|
||||
transaction_type, transaction_date, quantity, balance_qty, remark,
|
||||
writer, created_date
|
||||
) VALUES (gen_random_uuid()::text, $1, $2, $3, $4, '입고취소', NOW(), $5, $6, '입고 삭제에 의한 롤백', $7, NOW())`,
|
||||
[companyCode, itemCode, whCode, locCode, String(-inQty), afterQty, userId]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user