Merge remote-tracking branch 'origin/jskim-node' into jskim-node

; Conflicts:
;	frontend/app/(main)/COMPANY_30/sales/order/page.tsx
This commit is contained in:
DDD1542
2026-04-16 12:10:32 +09:00
68 changed files with 5886 additions and 533 deletions

View File

@@ -207,6 +207,17 @@ export async function create(req: AuthenticatedRequest, res: Response) {
}
const insertedDetails: any[] = [];
// 기존 디테일이 있으면 스킵 (멱등성 — 같은 inbound_number로 2번 호출 방지)
const existingDetails = await client.query(
`SELECT COUNT(*) AS cnt FROM inbound_detail WHERE company_code = $1 AND inbound_id = $2`,
[companyCode, inboundNumber]
);
if (parseInt(existingDetails.rows[0].cnt, 10) > 0) {
await client.query("COMMIT");
client.release();
return res.json({ success: true, data: [], message: "이미 등록된 입고입니다." });
}
// 2. 디테일 INSERT (inbound_detail) + 재고/발주 업데이트
for (let i = 0; i < items.length; i++) {
const item = items[i];