Enhance Item Inspection and Outbound Functionality
- Added `apply_process_name` to the item inspection controller, allowing for better clarity in process identification by joining with the `process_mng` table. - Updated the outbound controller to include additional delivery details, such as `delivery_destination_name` and `customer_name`, with fallback logic for improved data accuracy. - Enhanced the query logic to ensure proper handling of delivery addresses and customer information, improving the overall data retrieval process. (TASK: ERP-XXX)
This commit is contained in:
@@ -18,6 +18,7 @@ interface InspectionRow {
|
||||
inspection_item_name: string | null;
|
||||
inspection_method: string | null;
|
||||
apply_process: string | null;
|
||||
apply_process_name: string | null;
|
||||
classification: string | null;
|
||||
pass_criteria: string | null;
|
||||
upper_limit: string | null;
|
||||
@@ -96,16 +97,25 @@ export async function getGroupedList(req: AuthenticatedRequest, res: Response) {
|
||||
}
|
||||
|
||||
// 3) 페이지 item_code들의 모든 검사항목 row
|
||||
// 적용공정(apply_process)은 공정 코드(P001 등)이므로 process_mng JOIN으로 공정명 해석.
|
||||
// 공정 매핑이 깨졌거나 코드가 없으면 apply_process_name 은 NULL → 프론트에서 코드 fallback.
|
||||
const detailQuery = `
|
||||
SELECT
|
||||
id, item_code, item_name, inspection_type, inspection_standard, inspection_standard_id,
|
||||
inspection_item_name, inspection_method, apply_process, classification,
|
||||
pass_criteria, upper_limit, lower_limit, is_required, is_active, manager_id, memo,
|
||||
sort_order, change_record, created_date, updated_date
|
||||
FROM item_inspection_info
|
||||
WHERE company_code = $1
|
||||
AND item_code = ANY($2::text[])
|
||||
ORDER BY item_code, sort_order, created_date;
|
||||
iii.id, iii.item_code, iii.item_name, iii.inspection_type, iii.inspection_standard,
|
||||
iii.inspection_standard_id, iii.inspection_item_name, iii.inspection_method,
|
||||
iii.apply_process,
|
||||
pm.process_name AS apply_process_name,
|
||||
iii.classification,
|
||||
iii.pass_criteria, iii.upper_limit, iii.lower_limit, iii.is_required, iii.is_active,
|
||||
iii.manager_id, iii.memo, iii.sort_order, iii.change_record,
|
||||
iii.created_date, iii.updated_date
|
||||
FROM item_inspection_info iii
|
||||
LEFT JOIN process_mng pm
|
||||
ON pm.process_code = iii.apply_process
|
||||
AND pm.company_code = iii.company_code
|
||||
WHERE iii.company_code = $1
|
||||
AND iii.item_code = ANY($2::text[])
|
||||
ORDER BY iii.item_code, iii.sort_order, iii.created_date;
|
||||
`;
|
||||
const detailRes = await pool.query(detailQuery, [companyCode, itemCodes]);
|
||||
const rowsByItem: Record<string, InspectionRow[]> = {};
|
||||
|
||||
Reference in New Issue
Block a user