fix(sales): 修复部门匹配逻辑

- 在 PassiveWarehouseReceiptToC、SoSaleOutPluginInitializerToC 和 SoSaleReturnPluginInitializerToC 中
  修改了部门匹配逻辑,增加了公司主键作为后缀
- 更新了相关缓存工具类中的部门编码处理方式- 优化了错误信息提示内容
This commit is contained in:
liuy 2025-05-28 18:07:17 +08:00
parent aae67832b7
commit 12a1acb3f5
11 changed files with 25 additions and 12 deletions

View File

@ -66,4 +66,8 @@ public class QueryOfsSoSaleOutVo {
private String relatedAt_end; private String relatedAt_end;
//无源入库单号 //无源入库单号
private String receiptCode; private String receiptCode;
//更新开始时间
private String lastUpdated_start;
//更新结束时间
private String lastUpdated_end;
} }

View File

@ -1399,7 +1399,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
} else { } else {
logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType()); logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType());
String deptCode = header1.getDepartmentType().trim(); String deptCode = header1.getDepartmentType().trim();
bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode); bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode + bdCorpEntity.getPkCorp());
} }
//客商基本档案 //客商基本档案
@ -1654,7 +1654,8 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
} else { } else {
logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType()); logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType());
String deptCode = header1.getDepartmentType().trim(); String deptCode = header1.getDepartmentType().trim();
bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode); bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode + bdCorpEntity.getPkCorp());
Assert.notNull(bdDeptdocEntity, "无法匹配到指定部门 部门编码:{} 对应公司主键:{}", deptCode, bdCorpEntity.getPkCorp());
} }
//客商基本档案 //客商基本档案

View File

@ -1574,8 +1574,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//使用O选定的部门字段logger太影响性能 //使用O选定的部门字段logger太影响性能
// logger.info("OFS销售订单号{} 存在部门字段:{}", header2.getCode(), header2.getDepartmentType()); // logger.info("OFS销售订单号{} 存在部门字段:{}", header2.getCode(), header2.getDepartmentType());
String deptCode = header2.getDepartmentType().trim(); String deptCode = header2.getDepartmentType().trim();
bdDeptdocEntity = cacheTocMapVo.getStringBdDeptdocEntityMapByDeptCode().get(deptCode); bdDeptdocEntity = cacheTocMapVo.getStringBdDeptdocEntityMapByDeptCode().get(deptCode + bdCorpEntity.getPkCorp());
Assert.notNull(bdDeptdocEntity, "无法匹配到U8C部门档案 OFS销售订单-部门编码:{}", deptCode); Assert.notNull(bdDeptdocEntity, "无法匹配到U8C部门档案 OFS销售订单-部门编码:{}", deptCode + "_" + bdCorpEntity.getPkCorp());
} }
//存货基本档案 //存货基本档案

View File

@ -1544,7 +1544,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} else { } else {
logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType()); logger.info("OFS销售订单号{} 存在部门字段:{}", header1.getCode(), header1.getDepartmentType());
String deptCode = header1.getDepartmentType().trim(); String deptCode = header1.getDepartmentType().trim();
bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode); bdDeptdocEntity = cacheTocMapVoV2.getStringBdDeptdocEntityMapByDeptCode().get(deptCode + bdCorpEntity.getPkCorp());
Assert.notNull(bdDeptdocEntity, "无法匹配到指定部门 部门编码:{} 对应公司主键:{}", deptCode, bdCorpEntity.getPkCorp());
} }
//客商基本档案 //客商基本档案

View File

@ -178,7 +178,7 @@ public class PassiveComponentsArchivesCacheUtil {
if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) { if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) {
for (int i = 0; i < bdDeptdocEntityList2.size(); i++) { for (int i = 0; i < bdDeptdocEntityList2.size(); i++) {
BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i); BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i);
stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode(), bdDeptdocEntity1); stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode() + bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1);
} }
} }
return bddeptdocEntityList; return bddeptdocEntityList;

View File

@ -180,7 +180,7 @@ public class PassiveComponentsArchivesCacheUtilV2 {
if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) { if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) {
for (int i = 0; i < bdDeptdocEntityList2.size(); i++) { for (int i = 0; i < bdDeptdocEntityList2.size(); i++) {
BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i); BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i);
stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode(), bdDeptdocEntity1); stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode() + bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1);
} }
} }
return bddeptdocEntityList; return bddeptdocEntityList;

View File

@ -179,6 +179,7 @@ public class TocOrderBasicArchivesCacheUtil {
} }
} }
//部门编码+主键
BdDeptdocEntity bdDeptdocEntity2 = new BdDeptdocEntity(); BdDeptdocEntity bdDeptdocEntity2 = new BdDeptdocEntity();
bdDeptdocEntity2.setDataSourceCode("lets_u8c"); bdDeptdocEntity2.setDataSourceCode("lets_u8c");
bdDeptdocEntity2.setDr(0); bdDeptdocEntity2.setDr(0);
@ -186,7 +187,7 @@ public class TocOrderBasicArchivesCacheUtil {
if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) { if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) {
for (int i = 0; i < bdDeptdocEntityList2.size(); i++) { for (int i = 0; i < bdDeptdocEntityList2.size(); i++) {
BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i); BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i);
stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode(), bdDeptdocEntity1); stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode() + bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1);
} }
} }
return bddeptdocEntityList; return bddeptdocEntityList;

View File

@ -179,7 +179,7 @@ public class TocReturnBasicArchivesCacheUtil {
if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) { if (bdDeptdocEntityList2 != null && bdDeptdocEntityList2.size() > 0) {
for (int i = 0; i < bdDeptdocEntityList2.size(); i++) { for (int i = 0; i < bdDeptdocEntityList2.size(); i++) {
BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i); BdDeptdocEntity bdDeptdocEntity1 = bdDeptdocEntityList2.get(i);
stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode(), bdDeptdocEntity1); stringBdDeptdocEntityMap2.put(bdDeptdocEntity1.getDeptcode() + bdDeptdocEntity1.getPkCorp(), bdDeptdocEntity1);
} }
} }
return bddeptdocEntityList; return bddeptdocEntityList;

View File

@ -27,8 +27,10 @@ public class ProxyPurchaseWarehousOrderTest {
@Test @Test
public void startImplementByCode() { public void startImplementByCode() {
try { try {
proxyPurchaseWarehousOrder.startImplementByCode("LETS-RE2025040300001802-confirm"); // proxyPurchaseWarehousOrder.startImplementByCode("LETS-RE2025040300001802-confirm");
// proxyPurchaseWarehousOrder.startImplementByTime("2025-01-21 17:38:26", "2025-01-21 17:38:26"); // proxyPurchaseWarehousOrder.startImplementByTime("2025-01-21 17:38:26", "2025-01-21 17:38:26");
// proxyPurchaseWarehousOrder.startImplementByCode("");
proxyPurchaseWarehousOrder.startImplementByTime("2025-05-13 19:22:04", "2025-05-13 19:22:04");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -72,6 +72,10 @@ class SoSaleOutPluginInitializerToCTest {
// errorHeaderDetailsDtoDto.setHeader(header); // errorHeaderDetailsDtoDto.setHeader(header);
// errorHeaderDetailsDtoDto.setDetails(details); // errorHeaderDetailsDtoDto.setDetails(details);
// errorHeaderDetailsDtoDto. // errorHeaderDetailsDtoDto.
String aaa = "LETS-SH2025032600025120";
soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -99,7 +103,7 @@ class SoSaleOutPluginInitializerToCTest {
// String s = "LETS-SH2025032200027982"; // String s = "LETS-SH2025032200027982";
// soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock"); // soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock");
soSaleOutPluginInitializerToC.startImplementTranByTime("2025-05-08 00:00:00", "2025-05-08 23:59:59", "2"); // soSaleOutPluginInitializerToC.startImplementTranByTime("2025-05-08 00:00:00", "2025-05-08 23:59:59", "2");
// List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>(); // List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();

View File

@ -65,7 +65,7 @@ public class SoSaleReturnPluginInitializerToCTest {
// soSaleReturnPluginInitializerToC.startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); // soSaleReturnPluginInitializerToC.startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
try { try {
soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "2"); // soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "2");
// soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025010900002384", "tran"); // soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025010900002384", "tran");