jskim-node #53

Merged
jskim merged 26 commits from jskim-node into main 2026-05-22 04:57:10 +00:00
Owner
No description provided.
jskim added 25 commits 2026-05-22 04:56:58 +00:00
- Added new fields for delivery details in the shipping order controller, including delivery date, delivery destination ID, and delivery address.
- Implemented validation logic to ensure that only confirmed sales orders can be processed, preventing the registration of shipments for orders that are waiting, canceled, or completed.
- Updated the save functionality to handle new delivery-related fields and improved error handling for blocked orders.
- Enhanced the shipping plan controller to include status checks and automatic updates based on changes in order quantities.

(TASK: ERP-047)
- Added checks to ensure that only orders with a positive quantity are included in the order summary by using COALESCE to handle null values.
- Updated the query logic to improve data integrity and accuracy in the order summary results.

(TASK: ERP-XXX)
- Introduced new routes for customer contact management, allowing for the retrieval of customer contact information.
- Updated the user management functionality to include validation for the hire date, ensuring proper date format and handling of null values.
- Enhanced the save user functionality to accommodate the new hire date field, maintaining existing values when not provided.

(TASK: ERP-XXX)
- Added automatic migration to include a new column `batch_use` in the `item_info` table, allowing for batch usage management.
- Implemented logic to prevent deletion of work instructions that are in progress or completed, ensuring data integrity.
- Enhanced the `getBomBaseQtyMap` function to return batch usage status for items, defaulting to 'Y' if not specified.
- Introduced warnings for overdue items and insufficient production time in the production plan management, allowing users to proceed with caution.

(TASK: ERP-node-074, ERP-node-075, ERP-node-076)
- Implemented a new endpoint for batch registration of process equipment, allowing users to add multiple equipment codes at once while skipping duplicates.
- Enhanced error handling to provide detailed feedback on the registration process, including the number of successfully inserted and skipped items.
- Updated the process info routes to include the new batch registration functionality.

(TASK: ERP-node-087)
- Added `inventory_unit` to the item selection query in the outbound controller to improve data retrieval.
- Updated the multi-table Excel service to exclude overlapping headers between parent and child levels, ensuring accurate data insertion.
- Introduced new category combobox components for better user interaction in the supplied item page.
- Enhanced the inbound-outbound page to correctly map user IDs, including super admin handling for user information retrieval.

(TASK: ERP-XXX)
- Added validation for `materialOverrides` in the `save` function of the work instruction controller, ensuring proper structure and required fields.
- Implemented logic to handle the insertion and deletion of material input details based on the provided `materialOverrides`, maintaining data integrity during edits.
- Introduced new routes for retrieving BOM tree and material overrides, enhancing the work instruction management process.
- Updated the frontend to support new material mapping features, including a structured approach for handling BOM substitutes and material inputs.

(TASK: ERP-node-090)
- Updated the outbound and outsourcing outbound controllers to replace `source_type` with `source_table` for improved clarity and consistency in data handling.
- Enhanced the work instruction controller to include automatic migration for the `work_instruction_info` table, allowing for better management of work instruction notes.
- Implemented new logic to handle material input types in the work instruction detail modal, supporting both automatic and manual input methods.
- Added new routes for retrieving work instruction information, facilitating better data retrieval for editing purposes.

(TASK: ERP-node-095, ERP-node-096)
- Add inventoryTransferController/routes for POP inventory move (send/receive)
- Add transactionPackagingService for transactional packaging operations
- Enhance popProduction/popInventoryMove/popInventoryAdjust controllers
- Enhance receiving/outbound/packaging/workInstruction controllers

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add InventoryMoveReceive component for new inventory-move inbound type
- Add pop/inbound/inventory-move page for all 9 companies
- Remove deprecated InboundCart.tsx (replaced by InboundCartPage)
- Refactor inbound type components (Purchase/Production/Recovery/Return/Subcontractor/Supplied/Change/Error)
- Apply changes across COMPANY_7/8/9/10/16/28/29/30/31

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add InventoryMoveSend component for new inventory-move outbound type
- Add pop/outbound/inventory-move page for all 9 companies
- Refactor outbound type components (Production/Sales/Return/Subcontractor/Supplied/Etc)
- Refactor OutboundCartPage and OutboundManage
- Apply changes across COMPANY_7/8/9/10/16/28/29/30/31

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Refactor ProcessWork, WorkOrderList, AcceptProcessModal, ProcessDetailModal
- Add LossDetailModal and ProcessPackagingModal for COMPANY_7
- Add AdjustHistoryModal for inventory adjust history
- Add PopCalendarModal as shared calendar picker
- Enhance SimpleKeypadModal and useCartSync hook
- Update inventory/adjust, inventory/move, inventory/inout-manage pages
- Update production/page.tsx route handlers
- Update POP.md docs for COMPANY_7 and COMPANY_31

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Update logistics/inbound-outbound pages across 9 companies
- Update production/result and production/work-instruction admin pages
- Add inventoryTransfer API client and enhance packaging/popInventoryAdjust/popInventoryMove clients
- Add transaction-packaging-loading-plan docs
- Add AdjustHistoryModal for COMPANY_9

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolved 11 conflicts by taking the jskim side. mhkim-side changes lost
in conflict zones (to be re-applied separately):

backend-node/
  - outboundController.ts: source_table/sales_order_id/shipment_plan_id/item_info_id columns in outbound_mng INSERT
  - popProductionController.ts: ensureLoadingInstance/insertPackagingRows imports and material auto-input + inventory_stock deduction block
  - workInstructionController.ts: getProcessResults function for production-result right panel
  - routes/workInstructionRoutes.ts: GET /:wiId/process-results route

frontend/
  - COMPANY_7/production/work-instruction/page.tsx: Lock icon, detailId/locked fields on WorkRow, locked column and lock icon in items table
  - COMPANY_8/10/16/28/29/production/work-instruction/page.tsx: expandedItems._qty payload (batch-split) replaced by jskim confirmItems.qty + infos
  - COMPANY_8/logistics/inbound-outbound/page.tsx: autoFilter true replaced by autoFilter:{enabled:false}

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend:
- outboundController.ts: restore sales_order_id/shipment_plan_id/item_info_id columns in outbound_mng INSERT; restore getProductionResults endpoint
- popProductionController.ts: restore transactionPackagingService import (ensureLoadingInstance/insertPackagingRows); restore material auto-input + inventory_stock deduction before WIP trigger; restore autoCompleteProcess/savePackaging/getProcessPackaging endpoints
- workInstructionController.ts: restore getProcessResults function for production-result right panel
- workInstructionRoutes.ts: restore GET /:wiId/process-results route

Frontend:
- COMPANY_7/production/work-instruction/page.tsx: restore Lock icon, WorkRow detailId/locked fields, items mapping detailId, locked column UI with lock icon and disabled cells
- COMPANY_8/10/16/28/29/production/work-instruction/page.tsx: restore SelectedItem baseQty/splitMode fields, calcBatchCount/splitQty helpers, expandedItems batch split logic in finalizeRegistration payload (keeps jskim infos field)
- COMPANY_8/logistics/inbound-outbound/page.tsx: restore autoFilter:true (company scope) for user_info writer lookup — replaces jskim autoFilter:{enabled:false} which violated multitenancy policy

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- ChecklistRow buttons for CAT_JC_03 (O/X type): "✓ 합격" → "O", "✗ 불합격" → "X"
- Saved value (Y/N), colors and handlers unchanged
- POP.md work log updated (5th entry)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DB has no sales_order_id/shipment_plan_id/item_info_id columns
(mhkim original work shipped without migration DDL), so the re-applied
INSERT would error at runtime. Roll back to jskim-side column list
to keep outbound registration working; getProductionResults endpoint
restoration is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- 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)
Re-implements the batch-id separation backend SQL that was lost during
the 2026-05-21 jskim-node merge (commit 9da6b22a). The previous re-apply
commit (15fa3e37) covered packaging/material auto-input/autoComplete
but missed the batch separation block.

Changes (B1~B10 in POP.md log):
- syncWorkInstructions: detail SELECT + generateWorkProcessesForInstruction call use detail.id instead of detail.item_number
- generateWorkProcessesForInstruction: existCheck uses batch_id = $3 OR matching item_number via subquery
- syncWorkInstructions unsynced EXISTS: matches both wid.id and wid.item_number
- getProcessList prev_good_raw: 5 inner subqueries match COALESCE(wop2.batch_id,'') = COALESCE(wop.batch_id,'') and CTE exposes wop.batch_id
- prev_good CTE: first-process fallback uses COALESCE(wid.qty, wi.qty, 0) with LEFT JOIN work_instruction_detail wid ON wid.id = pgr.batch_id
- Final SELECT: ROW_NUMBER batch_index, COUNT batch_count, wid_b.item_number batch_item_number; LEFT JOIN wid_b; ORDER BY batch keys
- getPrevProcessGoodQty: batchId param + 3 SELECTs filter COALESCE(batch_id,'') = $batchKey
- evaluatePrevProcesses: batchId param + wop_with_seq CTE adds COALESCE(wop.batch_id,'') = $4 + fetchInstructionQty prefers work_instruction_detail.qty when batchKey present
- getAvailableQty: current SELECT adds wop.batch_id and passes to evaluatePrevProcesses
- acceptProcess: master FOR UPDATE SELECT adds wop.batch_id and passes to evaluatePrevProcesses

Verification (per POP.md):
- backend npm run build PASS
- GET /api/pop/production/processes responds with batch_id/batch_index/batch_count/batch_item_number
- COMPANY_7 GUI: 25 cards, 17 with -NN (n/m) suffix; CODE-00027 shows -01..04 of 4 correctly
- No regression on single-batch (batch_id NULL) rows due to COALESCE matching pattern

Known follow-up: work-instruction edit guard (locked detail rows) — implemented in next commit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Implements the lock scenario originally designed in mhkim 79962160 that was
lost during the jskim-node merge. Production-acknowledged detail rows
(those with batch_id-matched work_order_process having work_order_process_result)
are protected from item/qty/routing changes and deletion during work-instruction edit.

Layer 1 — backend list SQL (2 locations, paginated + non-paginated):
- Add is_locked column via EXISTS subquery
  (wopr JOIN wop where wop.wo_id = wi.id AND wop.batch_id = d.id OR d.item_number)
- Leverages idx_wop_company_wo for performance

Layer 2 — backend save edit-mode rewrite (workInstructionController.ts:save):
1. Load existing detail rows with is_locked
2. Classify payload items: detailId match → updates, no match → inserts, missing in payload → deleteIds
3. Lock guard:
   - UPDATE: locked row item/qty/routing change → throw
   - DELETE: locked row → throw
4. work_instruction header UPDATE (existing)
5. deleteIds: cascade DELETE process_work_result → work_order_process → work_instruction_detail
6. updates: locked → schedule/equipment/worker only; unlocked → full + wop.plan_qty sync
7. inserts: standard INSERT (shared with new-mode path)

Layer 3 — frontend COMPANY_7 mapping:
- relatedDetails.map adds detailId: d.detail_id, locked: d.is_locked === true

Verification:
- backend npm run build PASS
- frontend tsc work-instruction file errors 0
- DB SQL simulation: COMPANY_7 CODE-00010 detail correctly identified as locked

Companion to previous commit (POP batch-id separation restoration). Together they
re-establish mhkim's original batch-aware work-instruction lifecycle.

Scope: COMPANY_7 only. COMPANY_8/9/10/16/28/29/30/31 frontend mapping pending verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Apply the same Layer 3 pattern as COMPANY_7 (commit 47170444) to the
remaining work-instruction screens. Backend Layer 1/2 (workInstructionController
is_locked + save guard) is shared, so frontend mapping is the only change needed.

Per company:
- SelectedItem interface: add detailId? + locked? fields
- relatedDetails.map: add detailId: d.detail_id, locked: d.is_locked === true

COMPANY_30 already had this mapping (mhkim work survived the merge there),
so it is excluded from this commit.

Verification: frontend tsc on changed files → 0 errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Integrated `SmartSelect` component for improved material selection in the cutting plan page, providing a better user experience when no materials are available.
- Updated the work instruction modal to include routing options directly selectable by users, enhancing the flexibility of work instruction management.
- Adjusted table layouts across various components to accommodate new data fields and improve overall UI consistency.

(TASK: ERP-XXX)
충돌 해결: COMPANY_9 ProcessWork.tsx — checklist 조회를 mhkim-node 방식(process_work_result + process_work_inspection_result 통합)으로 채택, judgment_criteria 중복 선언 정리 (TASK:ERP-103 O/X 분기 렌더링 유지)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jskim added 1 commit 2026-05-22 04:57:04 +00:00
jskim merged commit a36f126323 into main 2026-05-22 04:57:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jskim/vexplor_dev#53