| @@ -25,6 +25,7 @@ import { | |||||
| mergeWorkbenchTickets, | mergeWorkbenchTickets, | ||||
| type WorkbenchMergeTicketCandidate, | type WorkbenchMergeTicketCandidate, | ||||
| } from "@/app/api/doworkbench/actions"; | } from "@/app/api/doworkbench/actions"; | ||||
| import { isWorkbenchMergeTicketNo } from "@/utils/workbenchReleaseType"; | |||||
| const SWAL_ABOVE_DIALOG = { | const SWAL_ABOVE_DIALOG = { | ||||
| customClass: { container: "swal2-custom-zindex" }, | customClass: { container: "swal2-custom-zindex" }, | ||||
| @@ -306,15 +307,21 @@ const WorkbenchEtraMergeDialog: React.FC<Props> = ({ | |||||
| const extra = filteredExtraTickets.find((x) => x.id === selectedExtraId); | const extra = filteredExtraTickets.find((x) => x.id === selectedExtraId); | ||||
| if (!batch || !extra) return; | if (!batch || !extra) return; | ||||
| const intoExistingTiM = isWorkbenchMergeTicketNo(batch.ticketNo); | |||||
| const leftLabel = intoExistingTiM ? t("Merge ticket TI-M") : t("Batch/Single ticket"); | |||||
| const confirmHint = intoExistingTiM | |||||
| ? t("Merge Etra ticket confirm hint into TI-M") | |||||
| : t("Merge Etra ticket confirm hint"); | |||||
| const confirm = await Swal.fire({ | const confirm = await Swal.fire({ | ||||
| ...SWAL_ABOVE_DIALOG, | ...SWAL_ABOVE_DIALOG, | ||||
| icon: "question", | icon: "question", | ||||
| title: t("Merge Etra ticket confirm title"), | title: t("Merge Etra ticket confirm title"), | ||||
| html: ` | html: ` | ||||
| <div style="text-align:left;font-size:0.95em;"> | <div style="text-align:left;font-size:0.95em;"> | ||||
| <p><b>${t("Batch/Single ticket")}:</b> ${batch.ticketNo ?? batch.id}</p> | |||||
| <p><b>${leftLabel}:</b> ${batch.ticketNo ?? batch.id}</p> | |||||
| <p><b>${t("Etra ticket")}:</b> ${extra.ticketNo ?? extra.id}</p> | <p><b>${t("Etra ticket")}:</b> ${extra.ticketNo ?? extra.id}</p> | ||||
| <p style="margin-top:0.75em;color:#666;">${t("Merge Etra ticket confirm hint")}</p> | |||||
| <p style="margin-top:0.75em;color:#666;">${confirmHint}</p> | |||||
| </div> | </div> | ||||
| `, | `, | ||||
| showCancelButton: true, | showCancelButton: true, | ||||
| @@ -406,7 +413,7 @@ const WorkbenchEtraMergeDialog: React.FC<Props> = ({ | |||||
| ) : ( | ) : ( | ||||
| <Stack direction={{ xs: "column", md: "row" }} spacing={2}> | <Stack direction={{ xs: "column", md: "row" }} spacing={2}> | ||||
| <MergeTicketCarousel | <MergeTicketCarousel | ||||
| title={t("Batch/Single ticket")} | |||||
| title={t("Merge left column title")} | |||||
| items={batchTickets} | items={batchTickets} | ||||
| selectedId={selectedBatchId} | selectedId={selectedBatchId} | ||||
| onSelect={(id) => { | onSelect={(id) => { | ||||
| @@ -155,7 +155,9 @@ | |||||
| "Etra Ticket Notice": "Etra Ticket Notice", | "Etra Ticket Notice": "Etra Ticket Notice", | ||||
| "Merge Etra ticket": "Merge Etra ticket", | "Merge Etra ticket": "Merge Etra ticket", | ||||
| "Merge Etra ticket dialog title": "Merge Etra into batch ticket", | "Merge Etra ticket dialog title": "Merge Etra into batch ticket", | ||||
| "Merge Etra ticket lane hint": "Only unassigned tickets on the same shop, floor (2/F, 4/F, or Truck X), truck lane, and departure time can be merged. A new TI-M ticket will be created.", | |||||
| "Merge Etra ticket lane hint": "Only unassigned tickets on the same shop, floor (2/F, 4/F, or Truck X), truck lane, and departure time can be merged. Left: batch/single or TI-M merge ticket.", | |||||
| "Merge left column title": "Batch / Single / Merge ticket", | |||||
| "Merge ticket TI-M": "TI-M merge ticket", | |||||
| "Batch/Single ticket": "Batch / Single ticket", | "Batch/Single ticket": "Batch / Single ticket", | ||||
| "Etra ticket": "Etra ticket", | "Etra ticket": "Etra ticket", | ||||
| "No mergeable batch tickets": "No unassigned batch or single tickets", | "No mergeable batch tickets": "No unassigned batch or single tickets", | ||||
| @@ -165,6 +167,7 @@ | |||||
| "Merge Etra ticket confirm": "Confirm merge", | "Merge Etra ticket confirm": "Confirm merge", | ||||
| "Merge Etra ticket confirm title": "Confirm merge batch and Etra tickets?", | "Merge Etra ticket confirm title": "Confirm merge batch and Etra tickets?", | ||||
| "Merge Etra ticket confirm hint": "A new TI-M ticket will be created; the original batch and Etra tickets will be archived.", | "Merge Etra ticket confirm hint": "A new TI-M ticket will be created; the original batch and Etra tickets will be archived.", | ||||
| "Merge Etra ticket confirm hint into TI-M": "The Etra ticket will be folded into the selected TI-M; the Etra ticket will be archived.", | |||||
| "Merge Etra ticket success": "Merge completed", | "Merge Etra ticket success": "Merge completed", | ||||
| "Merge Etra ticket failed": "Merge failed", | "Merge Etra ticket failed": "Merge failed", | ||||
| "Shop search": "Shop search", | "Shop search": "Shop search", | ||||
| @@ -157,7 +157,9 @@ | |||||
| "Etra Ticket Notice": "目前是加單票,顯示與操作已切換為加單模式。", | "Etra Ticket Notice": "目前是加單票,顯示與操作已切換為加單模式。", | ||||
| "Merge Etra ticket": "合併加單送貨訂單", | "Merge Etra ticket": "合併加單送貨訂單", | ||||
| "Merge Etra ticket dialog title": "合併加單送貨訂單和批次送貨訂單", | "Merge Etra ticket dialog title": "合併加單送貨訂單和批次送貨訂單", | ||||
| "Merge Etra ticket lane hint": "僅可合併同一店鋪、同一樓層(2/F、4/F 或車線-X)、同一車線與發車時間的未指派送貨訂單。", | |||||
| "Merge Etra ticket lane hint": "僅可合併同一店鋪、同一樓層(2/F、4/F 或車線-X)、同一車線與發車時間的未指派送貨訂單。左側可選批次/單張票或 TI-M 合併票。", | |||||
| "Merge left column title": "批次/單張/合併票", | |||||
| "Merge ticket TI-M": "TI-M 合併票", | |||||
| "Batch/Single ticket": "批次/單張 送貨訂單", | "Batch/Single ticket": "批次/單張 送貨訂單", | ||||
| "Etra ticket": "加單送貨訂單", | "Etra ticket": "加單送貨訂單", | ||||
| "No mergeable batch tickets": "暫無可合併的批次/單張 送貨訂單", | "No mergeable batch tickets": "暫無可合併的批次/單張 送貨訂單", | ||||
| @@ -167,6 +169,7 @@ | |||||
| "Merge Etra ticket confirm": "確認合併", | "Merge Etra ticket confirm": "確認合併", | ||||
| "Merge Etra ticket confirm title": "確認合併批次/加單送貨訂單?", | "Merge Etra ticket confirm title": "確認合併批次/加單送貨訂單?", | ||||
| "Merge Etra ticket confirm hint": "將產生新 TI-M 合併票,原批次票與加單票將歸檔。", | "Merge Etra ticket confirm hint": "將產生新 TI-M 合併票,原批次票與加單票將歸檔。", | ||||
| "Merge Etra ticket confirm hint into TI-M": "加單票將併入所選 TI-M,原加單票將歸檔。", | |||||
| "Merge Etra ticket success": "合併成功", | "Merge Etra ticket success": "合併成功", | ||||
| "Merge Etra ticket failed": "合併失敗", | "Merge Etra ticket failed": "合併失敗", | ||||
| "Next": "下一頁", | "Next": "下一頁", | ||||
| @@ -178,6 +181,8 @@ | |||||
| "batch": "批量", | "batch": "批量", | ||||
| "single": "單張", | "single": "單張", | ||||
| "isExtra": "加單", | "isExtra": "加單", | ||||
| "isExtrabatch": "合併批量", | |||||
| "isExtrasingle": "合併單張", | |||||
| "Pick Order": "提料單", | "Pick Order": "提料單", | ||||
| "Type": "類型", | "Type": "類型", | ||||
| "Product Type": "貨品類型", | "Product Type": "貨品類型", | ||||
| @@ -1,3 +1,7 @@ | |||||
| export function isWorkbenchMergeTicketNo(ticketNo?: string | null): boolean { | |||||
| return (ticketNo ?? "").trim().toUpperCase().startsWith("TI-M-"); | |||||
| } | |||||
| /** Workbench ticket carries extra DOs when releaseType or legacy TI-E- ticket. */ | /** Workbench ticket carries extra DOs when releaseType or legacy TI-E- ticket. */ | ||||
| export function isWorkbenchExtraTicket( | export function isWorkbenchExtraTicket( | ||||
| releaseType?: string | null, | releaseType?: string | null, | ||||