refactor(sales): 优化销售出库单生成逻辑

-调整了单据合并和档案查询的执行顺序,提高处理效率
- 禁用了 MyBatis 缓存,避免数据不一致问题
- 更新了应用配置,激活 lets 环境
- 移除了测试代码中的硬编码部分,提高了代码可读性
This commit is contained in:
liuy 2024-11-02 09:46:49 +08:00
parent 064e28a456
commit 74b9e1314b
5 changed files with 19 additions and 12 deletions

View File

@ -1890,17 +1890,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案
String newState2 = oldValue.get(0).getNewState2();//交易成功- 是否成功
String newState3 = oldValue.get(0).getNewState3();//交易成功- 是否成功
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
//验证是否为指定的店铺如果为true则取结存价
Boolean isCheckShopChoose = balanceUnitPriceUtil.checkOfsShop(header.getStoreCode());
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行
// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp());
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案
// BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案
// BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode());
BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率
BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别
/**
* 先要确保红字销售订单生成后再生成蓝字销售订单,否则很有可能出现库存不足的问题所以才共用了同一个summaryDimensionMap
* 这样导致的问题是不好独立判断newState2newState3的状态独立判断这个状态有利于防止单据重新推送
@ -1910,6 +1902,12 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
try {
//如果这个汇总集合已经全部推送成功那么就不需要推送红字销售订单把isOneSuccess标识修改为true即可
if (!"Y".equals(newState2)) {
//合并成一行
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案
BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率
//验证数据完整性
// checkArchives(oldValue.get(0));
// checkAllFail(oldValue, newState2, "1");
@ -2125,6 +2123,12 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//2024年9月4日 14:30:31 第一阶段推送成功才能执行第二阶段否则不能执行以下代码
logger.info("开始第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票");
try {
//合并成一行
SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue, isCheckShopChoose, mapList);//把汇总好的出库单明细行合并成一行
BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案取发货公司的存货管理档案
BdInvbasdocEntity bdInvbasdocEntity = sonDetailsDto.getBdInvbasdocEntity();//存货基础档案
BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码查询当前存货的税率
//验证数据完整性
// checkAllFail(oldValue, newState3, "2");
//取交易成功时间生成业务日期

View File

@ -36,7 +36,7 @@ spring:
# use-suffix-pattern: true
profiles:
# active: @profileActive@
active: letsprod
active: lets
# active: @profile.active@
# active: dev
servlet:

View File

@ -4,7 +4,7 @@
<configuration>
<settings>
<setting name="cacheEnabled" value="true" />
<setting name="cacheEnabled" value="false" />
<setting name="lazyLoadingEnabled" value="true" />
<!--<setting name="aggressiveLazyLoading" value="false" />-->
<setting name="multipleResultSetsEnabled" value="true" />

View File

@ -86,7 +86,9 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByCode(aaa, "stock");
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-28 00:00:00", "2024-10-28 23:59:59");
soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024103000021968","stock");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -121,6 +121,7 @@ class SoSaleOutPluginInitializerToCTest {
try {
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024091900002878", "stock");
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024102900028994", "tran");
} catch (Exception e) {
e.printStackTrace();
}