소스 검색

fix do reprint

MergeProblem1
CANCERYS\kw093 1 주 전
부모
커밋
0b895e7238
5개의 변경된 파일130개의 추가작업 그리고 2개의 파일을 삭제
  1. +26
    -0
      src/app/api/do/actions.tsx
  2. +100
    -1
      src/components/DoWorkbench/GoodPickExecutionWorkbenchRecord.tsx
  3. +1
    -1
      src/components/DoWorkbench/WorkbenchFloorLanePanel.tsx
  4. +1
    -0
      src/i18n/zh/jo.json
  5. +2
    -0
      src/i18n/zh/pickOrder.json

+ 26
- 0
src/app/api/do/actions.tsx 파일 보기

@@ -528,6 +528,14 @@ export interface PrintWorkbenchDNLabelsRequest{
printQty: number;
numOfCarton: number;
}
export interface PrintWorkbenchDNLabelsReprintRequest{
deliveryOrderPickOrderId: number;
printerId: number;
printQty: number;
fromCarton: number;
toCarton: number;
totalCartonsOnShipment: number;
}
export async function printDNWorkbench(request: PrintWorkbenchDeliveryNoteRequest){
const params = new URLSearchParams();
params.append("doPickOrderId", request.deliveryOrderPickOrderId.toString());
@@ -576,6 +584,24 @@ export async function printDNLabelsWorkbench(request: PrintWorkbenchDNLabelsRequ
return { success: true, message: "Print job sent successfully (workbench labels)"} as PrintDeliveryNoteResponse
}

export async function printDNLabelsReprintWorkbench(request: PrintWorkbenchDNLabelsReprintRequest){
const params = new URLSearchParams();
params.append("doPickOrderId", request.deliveryOrderPickOrderId.toString());
params.append("printerId", request.printerId.toString());
if (request.printQty !== null && request.printQty !== undefined) {
params.append("printQty", request.printQty.toString());
}
params.append("fromCarton", request.fromCarton.toString());
params.append("toCarton", request.toCarton.toString());
params.append("totalCartonsOnShipment", request.totalCartonsOnShipment.toString());

await serverFetchWithNoContent(`${BASE_API_URL}/doPickOrder/workbench/print-DNLabels-reprint?${params.toString()}`,{
method: "GET"
});

return { success: true, message: "Print job sent successfully (workbench reprint labels)"} as PrintDeliveryNoteResponse
}

export interface Check4FTruckBatchResponse {
hasProblem: boolean;
problems: ProblemDoDto[];


+ 100
- 1
src/components/DoWorkbench/GoodPickExecutionWorkbenchRecord.tsx 파일 보기

@@ -35,7 +35,7 @@ import {
fetchCompletedDoPickOrdersWorkbench,
fetchCompletedDoPickOrdersWorkbenchAll,
} from "@/app/api/pickOrder/actions";
import { printDNWorkbench, printDNLabelsWorkbench } from "@/app/api/do/actions";
import { printDNWorkbench, printDNLabelsWorkbench, printDNLabelsReprintWorkbench } from "@/app/api/do/actions";
import { fetchWorkbenchCompletedLotDetails } from "@/app/api/doworkbench/actions";
import SearchBox, { Criterion } from "../SearchBox";

@@ -281,6 +281,102 @@ const GoodPickExecutionWorkbenchRecord: React.FC<Props> = ({
},
[a4Printer, askNumOfCarton, labelPrinter, loadData, t],
);
const handleLabelReprint = useCallback(async (doPickOrder: CompletedDoPickOrderResponse) => {
if (!labelPrinter) {
Swal.fire({
position: "bottom-end",
icon: "warning",
text: t("Please select a label printer first"),
showConfirmButton: false,
timer: 1500
});
return;
}

const defaultTotalCartons = Math.max(1, doPickOrder.numberOfCartons || 1);
const result = await Swal.fire({
title: t("Reprint DN Label"),
html: `
<div style="display:flex;flex-direction:column;gap:10px;text-align:left;">
<div style="display:flex;align-items:center;gap:12px;">
<label for="swal-from-carton" style="min-width:120px;">${t("From carton")}</label>
<input id="swal-from-carton" class="swal2-input" type="number" min="1" step="1" value="1" style="margin:0;flex:1;outline:none;box-shadow:none;border:1px solid #d9d9d9;" onfocus="this.style.outline='none';this.style.boxShadow='none';this.style.borderColor='#d9d9d9';" />
</div>
<div style="display:flex;align-items:center;gap:12px;">
<label for="swal-to-carton" style="min-width:120px;">${t("To carton")}</label>
<input id="swal-to-carton" class="swal2-input" type="number" min="1" step="1" value="1" style="margin:0;flex:1;outline:none;box-shadow:none;border:1px solid #d9d9d9;" onfocus="this.style.outline='none';this.style.boxShadow='none';this.style.borderColor='#d9d9d9';" />
</div>
<div style="display:flex;align-items:center;gap:12px;">
<label for="swal-total-carton" style="min-width:120px;">${t("Total cartons on shipment")}</label>
<input id="swal-total-carton" class="swal2-input" type="number" min="1" step="1" value="${defaultTotalCartons}" style="margin:0;flex:1;outline:none;box-shadow:none;border:1px solid #d9d9d9;" onfocus="this.style.outline='none';this.style.boxShadow='none';this.style.borderColor='#d9d9d9';" />
</div>
</div>
`,
showCancelButton: true,
confirmButtonText: t("Confirm"),
cancelButtonText: t("Cancel"),
confirmButtonColor: "#8dba00",
cancelButtonColor: "#F04438",
focusConfirm: false,
preConfirm: () => {
const fromCarton = Number((document.getElementById("swal-from-carton") as HTMLInputElement | null)?.value || "0");
const toCarton = Number((document.getElementById("swal-to-carton") as HTMLInputElement | null)?.value || "0");
const totalCartonsOnShipment = Number((document.getElementById("swal-total-carton") as HTMLInputElement | null)?.value || "0");

if (!Number.isInteger(fromCarton) || fromCarton < 1) {
Swal.showValidationMessage(t("From carton must be at least 1"));
return null;
}
if (!Number.isInteger(toCarton) || toCarton < fromCarton) {
Swal.showValidationMessage(t("To carton must be greater than or equal to from carton"));
return null;
}
if (!Number.isInteger(totalCartonsOnShipment) || totalCartonsOnShipment < 1) {
Swal.showValidationMessage(t("Total cartons on shipment must be at least 1"));
return null;
}
if (toCarton > totalCartonsOnShipment) {
Swal.showValidationMessage(t("To carton cannot be greater than total cartons on shipment"));
return null;
}

return {
fromCarton,
toCarton,
totalCartonsOnShipment,
};
}
});

if (!result.isConfirmed || !result.value) {
return;
}

try {
const response = await printDNLabelsReprintWorkbench({
deliveryOrderPickOrderId: doPickOrder.doPickOrderRecordId,
printerId: labelPrinter.id,
printQty: 1,
fromCarton: result.value.fromCarton,
toCarton: result.value.toCarton,
totalCartonsOnShipment: result.value.totalCartonsOnShipment,
});

if (response.success) {
Swal.fire({
position: "bottom-end",
icon: "success",
text: t("Printed Successfully."),
showConfirmButton: false,
timer: 1500
});
} else {
console.error("Reprint failed:", response.message);
}
} catch (error) {
console.error("reprint error: ", error);
}
}, [labelPrinter, t]);

const handleDetailClick = useCallback(
async (record: CompletedDoPickOrderResponse) => {
@@ -547,6 +643,9 @@ const GoodPickExecutionWorkbenchRecord: React.FC<Props> = ({
<Button variant="contained" onClick={() => void handlePrintLabel(row.doPickOrderRecordId)}>
{t("Print Label")}
</Button>
<Button variant="contained" onClick={() => void handleLabelReprint(row)}>
{t("Reprint Label(s)")}
</Button>
</CardActions>
</Card>
))}


+ 1
- 1
src/components/DoWorkbench/WorkbenchFloorLanePanel.tsx 파일 보기

@@ -453,7 +453,7 @@ const WorkbenchFloorLanePanel: React.FC<Props> = ({ onPickOrderAssigned, onSwitc
setModalOpen(true);
}}
>
{`${t("Before today")} (${beforeTodayTruckXCount})`}
{`${t("車線-X")} (${beforeTodayTruckXCount})`}
</Button>
)}
</Stack>


+ 1
- 0
src/i18n/zh/jo.json 파일 보기

@@ -11,6 +11,7 @@
"storing": "待品檢入倉",
"Name": "成品/半成品名稱",
"Picked Qty": "已提料數量",
"Insufficient available quantity on lot (may have been picked by another user)": "掃描的批次已被其他用戶完全提料。請掃描其他批次。",
"Please check around have QR code or not, may be have just now stock in or transfer in or transfer out.": "請檢查周圍是否有QR碼,可能是剛剛入庫或轉移入庫或轉移出庫。",
"is expired. Please check around have available QR code or not.": "已過期。請檢查周圍是否有可用的 QR 碼。",
"Confirm All": "確認所有提料",


+ 2
- 0
src/i18n/zh/pickOrder.json 파일 보기

@@ -265,7 +265,9 @@
"storing": "待品檢入倉",
"pick successful": "提料成功",
"Suggestion success": "建議成功",
"Insufficient available quantity on lot (may have been picked by another user)": "掃描的批次已被其他用戶完全提料。請掃描其他批次。",
"Scan": "掃描",
"Before today": "今天之前",
"Scanned": "已掃描",
"Loading data...": "正在載入數據...",
"No available stock for this item": "沒有可用庫存",


불러오는 중...
취소
저장