Commit 33f654b73b78d617bc65ef6f230144edecb24a97

Authored by YunaiV
1 parent 9e3858ae

✨ ERP:销售订单的 receiptPrice 调整,为接入财务的收款单做准备

Showing 15 changed files with 70 additions and 64 deletions
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutPageReqVO.java
@@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class ErpSaleOutPageReqVO extends PageParam { 18 public class ErpSaleOutPageReqVO extends PageParam {
19 19
  20 + public static final Integer RECEIPT_STATUS_NONE = 0;
  21 + public static final Integer RECEIPT_STATUS_PART = 1;
  22 + public static final Integer RECEIPT_STATUS_ALL = 2;
  23 +
20 @Schema(description = "销售单编号", example = "XS001") 24 @Schema(description = "销售单编号", example = "XS001")
21 private String no; 25 private String no;
22 26
@@ -45,8 +49,11 @@ public class ErpSaleOutPageReqVO extends PageParam { @@ -45,8 +49,11 @@ public class ErpSaleOutPageReqVO extends PageParam {
45 @Schema(description = "结算账号编号", example = "1") 49 @Schema(description = "结算账号编号", example = "1")
46 private Long accountId; 50 private Long accountId;
47 51
48 - @Schema(description = "是否欠款", example = "true")  
49 - private Boolean debtStatus; 52 + @Schema(description = "收款状态", example = "1")
  53 + private Integer receiptStatus;
  54 +
  55 + @Schema(description = "是否可收款", example = "true")
  56 + private Boolean receiptEnable; // 对应 receiptStatus = [0, 1]
50 57
51 @Schema(description = "销售单号", example = "1") 58 @Schema(description = "销售单号", example = "1")
52 private String orderNo; 59 private String orderNo;
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutRespVO.java
@@ -55,6 +55,8 @@ public class ErpSaleOutRespVO { @@ -55,6 +55,8 @@ public class ErpSaleOutRespVO {
55 @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") 55 @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
56 @ExcelProperty("最终合计价格") 56 @ExcelProperty("最终合计价格")
57 private BigDecimal totalPrice; 57 private BigDecimal totalPrice;
  58 + @Schema(description = "已收款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  59 + private BigDecimal receiptPrice;
58 60
59 @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 61 @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
60 private BigDecimal totalProductPrice; 62 private BigDecimal totalProductPrice;
@@ -68,15 +70,9 @@ public class ErpSaleOutRespVO { @@ -68,15 +70,9 @@ public class ErpSaleOutRespVO {
68 @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 70 @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
69 private BigDecimal discountPrice; 71 private BigDecimal discountPrice;
70 72
71 - @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 73 + @Schema(description = "其它金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
72 private BigDecimal otherPrice; 74 private BigDecimal otherPrice;
73 75
74 - @Schema(description = "本次收款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")  
75 - private BigDecimal payPrice;  
76 - @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")  
77 - private BigDecimal debtPrice;  
78 -  
79 -  
80 @Schema(description = "附件地址", example = "https://www.iocoder.cn") 76 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
81 @ExcelProperty("附件地址") 77 @ExcelProperty("附件地址")
82 private String fileUrl; 78 private String fileUrl;
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/out/ErpSaleOutSaveReqVO.java
@@ -35,10 +35,6 @@ public class ErpSaleOutSaveReqVO { @@ -35,10 +35,6 @@ public class ErpSaleOutSaveReqVO {
35 @Schema(description = "其它金额,单位:元", example = "7127") 35 @Schema(description = "其它金额,单位:元", example = "7127")
36 private BigDecimal otherPrice; 36 private BigDecimal otherPrice;
37 37
38 - @Schema(description = "本次收款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")  
39 - @NotNull(message = "本次收款不能为空")  
40 - private BigDecimal payPrice;  
41 -  
42 @Schema(description = "附件地址", example = "https://www.iocoder.cn") 38 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
43 private String fileUrl; 39 private String fileUrl;
44 40
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnPageReqVO.java
@@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @@ -17,6 +17,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 @ToString(callSuper = true) 17 @ToString(callSuper = true)
18 public class ErpSaleReturnPageReqVO extends PageParam { 18 public class ErpSaleReturnPageReqVO extends PageParam {
19 19
  20 + public static final Integer REFUND_STATUS_NONE = 0;
  21 + public static final Integer REFUND_STATUS_PART = 1;
  22 + public static final Integer REFUND_STATUS_ALL = 2;
  23 +
20 @Schema(description = "销售单编号", example = "XS001") 24 @Schema(description = "销售单编号", example = "XS001")
21 private String no; 25 private String no;
22 26
@@ -48,4 +52,10 @@ public class ErpSaleReturnPageReqVO extends PageParam { @@ -48,4 +52,10 @@ public class ErpSaleReturnPageReqVO extends PageParam {
48 @Schema(description = "销售单号", example = "1") 52 @Schema(description = "销售单号", example = "1")
49 private String orderNo; 53 private String orderNo;
50 54
  55 + @Schema(description = "退款状态", example = "1")
  56 + private Integer refundStatus;
  57 +
  58 + @Schema(description = "是否可退款", example = "true")
  59 + private Boolean refundEnable; // 对应 refundStatus = [0, 1]
  60 +
51 } 61 }
52 \ No newline at end of file 62 \ No newline at end of file
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnRespVO.java
@@ -55,6 +55,8 @@ public class ErpSaleReturnRespVO { @@ -55,6 +55,8 @@ public class ErpSaleReturnRespVO {
55 @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906") 55 @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
56 @ExcelProperty("最终合计价格") 56 @ExcelProperty("最终合计价格")
57 private BigDecimal totalPrice; 57 private BigDecimal totalPrice;
  58 + @Schema(description = "已退款金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
  59 + private BigDecimal refundPrice;
58 60
59 @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 61 @Schema(description = "合计产品价格,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
60 private BigDecimal totalProductPrice; 62 private BigDecimal totalProductPrice;
@@ -68,15 +70,9 @@ public class ErpSaleReturnRespVO { @@ -68,15 +70,9 @@ public class ErpSaleReturnRespVO {
68 @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 70 @Schema(description = "优惠金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
69 private BigDecimal discountPrice; 71 private BigDecimal discountPrice;
70 72
71 - @Schema(description = "定金金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127") 73 + @Schema(description = "其它金额,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
72 private BigDecimal otherPrice; 74 private BigDecimal otherPrice;
73 75
74 - @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")  
75 - private BigDecimal refundPrice;  
76 - @Schema(description = "本次欠款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")  
77 - private BigDecimal debtPrice;  
78 -  
79 -  
80 @Schema(description = "附件地址", example = "https://www.iocoder.cn") 76 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
81 @ExcelProperty("附件地址") 77 @ExcelProperty("附件地址")
82 private String fileUrl; 78 private String fileUrl;
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/sale/vo/returns/ErpSaleReturnSaveReqVO.java
@@ -35,10 +35,6 @@ public class ErpSaleReturnSaveReqVO { @@ -35,10 +35,6 @@ public class ErpSaleReturnSaveReqVO {
35 @Schema(description = "其它金额,单位:元", example = "7127") 35 @Schema(description = "其它金额,单位:元", example = "7127")
36 private BigDecimal otherPrice; 36 private BigDecimal otherPrice;
37 37
38 - @Schema(description = "本次退款,单位:元", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")  
39 - @NotNull(message = "本次退款不能为空")  
40 - private BigDecimal refundPrice;  
41 -  
42 @Schema(description = "附件地址", example = "https://www.iocoder.cn") 38 @Schema(description = "附件地址", example = "https://www.iocoder.cn")
43 private String fileUrl; 39 private String fileUrl;
44 40
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/finance/ErpFinanceReceiptDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.erp.dal.dataobject.finance;
  2 +
  3 +public class ErpFinanceReceiptDO {
  4 +}
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseInDO.java
@@ -83,7 +83,7 @@ public class ErpPurchaseInDO extends BaseDO { @@ -83,7 +83,7 @@ public class ErpPurchaseInDO extends BaseDO {
83 /** 83 /**
84 * 已支付金额,单位:元 84 * 已支付金额,单位:元
85 * 85 *
86 - * 目的:和 TODO erp_finance_payment 结合,记录已支付金额 86 + * 目的:和 {@link cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentDO} 结合,记录已支付金额
87 */ 87 */
88 private BigDecimal paymentPrice; 88 private BigDecimal paymentPrice;
89 89
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/purchase/ErpPurchaseReturnDO.java
@@ -83,7 +83,7 @@ public class ErpPurchaseReturnDO extends BaseDO { @@ -83,7 +83,7 @@ public class ErpPurchaseReturnDO extends BaseDO {
83 /** 83 /**
84 * 已退款金额,单位:元 84 * 已退款金额,单位:元
85 * 85 *
86 - * 目的:和 TODO erp_finance_payment 结合,记录已退款金额 86 + * 目的:和 {@link cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentDO} 结合,记录已支付金额
87 */ 87 */
88 private BigDecimal refundPrice; 88 private BigDecimal refundPrice;
89 89
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleOutDO.java
@@ -83,9 +83,15 @@ public class ErpSaleOutDO extends BaseDO { @@ -83,9 +83,15 @@ public class ErpSaleOutDO extends BaseDO {
83 /** 83 /**
84 * 最终合计价格,单位:元 84 * 最终合计价格,单位:元
85 * 85 *
86 - * totalPrice = totalProductPrice + totalTaxPrice - discountPrice 86 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
87 */ 87 */
88 private BigDecimal totalPrice; 88 private BigDecimal totalPrice;
  89 + /**
  90 + * 已收款金额,单位:元
  91 + *
  92 + * 目的:和 {@link cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinanceReceiptDO} 结合,记录已收款金额
  93 + */
  94 + private BigDecimal receiptPrice;
89 95
90 /** 96 /**
91 * 合计产品价格,单位:元 97 * 合计产品价格,单位:元
@@ -110,18 +116,6 @@ public class ErpSaleOutDO extends BaseDO { @@ -110,18 +116,6 @@ public class ErpSaleOutDO extends BaseDO {
110 */ 116 */
111 private BigDecimal otherPrice; 117 private BigDecimal otherPrice;
112 118
113 - // TODO 芋艿:receiptPrice  
114 - /**  
115 - * 本次收款,单位:元  
116 - *  
117 - * payPrice = totalPrice + otherPrice - debtPrice  
118 - */  
119 - private BigDecimal payPrice;  
120 - /**  
121 - * 本次欠款,单位:元  
122 - */  
123 - private BigDecimal debtPrice;  
124 -  
125 /** 119 /**
126 * 附件地址 120 * 附件地址
127 */ 121 */
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/dataobject/sale/ErpSaleReturnDO.java
@@ -83,9 +83,15 @@ public class ErpSaleReturnDO extends BaseDO { @@ -83,9 +83,15 @@ public class ErpSaleReturnDO extends BaseDO {
83 /** 83 /**
84 * 最终合计价格,单位:元 84 * 最终合计价格,单位:元
85 * 85 *
86 - * totalPrice = totalProductPrice + totalTaxPrice - discountPrice 86 + * totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
87 */ 87 */
88 private BigDecimal totalPrice; 88 private BigDecimal totalPrice;
  89 + /**
  90 + * 已退款金额,单位:元
  91 + *
  92 + * 目的:和 {@link cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinanceReceiptDO} 结合,记录已退款金额
  93 + */
  94 + private BigDecimal refundPrice;
89 95
90 /** 96 /**
91 * 合计产品价格,单位:元 97 * 合计产品价格,单位:元
@@ -111,17 +117,6 @@ public class ErpSaleReturnDO extends BaseDO { @@ -111,17 +117,6 @@ public class ErpSaleReturnDO extends BaseDO {
111 private BigDecimal otherPrice; 117 private BigDecimal otherPrice;
112 118
113 /** 119 /**
114 - * 本次收款,单位:元  
115 - *  
116 - * refundPrice = totalPrice + otherPrice - debtPrice  
117 - */  
118 - private BigDecimal refundPrice;  
119 - /**  
120 - * 本次欠款,单位:元  
121 - */  
122 - private BigDecimal debtPrice;  
123 -  
124 - /**  
125 * 附件地址 120 * 附件地址
126 */ 121 */
127 private String fileUrl; 122 private String fileUrl;
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/sale/ErpSaleOutMapper.java
@@ -10,8 +10,8 @@ import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutItemDO; @@ -10,8 +10,8 @@ import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOutItemDO;
10 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 10 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
11 import org.apache.ibatis.annotations.Mapper; 11 import org.apache.ibatis.annotations.Mapper;
12 12
13 -import java.math.BigDecimal;  
14 import java.util.List; 13 import java.util.List;
  14 +import java.util.Objects;
15 15
16 /** 16 /**
17 * ERP 销售出库 Mapper 17 * ERP 销售出库 Mapper
@@ -32,10 +32,16 @@ public interface ErpSaleOutMapper extends BaseMapperX<ErpSaleOutDO> { @@ -32,10 +32,16 @@ public interface ErpSaleOutMapper extends BaseMapperX<ErpSaleOutDO> {
32 .eqIfPresent(ErpSaleOutDO::getAccountId, reqVO.getAccountId()) 32 .eqIfPresent(ErpSaleOutDO::getAccountId, reqVO.getAccountId())
33 .likeIfPresent(ErpSaleOutDO::getOrderNo, reqVO.getOrderNo()) 33 .likeIfPresent(ErpSaleOutDO::getOrderNo, reqVO.getOrderNo())
34 .orderByDesc(ErpSaleOutDO::getId); 34 .orderByDesc(ErpSaleOutDO::getId);
35 - if (Boolean.TRUE.equals(reqVO.getDebtStatus())) {  
36 - query.gt(ErpSaleOutDO::getDebtPrice, BigDecimal.ZERO);  
37 - } else if (Boolean.FALSE.equals(reqVO.getDebtStatus())) {  
38 - query.eq(ErpSaleOutDO::getDebtPrice, BigDecimal.ZERO); 35 + // 收款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
  36 + if (Objects.equals(reqVO.getReceiptStatus(), ErpSaleOutPageReqVO.RECEIPT_STATUS_NONE)) {
  37 + query.eq(ErpSaleOutDO::getReceiptPrice, 0);
  38 + } else if (Objects.equals(reqVO.getReceiptStatus(), ErpSaleOutPageReqVO.RECEIPT_STATUS_PART)) {
  39 + query.gt(ErpSaleOutDO::getReceiptPrice, 0).apply("t.receipt_price < t.total_price");
  40 + } else if (Objects.equals(reqVO.getReceiptStatus(), ErpSaleOutPageReqVO.RECEIPT_STATUS_ALL)) {
  41 + query.apply("t.receipt_price = t.total_price");
  42 + }
  43 + if (Boolean.TRUE.equals(reqVO.getReceiptEnable())) {
  44 + query.apply("t.receipt_price < t.total_price");
39 } 45 }
40 if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) { 46 if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
41 query.leftJoin(ErpSaleOutItemDO.class, ErpSaleOutItemDO::getOutId, ErpSaleOutDO::getId) 47 query.leftJoin(ErpSaleOutItemDO.class, ErpSaleOutItemDO::getOutId, ErpSaleOutDO::getId)
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/sale/ErpSaleReturnMapper.java
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
11 import org.apache.ibatis.annotations.Mapper; 11 import org.apache.ibatis.annotations.Mapper;
12 12
13 import java.util.List; 13 import java.util.List;
  14 +import java.util.Objects;
14 15
15 /** 16 /**
16 * ERP 销售退货 Mapper 17 * ERP 销售退货 Mapper
@@ -31,6 +32,17 @@ public interface ErpSaleReturnMapper extends BaseMapperX&lt;ErpSaleReturnDO&gt; { @@ -31,6 +32,17 @@ public interface ErpSaleReturnMapper extends BaseMapperX&lt;ErpSaleReturnDO&gt; {
31 .eqIfPresent(ErpSaleReturnDO::getAccountId, reqVO.getAccountId()) 32 .eqIfPresent(ErpSaleReturnDO::getAccountId, reqVO.getAccountId())
32 .likeIfPresent(ErpSaleReturnDO::getOrderNo, reqVO.getOrderNo()) 33 .likeIfPresent(ErpSaleReturnDO::getOrderNo, reqVO.getOrderNo())
33 .orderByDesc(ErpSaleReturnDO::getId); 34 .orderByDesc(ErpSaleReturnDO::getId);
  35 + // 退款状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报字段不存在的错误
  36 + if (Objects.equals(reqVO.getRefundStatus(), ErpSaleReturnPageReqVO.REFUND_STATUS_NONE)) {
  37 + query.eq(ErpSaleReturnDO::getRefundPrice, 0);
  38 + } else if (Objects.equals(reqVO.getRefundStatus(), ErpSaleReturnPageReqVO.REFUND_STATUS_PART)) {
  39 + query.gt(ErpSaleReturnDO::getRefundPrice, 0).apply("t.refund_price < t.total_price");
  40 + } else if (Objects.equals(reqVO.getRefundStatus(), ErpSaleReturnPageReqVO.REFUND_STATUS_ALL)) {
  41 + query.apply("t.refund_price = t.total_price");
  42 + }
  43 + if (Boolean.TRUE.equals(reqVO.getRefundEnable())) {
  44 + query.apply("t.refund_price < t.total_price");
  45 + }
34 if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) { 46 if (reqVO.getWarehouseId() != null || reqVO.getProductId() != null) {
35 query.leftJoin(ErpSaleReturnItemDO.class, ErpSaleReturnItemDO::getReturnId, ErpSaleReturnDO::getId) 47 query.leftJoin(ErpSaleReturnItemDO.class, ErpSaleReturnItemDO::getReturnId, ErpSaleReturnDO::getId)
36 .eq(reqVO.getWarehouseId() != null, ErpSaleReturnItemDO::getWarehouseId, reqVO.getWarehouseId()) 48 .eq(reqVO.getWarehouseId() != null, ErpSaleReturnItemDO::getWarehouseId, reqVO.getWarehouseId())
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/sale/ErpSaleOutServiceImpl.java
@@ -148,10 +148,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService { @@ -148,10 +148,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
148 saleOut.setDiscountPercent(BigDecimal.ZERO); 148 saleOut.setDiscountPercent(BigDecimal.ZERO);
149 } 149 }
150 saleOut.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleOut.getTotalPrice(), saleOut.getDiscountPercent())); 150 saleOut.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleOut.getTotalPrice(), saleOut.getDiscountPercent()));
151 - saleOut.setTotalPrice(saleOut.getTotalPrice().subtract(saleOut.getDiscountPrice()));  
152 - // 计算应收金额  
153 - BigDecimal allPrice = saleOut.getTotalPrice().add(saleOut.getOtherPrice());  
154 - saleOut.setDebtPrice(allPrice.subtract(saleOut.getPayPrice())); 151 + saleOut.setTotalPrice(saleOut.getTotalPrice().subtract(saleOut.getDiscountPrice().add(saleOut.getOtherPrice())));
155 } 152 }
156 153
157 private void updateSaleOrderOutCount(Long orderId) { 154 private void updateSaleOrderOutCount(Long orderId) {
yudao-module-erp/yudao-module-erp-biz/src/main/java/cn/iocoder/yudao/module/erp/service/sale/ErpSaleReturnServiceImpl.java
@@ -148,10 +148,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService { @@ -148,10 +148,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
148 saleReturn.setDiscountPercent(BigDecimal.ZERO); 148 saleReturn.setDiscountPercent(BigDecimal.ZERO);
149 } 149 }
150 saleReturn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleReturn.getTotalPrice(), saleReturn.getDiscountPercent())); 150 saleReturn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleReturn.getTotalPrice(), saleReturn.getDiscountPercent()));
151 - saleReturn.setTotalPrice(saleReturn.getTotalPrice().subtract(saleReturn.getDiscountPrice()));  
152 - // 计算应退金额  
153 - BigDecimal allPrice = saleReturn.getTotalPrice().add(saleReturn.getOtherPrice());  
154 - saleReturn.setDebtPrice(allPrice.subtract(saleReturn.getRefundPrice())); 151 + saleReturn.setTotalPrice(saleReturn.getTotalPrice().subtract(saleReturn.getDiscountPrice().add(saleReturn.getOtherPrice())));
155 } 152 }
156 153
157 private void updateSaleOrderReturnCount(Long orderId) { 154 private void updateSaleOrderReturnCount(Long orderId) {