| | |
| | | import ReplaceModal from "./modules/replace-form.vue"; |
| | | import QrTraceModal from "../components/qr-trace-modal.vue"; |
| | | import BusinessQrModal from "../components/business-qr.vue"; |
| | | import QrExportProgress from "../qrexport/qr-export-progress.vue"; |
| | | import { useQrExport } from "../qrexport/use-qr-export"; |
| | | |
| | | defineOptions({ name: "MesProBagCode" }); |
| | | |
| | |
| | | gridApi.query(); |
| | | } |
| | | |
| | | const { start: startQrExport } = useQrExport(); |
| | | |
| | | /** 生成数据包 */ |
| | | function handleGenerate() { |
| | | generateFormModalApi.open(); |
| | |
| | | message.warning("请先按生成组或批次筛选后再导出二维码"); |
| | | return; |
| | | } |
| | | const data = await (kind === 'business' ? exportBagBusinessQr : exportBagQr)(params); |
| | | downloadFileFromBlobPart({ fileName: kind === 'business' ? '袋码业务二维码.zip' : '袋码追溯二维码.zip', source: data }); |
| | | // 数量少则同步秒出;超过分界线自动转后台任务,由进度浮层展示真实进度并支持取消/隐藏 |
| | | const bizType = kind === "business" ? "BAG_BUSINESS" : "BAG_LABEL"; |
| | | const fileName = kind === "business" ? "袋码业务二维码" : "袋码追溯二维码"; |
| | | await startQrExport( |
| | | { bizType, ...params }, |
| | | { |
| | | fileName, |
| | | syncDownload: async () => { |
| | | const data = await (kind === "business" |
| | | ? exportBagBusinessQr |
| | | : exportBagQr)(params); |
| | | downloadFileFromBlobPart({ |
| | | fileName: `${fileName}.zip`, |
| | | source: data, |
| | | }); |
| | | }, |
| | | }, |
| | | ); |
| | | } |
| | | |
| | | /** 导出袋码 Excel(交付印刷),导出后袋码状态变为已印刷,需刷新列表 */ |
| | |
| | | function handleBindPallet() { |
| | | const records = getSelectedRecords(); |
| | | if (!records) return; |
| | | if (records.some((record) => !record.batchId)) { |
| | | message.warning("请先录入生产批次,再绑定托盘"); |
| | | // 已录入批次的袋码只能绑到本批次的托盘;未录入批次的袋码可绑任意托盘(选到正式托盘时后端会先补录批次)。 |
| | | // 两者混选时批次归属不明确,要求分开操作。 |
| | | const boundRecords = records.filter((record) => record.batchId); |
| | | if (boundRecords.length > 0 && boundRecords.length < records.length) { |
| | | message.warning("所选袋码中既有已录入批次、也有未录入批次的记录,请分开绑定"); |
| | | return; |
| | | } |
| | | const batchIds = new Set(records.map((record) => record.batchId)); |
| | | const batchIds = new Set(boundRecords.map((record) => record.batchId)); |
| | | if (batchIds.size > 1) { |
| | | message.warning("请选择同一批次下的袋码进行绑定"); |
| | | return; |
| | |
| | | .setData({ |
| | | batchId: first.batchId, |
| | | batchCode: first.batchCode, |
| | | itemId: first.itemId, |
| | | ids: records.map((record) => record.id!), |
| | | }) |
| | | .open(); |
| | |
| | | <ReplaceFormModal @success="handleReplaceSuccess" /> |
| | | <QrTraceQueryModal /> |
| | | <BusinessQrViewModal /> |
| | | <QrExportProgress /> |
| | | <Grid table-title="袋码列表(一袋一码)"> |
| | | <template #table-title><span class="text-[1rem] font-bold" style="white-space:nowrap">袋码列表(一袋一码)</span></template> |
| | | <template #toolbar-tools> |