diff --git a/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue b/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue index c2fbc93..65c94f1 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/labels/preview.vue @@ -215,7 +215,6 @@ import { postUsAppLabelPrint, US_APP_LABEL_PRINT_PATH, } from '../../services/usAppLabeling' -import { savePrintTemplateSnapshotForTask } from '../../utils/printSnapshotStorage' import { applyTemplateProductDefaultValuesToTemplate, extractTemplateProductDefaultValuesFromPreviewPayload, @@ -671,38 +670,28 @@ const handlePrint = async () => { try { const bt = getBluetoothConnection() /** - * 接口 9 落库必须与本次出纸使用的合并模板完全一致(与 labelPrintJobPayload.template 同源), - * 避免另起 buildPrintPersistTemplateSnapshot(base) 与 computeMergedPreviewTemplate() 细微偏差, - * 导致库内缺用户输入的价签/过敏原/数字/日期,重打与预览不一致。 + * 接口 9 的 `printInputJson`:整份合并模板快照(与出纸 labelPrintJobPayload.template 同源)+ + * buildPrintInputJson 的键值(PRINT_INPUT / 多选等),后端应原样落库并在接口 10 `renderTemplateJson` 返回供重打。 */ const persistTemplateDoc = JSON.parse( JSON.stringify(labelPrintJobPayload.template) ) as Record + const printInputSnapshotForApi: Record = { + ...printInputJson, + ...persistTemplateDoc, + } printLogRequestBody = buildUsAppLabelPrintRequestBody({ locationId: getCurrentStoreId(), labelCode: labelCode.value, productId: productId.value || undefined, printQuantity: printQty.value, - mergedTemplate: persistTemplateDoc, + mergedTemplate: printInputSnapshotForApi, clientRequestId: createPrintClientRequestId(), printerMac: bt?.deviceId || undefined, }) if (printLogRequestBody) { - const printRes = await postUsAppLabelPrint(printLogRequestBody) - /** 本机快照:列表接口 renderTemplateJson 常为设计器占位,重打需与当次出纸合并模板一致 */ - try { - const tid = String( - (printRes as { taskId?: string })?.taskId - ?? (printRes as { TaskId?: string })?.TaskId - ?? '', - ).trim() - if (tid) { - savePrintTemplateSnapshotForTask(tid, JSON.stringify(persistTemplateDoc)) - } - } catch { - /* 忽略快照写入失败 */ - } + await postUsAppLabelPrint(printLogRequestBody) } } catch (syncErr: unknown) { if (!isUsAppSessionExpiredError(syncErr)) { diff --git a/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue b/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue index d319ffa..d1e9c4d 100644 --- a/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue +++ b/美国版/Food Labeling Management App UniApp/src/pages/more/print-log.vue @@ -125,11 +125,21 @@ + + +