fix(outsourc): 修复红字委外入库单生成逻辑

- 更新 SQL 查询语句,使用 CONCAT 替代 concat 函数
- 添加公司代码替换逻辑,确保正确匹配公司档案
- 修改插件名称和标签,使其更加准确
- 更新测试用例,使用新的订单编号
This commit is contained in:
liuy 2024-10-29 14:30:31 +08:00
parent bcd96ec28c
commit 7e89ad620d
5 changed files with 38 additions and 19 deletions

View File

@ -83,7 +83,7 @@ public class BdCubasdocEntity extends BaseEntity {
private String ts;
private String url;
private String zipcode;
// private String def1like;
/**
* 客商管理档案主键

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 like concat('%',#{def1},'%') </if>
<if test="def1 != null and def1 != ''"> and def1 LIKE CONCAT(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

@ -61,6 +61,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
@Autowired
private IBdInvmandocDao iBdInvmandocDao;
@Autowired
private QueryU8CEntityUtil queryU8CEntityUtil;
@Autowired
private IBdCalbodyDao iBdCalbodyDao;
@ -125,12 +128,12 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
@Override
public String getPluginName() {
return "OFS采退出库单生成U8C红字委外单(关联原委外订单)";
return "OFS采退出库单生成U8C红字委外入库单(关联原委外订单)";
}
@Override
public String getPluginLabel() {
return "OFS采退出库单生成U8C红字委外单(关联原委外订单)";
return "OFS采退出库单生成U8C红字委外入库单(关联原委外订单)";
}
@Override
@ -568,11 +571,27 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
bdCorpEntity.setDr(0);
bdCorpEntity.setDataSourceCode("lets_u8c");
bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp());
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
List<BdCorpEntity> oldBdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
if (oldBdCorpEntityList.size() == 0) {
Assert.state(false, "(原始公司没有替换之前)根据委外订单公司主键:{},无法匹配到对应的公司", scOrderEntity.getPkCorp());
} else if (oldBdCorpEntityList.size() >= 2) {
Assert.state(false, "(原始公司没有替换之前)根据委外订单公司主键:{},匹配到{}个公司档案", scOrderEntity.getPkCorp(), oldBdCorpEntityList.size());
}
//得到原始的公司编码
BdCorpEntity bdCorpEntity1 = oldBdCorpEntityList.get(0);
String unitcode = bdCorpEntity1.getUnitcode();
String replaceCompanyCode = queryU8CEntityUtil.queryBdDefDocByPkDefDocList(unitcode.trim());
Assert.notNull(replaceCompanyCode, "replaceCompanyCode不能为空");
BdCorpEntity bdCorpEntity2 = new BdCorpEntity();
bdCorpEntity2.setDr(0);
bdCorpEntity2.setDataSourceCode("lets_u8c");
bdCorpEntity2.setUnitcode(replaceCompanyCode);
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity2);
if (bdCorpEntityList.size() == 0) {
Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp());
Assert.state(false, "(原始公司替换之后)根据委外订单公司主键:{},无法匹配到对应的公司", scOrderEntity.getPkCorp());
} else if (bdCorpEntityList.size() >= 2) {
Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size());
Assert.state(false, "(原始公司替换之后)根据委外订单公司主键:{},匹配到{}个公司档案", scOrderEntity.getPkCorp(), bdCorpEntityList.size());
}
// 2024年8月27日 17:15:09 收货库存组织应该是通过收货公司查询得出收货库存组织目前收货公司和采购公司保持一致那么就以采购公司带出这个逻辑已经和佳妮确认

View File

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

View File

@ -21,17 +21,17 @@ import static org.junit.Assert.*;
@SpringBootTest(classes = WebappApplication.class)
public class ConsignmachiningInReturnTest {
// @Autowired
// private ConsignmachiningInReturn consignmachiningInReturn;
@Autowired
private ConsignmachiningInReturn consignmachiningInReturn;
// @Test
// public void startImplement() {
// try {
// consignmachiningInReturn.startImplement("LETS-SH2024082700000006");
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
@Test
public void startImplement() {
try {
consignmachiningInReturn.startImplement("LETS-SH2024082300017733");
} catch (Exception e) {
e.printStackTrace();
}
}
// @Test
// public void testStartImplement() {