refactor(buildpackage): 优化公司代码转换逻辑和模糊查询

- 在 OverallConstant 中添加了 "u8c自定义项档案-公司对照" 配置项
- 修改了 BdCubasdocEntity 中的 def1 字段查询方式,改为模糊查询
- 更新了 ConsignmachiningIn 中的公司代码转换逻辑
- 优化了 QueryU8CEntityUtil 中的 queryBdDefDocByPkDefDocList 方法
This commit is contained in:
liuy 2024-10-29 10:45:29 +08:00
parent fd8d287b95
commit e29b0647f9
5 changed files with 24 additions and 11 deletions

View File

@ -93,6 +93,7 @@ public class OverallConstant {
devOverAll.put("u8cApiNeedStackTraceCode", "Y");
devOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境tbadmin
devOverAll.put("u8c自定义项档案-公司对照", "0001A11000000004XB42");
devOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
devOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
devOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");
@ -126,6 +127,7 @@ public class OverallConstant {
prodOverAll.put("u8cApiNeedStackTraceCode", "N");
prodOverAll.put("u8cApiZdrCode", "tbadmin");//单据制单人---测试环境tbadmin
prodOverAll.put("u8c自定义项档案-公司对照", "0001A11000000004XB42");
prodOverAll.put("u8c自定义项档案-店铺主键", "0001A110000000000EBX");
prodOverAll.put("u8c自定义项档案-平台主键", "0001A110000000000EEU");
prodOverAll.put("u8c自定义项档案-存货分类对应收支项目主键", "0001A210000000008FBN");

View File

@ -169,7 +169,7 @@
<if test="custname != null and custname != ''"> and custname = #{custname} </if>
<if test="custprop != null"> and custprop = #{custprop} </if>
<if test="custshortname != null and custshortname != ''"> and custshortname = #{custshortname} </if>
<if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
<if test="def1 != null and def1 != ''"> and def1 like concat('%',#{def1},'%') </if>
<if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
<if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
<if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>

View File

@ -106,6 +106,9 @@ public class ConsignmachiningIn extends PluginBaseEntity {
private static final String PROD_FILED = "prod";
@Autowired
private QueryU8CEntityUtil queryU8CEntityUtil;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
@ -566,10 +569,12 @@ public class ConsignmachiningIn extends PluginBaseEntity {
//委外订单表头公司
String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O表头公司不能为空(物理货主)");
String replaceCompanyCode = queryU8CEntityUtil.queryBdDefDocByPkDefDocList(companyCode.trim());
BdCorpEntity bdCorpEntity = new BdCorpEntity();
bdCorpEntity.setDr(0);
bdCorpEntity.setDataSourceCode("lets_u8c");
bdCorpEntity.setUnitcode(companyCode);
bdCorpEntity.setUnitcode(replaceCompanyCode);
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
if (bdCorpEntityList.size() == 0) {
Assert.state(false, "根据O货主编码{}无法匹配到U8C委外订单公司", companyCode);
@ -633,7 +638,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
// Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size());
// }
// 库存组织
//库存组织
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
bdCalbodyEntity.setDr(0);
bdCalbodyEntity.setDataSourceCode("lets_u8c");

View File

@ -292,24 +292,28 @@ public class QueryU8CEntityUtil {
* YD 杭州盈达电子商务有限公司
* 都传到 YD,杭州盈达电子商务有限公司
* SELECT * FROM BD_DEFDOC WHERE pk_defdoclist=(SELECT pk_defdoclist FROM BD_DEFDOCLIST WHERE doclistcode='GSDY')-- 0001A11000000004XB42
*
* @param corpCode 公司编码
* @return corpCode 如果时需要转换的会自动转换如果不需要返回原始公司编码
*/
public String queryBdDefDocByPkDefDocList(String corpCode){
Assert.notNull(corpCode,"公司三对一,入参公司不能为空!!!");
public String queryBdDefDocByPkDefDocList(String corpCode) {
Assert.notNull(corpCode, "公司三对一,入参公司不能为空!!!");
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist("0001A11000000004XB42");
bdDefdocEntity.setPkDefdoclist(OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
if (bdDefdocEntityList.size() == 0) {
Assert.state(false,"根据自定义档案列表编码GSDY主键[0001A11000000004XB42],未查询到自定义档案");
Assert.state(false, "根据自定义档案列表编码GSDY主键[{}],未查询到自定义档案", OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
}
List<String> corpCollect = bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.toList());
if(corpCollect.contains(corpCode)){
if (corpCollect.contains(corpCode)) {
String memo = bdDefdocEntityList.get(0).getMemo();
String[] split = memo.split(",");
corpCode=split[0];
if (split.length > 0) {
corpCode = split[0];
}
}
return corpCode;
}

View File

@ -109,8 +109,10 @@ class SoSaleOutPluginInitializerToCTest {
// String aaa = "LETS-SH2024101900022025";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
String aaa = "LETS-SH2024101800007483";
soSaleOutPluginInitializerToC.startImplementStockByCode(aaa,"stock");
// String aaa = "LETS-SH2024102200217857";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-10-26 18:20:09","2024-10-26 18:20:09");
} catch (Exception e) {
e.printStackTrace();
}