diff --git a/oms_web/oms_vue/src/views/finance/payable/components/MergeReceiptDialog.vue b/oms_web/oms_vue/src/views/finance/payable/components/MergeReceiptDialog.vue index 367349ca..de20085b 100644 --- a/oms_web/oms_vue/src/views/finance/payable/components/MergeReceiptDialog.vue +++ b/oms_web/oms_vue/src/views/finance/payable/components/MergeReceiptDialog.vue @@ -317,6 +317,7 @@ export default { payableOrders: this.payableOrdersWithPlans.map(order => ({ id: order.id, payableBillCode: order.payableBillCode, + taxRate: order.taxRate, ticketPlans: order.ticketPlans.map(plan => ({ planTicketDate: plan.planTicketDate, planAmount: plan.planAmount, diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java index ae095249..8a5c3d06 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java @@ -231,14 +231,15 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService { // Fetch bills once Date minPaymentDate = DateUtils.getNowDate(); for (PayableOrderDto order : dto.getPayableOrders()) { + BigDecimal taxRate = order.getTaxRate(); + if (taxRate == null || taxRate.compareTo(BigDecimal.ZERO) < 0) { + // 如果税率为空或小于0,则默认为0 + taxRate = new BigDecimal(defaultTax); + } for (OmsPayablePaymentPlan plan : order.getPaymentPlans()) { minPaymentDate = minPaymentDate.after(plan.getPlanPaymentDate()) ? plan.getPlanPaymentDate() : minPaymentDate; // 计算每个 plan 的未税金额 = planAmount / (1 + 税率),保留两位小数 - BigDecimal taxRate = order.getTaxRate(); - if (taxRate == null || taxRate.compareTo(BigDecimal.ZERO) < 0) { - // 如果税率为空或小于0,则默认为0 - taxRate = new BigDecimal(defaultTax); - } + // 计算未税金额 = planAmount / (1 + 税率) BigDecimal divisor = BigDecimal.ONE.add(taxRate); BigDecimal planWithoutTax = plan.getPlanAmount().divide(divisor, 2, java.math.RoundingMode.HALF_UP); @@ -344,15 +345,14 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService { Date minTicketDate = DateUtils.getNowDate(); // Fetch bills once for (PayableOrderReceiptDto order : dto.getPayableOrders()) { - + BigDecimal taxRate = order.getTaxRate(); + if (taxRate == null || taxRate.compareTo(BigDecimal.ZERO) < 0) { + // 如果税率为空或小于0,则默认为0 + taxRate = new BigDecimal(defaultTax); + } for (OmsPayableTicketPlan plan : order.getTicketPlans()) { minTicketDate = minTicketDate.after(plan.getPlanTicketDate()) ? plan.getPlanTicketDate() : minTicketDate; // 计算每个 plan 的未税金额 = planAmount / (1 + 税率),保留两位小数 - BigDecimal taxRate = order.getTaxRate(); - if (taxRate == null || taxRate.compareTo(BigDecimal.ZERO) < 0) { - // 如果税率为空或小于0,则默认为0 - taxRate = new BigDecimal(defaultTax); - } // 计算未税金额 = planAmount / (1 + 税率) BigDecimal divisor = BigDecimal.ONE.add(taxRate); BigDecimal planWithoutTax = plan.getPlanAmount().divide(divisor, 2, java.math.RoundingMode.HALF_UP); diff --git a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml index 64bdf10c..a24fdc47 100644 --- a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml @@ -199,11 +199,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" , #{item.warehouseId}, #{item.innerPrice}, #{item.outerPrice}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},#{item.payableBillCode},#{item.taxRate},#{item.orderCode}) ON DUPLICATE KEY UPDATE - license_key = VALUES(license_key), + + license_key = COALESCE(NULLIF(VALUES(license_key), ''), license_key), inventory_status = VALUES(inventory_status), outer_code = VALUES(outer_code), outer_price = VALUES(outer_price), - payable_bill_code = VALUES(payable_bill_code), + payable_bill_code = COALESCE(NULLIF(VALUES(payable_bill_code), ''), payable_bill_code), update_by = VALUES(update_by), update_time = now(), order_code = VALUES(order_code)