대진 오류사항 일부 수정

This commit is contained in:
kjs
2026-05-19 11:57:05 +09:00
parent fa9f5451f6
commit 6731ca4183
17 changed files with 1673 additions and 132 deletions

View File

@@ -1669,6 +1669,20 @@ const checkAndCompleteWorkInstruction = async (
if (itemResult.rowCount === 0) return;
const itemCode = itemResult.rows[0].item_number;
// 담당자 한글명 조회 — inventory_history manager_name 기록용
// (CLAUDE.md "사용자 식별 표시 필수": DB에는 user_id 저장, 표시는 user_name)
let autoUserName = userId;
try {
const mgrRes = await pool.query(
`SELECT COALESCE(NULLIF(user_name, ''), user_id) AS user_name
FROM user_info WHERE user_id = $1 AND company_code = $2 LIMIT 1`,
[userId, companyCode],
);
if (mgrRes.rows[0]?.user_name) autoUserName = mgrRes.rows[0].user_name;
} catch {
/* user_info 조회 실패 시 userId fallback 유지 */
}
const warehouseResult = await pool.query(
`SELECT target_warehouse_id, target_location_code
FROM work_order_process
@@ -1722,7 +1736,7 @@ const checkAndCompleteWorkInstruction = async (
completedQty,
userId,
{
userName: userId,
userName: autoUserName,
source: "auto_cascade",
woId,
},