|
|
|
@@ -91,6 +91,12 @@ export interface WorkbenchLotLabelPrintModalProps { |
|
|
|
/** 與 statusTitleText 搭配;預設 error(舊版固定紅字) */ |
|
|
|
statusTitleSeverity?: "success" | "warning" | "error"; |
|
|
|
warehouseCodePrefixFilter?: string; |
|
|
|
/** |
|
|
|
* Hide lots whose warehouse code equals an entry or starts with `{entry}-`. |
|
|
|
* JO passes `4F` so the pick-station list matches the suggestion block list. |
|
|
|
* The row that opened the dialog stays visible. |
|
|
|
*/ |
|
|
|
excludeWarehouseCodePrefixes?: string[]; |
|
|
|
/** |
|
|
|
* When true, omit the API 「scanned」 lot from the merged list (legacy FG-style). |
|
|
|
* Workbench should leave false so the current row’s lot appears for label print / scan-pick. |
|
|
|
@@ -147,7 +153,7 @@ function isLabelPrinter(p: Printer): boolean { |
|
|
|
return s.includes("label") && !s.includes("a4"); |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 30 | v1.0.1 | 2026-07-22 */ |
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 30 | v1.0.2 | 2026-11-02 */ |
|
|
|
const WorkbenchLotLabelPrintModal: React.FC<WorkbenchLotLabelPrintModalProps> = ({ |
|
|
|
open, |
|
|
|
onClose, |
|
|
|
@@ -159,6 +165,7 @@ const WorkbenchLotLabelPrintModal: React.FC<WorkbenchLotLabelPrintModalProps> = |
|
|
|
statusTitleText, |
|
|
|
statusTitleSeverity = "error", |
|
|
|
warehouseCodePrefixFilter, |
|
|
|
excludeWarehouseCodePrefixes, |
|
|
|
hideTriggeredLot = false, |
|
|
|
triggerLotAvailableQty = null, |
|
|
|
triggerLotUom = null, |
|
|
|
@@ -450,14 +457,22 @@ const WorkbenchLotLabelPrintModal: React.FC<WorkbenchLotLabelPrintModalProps> = |
|
|
|
]); |
|
|
|
|
|
|
|
const filteredLots = useMemo(() => { |
|
|
|
const prefix = String(warehouseCodePrefixFilter ?? "").trim(); |
|
|
|
if (!prefix) return availableLots; |
|
|
|
const prefix = String(warehouseCodePrefixFilter ?? "").trim().toUpperCase(); |
|
|
|
const blocked = (excludeWarehouseCodePrefixes ?? []) |
|
|
|
.map((entry) => entry.trim().toUpperCase()) |
|
|
|
.filter((entry) => entry.length > 0); |
|
|
|
return availableLots.filter((lot) => { |
|
|
|
// 使用者從本列開啟視窗:即使 API 未帶 warehouseCode,仍應顯示目前這筆批號 |
|
|
|
// 使用者從本列開啟視窗:即使倉位在排除清單,仍顯示目前這筆批號 |
|
|
|
if (lot._scanned) return true; |
|
|
|
return String(lot.warehouseCode ?? "").startsWith(prefix); |
|
|
|
const code = String(lot.warehouseCode ?? "").trim().toUpperCase(); |
|
|
|
const blockedHit = blocked.some( |
|
|
|
(entry) => code === entry || code.startsWith(`${entry}-`), |
|
|
|
); |
|
|
|
if (blockedHit) return false; |
|
|
|
if (!prefix) return true; |
|
|
|
return code.startsWith(prefix); |
|
|
|
}); |
|
|
|
}, [availableLots, warehouseCodePrefixFilter]); |
|
|
|
}, [availableLots, warehouseCodePrefixFilter, excludeWarehouseCodePrefixes]); |
|
|
|
|
|
|
|
const selectedPrinter = useMemo(() => { |
|
|
|
if (selectedPrinterId === "") return null; |
|
|
|
|