diff --git a/src/main/java/com/yem/wm/es/contactbook/op/ContactBookSaveOp.java b/src/main/java/com/yem/wm/es/contactbook/op/ContactBookSaveOp.java index e6617bfa..c931a784 100644 --- a/src/main/java/com/yem/wm/es/contactbook/op/ContactBookSaveOp.java +++ b/src/main/java/com/yem/wm/es/contactbook/op/ContactBookSaveOp.java @@ -19,6 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; @@ -201,7 +202,7 @@ public class ContactBookSaveOp extends AbstractOperationServicePlugIn debugMsg.append(String.format("下单预收比例:%s,发货预收比例::%s,尾款比例:%s", procPreRapRate, shipPreRapRate, lastRate)).append("\n"); BigDecimal procClaimAnt = PaymentControlUtil.getPreCollection(saleOrder, payBills, "D");//下单已认领金额 BigDecimal offeramount = saleOrder.getBigDecimal("yem_offeramount");//合同价格条款金额 - BigDecimal advancePayment = PaymentControlUtil.getAdvancePayment(offeramount, procPreRapRate); + BigDecimal advancePayment = PaymentControlUtil.getAdvancePayment(offeramount, procPreRapRate).setScale(2, RoundingMode.HALF_UP); logger.info("下单已认领金额:{}, 下单预收金额:{}", procClaimAnt, advancePayment); debugMsg.append(String.format("下单已认领金额:%s, 下单预收金额:%s", procClaimAnt, advancePayment)).append("\n"); @@ -209,10 +210,9 @@ public class ContactBookSaveOp extends AbstractOperationServicePlugIn if (advancePayment.compareTo(BigDecimal.ZERO) > 0 && procClaimAnt.compareTo(advancePayment) >= 0) { isProcClaimFinish = true; } - + BigDecimal thisAmt = getThisAmt(shipDetail);//本次出运/发货金额 // 本次发运已认领金额 >= 发运预收金额 - BigDecimal thisShipIOUAmt = PaymentControlUtil.getThisRealityAmt(saleOrder, shipBills, payBills, shipDetail);//本次发运欠款金额,本次发运应认领金额 - thisShipIOUAmt = thisShipIOUAmt.abs(); + BigDecimal thisShipIOUAmt = PaymentControlUtil.getAdvancePayment(thisAmt, shipPreRapRate).setScale(2, RoundingMode.HALF_UP);//本次发运欠款金额,本次发运应认领金额 BigDecimal shipClaimAmt = PaymentControlUtil.getAmountClaimed(new DynamicObject[]{shipDetail}, "E");//本次发运已认领金额 logger.info("发运已认领金额:{},发运预收金额:{}", shipClaimAmt, thisShipIOUAmt); debugMsg.append(String.format("发运已认领金额:%s, 发运预收金额:%s", shipClaimAmt, thisShipIOUAmt)).append("\n"); @@ -221,7 +221,7 @@ public class ContactBookSaveOp extends AbstractOperationServicePlugIn } BigDecimal amount = shipDetail.getBigDecimal("yem_offeramount");//发运 价格条款金额 - BigDecimal periodrefundamt = lastRate.multiply(amount);//尾款 应收金额 + BigDecimal periodrefundamt = lastRate.multiply(amount).setScale(2, RoundingMode.HALF_UP);//尾款 应收金额 BigDecimal shipClaimAmt_periodrefund = PaymentControlUtil.getAmountClaimed(new DynamicObject[]{shipDetail}, "F");//本次发运已认领金额_尾款 logger.info("尾款已认领金额:{}, 尾款应收金额:{}", shipClaimAmt_periodrefund, periodrefundamt); debugMsg.append(String.format("尾款已认领金额:%s, 尾款应收金额:%s", shipClaimAmt_periodrefund, periodrefundamt)).append("\n");