展示组件

tags/yfai-pcn-ext-v1.0
微笑着面对明天 11 months ago
parent d6b9195768
commit eb317e9974

@ -11,7 +11,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* *
*/ */
@Slf4j @Slf4j
@Service @Service

@ -28,24 +28,24 @@ public class MesNumberRuleMatchDispatchService implements IMesNumberRuleMatchDis
List<Object> resultList = new ArrayList<>(); List<Object> resultList = new ArrayList<>();
if (numberRuleList.get(0) instanceof MesProdRuleNosortCfg) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, o, "mesNumberRuleMatchRegularExpressionService",o, ((MesProdRuleNosortCfg) o).getInPartNoRule())); if (numberRuleList.get(0) instanceof MesProdRuleNosortCfg) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, "mesNumberRuleMatchRegularExpressionService",o, ((MesProdRuleNosortCfg) o).getInPartNoRule()));
if (numberRuleList.get(0) instanceof MesProductionAssemblyNosortContext) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, o, MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfStrategyClass(((MesProductionAssemblyNosortContext) o).getMatchType()),o, ((MesProductionAssemblyNosortContext) o).getMatchRule())); if (numberRuleList.get(0) instanceof MesProductionAssemblyNosortContext) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfStrategyClass(((MesProductionAssemblyNosortContext) o).getMatchType()),o, ((MesProductionAssemblyNosortContext) o).getMatchRule()));
if (numberRuleList.get(0) instanceof MesProductionAssemblySortContext) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, o, "mesNumberRuleMatchRegularExpressionService",o, ((MesProductionAssemblySortContext) o).getMatchRule())); if (numberRuleList.get(0) instanceof MesProductionAssemblySortContext) numberRuleList.forEach(o -> matchNumberRule(organizeCode, sn, resultList, "mesNumberRuleMatchRegularExpressionService",o, ((MesProductionAssemblySortContext) o).getMatchRule()));
return resultList; return resultList;
} }
private void matchNumberRule(String organizeCode, String sn, List<Object> resultList, Object o, String strategyClass, Object... params) { private void matchNumberRule(String organizeCode, String sn, List<Object> resultList, String strategyClass, Object... params) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(sn) || StringUtils.isEmpty(strategyClass) || null == o) return; if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(sn) || StringUtils.isEmpty(strategyClass) || null == params[0]) return;
Boolean result = ((IMesNumberRuleMatchDispatchService) SpringContextsUtil.getBean(strategyClass)).matchNumberRule(organizeCode, sn, params); Boolean result = ((IMesNumberRuleMatchDispatchService) SpringContextsUtil.getBean(strategyClass)).matchNumberRule(organizeCode, sn, params);
if (result) resultList.add(o); if (result) resultList.add(params[0]);
} }
} }

@ -69,11 +69,11 @@ public class MesNumberRuleMatchSnService implements IMesNumberRuleMatchDispatchS
return false; return false;
} }
MesProductionAssemblyNosortContext context = (MesProductionAssemblyNosortContext) obj; MesProductionAssemblyNosortContext context = (MesProductionAssemblyNosortContext) obj;
context.setProductSnId(mesProduceSn.getId());
if (!Objects.equal(context.getAssemblyPartNo(), mesProduceSn.getPartNo())) { if (!Objects.equal(context.getAssemblyPartNo(), mesProduceSn.getPartNo())) {
return false; return false;
} }
// 需要校验时效性 // 需要校验时效性
return true; return true;
} }
} }

@ -17,6 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Date; import java.util.Date;
@ -84,26 +85,33 @@ public class WriteVariableService implements IWriteVariableService {
MesProductionPartContext mesProductionPartContext; MesProductionPartContext mesProductionPartContext = null;
MesProductionPsOutContext productionPsOutSn; MesProductionPsOutContext productionPsOutSn = null;
if (!Objects.isNull(foreignKey)) { if (!Objects.isNull(foreignKey)) {
mesProductionPartContext = productionPartContextList.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null); if (!CollectionUtils.isEmpty(productionPartContextList)) {
productionPsOutSn = productionPsOutContexts.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null); mesProductionPartContext = productionPartContextList.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null);
String newValue = ""; }
if (!CollectionUtils.isEmpty(productionPsOutContexts)) {
productionPsOutSn = productionPsOutContexts.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null);
}
String newValue = "";
if (StringUtils.isEmpty(value)) { if (StringUtils.isEmpty(value)) {
return null; return null;
} }
if (mesProductionPartContext == null) { if (mesProductionPartContext == null) {
mesProductionPartContext = new MesProductionPartContext(); mesProductionPartContext = new MesProductionPartContext();
} }
if (productionPsOutSn == null) {
productionPsOutSn = new MesProductionPsOutContext();
}
switch (value.toUpperCase()) { switch (value.toUpperCase()) {
case "%RESULT%" : newValue = mesProductionPartContext.getPartNo(); break; case "%RESULT%" : newValue = mesProductionPartContext.getPartNo(); break;
case "%PARAM%": newValue = mesProductionPartContext.getWorkOrderNo(); break; case "%PARAM%": newValue = mesProductionPartContext.getWorkOrderNo(); break;
case "%ORDERCODE%": newValue = mesProductionPartContext.getWorkOrderNo(); break; case "%ORDERCODE%": newValue = mesProductionPartContext.getWorkOrderNo(); break;
case "%CUSTPARTNO%": newValue = mesProductionPartContext.getCustPartNo(); break; case "%CUSTPARTNO%": newValue = mesProductionPartContext.getCustPartNo(); break;
case "%EMPLOYEENO%": newValue = reqBean.getUserInfo(); break;///当前操作员工号 用户名 case "%EMPLOYEENO%": newValue = reqBean.getUserInfo(); break;///当前操作员工号 用户名
case "%BARCODE%": newValue = productionPsOutContexts.get(0).getProductSn(); break;// 条码 case "%BARCODE%": newValue = productionPsOutSn.getProductSn(); break;// 条码
case "%BARCODE2%": newValue = productionPsOutContexts.get(1).getProductSn(); break;///条码 case "%BARCODE2%": newValue = productionPsOutContexts.get(1).getProductSn(); break;///条码
case "%BARCODE3%": newValue = productionPsOutContexts.get(2).getProductSn(); break;///条码 case "%BARCODE3%": newValue = productionPsOutContexts.get(2).getProductSn(); break;///条码
case "%BARCODE4%": newValue = productionPsOutContexts.get(3).getProductSn(); break;///条码 case "%BARCODE4%": newValue = productionPsOutContexts.get(3).getProductSn(); break;///条码
@ -131,7 +139,7 @@ public class WriteVariableService implements IWriteVariableService {
case "%PARTNO%": newValue = mesProductionPartContext.getPartNo(); break;///工单对应的零件号 case "%PARTNO%": newValue = mesProductionPartContext.getPartNo(); break;///工单对应的零件号
//case "%VINCODE%": newValue = mesProductionPartContext.getv(); break;///工单对应的vincode //case "%VINCODE%": newValue = mesProductionPartContext.getv(); break;///工单对应的vincode
case "%SEQUENCE%": newValue = reqBean.getUserInfo(); break;///工单顺序号 不是生产顺序号 case "%SEQUENCE%": newValue = reqBean.getUserInfo(); break;///工单顺序号 不是生产顺序号
case "%CUSTBARCODE%": newValue = productionPsOutContexts.get(0).getCustSn(); break;///客户条码 case "%CUSTBARCODE%": newValue = productionPsOutSn.getCustSn(); break;///客户条码
case "%GETDATE%": newValue = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); break;///客户条码 case "%GETDATE%": newValue = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); break;///客户条码
default: default:

Loading…
Cancel
Save