feat:PLM匹配时,去掉空格再比较

This commit is contained in:
zzs 2025-01-13 11:34:10 +08:00
parent 9fe26f5974
commit 7504c5d218

View File

@ -42,7 +42,9 @@ public class MatchingPLMChangeUpdateTaskEdit extends AbstractTask {
List<MatchResult> matchList = new ArrayList<>();
StringBuilder bomBillno = new StringBuilder();
for (DynamicObject bomObj : boms) {
bomBillno.append(bomObj.getString("number")).append("\n");
DynamicObjectCollection bom_entry = bomObj.getDynamicObjectCollection("yem_entryentity");
for (DynamicObject bom : bom_entry) {
for (DynamicObject plmObj : plms) {
@ -123,14 +125,18 @@ public class MatchingPLMChangeUpdateTaskEdit extends AbstractTask {
// 后替代前通用不通用必须停用启用都匹配到才更新完成状态
if (YEM.isNotEmpty(info.getReplace()) && "A-B-C".contains(info.getReplace()) && result.getDisable() && result.getEnable()) {
plm.set("yem_invoktime", info.getComplateDate());
plm.set("yem_invokstatus", info.getStatus());
if (!"B".equals(plm.getString("yem_invokstatus"))) {
plm.set("yem_invoktime", info.getComplateDate());
plm.set("yem_invokstatus", info.getStatus());
}
}
// 启用或停用的停用的匹配到一个就更新完成状态
if (YEM.isNotEmpty(info.getReplace()) && "D-E".contains(info.getReplace()) && result.isMatched()) {
plm.set("yem_invoktime", info.getComplateDate());
plm.set("yem_invokstatus", info.getStatus());
if (!"B".equals(plm.getString("yem_invokstatus"))) {
plm.set("yem_invoktime", info.getComplateDate());
plm.set("yem_invokstatus", info.getStatus());
}
}
}
}
@ -173,7 +179,7 @@ public class MatchingPLMChangeUpdateTaskEdit extends AbstractTask {
result.setDisable(true);
}
// logger.info("启用_compare{} {}, {} {}, {} {}, {} {}, {}", plm_billno, bom_billno,plm_after_parent_now, bom_before_parent_no, plm_after_child_now, bom_before_child_no, plm_after_qty, bom_before_qty, bom_enablesta);
// logger.info("启用_compare{} {}, {} {}, {} {}, {}", plm_billno, bom_billno,plm_after_parent_now, bom_before_parent_no, plm_after_child_now, bom_before_child_no, bom_enablesta);
if (eq(plm_billno, bom_billno) && eq(plm_after_parent_now, bom_before_parent_no) && eq(plm_after_child_now, bom_before_child_no) && "A".equals(bom_enablesta)) {
logger.info("启用_PLM匹配到BOM{} {}, {} {}, {} {}", plm_billno, bom_billno, plm_after_parent_now, bom_before_parent_no, plm_after_child_now, bom_before_child_no);
result.setEnable(true);
@ -184,6 +190,12 @@ public class MatchingPLMChangeUpdateTaskEdit extends AbstractTask {
public static boolean eq(Object str1, Object str2) {
if (str1 instanceof String && str2 instanceof String) {
if (YEM.isNotEmpty(str1)) {
str1 = ((String) str1).trim();
}
if (YEM.isNotEmpty(str2)) {
str2 = ((String) str2).trim();
}
return str1.equals(str2);
}
if (str1 instanceof BigDecimal && str2 instanceof BigDecimal) {