fix: 리워크 접수 버그 2건 수정
- 리워크 전량 접수 시 status→in_progress (재접수 방지) - 리워크 접수 시 master input_qty 덮어쓰기 방지 - 재고 중복: location_code 차이 (NULL vs "01") — 정상 동작이지만 주의 필요
This commit is contained in:
@@ -1858,13 +1858,24 @@ export const acceptProcess = async (req: AuthenticatedRequest, res: Response) =>
|
||||
client, masterId, splitId, row.routing_detail_id, companyCode, userId
|
||||
);
|
||||
|
||||
// 마스터 행의 input_qty를 분할 합계로 갱신
|
||||
const newTotalInput = currentTotalInput + qty;
|
||||
await client.query(
|
||||
`UPDATE work_order_process SET input_qty = $3, updated_date = NOW()
|
||||
WHERE id = $1 AND company_code = $2`,
|
||||
[masterId, companyCode, String(newTotalInput)]
|
||||
);
|
||||
// 마스터 행의 input_qty를 분할 합계로 갱신 (리워크 접수 시에는 마스터 input_qty 변경 안 함)
|
||||
if (!isRework) {
|
||||
const newTotalInput = currentTotalInput + qty;
|
||||
await client.query(
|
||||
`UPDATE work_order_process SET input_qty = $3, updated_date = NOW()
|
||||
WHERE id = $1 AND company_code = $2`,
|
||||
[masterId, companyCode, String(newTotalInput)]
|
||||
);
|
||||
}
|
||||
|
||||
// 리워크 카드: 전량 접수 시 status를 in_progress로 변경 (추가 접수 방지)
|
||||
if (isRework && qty >= reworkInputQty) {
|
||||
await client.query(
|
||||
`UPDATE work_order_process SET status = 'in_progress', updated_date = NOW()
|
||||
WHERE id = $1 AND company_code = $2`,
|
||||
[work_order_process_id, companyCode]
|
||||
);
|
||||
}
|
||||
|
||||
await client.query("COMMIT");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user