Merge remote-tracking branch 'origin/lets' into lets

This commit is contained in:
zhengyf 2024-11-29 08:44:56 +08:00
commit a96866431d
3 changed files with 149 additions and 39 deletions

View File

@ -856,7 +856,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
// 查询销售收发类别 // 查询销售收发类别
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); // BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202");
//初始化所有存货管理档案对应的结存价+采购价 //初始化所有存货管理档案对应的结存价+采购价
List<Map> mapList = initAllBalancePricePurchasePrice(); // List<Map> mapList = initAllBalancePricePurchasePrice();
//查询平台运费存货基本档案 //查询平台运费存货基本档案
BdInvbasdocEntity bdInvbasdocEntity1 = queryStockBasicArchives(); BdInvbasdocEntity bdInvbasdocEntity1 = queryStockBasicArchives();
//查询平台运费对应的税率 //查询平台运费对应的税率
@ -938,7 +938,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode()); Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
//把汇总好的出库单明细行合并成一行 //把汇总好的出库单明细行合并成一行
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList); SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp()); // BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp());
@ -1666,14 +1666,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* 单价计算公式sum(实付金额/实发数量) 最后除以条数 * 单价计算公式sum(实付金额/实发数量) 最后除以条数
* *
* @param sonDetailsDtoList 销售出库单明细行集合 * @param sonDetailsDtoList 销售出库单明细行集合
* @param isCheckShopChoose true取参考售价false取O应收
* @author liuyang * @author liuyang
*/ */
private SonDetailsDto groupMergeDetailedRows(List<SonDetailsDto> sonDetailsDtoList, Boolean isCheckShopChoose, List<Map> mapList) throws Exception { private SonDetailsDto groupMergeDetailedRows(List<SonDetailsDto> sonDetailsDtoList, Boolean isCheckShopChoose) throws Exception {
Assert.notNull(sonDetailsDtoList, "sonDetailsDtoList不能为空"); Assert.notNull(sonDetailsDtoList, "sonDetailsDtoList不能为空");
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空"); Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
Assert.notNull(mapList, "mapLists不能为空");
StringBuffer aaa = new StringBuffer(); // Assert.notNull(mapList, "mapLists不能为空");
// StringBuffer aaa = new StringBuffer();
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
BigDecimal groupTotalPayAmount = new BigDecimal("0"); BigDecimal groupTotalPayAmount = new BigDecimal("0");
BigDecimal groupShipQty = new BigDecimal("0"); BigDecimal groupShipQty = new BigDecimal("0");
@ -1682,6 +1683,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i);
HeaderDto header = sonDetailsDto.getHeader();//销售出库单表头 HeaderDto header = sonDetailsDto.getHeader();//销售出库单表头
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案 BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基本档案
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = sonDetailsDto.getHeaderDetailsDto();//OFS销售订单 com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = sonDetailsDto.getHeaderDetailsDto();//OFS销售订单
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader(); com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader();
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> details = headerDetailsDto.getDetails(); List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> details = headerDetailsDto.getDetails();
@ -1702,9 +1704,13 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//OFS销售订单实付金额:totalPayAmount //OFS销售订单实付金额:totalPayAmount
//OFS销售出库单实付金额totalPayAmount //OFS销售出库单实付金额totalPayAmount
//是一样的字段目前暂时取销售出库单对应的totalPayAmount //是一样的字段目前暂时取销售出库单对应的totalPayAmount
String totalPayAmount = null;
StringBuffer calculationFormulaStr = new StringBuffer(); StringBuffer calculationFormulaStr = new StringBuffer();
String totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, sonDetailsDto, mapList, calculationFormulaStr); if (isCheckShopChoose) {
if (totalPayAmount == null) { //U8C存货基本档案-参考售价
totalPayAmount = getRefsaleprice(bdInvmandocEntity, bdInvbasdocEntity, calculationFormulaStr, sonDetailsDto, header);
} else {
//O实付
calculationFormulaStr.append("取O应收金额"); calculationFormulaStr.append("取O应收金额");
//触发取实付金额的逻辑因此需要累加O实付金额+O达人优惠+O支付优惠+O平台优惠 //触发取实付金额的逻辑因此需要累加O实付金额+O达人优惠+O支付优惠+O平台优惠
//取O实付金额 //取O实付金额
@ -1724,19 +1730,47 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
BigDecimal detailedLineUnitPrice = new BigDecimal(targetDetails.getPayableAmount()).divide(new BigDecimal(targetDetails.getRequestQty()), 20, BigDecimal.ROUND_HALF_UP); 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); BigDecimal totalPayAmountBigDecimal = detailedLineUnitPrice.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString(); totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
aaa.append(totalPayAmount); // aaa.append(totalPayAmount);
aaa.append(","); // aaa.append(",");
String format = StrUtil.format("{}/{}*{}", targetDetails.getPayableAmount(), targetDetails.getRequestQty(), sonDetailsDto.getShipQty()); String format = StrUtil.format("{}/{}*{}", targetDetails.getPayableAmount(), targetDetails.getRequestQty(), sonDetailsDto.getShipQty());
calculationFormulaStr.append(format); calculationFormulaStr.append(format);
} else {
//取结存单价或者采购单价
//和李佳妮确认取采购价结存价的情况下不需要累加优惠金额
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalPayAmount);
// totalPayAmount = totalPayAmountBigDecimal.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
} }
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) {
// 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.getRequestQty(), "O请求数量不能为空 O销售订单编码{} O明细行主键{}", header1.getCode(), targetDetails.getId());
// Assert.state(!"".equals(targetDetails.getRequestQty()), "O请求数量不能为空 O销售订单编码{} O明细行主键{}", header1.getCode(), targetDetails.getId());
//
// 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 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);
// } else {
// //取结存单价或者采购单价
// //和李佳妮确认取采购价结存价的情况下不需要累加优惠金额
// BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalPayAmount);
//// totalPayAmount = totalPayAmountBigDecimal.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
// totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
// }
// Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId()); // Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId());
// BigDecimal totalPayAmountBigDecimal = new BigDecimal("0"); // BigDecimal totalPayAmountBigDecimal = new BigDecimal("0");
@ -1780,7 +1814,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//累加各类优惠 //累加各类优惠
// logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size()); // logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size());
System.out.println(aaa.toString()); // System.out.println(aaa.toString());
return sonDetailsDto; return sonDetailsDto;
} else { } else {
logger.error("sonDetailsDtoList集合是空的"); logger.error("sonDetailsDtoList集合是空的");
@ -1923,7 +1957,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//查询销售收发类别 //查询销售收发类别
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); // BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202");
//初始化所有存货管理档案对应的结存价+采购价 //初始化所有存货管理档案对应的结存价+采购价
List<Map> mapList = initAllBalancePricePurchasePrice(); // List<Map> mapList = initAllBalancePricePurchasePrice();
//查询平台运费存货基本档案 //查询平台运费存货基本档案
BdInvbasdocEntity bdInvbasdocEntity1 = queryStockBasicArchives(); BdInvbasdocEntity bdInvbasdocEntity1 = queryStockBasicArchives();
//查询平台运费对应的税率 //查询平台运费对应的税率
@ -1965,7 +1999,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//如果这个汇总集合已经全部推送成功那么就不需要推送红字销售订单把isOneSuccess标识修改为true即可 //如果这个汇总集合已经全部推送成功那么就不需要推送红字销售订单把isOneSuccess标识修改为true即可
if (!"Y".equals(newState2)) { if (!"Y".equals(newState2)) {
//合并成一行 //合并成一行
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行 SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose);//把汇总好的出库单明细行合并成一行
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案 BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案 BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案
BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率 BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率
@ -2186,7 +2220,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
logger.info("开始第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票"); logger.info("开始第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票");
try { try {
//合并成一行 //合并成一行
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行 SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose);//把汇总好的出库单明细行合并成一行
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案 BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案 BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案
BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率 BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率
@ -3518,4 +3552,38 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal.stripTrailingZeros().toPlainString());//商家 sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal.stripTrailingZeros().toPlainString());//商家
} }
} }
/**
* 获取参考售价
*
* @param bdInvmandocEntity 存货管理档案
* @param bdInvbasdocEntity 存货基本档案
* @param calculationFormulaStr 计算公式
* @param sonDetailsDto O销售出库单明细行
* @param header O销售出库单表头
* @author liuyang
*/
private String getRefsaleprice(BdInvmandocEntity bdInvmandocEntity, BdInvbasdocEntity bdInvbasdocEntity, StringBuffer calculationFormulaStr, SonDetailsDto sonDetailsDto, HeaderDto header) throws Exception {
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空!");
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空!");
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空");
Assert.notNull(sonDetailsDto, "sonDetailsDto不能为空");
Assert.notNull(header, "header不能为空");
//U参考售价
String refsaleprice = bdInvmandocEntity.getRefsaleprice();
Assert.notNull(refsaleprice, "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
Assert.state(!"".equals(refsaleprice.trim()), "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
//O实发数量
String shipQty = sonDetailsDto.getShipQty();
Assert.notNull(shipQty, "O实发数量不能为空 O销售出库单编码{} O明细行主键{}", header.getCode(), sonDetailsDto.getId());
Assert.state(!"".equals(shipQty.trim()), "O实发数量不能为空 O销售出库单编码{} O明细行主键{}", header.getCode(), sonDetailsDto.getId());
BigDecimal amountOfMoney = new BigDecimal(refsaleprice).multiply(new BigDecimal(shipQty));
String format = StrUtil.format("取U参考售价{}*{}", refsaleprice, shipQty);
calculationFormulaStr.append(format);
return amountOfMoney.stripTrailingZeros().toPlainString();
}
} }

View File

@ -617,7 +617,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
// 查询销售收发类别 // 查询销售收发类别
// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); // BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202");
//初始化所有存货管理档案对应的结存价+采购价 //初始化所有存货管理档案对应的结存价+采购价
List<Map> mapList = initAllBalancePricePurchasePrice(); // List<Map> mapList = initAllBalancePricePurchasePrice();
if (bdBusitypeEntity != null && summaryDimensionMap != null) { if (bdBusitypeEntity != null && summaryDimensionMap != null) {
Iterator<Map.Entry<String, List<GoodsRertunSonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator(); Iterator<Map.Entry<String, List<GoodsRertunSonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator();
@ -692,7 +692,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode()); Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
//把汇总好的出库单明细行合并成一行 //把汇总好的出库单明细行合并成一行
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList); GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity(); BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
//存货基础档案 //存货基础档案
@ -830,7 +830,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
// 查询U8C业务流程 // 查询U8C业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV2(); BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV2();
//初始化所有存货管理档案对应的结存价+采购价 //初始化所有存货管理档案对应的结存价+采购价
List<Map> mapList = initAllBalancePricePurchasePrice(); // List<Map> mapList = initAllBalancePricePurchasePrice();
if (bdBusitypeEntity != null && summaryDimensionMap != null) { if (bdBusitypeEntity != null && summaryDimensionMap != null) {
Iterator<Map.Entry<String, List<GoodsRertunSonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator(); Iterator<Map.Entry<String, List<GoodsRertunSonDetailsDto>>> iterator = summaryDimensionMap.entrySet().iterator();
@ -904,7 +904,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//验证是否为指定的店铺如果为true则取结存价 //验证是否为指定的店铺如果为true则取结存价
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode()); Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
//把汇总好的出库单明细行合并成一行 //把汇总好的出库单明细行合并成一行
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList); GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose);
//存货管理档案取发货公司的存货管理档案 //存货管理档案取发货公司的存货管理档案
BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity(); BdInvmandocEntity bdInvmandocEntity = oldValue.get(0).getBdInvmandocEntity();
@ -1489,10 +1489,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @param sonDetailsDtoList 汇总过后的售后入库单明细 * @param sonDetailsDtoList 汇总过后的售后入库单明细
* @author liuyang * @author liuyang
*/ */
private GoodsRertunSonDetailsDto groupMergeDetailedRows(List<GoodsRertunSonDetailsDto> sonDetailsDtoList, Boolean isCheckShopChoose, List<Map> mapList) throws Exception { private GoodsRertunSonDetailsDto groupMergeDetailedRows(List<GoodsRertunSonDetailsDto> sonDetailsDtoList, Boolean isCheckShopChoose) throws Exception {
Assert.notNull(sonDetailsDtoList, "sonDetailsDtoList不能为空"); Assert.notNull(sonDetailsDtoList, "sonDetailsDtoList不能为空");
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空"); Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
Assert.notNull(mapList, "mapLists不能为空"); // Assert.notNull(mapList, "mapLists不能为空");
if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) {
BigDecimal groupTotalPayAmount = new BigDecimal("0"); BigDecimal groupTotalPayAmount = new BigDecimal("0");
@ -1506,23 +1506,34 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader();//OFS售后订单表头对象 RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader();//OFS售后订单表头对象
List<RerturnGoodsOrderSearchDetails> details = rerturnGoodsOrderSearchData.getDetails();//OFS售后订单表体对象 List<RerturnGoodsOrderSearchDetails> details = rerturnGoodsOrderSearchData.getDetails();//OFS售后订单表体对象
//存货管理档案 // BdInvmandocEntity bdInvmandocEntity1 = goodsRertunSonDetailsDto.getBdInvmandocEntity();//存货管理档案
BdInvmandocEntity bdInvmandocEntity = goodsRertunSonDetailsDto.getBdInvmandocEntity(); BdInvbasdocEntity bdInvbasdocEntity = goodsRertunSonDetailsDto.getBdInvbasdocEntity();//存货基本档案
BdInvmandocEntity bdInvmandocEntity = goodsRertunSonDetailsDto.getBdInvmandocEntity();//存货管理档案
//根据OFS售后入库单明细行查找匹配OFS售后订单明细行 //根据OFS售后入库单明细行查找匹配OFS售后订单明细行
RerturnGoodsOrderSearchDetails ofsOrderDetail = findOfsOrderDetail(details, goodsRertunSonDetailsDto); RerturnGoodsOrderSearchDetails ofsOrderDetail = findOfsOrderDetail(details, goodsRertunSonDetailsDto);
//取对应的售后订单明细主要是取这个价格 String totalAmount = null;
StringBuffer calculationFormulaStr = new StringBuffer(); StringBuffer calculationFormulaStr = new StringBuffer();
String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList, calculationFormulaStr); if (isCheckShopChoose) {
if (totalAmount == null) { //U8C存货基本档案-参考售价
calculationFormulaStr.append("取O实退金额"); totalAmount = getRefsaleprice(bdInvmandocEntity, bdInvbasdocEntity, calculationFormulaStr, goodsRertunSonDetailsDto, header);
//取O实退金额 } else {
// RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData); //O实退
// totalAmount = afterSalesOrder.getTotalAmount();
//测试
// goodsRertunSonDetailsDto.setReceivedQty("1");
totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData, calculationFormulaStr); totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData, calculationFormulaStr);
} }
//取对应的售后订单明细主要是取这个价格
// String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList, calculationFormulaStr);
// if (totalAmount == null) {
// calculationFormulaStr.append("取O实退金额");
// //取O实退金额
//// RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
//// totalAmount = afterSalesOrder.getTotalAmount();
// //测试
//// goodsRertunSonDetailsDto.setReceivedQty("1");
// totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData, calculationFormulaStr);
// }
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId()); Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId()); Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
@ -2770,11 +2781,42 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} }
} }
} }
sonDetailsDtoList.get(0).setVdef4(platformDiscountsBigDecimal);//平台 sonDetailsDtoList.get(0).setVdef4(platformDiscountsBigDecimal);//平台
sonDetailsDtoList.get(0).setVdef5(payDiscountsBigDecimal);//支付 sonDetailsDtoList.get(0).setVdef5(payDiscountsBigDecimal);//支付
sonDetailsDtoList.get(0).setVdef6(expertDiscountsBigDecimal);//达人 sonDetailsDtoList.get(0).setVdef6(expertDiscountsBigDecimal);//达人
sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal);//商家 sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal);//商家
} }
} }
/**
* 获取参考售价
*
* @param bdInvmandocEntity 存货管理档案
* @param bdInvbasdocEntity 存货基本档案
* @param calculationFormulaStr 计算公式
* @param goodsRertunSonDetailsDto O售后入库单明细行
* @param header O售后入库单表头
* @author liuyang
*/
private String getRefsaleprice(BdInvmandocEntity bdInvmandocEntity, BdInvbasdocEntity bdInvbasdocEntity, StringBuffer calculationFormulaStr, GoodsRertunSonDetailsDto goodsRertunSonDetailsDto, StockinOrderSearchResponse.StockinOrder.StockinH header) throws Exception {
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空!");
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空!");
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空");
Assert.notNull(goodsRertunSonDetailsDto, "goodsRertunSonDetailsDto不能为空");
Assert.notNull(header, "header不能为空");
//U参考售价
String refsaleprice = bdInvmandocEntity.getRefsaleprice();
Assert.notNull(refsaleprice, "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
//O实收数量
String receivedQty = goodsRertunSonDetailsDto.getReceivedQty();
Assert.notNull(receivedQty, "O实收数量不能为空 O售后入库单编码{} O明细行主键{}", header.getCode(), goodsRertunSonDetailsDto.getId());
Assert.state(!"".equals(receivedQty), "O实收数量不能为空 O售后入库单编码{} O明细行主键{}", header.getCode(), goodsRertunSonDetailsDto.getId());
BigDecimal amountOfMoney = new BigDecimal(refsaleprice).multiply(new BigDecimal(receivedQty));
String format = StrUtil.format("取U参考售价{}*{}", refsaleprice, receivedQty);
calculationFormulaStr.append(format);
return amountOfMoney.stripTrailingZeros().toPlainString();
}
} }

View File

@ -110,7 +110,7 @@ class SoSaleOutPluginInitializerToCTest {
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
// String aaa = "LETS-SH2024102800021196"; // String aaa = "LETS-SH2024102800021196";
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-23 11:24:33", "2024-11-23 11:24:33"); // 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) { } catch (Exception e) {
@ -120,7 +120,7 @@ class SoSaleOutPluginInitializerToCTest {
// soSaleOutPluginInitializerToC.sendU8CTOCOrder("123446"); // soSaleOutPluginInitializerToC.sendU8CTOCOrder("123446");
try { try {
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024103100030329", "stock"); soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110100000024", "stock");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");