From 0da2e5f890084c362912faadacd00aa721fc34c1 Mon Sep 17 00:00:00 2001 From: wjh Date: Tue, 16 Apr 2024 18:18:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95=E5=90=88=E5=B9=B6=E8=A7=84=E5=88=99=E7=9A=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E9=87=8F=E4=B8=8D=E5=AF=B9=20(#734)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachycode/pulls/734 Co-authored-by: wjh Co-committed-by: wjh --- .changeset/tricky-garlics-pay.md | 5 +++++ .../src/server/services/settlement-service.ts | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/tricky-garlics-pay.md diff --git a/.changeset/tricky-garlics-pay.md b/.changeset/tricky-garlics-pay.md new file mode 100644 index 000000000..c4326aa8c --- /dev/null +++ b/.changeset/tricky-garlics-pay.md @@ -0,0 +1,5 @@ +--- +"@hera/plugin-rental": patch +--- + +修改结算单的合并规格产品数量不对 diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts index 960d6475d..4072bd03e 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-service.ts @@ -146,6 +146,20 @@ export class SettlementService { settlementAbout.end_date, ); const movement = item.movement === '-1' ? '1' : '-1'; + const item_count = item.record_items.reduce((prev, curr) => { + if ( + countRule.find( + (productRule) => + (productRule.product_id > RulesNumber && + productRule.product_id - RulesNumber === curr.product.category_id) || + productRule.product_id === curr?.product_id, + ) + ) { + return prev + curr.count; + } else { + return prev + 0; + } + }, 0); createLeasDatas.push({ settlement_id: settlementsId, //合同ID movement: item.movement, //出入库状态 @@ -156,7 +170,7 @@ export class SettlementService { //租赁天数 历史订单就存开始日期到结束日期 当前订单存储订单日期到结束日期 days: day, is_excluded: false, - item_count: recordItem.count * Number(movement), + item_count: productLength > 1 ? item_count : recordItem.count * Number(movement), count: item.weight * Number(movement), unit_price: rule.unit_price * 1000, amount: item.weight * (rule.unit_price * 1000) * day * Number(movement),