From 30823cee8e29549f53834c26ec1fd6222ceb1479 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Mon, 2 Feb 2026 10:26:43 +0800 Subject: [PATCH] update scan lot --- .../GoodPickExecutiondetail.tsx | 21 +- src/components/Jodetail/JoPickOrderList.tsx | 3 +- .../Jodetail/JobPickExecutionForm.tsx | 49 +--- .../Jodetail/newJobPickExecution.tsx | 247 +++++++++++------- .../ProductionProcessJobOrderDetail.tsx | 1 + src/i18n/zh/common.json | 3 + src/i18n/zh/jo.json | 3 + src/i18n/zh/pickOrder.json | 1 + 8 files changed, 177 insertions(+), 151 deletions(-) diff --git a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx index 549164f..9097a15 100644 --- a/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx +++ b/src/components/FinishedGoodSearch/GoodPickExecutiondetail.tsx @@ -3208,9 +3208,23 @@ paginatedData.map((lot, index) => { const isRejected = status === 'rejected' || lot.lotAvailability === 'rejected'; const isNoLot = !lot.lotNo; - // rejected lot:不显示任何按钮 + // ✅ rejected lot:显示提示文本(换行显示) if (isRejected && !isNoLot) { - return null; + return ( + + {t("This lot is rejected, please scan another lot.")} + + ); } // noLot 情况:只显示 Issue 按钮 @@ -3264,10 +3278,7 @@ paginatedData.map((lot, index) => { onClick={() => handlePickExecutionForm(lot)} disabled={ lot.lotAvailability === 'expired' || - //lot.lotAvailability === 'status_unavailable' || - // lot.lotAvailability === 'rejected' || lot.stockOutLineStatus === 'completed' - //lot.stockOutLineStatus === 'pending' } sx={{ fontSize: '0.7rem', diff --git a/src/components/Jodetail/JoPickOrderList.tsx b/src/components/Jodetail/JoPickOrderList.tsx index 907738e..938960b 100644 --- a/src/components/Jodetail/JoPickOrderList.tsx +++ b/src/components/Jodetail/JoPickOrderList.tsx @@ -50,7 +50,8 @@ const JoPickOrderList: React.FC = ({ onSwitchToRecordTab }) =>{ const handleBackToList = useCallback(() => { setSelectedPickOrderId(undefined); setSelectedJobOrderId(undefined); - }, []); + fetchPickOrders(); + }, [fetchPickOrders]); // If a pick order is selected, show JobPickExecution detail view if (selectedPickOrderId !== undefined) { return ( diff --git a/src/components/Jodetail/JobPickExecutionForm.tsx b/src/components/Jodetail/JobPickExecutionForm.tsx index 03b16f1..72ed84d 100644 --- a/src/components/Jodetail/JobPickExecutionForm.tsx +++ b/src/components/Jodetail/JobPickExecutionForm.tsx @@ -471,54 +471,7 @@ useEffect(() => { - {/* Show issue description and handler fields when bad items > 0 */} - {(formData.badItemQty && formData.badItemQty > 0) || ((formData as any).badPackageQty && (formData as any).badPackageQty > 0) ? ( - <> - - { - handleInputChange('issueRemark', e.target.value); - // Don't reset badItemQty when typing in issue remark - }} - error={!!errors.issueRemark} - helperText={errors.issueRemark} - //placeholder={t('Describe the issue with bad items')} - variant="outlined" - /> - - - - - {t('handler')} - - {errors.handledBy && ( - - {errors.handledBy} - - )} - - - - ) : null} + diff --git a/src/components/Jodetail/newJobPickExecution.tsx b/src/components/Jodetail/newJobPickExecution.tsx index 9c4c618..0ade15b 100644 --- a/src/components/Jodetail/newJobPickExecution.tsx +++ b/src/components/Jodetail/newJobPickExecution.tsx @@ -1686,6 +1686,11 @@ const JobPickExecution: React.FC = ({ filterArgs, onBackToList }) => { if (completionResponse.code === "SUCCESS") { console.log(` Pick order ${lot.pickOrderConsoCode} completed successfully!`); + setTimeout(() => { + if (onBackToList) { + onBackToList(); + } + }, 1500); } else if (completionResponse.message === "not completed") { console.log(`⏳ Pick order not completed yet, more lines remaining`); } else { @@ -1756,6 +1761,11 @@ const JobPickExecution: React.FC = ({ filterArgs, onBackToList }) => { if (completionResponse.code === "SUCCESS") { console.log(` Pick order ${lot.pickOrderConsoCode} completed successfully!`); + setTimeout(() => { + if (onBackToList) { + onBackToList(); + } + }, 1500); } else if (completionResponse.message === "not completed") { console.log(`⏳ Pick order not completed yet, more lines remaining`); } else { @@ -2229,10 +2239,10 @@ const JobPickExecution: React.FC = ({ filterArgs, onBackToList }) => { @@ -2253,8 +2263,8 @@ const JobPickExecution: React.FC = ({ filterArgs, onBackToList }) => { {lot.lotNo} @@ -2269,98 +2279,141 @@ const JobPickExecution: React.FC = ({ filterArgs, onBackToList }) => { - {lot.stockOutLineStatus?.toLowerCase() !== 'pending' ? ( - - - - ) : null} - - - - - - - - - - - - + {(() => { + const status = lot.stockOutLineStatus?.toLowerCase(); + const isRejected = status === 'rejected' || lot.lotAvailability === 'rejected'; + const isNoLot = !lot.lotNo; + + // ✅ rejected lot:显示红色勾选(已扫描但被拒绝) + if (isRejected && !isNoLot) { + return ( + + + + ); + } + + // ✅ 正常 lot:已扫描(checked/partially_completed/completed) + if (!isNoLot && status !== 'pending' && status !== 'rejected') { + return ( + + + + ); + } + + return null; + })()} + + + + + {(() => { + const status = lot.stockOutLineStatus?.toLowerCase(); + const isRejected = status === 'rejected' || lot.lotAvailability === 'rejected'; + const isNoLot = !lot.lotNo; + + // ✅ rejected lot:显示提示文本(换行显示) + if (isRejected && !isNoLot) { + return ( + + {t("This lot is rejected, please scan another lot.")} + + ); + } + + // 正常 lot:显示按钮 + return ( + + + + + + + ); + })()} + + )) )} diff --git a/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx b/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx index 573b7e8..808c1d2 100644 --- a/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx +++ b/src/components/ProductionProcess/ProductionProcessJobOrderDetail.tsx @@ -641,6 +641,7 @@ const handleRelease = useCallback(async ( jobOrderId: number) => { color="primary" onClick={() => handleRelease(jobOrderId)} //disabled={stockCounts.insufficient > 0 || processData?.jobOrderStatus !== "planning"} + disabled={processData?.jobOrderStatus !== "planning"} > {t("Release")} diff --git a/src/i18n/zh/common.json b/src/i18n/zh/common.json index ee1e539..38dbda7 100644 --- a/src/i18n/zh/common.json +++ b/src/i18n/zh/common.json @@ -9,9 +9,12 @@ "Select Another Bag Lot": "選擇另一個包裝袋", "Finished QC Job Orders": "完成QC工單", "Stock Issue": "出倉問題", + "Step Start Time": "步驟開始時間", "Overall Time Remaining": "總剩餘時間", "Reset": "重置", "Search": "搜索", + "This lot is rejected, please scan another lot.": "此批次已封存,請掃描另一個批號。", + "Process Start Time": "工序開始時間", "Stock Req. Qty": "需求數(庫存單位)", "Staff No Required": "員工編號必填", "User Not Found": "用戶不存在", diff --git a/src/i18n/zh/jo.json b/src/i18n/zh/jo.json index 235a204..2870fec 100644 --- a/src/i18n/zh/jo.json +++ b/src/i18n/zh/jo.json @@ -12,9 +12,12 @@ "Confirm All": "確認所有提料", "Wait Time [minutes]": "等待時間(分鐘)", "Job Process Status": "工單流程狀態", + "This lot is rejected, please scan another lot.": "此批次已拒收,請掃描另一個批次。", "Edit": "改數", "Just Complete": "已完成", "Stock Req. Qty": "需求數(庫存單位)", + "Bad Package Qty": "不良包裝數量", + "Progress": "進度", "Search Job Order/ Create Job Order":"搜尋工單/建立工單", "UoM": "銷售單位", "Select Another Bag Lot":"選擇另一個包裝袋", diff --git a/src/i18n/zh/pickOrder.json b/src/i18n/zh/pickOrder.json index 2635290..e51fd5d 100644 --- a/src/i18n/zh/pickOrder.json +++ b/src/i18n/zh/pickOrder.json @@ -21,6 +21,7 @@ "Required Date": "所需日期", "Store": "位置", "Available Orders": "可用訂單", + "This lot is rejected, please scan another lot.": "此批次已拒收,請掃描另一個批次。", "Lane Code": "車線號碼", "Fetching all matching records...": "正在獲取所有匹配的記錄...", "Edit": "改數",