diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java index dcc4f3a4..5836517e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java @@ -145,7 +145,7 @@ public class OverallConstant { prodOverAll.put("u8c自定义项档案-单据红字标识-N名称", "N"); //中台地址 - prodOverAll.put("u8c_url", "http://127.0.0.1:8081/kangarooDataCenterV3/entranceController/externalCallInterface"); + prodOverAll.put("u8c_url", "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"); //测试 // prodOverAll.put("u8c_url", "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index 2a7f3e44..1b9420b7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -961,7 +961,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); - String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); +// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); // BigDecimal noriginalcurprice = null;//无税单价 // BigDecimal noriginalcurmny = null;//无税金额 @@ -1272,6 +1272,20 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //查询对应的OFS销售订单 List headerDetailsDtos = queryOfsOrder(headerDetailsDtoList); findMatchingOfsOrder(headerDetailsDtos, headerDetailsDtoList); + + //TODO 测试 + for (int i = 0; i < headerDetailsDtos.size(); i++) { + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(i); + List details = headerDetailsDto.getDetails(); + for (int j = 0; j < details.size(); j++) { + com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto detailsDto = details.get(j); + detailsDto.setPlatformDiscounts("1"); + detailsDto.setPayDiscounts("1"); + detailsDto.setExpertDiscounts("1"); + detailsDto.setMerchantDiscounts("1"); + } + } + //计算OFS销售订单优惠金额分摊到明细行 // ofsOrderSaleAmountAllocationUtil.batchTocSalesAmountAllocation(headerDetailsDtos); //计算OFS销售订单邮费分摊 @@ -1770,15 +1784,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { totalPayAmount = getRefsaleprice(bdInvmandocEntity, bdInvbasdocEntity, calculationFormulaStr, sonDetailsDto, header); } else { //取《O实付》 - calculationFormulaStr.append("取O应收金额:"); + calculationFormulaStr.append("取O实付金额:"); //触发取实付金额的逻辑,因此需要累加:O实付金额+O达人优惠+O支付优惠+O平台优惠 //取O实付金额 // totalPayAmount = sonDetailsDto.getTotalPayAmount(); // totalPayAmount = accumulatedDiscounts(sonDetailsDto, headerDetailsDto, targetDetails); //和万万确认,O销售出库单明细行应收金额=O销售订单明细行应收金额/O销售订单明细行请求数量*O销售出库单明细行实发数量 //这里做好必要的参数验证抛出异常 - Assert.notNull(targetDetails.getPayableAmount(), "O应收金额不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); - Assert.state(!"".equals(targetDetails.getPayableAmount()), "O应收金额不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); + Assert.notNull(targetDetails.getTotalPayAmount(), "O实付金额不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); + Assert.state(!"".equals(targetDetails.getTotalPayAmount()), "O实付金额不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); Assert.notNull(targetDetails.getRequestQty(), "O请求数量不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); Assert.state(!"".equals(targetDetails.getRequestQty()), "O请求数量不能为空 O销售订单编码:{} O明细行主键:{}", header1.getCode(), targetDetails.getId()); @@ -1786,16 +1800,16 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { Assert.notNull(sonDetailsDto.getShipQty(), "O实发数量不能为空 O销售出库单编码:{} O明细行主键:{}", header.getCode(), sonDetailsDto.getId()); Assert.state(!"".equals(sonDetailsDto.getShipQty()), "O实发数量不能为空 O销售出库单编码:{} O明细行主键:{}", header.getCode(), sonDetailsDto.getId()); - BigDecimal detailedLineUnitPrice = new BigDecimal(targetDetails.getPayableAmount()).divide(new BigDecimal(targetDetails.getRequestQty()), 20, BigDecimal.ROUND_HALF_UP); + BigDecimal detailedLineUnitPrice = new BigDecimal(targetDetails.getTotalPayAmount()).divide(new BigDecimal(targetDetails.getRequestQty()), 20, BigDecimal.ROUND_HALF_UP); BigDecimal totalPayAmountBigDecimal = detailedLineUnitPrice.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP); totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString(); // aaa.append(totalPayAmount); // aaa.append(","); - String format = StrUtil.format("{}/{}*{}", targetDetails.getPayableAmount(), targetDetails.getRequestQty(), sonDetailsDto.getShipQty()); + String format = StrUtil.format("{}/{}*{}", targetDetails.getTotalPayAmount(), targetDetails.getRequestQty(), sonDetailsDto.getShipQty()); calculationFormulaStr.append(format); } - Assert.notNull(totalPayAmount, "应收金额不能为空(应收金额=实付金额+达人优惠+支付优惠+平台优惠) 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId()); + Assert.notNull(totalPayAmount, "实付金额不能为空 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId()); // String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, sonDetailsDto, mapList, calculationFormulaStr); // if (totalPayAmount == null) { @@ -3626,6 +3640,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { if (bdTaxitemsEntityList.size() == 0) { Assert.state(false, "根据存货编码{}没有查询到U8C税目档案", invcode); } + if (bdTaxitemsEntityList.size() != 4) { + Assert.state(false, "根据存货编码{}没有查询到足够的U8C税目档案", invcode); + } return bdTaxitemsEntityList.stream().collect(Collectors.toMap(BdTaxitemsEntity::getInvcode, entity -> entity)); } @@ -3844,6 +3861,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { saleorderRequestChildrenDto1.setVdef5("0"); saleorderRequestChildrenDto1.setVdef6("0"); saleorderRequestChildrenDto1.setVdef7("0"); + + //是否赠品 + saleorderRequestChildrenDto1.setBlargessflag(false); saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto1); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java index b8ca37cf..c2b4aefe 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java @@ -73,6 +73,9 @@ public class OfsOrderSalePostageFeeAllocationUtil { //销售订单运费 String postageAmount = header.getPostageAmount(); + // TODO 测试 + postageAmount = "10"; + //运费可能没有,也有可能为0! BigDecimal postageAmountDiscounts = null; if (postageAmount != null && !"".equals(postageAmount) && !"0".equals(new BigDecimal(postageAmount).stripTrailingZeros().toPlainString())) { diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java index d63a9b27..184f5106 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java @@ -112,7 +112,7 @@ class SoSaleOutPluginInitializerToCTest { // String aaa = "LETS-SH2024102800021196"; // soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-23 11:24:33", "2024-11-23 11:24:33"); - soSaleOutPluginInitializerToC.startImplementStockByTime("2024-11-15 00:00:00", "2024-11-15 23:59:59"); +// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-11-15 00:00:00", "2024-11-15 23:59:59"); } catch (Exception e) { e.printStackTrace(); } @@ -120,7 +120,7 @@ class SoSaleOutPluginInitializerToCTest { // soSaleOutPluginInitializerToC.sendU8CTOCOrder("123446"); try { -// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110100000024", "tran"); + soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024120300016549", "stock"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");