浏览代码

separate IQC and EPQC stock in modal

master
kelvin.yau 4 天前
父节点
当前提交
1b404335e5
共有 4 个文件被更改,包括 58 次插入16 次删除
  1. +29
    -0
      src/app/api/jo/actions.ts
  2. +1
    -0
      src/components/PoDetail/PoInputGrid.tsx
  3. +1
    -0
      src/components/ProductionProcess/ProductionProcessList.tsx
  4. +27
    -16
      src/components/Qc/QcStockInModal.tsx

+ 29
- 0
src/app/api/jo/actions.ts 查看文件

@@ -137,6 +137,35 @@ export interface PrintPickRecordResponse{
message?: string message?: string
} }



export interface PrintFGStockInLabelRequest {
stockInLineId: number;
printerId: number;
printQty?: number;
}

export const printFGStockInLabel = cache(async(data: PrintFGStockInLabelRequest) => {
const params = new URLSearchParams();
if (data.stockInLineId) {
params.append('stockInLineId', data.stockInLineId.toString());
}
params.append('printerId', data.printerId.toString());
if (data.printQty !== undefined && data.printQty !== null) {
params.append('printQty', data.printQty.toString());
}
return serverFetchWithNoContent(
`${BASE_API_URL}/jo/print-FGPickRecordLabel?${params.toString()}`,
{
method: "GET",
next: {
tags: ["printFGStockInLabel"],
},
}
);
});


export const recordSecondScanIssue = cache(async ( export const recordSecondScanIssue = cache(async (
pickOrderId: number, pickOrderId: number,
itemId: number, itemId: number,


+ 1
- 0
src/components/PoDetail/PoInputGrid.tsx 查看文件

@@ -955,6 +955,7 @@ const closeNewModal = useCallback(() => {
// itemDetail={modalInfo} // itemDetail={modalInfo}
inputDetail={modalInfo} inputDetail={modalInfo}
printerCombo={printerCombo} printerCombo={printerCombo}
printSource="stockIn"
/> />
</> </>
{/* ) {/* )


+ 1
- 0
src/components/ProductionProcess/ProductionProcessList.tsx 查看文件

@@ -248,6 +248,7 @@ const ProductProcessList: React.FC<ProductProcessListProps> = ({ onSelectProcess
onClose={closeNewModal} onClose={closeNewModal}
inputDetail={modalInfo} inputDetail={modalInfo}
printerCombo={printerCombo} printerCombo={printerCombo}
printSource="productionProcess"
/> />
{processes.length > 0 && ( {processes.length > 0 && (
<TablePagination <TablePagination


+ 27
- 16
src/components/Qc/QcStockInModal.tsx 查看文件

@@ -40,7 +40,7 @@ import { StockInLineEntry, updateStockInLine, printQrCodeForSil, PrintQrCodeForS
import { fetchStockInLineInfo } from "@/app/api/stockIn/actions"; import { fetchStockInLineInfo } from "@/app/api/stockIn/actions";
import FgStockInForm from "../StockIn/FgStockInForm"; import FgStockInForm from "../StockIn/FgStockInForm";
import LoadingComponent from "../General/LoadingComponent"; import LoadingComponent from "../General/LoadingComponent";
import { printFGStockInLabel, PrintFGStockInLabelRequest } from "@/app/api/jo/actions";


const style = { const style = {
position: "absolute", position: "absolute",
@@ -63,6 +63,7 @@ interface CommonProps extends Omit<ModalProps, "children"> {
printerCombo: PrinterCombo[]; printerCombo: PrinterCombo[];
onClose: () => void; onClose: () => void;
skipQc?: Boolean; skipQc?: Boolean;
printSource?: "stockIn" | "productionProcess";
} }
interface Props extends CommonProps { interface Props extends CommonProps {
// itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] }; // itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] };
@@ -76,6 +77,7 @@ const QcStockInModal: React.FC<Props> = ({
warehouse, warehouse,
printerCombo, printerCombo,
skipQc = false, skipQc = false,
printSource = "stockIn",
}) => { }) => {
const { const {
t, t,
@@ -496,27 +498,36 @@ const QcStockInModal: React.FC<Props> = ({
alert("列印數量不正確!"); alert("列印數量不正確!");
return; return;
} }
// console.log(pafRowSelectionModel)
const printList = formProps.watch("putAwayLines")?.filter((line) => ((pafRowSelectionModel ?? []).some((model) => model === line.id))) ?? []
// const printQty = printList.reduce((acc, cur) => acc + cur.printQty, 0)
// console.log(printQty)
const data: PrintQrCodeForSilRequest = {
// Conditionally call different APIs based on source
let response;
if (printSource === "productionProcess") {
// Use FG Stock In Label print API for production process
const data: PrintFGStockInLabelRequest = {
stockInLineId: stockInLineInfo?.id ?? 0, stockInLineId: stockInLineInfo?.id ?? 0,
printerId: selectedPrinter.id, printerId: selectedPrinter.id,
printQty: printQty printQty: printQty
} }
const response = await printQrCodeForSil(data);
if (response) {
console.log(response)
}
if (typeof window !== 'undefined' && selectedPrinter) {
sessionStorage.setItem(printerStorageKey, String(selectedPrinter.id));
response = await printFGStockInLabel(data);
} else {
// Use stock-in print API (default)
const data: PrintQrCodeForSilRequest = {
stockInLineId: stockInLineInfo?.id ?? 0,
printerId: selectedPrinter.id,
printQty: printQty
} }
} finally {
setIsPrinting(() => false)
response = await printQrCodeForSil(data);
}
if (response) {
console.log(response)
}
if (typeof window !== 'undefined' && selectedPrinter) {
sessionStorage.setItem(printerStorageKey, String(selectedPrinter.id));
} }
// }, [pafRowSelectionModel, printQty, selectedPrinter]);
}, [stockInLineInfo?.id, pafRowSelectionModel, printQty, selectedPrinter]);
} finally {
setIsPrinting(() => false)
}
}, [stockInLineInfo?.id, pafRowSelectionModel, printQty, selectedPrinter, printSource]);
// const checkQcIsPassed = useCallback((qcItems: PurchaseQcResult[]) => { // const checkQcIsPassed = useCallback((qcItems: PurchaseQcResult[]) => {
// const isPassed = qcItems.every((qc) => qc.qcPassed); // const isPassed = qcItems.every((qc) => qc.qcPassed);


正在加载...
取消
保存