feat: enhance shipping plan editor and batch save functionality
- Added planDate support in batch save operations for shipping plans, allowing for more accurate scheduling. - Updated the ShippingPlanEditorComponent to handle planDate and splitKey for better management of shipping plans. - Enhanced validation logic to ensure that the total planned quantity does not exceed available stock during the editing process. - Introduced functionality to add and remove split rows dynamically, improving user experience in managing shipping plans. These changes aim to provide a more robust and flexible shipping plan management experience, facilitating better tracking and scheduling of shipping operations.
This commit is contained in:
@@ -333,8 +333,9 @@ export async function batchSave(req: AuthenticatedRequest, res: Response) {
|
||||
const savedPlans = [];
|
||||
|
||||
for (const plan of plans) {
|
||||
const { sourceId, planQty } = plan;
|
||||
const { sourceId, planQty, planDate } = plan;
|
||||
if (!sourceId || !planQty || planQty <= 0) continue;
|
||||
const planDateValue = planDate || null;
|
||||
|
||||
if (detectedSource === "detail") {
|
||||
// 디테일 소스: detail_id로 저장
|
||||
@@ -368,9 +369,9 @@ export async function batchSave(req: AuthenticatedRequest, res: Response) {
|
||||
const insertRes = await client.query(
|
||||
`INSERT INTO shipment_plan
|
||||
(company_code, detail_id, sales_order_id, plan_qty, plan_date, status, created_by)
|
||||
VALUES ($1, $2, $3, $4, CURRENT_DATE, 'READY', $5)
|
||||
VALUES ($1, $2, $3, $4, COALESCE($5::date, CURRENT_DATE), 'READY', $6)
|
||||
RETURNING *`,
|
||||
[companyCode, sourceId, detail.master_id, planQty, userId]
|
||||
[companyCode, sourceId, detail.master_id, planQty, planDateValue, userId]
|
||||
);
|
||||
savedPlans.push(insertRes.rows[0]);
|
||||
|
||||
@@ -410,9 +411,9 @@ export async function batchSave(req: AuthenticatedRequest, res: Response) {
|
||||
const insertRes = await client.query(
|
||||
`INSERT INTO shipment_plan
|
||||
(company_code, sales_order_id, plan_qty, plan_date, status, created_by)
|
||||
VALUES ($1, $2, $3, CURRENT_DATE, 'READY', $4)
|
||||
VALUES ($1, $2, $3, COALESCE($4::date, CURRENT_DATE), 'READY', $5)
|
||||
RETURNING *`,
|
||||
[companyCode, masterId, planQty, userId]
|
||||
[companyCode, masterId, planQty, planDateValue, userId]
|
||||
);
|
||||
savedPlans.push(insertRes.rows[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user