diff --git a/src/app/api/jo/actions.ts b/src/app/api/jo/actions.ts index e5b4d1e..7d92e77 100644 --- a/src/app/api/jo/actions.ts +++ b/src/app/api/jo/actions.ts @@ -352,6 +352,8 @@ export interface AllJoborderProductProcessInfoResponse { uom: string; isDrink?: boolean | null; stockInLineId: number; + /** Stock-in-line current status (e.g. receiving/received/partially_completed/completed/rejected). */ + stockInLineStatus?: string | null; jobOrderCode: string; productProcessLineCount: number; FinishedProductProcessLineCount: number; @@ -798,6 +800,8 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { qcReady?: boolean | null; type?: string | null; includePutaway?: boolean | null; + /** all | completed | notCompleted */ + putawayStatus?: string | null; page?: number; size?: number; }) => { @@ -808,6 +812,7 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { bomIds, qcReady, includePutaway, + putawayStatus, type, page = 0, size = 50, @@ -825,6 +830,7 @@ export const fetchJoborderProductProcessesPage = cache(async (params: { if (includePutaway !== undefined && includePutaway !== null) { queryParts.push(`includePutaway=${includePutaway}`); } + if (putawayStatus) queryParts.push(`putawayStatus=${encodeURIComponent(putawayStatus)}`); queryParts.push(`page=${page}`); queryParts.push(`size=${size}`); diff --git a/src/components/ProductionProcess/ProductionProcessList.tsx b/src/components/ProductionProcess/ProductionProcessList.tsx index 8e2b5d9..69e5682 100644 --- a/src/components/ProductionProcess/ProductionProcessList.tsx +++ b/src/components/ProductionProcess/ProductionProcessList.tsx @@ -60,6 +60,9 @@ interface ProductProcessListProps { onSelectMatchingStock: (jobOrderId: number|undefined, productProcessId: number|undefined,pickOrderId: number|undefined) => void; printerCombo: PrinterCombo[]; qcReady: boolean; + includePutaway?: boolean | null; + /** all | completed | notCompleted */ + putawayStatus?: string | null; listPersistedState: ProductionProcessListPersistedState; onListPersistedStateChange: React.Dispatch< React.SetStateAction @@ -93,6 +96,8 @@ const ProductProcessList: React.FC = ({ printerCombo, onSelectMatchingStock, qcReady, + includePutaway, + putawayStatus, listPersistedState, onListPersistedStateChange, }) => { @@ -258,7 +263,8 @@ const ProductProcessList: React.FC = ({ itemCode: appliedSearch.itemCode, jobOrderCode: appliedSearch.jobOrderCode, qcReady, - includePutaway: qcReady ? true : null, + includePutaway: includePutaway ?? (qcReady ? true : null), + putawayStatus, type: typeParam, page, size: PAGE_SIZE, @@ -273,7 +279,7 @@ const ProductProcessList: React.FC = ({ } finally { setLoading(false); } - }, [listPersistedState, qcReady]); + }, [listPersistedState, qcReady, includePutaway, putawayStatus]); useEffect(() => { fetchProcesses(); diff --git a/src/components/ProductionProcess/ProductionProcessPage.tsx b/src/components/ProductionProcess/ProductionProcessPage.tsx index 13501d0..aa48f3e 100644 --- a/src/components/ProductionProcess/ProductionProcessPage.tsx +++ b/src/components/ProductionProcess/ProductionProcessPage.tsx @@ -36,7 +36,10 @@ const ProductionProcessPage: React.FC = ({ printerCo const [productionListState, setProductionListState] = useState( createDefaultProductionProcessListPersistedState, ); - const [finishedQcListState, setFinishedQcListState] = useState( + const [waitingPutawayListState, setWaitingPutawayListState] = useState( + createDefaultProductionProcessListPersistedState, + ); + const [putawayedListState, setPutawayedListState] = useState( createDefaultProductionProcessListPersistedState, ); const { data: session } = useSession() as { data: SessionWithTokens | null }; @@ -199,7 +202,8 @@ const ProductionProcessPage: React.FC = ({ printerCo - + + @@ -231,8 +235,10 @@ const ProductionProcessPage: React.FC = ({ printerCo { const id = jobOrderId ?? null; if (id !== null) { @@ -248,13 +254,36 @@ const ProductionProcessPage: React.FC = ({ printerCo }} /> )} - {tabIndex === 2 && ( - + {tabIndex === 2 && ( + { + const id = jobOrderId ?? null; + if (id !== null) { + setSelectedProcessId(id); + } + }} + onSelectMatchingStock={(jobOrderId, productProcessId, pickOrderId) => { + setSelectedMatchingStock({ + jobOrderId: jobOrderId || 0, + productProcessId: productProcessId || 0, + pickOrderId: pickOrderId || 0, + }); + }} + /> )} {tabIndex === 3 && ( - + )} {tabIndex === 4 && ( + + )} + {tabIndex === 5 && ( )} diff --git a/src/components/PutAwayScan/PutAwayModal.tsx b/src/components/PutAwayScan/PutAwayModal.tsx index 2f8e6f9..f14cb8d 100644 --- a/src/components/PutAwayScan/PutAwayModal.tsx +++ b/src/components/PutAwayScan/PutAwayModal.tsx @@ -128,6 +128,7 @@ const PutAwayModal: React.FC = ({ open, onClose, warehouse, stockInLineId ...defaultNewValue, }, }); + const { isSubmitting } = formProps.formState; const errors = formProps.formState.errors; useEffect(() => { @@ -646,7 +647,7 @@ const PutAwayModal: React.FC = ({ open, onClose, warehouse, stockInLineId }, }} // onClick={formProps.handleSubmit()} - disabled={!verified || qtyError != ""} + disabled={!verified || qtyError != "" || isSubmitting} > {t("confirm putaway")} diff --git a/src/i18n/zh/common.json b/src/i18n/zh/common.json index f4a3cf1..cc41c68 100644 --- a/src/i18n/zh/common.json +++ b/src/i18n/zh/common.json @@ -12,6 +12,8 @@ "Please Select BOM": "請選擇 BOM", "No Lot": "沒有批號", "Select All": "全選", + "Waiting QC Put Away Job Orders": "待QC上架工單", + "Put Awayed Job Orders": "已上架工單", "Loading BOM Detail...": "正在載入 BOM 明細…", "Output Quantity": "使用數量", "Process & Equipment": "製程與設備",