diff --git a/src/app/api/jo/actions.ts b/src/app/api/jo/actions.ts index 33e05e7..e5b4d1e 100644 --- a/src/app/api/jo/actions.ts +++ b/src/app/api/jo/actions.ts @@ -797,6 +797,7 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { bomIds?: number[] | null; qcReady?: boolean | null; type?: string | null; + includePutaway?: boolean | null; page?: number; size?: number; }) => { @@ -806,6 +807,7 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { jobOrderCode, bomIds, qcReady, + includePutaway, type, page = 0, size = 50, @@ -820,7 +822,9 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { if (bomIds && bomIds.length > 0) queryParts.push(`bomIds=${bomIds.join(",")}`); if (qcReady !== undefined && qcReady !== null) queryParts.push(`qcReady=${qcReady}`); if (type) queryParts.push(`type=${encodeURIComponent(type)}`); - + if (includePutaway !== undefined && includePutaway !== null) { + queryParts.push(`includePutaway=${includePutaway}`); + } queryParts.push(`page=${page}`); queryParts.push(`size=${size}`); diff --git a/src/app/api/pickOrder/actions.ts b/src/app/api/pickOrder/actions.ts index 5811294..2dcde47 100644 --- a/src/app/api/pickOrder/actions.ts +++ b/src/app/api/pickOrder/actions.ts @@ -579,7 +579,7 @@ export const batchScan = async (data: BatchScanRequest) => { }, ); - console.log("📥 batchScan - Response:", response); + //console.log("📥 batchScan - Response:", response); return response; }; export const fetchDoPickOrderDetail = async ( @@ -765,6 +765,14 @@ export const fetchFGPickOrdersByUserId = async (userId: number) => { ); return response; }; + +/** DO workbench: FG headers from `delivery_order_pick_order`, not `do_pick_order_line`. */ +export const fetchFGPickOrdersByUserIdWorkbench = async (userId: number) => { + return serverFetchJson( + `${BASE_API_URL}/pickOrder/fg-pick-orders-workbench/${userId}`, + { method: "GET" }, + ); +}; export const updateSuggestedLotLineId = async (suggestedPickLotId: number, newLotLineId: number) => { const response = await serverFetchJson>( `${BASE_API_URL}/suggestedPickLot/update-suggested-lot/${suggestedPickLotId}`, @@ -824,6 +832,8 @@ export const recordPickExecutionIssue = async (data: PickExecutionIssueData) => revalidateTag("pickorder"); return result; }; + + export const resuggestPickOrder = async (pickOrderId: number) => { console.log("Resuggesting pick order:", pickOrderId); const result = await serverFetchJson( @@ -1134,6 +1144,26 @@ export const fetchAllPickOrderLotsHierarchical = cache(async (userId: number): P }; } }); + +/** DO workbench: hierarchical lots where header is `delivery_order_pick_order`. */ +export const fetchAllPickOrderLotsHierarchicalWorkbench = cache(async (userId: number): Promise => { + try { + const data = await serverFetchJson( + `${BASE_API_URL}/pickOrder/all-lots-hierarchical-workbench/${userId}`, + { + method: "GET", + next: { tags: ["pickorder"] }, + }, + ); + return data; + } catch (error) { + console.error("❌ Error fetching workbench hierarchical lot details:", error); + return { + pickOrder: null, + pickOrderLines: [], + }; + } +}); export const fetchLotDetailsByDoPickOrderRecordId = async (doPickOrderRecordId: number): Promise<{ fgInfo: any; pickOrders: any[]; diff --git a/src/components/ProductionProcess/ProductionProcessList.tsx b/src/components/ProductionProcess/ProductionProcessList.tsx index 068a94a..8e2b5d9 100644 --- a/src/components/ProductionProcess/ProductionProcessList.tsx +++ b/src/components/ProductionProcess/ProductionProcessList.tsx @@ -258,6 +258,7 @@ const ProductProcessList: React.FC = ({ itemCode: appliedSearch.itemCode, jobOrderCode: appliedSearch.jobOrderCode, qcReady, + includePutaway: qcReady ? true : null, type: typeParam, page, size: PAGE_SIZE, @@ -339,7 +340,7 @@ const ProductProcessList: React.FC = ({ const closeNewModal = useCallback(() => { // const response = updateJo({ id: 1, status: "storing" }); setOpenModal(false); // Close the modal first - fetchProcesses(); + // fetchProcesses(); // setTimeout(() => { // }, 300); // Add a delay to avoid immediate re-trigger of useEffect }, [fetchProcesses]);