refactor(sales): 优化 TOC 出库日志输出并调整销售订单优惠金额计算逻辑- 修改日志输出格式,增加 TOC 出库前缀- 注释测试代码段

- 优化销售订单优惠金额计算,使用负值处理
-调整测试方法中的参数
This commit is contained in:
liuy 2024-12-04 14:57:50 +08:00
parent 7b238a8d75
commit a93f4bd41c
3 changed files with 26 additions and 22 deletions

View File

@ -1160,7 +1160,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
pk_corp = soSaleResultRootDto.getParentvo().getPk_corp();
csaleid = soSaleResultRootDto.getParentvo().getCsaleid();
}
logger.info("销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
logger.info("TOC出库-销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
//记录成功
//日志推送的详情两种方法是推送U8C成功之后记录还是整理推送完毕后再记录
//护童项目之前是整体推送之前记录后来抛出链接失效的异常而且只有程序执行完毕后才能体现结果执行过程中无法发现结果
@ -1272,19 +1272,19 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//查询对应的OFS销售订单
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> 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<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> 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");
}
}
//测试
// for (int i = 0; i < headerDetailsDtos.size(); i++) {
// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(i);
// List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto> 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);
@ -2264,7 +2264,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//补充平台运费-存货
//accumulatedPostage应该是负数
BigDecimal absAccumulatedPostage = accumulatedPostage.abs();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absAccumulatedPostage, "-1", bdTaxitemsEntity);
BigDecimal negativeValue = absAccumulatedPostage.negate();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
}
//平台优惠
if (sonDetailsDto.getVdef4() != null && !"".equals(sonDetailsDto.getVdef4())) {
@ -2278,7 +2279,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01");
//补充平台优惠-存货
BigDecimal absBigDecimalVdef4 = bigDecimalVdef4.abs();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef4, "-1", bdTaxitemsEntity);
BigDecimal negativeValue = absBigDecimalVdef4.negate();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
}
}
//达人优惠
@ -2293,7 +2295,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02");
//补充达人优惠-存货
BigDecimal absBigDecimalVdef6 = bigDecimalVdef6.abs();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef6, "-1", bdTaxitemsEntity);
BigDecimal negativeValue = absBigDecimalVdef6.negate();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
}
}
//支付优惠
@ -2308,7 +2311,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04");
//补充支付优惠-存货
BigDecimal absBigDecimalVdef5 = bigDecimalVdef5.abs();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef5, "-1", bdTaxitemsEntity);
BigDecimal negativeValue = absBigDecimalVdef5.negate();
additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity);
}
}
@ -3861,7 +3865,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
saleorderRequestChildrenDto1.setVdef5("0");
saleorderRequestChildrenDto1.setVdef6("0");
saleorderRequestChildrenDto1.setVdef7("0");
//是否赠品
saleorderRequestChildrenDto1.setBlargessflag(false);

View File

@ -73,8 +73,8 @@ public class OfsOrderSalePostageFeeAllocationUtil {
//销售订单运费
String postageAmount = header.getPostageAmount();
// TODO 测试
postageAmount = "10";
//测试
// postageAmount = "10";
//运费可能没有也有可能为0
BigDecimal postageAmountDiscounts = null;

View File

@ -120,7 +120,7 @@ class SoSaleOutPluginInitializerToCTest {
// soSaleOutPluginInitializerToC.sendU8CTOCOrder("123446");
try {
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024120300016549", "stock");
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024120300016549", "tran");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");