diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml index 17e7a583..404a5b36 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml @@ -911,10 +911,10 @@ - insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary) + insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary,def7,def8) values - (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary}) + (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.def7},#{entity.def8}) on duplicate key update id = values(id), @@ -922,7 +922,9 @@ newTransmitInfo = values(newTransmitInfo), newState = values(newState), newSystemNumber = values(newSystemNumber), - newSystemPrimary = values(newSystemPrimary) + newSystemPrimary = values(newSystemPrimary), + def7 = values(def7), + def8 = values(def8) @@ -941,10 +943,10 @@ - insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2,newSystemNumber2,newSystemPrimary2) + insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2,newSystemNumber2,newSystemPrimary2,def7,def8) values - (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2}) + (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.def7},#{entity.def8}) on duplicate key update id = values(id), @@ -952,7 +954,9 @@ newTransmitInfo2 = values(newTransmitInfo2), newState2 = values(newState2), newSystemNumber2 = values(newSystemNumber2), - newSystemPrimary2 = values(newSystemPrimary2) + newSystemPrimary2 = values(newSystemPrimary2), + def7 = values(def7), + def8 = values(def8) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml index ecc9a204..857d1f14 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml @@ -1009,7 +1009,7 @@ - insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary,def7) + insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary,def7,def8) values ( @@ -1019,7 +1019,8 @@ #{entity.newstate}, #{entity.newsystemnumber}, #{entity.newsystemprimary}, - #{entity.def7} + #{entity.def7}, + #{entity.def8} ) on duplicate key update @@ -1029,7 +1030,8 @@ newState = values(newState), newSystemNumber = values(newSystemNumber), newSystemPrimary = values(newSystemPrimary), - def7 = values(def7) + def7 = values(def7), + def8 = values(def8) @@ -1053,7 +1055,7 @@ - insert into tocofs_saleout_detailed(id,def5,def6,newState4,newSystemNumber4,newSystemPrimary4,def7) + insert into tocofs_saleout_detailed(id,def5,def6,newState4,newSystemNumber4,newSystemPrimary4,def7,def8) values ( @@ -1063,7 +1065,8 @@ #{entity.newstate4}, #{entity.newsystemnumber4}, #{entity.newsystemprimary4}, - #{entity.def7} + #{entity.def7}, + #{entity.def8} ) on duplicate key update @@ -1073,7 +1076,8 @@ newState4 = values(newState4), newSystemNumber4 = values(newSystemNumber4), newSystemPrimary4 = values(newSystemPrimary4), - def7 = values(def7) + def7 = values(def7), + def8 = values(def8) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index d7b94546..351c6ed1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -781,15 +781,16 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { tax = "0"; } + StringBuffer calculationFormula = new StringBuffer();//计算公式 BigDecimal noriginalcurprice = null;//无税单价 BigDecimal noriginalcurmny = null;//无税金额 BigDecimal noriginalcurtaxprice = null;//含税单价 BigDecimal noriginalcursummny = null;//价税合计 BigDecimal noriginalcurtaxmny = null;//税额 + String totalPayAmount = null; try { //判断目标金额:O实收、结存价、采购价 - String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto); - detailsDto.setTargetAccountsReceivable(totalPayAmount); + totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula); noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); @@ -843,6 +844,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { // saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目 // saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj()); saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); + + detailsDto.setDef7(totalPayAmount); + detailsDto.setDef8(calculationFormula.toString()); } //记录成功 //销售订单单据推送到u8c @@ -1905,12 +1909,14 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); + //计算公式 + StringBuffer calculationFormula = new StringBuffer(); //含税单价 BigDecimal noriginalcurtaxprice = null; + String totalPayAmount = null; try { //综合判断对应的目标金额 - String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto); - detailsDto.setTargetAccountsReceivable(totalPayAmount); + totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula); noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); } catch (Exception e) { logger.error("含税单价金额计算失败!", e); @@ -1951,6 +1957,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { // salesInvoiceBodyDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj()); salesInvoiceBodyDtoList.add(salesInvoiceBodyDto); + + detailsDto.setDef7(totalPayAmount); + detailsDto.setDef8(calculationFormula.toString()); } SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto(); salesInvoiceDto.setParentvo(salesInvoiceHeadDto); @@ -2358,7 +2367,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { tocofsSaleoutDetailedEntity.setNewpushdate(getNewDateStr()); tocofsSaleoutDetailedEntity.setNewtransmitinfo(finalNewTransmitInfo); tocofsSaleoutDetailedEntity.setNewstate(newstate); - tocofsSaleoutDetailedEntity.setDef7(detailsDto.getTargetAccountsReceivable()); + tocofsSaleoutDetailedEntity.setDef7(detailsDto.getDef7()); + tocofsSaleoutDetailedEntity.setDef8(detailsDto.getDef8()); if (successY.equals(newstate)) { //只有成功才填充下游系统主键和编码 tocofsSaleoutDetailedEntity.setNewsystemnumber(newsystemnumber); @@ -2415,7 +2425,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { tocofsSaleoutDetailedEntity.setDef5(getNewDateStr()); tocofsSaleoutDetailedEntity.setDef6(finalNewTransmitInfo); tocofsSaleoutDetailedEntity.setNewstate4(newstate); - tocofsSaleoutDetailedEntity.setDef7(detailsDto.getTargetAccountsReceivable()); + tocofsSaleoutDetailedEntity.setDef7(detailsDto.getDef7()); + tocofsSaleoutDetailedEntity.setDef8(detailsDto.getDef8()); if (successY.equals(newstate)) { //只有成功才填充下游系统主键和编码 tocofsSaleoutDetailedEntity.setNewsystemnumber4(newsystemnumber); @@ -2660,11 +2671,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @param detailsDto 对应的销售出库单明细行对象 * @author liuyang */ - private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, DetailsDto detailsDto) throws Exception { + private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, DetailsDto detailsDto, StringBuffer calculationFormula) throws Exception { Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空"); Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空"); Assert.notNull(header, "header不能为空"); Assert.notNull(detailsDto, "detailsDto不能为空"); + Assert.notNull(calculationFormula, "calculationFormula不能为空"); //这里只能是金额 String totalPayAmount = null; @@ -2676,6 +2688,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { List iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList); if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) { logger.info("店铺:{} 取O结存价", header.getStoreCode()); + calculationFormula.append("U结存金额"); //结存金额 IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0); @@ -2707,6 +2720,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { List poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1); if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) { logger.info("店铺:{} 取O采购价", header.getStoreCode()); + calculationFormula.append("U采购金额"); String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice(); // String nordernum = poOrderBEntityList.get(0).getNordernum(); if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) { @@ -2724,6 +2738,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } } else { logger.info("店铺:{} 取O实付金额", header.getStoreCode()); + calculationFormula.append("O实退金额"); totalPayAmount = detailsDto.getTotalPayAmount(); } return totalPayAmount; 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 6fa68371..730c4717 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 @@ -201,7 +201,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { private static final String NOTHING = "无"; - private static final String ADD = "(*)"; + private static final String ADD = "&"; @Autowired private ShopTobOrToCUtil shopTobOrToCUtil; @@ -849,6 +849,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { List sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos, sceneType); // 分组汇总 // String dimension = "1001(*)dy-intoyou(*)B2CHA20240010(*)6973391735605(*)SALES(*)002"; +// String dimension = "1001(*)dy-intoyou(*)B2CHA20240010(*)6973391732482(*)SALES(*)002"; String dimension = null; Map> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList, dimension); // 查询U8C业务流程 @@ -1673,6 +1674,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空"); Assert.notNull(mapList, "mapLists不能为空"); + StringBuffer aaa = new StringBuffer(); if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { BigDecimal groupTotalPayAmount = new BigDecimal("0"); BigDecimal groupShipQty = new BigDecimal("0"); @@ -1723,6 +1725,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BigDecimal detailedLineUnitPrice = new BigDecimal(targetDetails.getPayableAmount()).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()); calculationFormulaStr.append(format); @@ -1777,6 +1781,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //累加各类优惠 // logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size()); + System.out.println(aaa.toString()); return sonDetailsDto; } else { logger.error("sonDetailsDtoList集合是空的!"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index de0ce152..3d5ee82e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -779,17 +779,18 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { tax = "0"; } + StringBuffer calculationFormula = new StringBuffer();//计算公式 BigDecimal noriginalcurprice = null;//无税单价 BigDecimal noriginalcurmny = null;//无税金额 BigDecimal noriginalcurtaxprice = null;//含税单价 BigDecimal noriginalcursummny = null;//价税合计 BigDecimal noriginalcurtaxmny = null;//税额 + String totalAmount = null; try { // Assert.notNull(stockinB.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(stockinB)); - Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(stockinB)); - - //确定好实退金额,可能为O的实退金额,也可能是结存价和采购价 - String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, afterSalesOrder); + Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 售后订单:{} 售后订单主键:{}", header.getCode(), stockinB.getId()); + //确定实退金额,可能为O的实退金额,也可能是结存价和采购价 + totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, afterSalesOrder, calculationFormula, stockinB); noriginalcurtaxprice = new BigDecimal(totalAmount).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); @@ -833,6 +834,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目 // saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj()); saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); + + stockinB.setDef7(totalAmount);//计算应收 + stockinB.setDef8(calculationFormula.toString());//计算公式 } //记录成功 //销售订单单据推送到u8c @@ -1847,6 +1851,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); + StringBuffer calculationFormula = new StringBuffer();//计算公式 + calculationFormula.append("O实退金额"); BigDecimal noriginalcurtaxprice = null;//含税单价 try { noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); @@ -1877,6 +1883,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // salesInvoiceBodyDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目 // salesInvoiceBodyDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj()); salesInvoiceBodyDtoList.add(salesInvoiceBodyDto); + + stockinB.setDef7("-" + new BigDecimal(afterSalesOrder.getTotalAmount()).stripTrailingZeros().toPlainString()); + stockinB.setDef8(calculationFormula.toString());//计算公式 } SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto(); salesInvoiceDto.setParentvo(salesInvoiceHeadDto); @@ -2283,6 +2292,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setNewpushdate(getNewDateStr()); tocofsReturngoodsDetailedEntity.setNewtransmitinfo(finalNewTransmitInfo); tocofsReturngoodsDetailedEntity.setNewstate(newstate); + tocofsReturngoodsDetailedEntity.setDef7(stockinB.getDef7()); + tocofsReturngoodsDetailedEntity.setDef8(stockinB.getDef8()); if (successY.equals(newstate)) { tocofsReturngoodsDetailedEntity.setNewsystemnumber(newsystemnumber); tocofsReturngoodsDetailedEntity.setNewsystemprimary(newsystemprimary); @@ -2292,7 +2303,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { //以50行为一个批次,推送到Mysql if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) { - List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 50); + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 200); for (int i = 0; i < splitListByCount.size(); i++) { List tocofsReturngoodsDetailedEntities = splitListByCount.get(i); iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnStock(tocofsReturngoodsDetailedEntities); @@ -2349,6 +2360,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setNewpushdate2(getNewDateStr()); tocofsReturngoodsDetailedEntity.setNewtransmitinfo2(finalNewTransmitInfo); tocofsReturngoodsDetailedEntity.setNewstate2(newstate); + tocofsReturngoodsDetailedEntity.setDef7(stockinB.getDef7()); + tocofsReturngoodsDetailedEntity.setDef8(stockinB.getDef8()); if (successY.equals(newstate)) { tocofsReturngoodsDetailedEntity.setNewsystemnumber2(newsystemnumber); tocofsReturngoodsDetailedEntity.setNewsystemprimary2(newsystemprimary); @@ -2511,18 +2524,23 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * 获取结存金额或者采购金额 * Boolean isCheckShopChoose * - * @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价 - * @param bdInvmandocEntity 存货管理档案 - * @param header OFS收入入库单表头 - * @param afterSalesOrder OFS售后订单明细行 + * @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价 + * @param bdInvmandocEntity 存货管理档案 + * @param header OFS售后入库单表头 + * @param afterSalesOrder OFS售后订单明细行 + * @param calculationFormula 计算公式 + * @param stockinB OFS售后入库单明细行 * @author liuyang */ - private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder) throws Exception { + private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder, StringBuffer calculationFormula, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) throws Exception { Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空"); Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空"); Assert.notNull(header, "header不能为空"); Assert.notNull(afterSalesOrder, "afterSalesOrder不能为空"); + Assert.notNull(calculationFormula, "calculationFormula不能为空"); + Assert.notNull(stockinB, "stockinB不能为空"); + //totalPayAmount只能是金额 String totalPayAmount = null; if (isCheckShopChoose) { //取结存 @@ -2530,6 +2548,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { bdInvmandocEntityArrayList.add(bdInvmandocEntity); List iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList); if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) { + calculationFormula.append("U结存金额"); //结存金额 logger.info("店铺:{} 取O结存价", header.getStoreCode()); IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0); @@ -2550,17 +2569,21 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { bdInvmandocEntityArrayList1.add(bdInvmandocEntity); List poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1); if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) { + calculationFormula.append("U采购金额"); logger.info("店铺:{} 取O采购价", header.getStoreCode()); - String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice(); - String nordernum = poOrderBEntityList.get(0).getNordernum(); - if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString()) || "0".equals(new BigDecimal(nordernum).stripTrailingZeros().toPlainString())) { + String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();//原币含税单价 +// String nordernum = poOrderBEntityList.get(0).getNordernum();//订货数量 + if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) { //如果采购单价都为0,那么金额也为0 totalPayAmount = "0"; } else { - BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice); - BigDecimal nordernumBigDecimal = new BigDecimal(nordernum); - BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP); - totalPayAmount = multiply.stripTrailingZeros().toPlainString(); + //采购金额的确定=原币含税单价*O实退数量 +// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice); +// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum); +// BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP); +// totalPayAmount = multiply.stripTrailingZeros().toPlainString(); + BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); + totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString(); } } else { Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc()); @@ -2569,6 +2592,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } else { //O用户实退 logger.info("店铺:{} 取O实付金额", header.getStoreCode()); + calculationFormula.append("O实退金额"); totalPayAmount = afterSalesOrder.getTotalAmount(); } return totalPayAmount; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index 6d708485..7f662cc5 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -170,7 +170,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { private static final String NOTHING = "无"; - private static final String ADD = "(*)"; + private static final String ADD = "&"; @Autowired private ITocofsReturngoodsDao iTocofsReturngoodsDao; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java index a16fb1a4..caae9d15 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java @@ -54,8 +54,8 @@ public class OfsStandardUtil { Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空"); Assert.notNull(pageNo, "pageNo不能为空"); Assert.notNull(api, "api不能为空"); - - Long pageSize = 400L; + + Long pageSize = 500L; queryOfsSoSaleOutVo.setPageNo(pageNo); queryOfsSoSaleOutVo.setPageSize(pageSize); 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 d6e96b4d..c6d99c3e 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-05 10:28:06", "2024-11-05 10:28:06"); -// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-11-01 00:00:00", "2024-11-01 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-SH2024103100030329", "stock"); +// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024103100030329", "stock"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran"); } catch (Exception e) { e.printStackTrace(); diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java index 27e35435..93bcb988 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java @@ -60,5 +60,10 @@ public class DetailsDto { /** * 目标应收 */ - private String targetAccountsReceivable; + private String def7; + + /** + * 计算公式 + */ + private String def8; } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java index 740dc139..77b7ee66 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java @@ -107,6 +107,14 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics { private String newstate4; //表头对象 private StockinH returnGoodSearchHeaderDto; + /** + * 计算应收 + */ + private String def7; + /** + * 计算公式 + */ + private String def8; } } }