feat: Enhance work item detail management with additional inspection fields
- Updated the processWorkStandardController and workInstructionController to include new fields for process_inspection_apply and equip_inspection_apply in SQL queries and data handling. - Modified the DetailFormModal and WorkItemDetailList components to support individual registration of inspection items and equipment inspections, improving the flexibility of the inspection process. - Implemented logic to handle automatic content generation for inspection and equipment inspection types, enhancing user experience and data accuracy. - These changes aim to improve the management of work item details and streamline the inspection process across multiple company implementations.
This commit is contained in:
@@ -463,7 +463,7 @@ export async function getWorkItemDetails(req: AuthenticatedRequest, res: Respons
|
||||
SELECT id, work_item_id, detail_type, content, is_required, sort_order, remark,
|
||||
inspection_code, inspection_method, unit, lower_limit, upper_limit,
|
||||
duration_minutes, input_type, lookup_target, display_fields,
|
||||
selected_bom_items, created_date
|
||||
selected_bom_items, process_inspection_apply, equip_inspection_apply, created_date
|
||||
FROM process_work_item_detail
|
||||
WHERE work_item_id = $1 AND company_code = $2
|
||||
ORDER BY sort_order, created_date
|
||||
@@ -492,7 +492,7 @@ export async function createWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
work_item_id, detail_type, content, is_required, sort_order, remark,
|
||||
inspection_code, inspection_method, unit, lower_limit, upper_limit,
|
||||
duration_minutes, input_type, lookup_target, display_fields,
|
||||
selected_bom_items,
|
||||
selected_bom_items, process_inspection_apply, equip_inspection_apply,
|
||||
} = req.body;
|
||||
|
||||
if (!work_item_id || !content) {
|
||||
@@ -515,8 +515,9 @@ export async function createWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
INSERT INTO process_work_item_detail
|
||||
(company_code, work_item_id, detail_type, content, is_required, sort_order, remark, writer,
|
||||
inspection_code, inspection_method, unit, lower_limit, upper_limit,
|
||||
duration_minutes, input_type, lookup_target, display_fields, selected_bom_items)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
|
||||
duration_minutes, input_type, lookup_target, display_fields, selected_bom_items,
|
||||
process_inspection_apply, equip_inspection_apply)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
|
||||
RETURNING *
|
||||
`;
|
||||
|
||||
@@ -542,6 +543,8 @@ export async function createWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
lookup_target || null,
|
||||
display_fields || null,
|
||||
bomItemsJson,
|
||||
process_inspection_apply || null,
|
||||
equip_inspection_apply || null,
|
||||
]);
|
||||
|
||||
logger.info("작업 항목 상세 생성", { companyCode, id: result.rows[0].id });
|
||||
@@ -567,7 +570,7 @@ export async function updateWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
detail_type, content, is_required, sort_order, remark,
|
||||
inspection_code, inspection_method, unit, lower_limit, upper_limit,
|
||||
duration_minutes, input_type, lookup_target, display_fields,
|
||||
selected_bom_items,
|
||||
selected_bom_items, process_inspection_apply, equip_inspection_apply,
|
||||
} = req.body;
|
||||
|
||||
const bomItemsJson = Array.isArray(selected_bom_items) ? JSON.stringify(selected_bom_items) : selected_bom_items ?? null;
|
||||
@@ -589,6 +592,8 @@ export async function updateWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
lookup_target = $15,
|
||||
display_fields = $16,
|
||||
selected_bom_items = $17,
|
||||
process_inspection_apply = $18,
|
||||
equip_inspection_apply = $19,
|
||||
updated_date = NOW()
|
||||
WHERE id = $6 AND company_code = $7
|
||||
RETURNING *
|
||||
@@ -612,6 +617,8 @@ export async function updateWorkItemDetail(req: AuthenticatedRequest, res: Respo
|
||||
lookup_target || null,
|
||||
display_fields || null,
|
||||
bomItemsJson,
|
||||
process_inspection_apply || null,
|
||||
equip_inspection_apply || null,
|
||||
]);
|
||||
|
||||
if (result.rowCount === 0) {
|
||||
|
||||
Reference in New Issue
Block a user