From 253dc29c31fb84d4520954dcaea62575028c6ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E5=BB=B6=E7=A5=A5?= <2256334253@qq.com> Date: Fri, 8 Mar 2024 13:47:01 +0800 Subject: [PATCH] fix: record pdf data mistake --- .../src/server/pdf-documents/records-documentV2.tsx | 9 ++++++--- .../src/server/services/record-pdf-service.ts | 11 +++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/plugins/@hera/plugin-rental/src/server/pdf-documents/records-documentV2.tsx b/packages/plugins/@hera/plugin-rental/src/server/pdf-documents/records-documentV2.tsx index 08b3e8698..d50fed4e5 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/pdf-documents/records-documentV2.tsx +++ b/packages/plugins/@hera/plugin-rental/src/server/pdf-documents/records-documentV2.tsx @@ -459,7 +459,8 @@ const PreviewDocument = ({ {item.name} {!item.count ? '' : formatQuantity(item.count, 2) + item.unit} - {printSetup === PrintSetup.Display && !item.product_id && !item.isTotal + {(printSetup === PrintSetup.Display && !item.product_id && !item.isTotal) || + (printSetup === PrintSetup.Manual && !item.product_id && !item.isTotal) ? '' : item.total ? formatQuantity(item.total, 2) @@ -520,7 +521,8 @@ const PreviewDocument = ({ {!item.left_count ? '' : formatQuantity(item.left_count, 2) + item.left_unit} - {printSetup === PrintSetup.Display && !item.left_product_id && !item.left_isTotal + {(printSetup === PrintSetup.Display && !item.left_product_id && !item.left_isTotal) || + (printSetup === PrintSetup.Manual && !item.left_product_id && !item.left_isTotal) ? '' : item.left_total ? formatQuantity(item.left_total, 2) @@ -541,7 +543,8 @@ const PreviewDocument = ({ {!item.right_count ? '' : formatQuantity(item.right_count, 2) + item.right_unit} - {printSetup === PrintSetup.Display && !item.right_product_id && !item.right_isTotal + {(printSetup === PrintSetup.Display && !item.right_product_id && !item.right_isTotal) || + (printSetup === PrintSetup.Manual && !item.right_product_id && !item.right_isTotal) ? '' : item.right_total ? formatQuantity(item.right_total, 2) diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/record-pdf-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/record-pdf-service.ts index b714a0c6a..635bf18e9 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/record-pdf-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/record-pdf-service.ts @@ -161,11 +161,11 @@ export class RecordPdfService { } return data; }); - // 无关联产品赔偿 (打印设置为正常显示时显示物料+赔偿维修,无关联赔偿不显示) + // 无关联产品赔偿, 人工录取的情况直接为空,因为excludedFee已经处理,正常情况取非手动录入情况数据,excludedFee已经处理 const fee = printSetup === PrintSetup.Manual - ? fee_data.filter((item) => !item.product_id && item.count_source === SourcesType.staff) - : fee_data.filter((item) => !item.product_id); + ? [] + : fee_data.filter((item) => !item.product_id && item.count_source !== SourcesType.staff); const no_product_fee = fee .map((item) => { // 购销/暂存/盘点无费用信息 @@ -220,7 +220,7 @@ export class RecordPdfService { }) .filter((item) => item && item.count); // 注意把手动录入的加入 - const manualData = printSetup === PrintSetup.Manual ? [] : recordData.record_fee_items; + const manualData = recordData.record_fee_items; // 因为以往逻辑是根据规则查询,这个订单中数据智能单独查询 const excludedFee = manualData @@ -235,9 +235,8 @@ export class RecordPdfService { const feeRule = fee_data.find((fee) => fee.fee_product_id === item.product_id); if (feeRule) { data['total'] = feeRule.unit_price * item.count; + data['unit'] = feeRule.unit || ''; } - const findUnit = no_product_fee.find((fee) => fee.name === data.name); - data['unit'] = findUnit ? findUnit.unit : ''; return data; }) .filter(Boolean) || [];