diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java index a266615..723f18c 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java @@ -22,10 +22,10 @@ public interface IMesAssemblyExtService { List getProductionAssemblyList(String organizeCode, Integer dataSource, List sourceIdList); @ApiOperation(value = "获取非排序装配件配置信息") - List getProductionAssemblyNosortContextList(String organizeCode, Long... pids); + List getProductionAssemblyNosortContextList(MesProdRuleContext prodRuleContext); @ApiOperation(value = "获取非排序装配件配置信息") - List getAssemblyNosortCfgList(String organizeCode, Long... pids); + List getAssemblyNosortCfgList(String organizeCode, Long pid); } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java index 7a76013..278cbd6 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java @@ -15,7 +15,7 @@ public interface IMesProdRuleCfgExtService { List getProdRuleNosortCfgList(MesProdRuleContext... prodRuleContext); @ApiOperation(value = "【非排序线】获取产品加工规则对应的装配件信息") - MesProdRuleContext getProdRuleContext(MesProdRuleNosortCfg prodRuleNosortCfg, Integer foreignKey); + MesProdRuleContext getProdRuleContext(MesProdRuleContext prodRuleContext); @ApiOperation(value = "【排序线】获取产品加工规则(条码对应的装配件绑定记录,目前条码等同工单)") MesProdRuleContext getProdRuleSortContext(MesProdRuleContext prodRuleContext); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java index 1ca2700..8e6284f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java @@ -58,7 +58,7 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { List productionAssemblySortContextList = new ArrayList<>(); - workOrderAssemblyList.forEach(o -> productionAssemblySortContextList.add(new MesProductionAssemblySortContext(o, getProductionAssembly(productionAssemblyMap, o.getId())))); + workOrderAssemblyList.forEach(o -> productionAssemblySortContextList.add(new MesProductionAssemblySortContext().copy(o, getProductionAssembly(productionAssemblyMap, o.getId())))); return productionAssemblySortContextList; } @@ -99,22 +99,18 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //获取非排序装配件配置信息 @Override - public List getProductionAssemblyNosortContextList(String organizeCode, Long... pids) { + public List getProductionAssemblyNosortContextList(MesProdRuleContext prodRuleContext) { - if (StringUtils.isEmpty(organizeCode) || null == pids) return null; + if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getOrganizeCode()) || StringUtils.isEmpty(prodRuleContext.getPid())) return null; //获取非排序装配件配置信息 - List assemblyNosortCfgList = getAssemblyNosortCfgList(organizeCode, pids); + List assemblyNosortCfgList = getAssemblyNosortCfgList(prodRuleContext.getOrganizeCode(), prodRuleContext.getPid()); if (CollectionUtils.isEmpty(assemblyNosortCfgList)) return null; - //获取装配件绑定记录 - Map productionAssemblyMap = groupProductionAssembly(filterProductionAssemblyList(getProductionAssemblyList( - organizeCode, MesExtEnumUtil.PRODUCTION_ASSEMBLY_DATA_SOURCE.NOSORT.getValue(), assemblyNosortCfgList.stream().filter(o -> null != o).map(MesAssemblyNosortCfg::getId).collect(Collectors.toList())))); - List productionAssemblyNosortContextList = new ArrayList<>(); - assemblyNosortCfgList.forEach(o -> productionAssemblyNosortContextList.add(new MesProductionAssemblyNosortContext(o, getProductionAssembly(productionAssemblyMap, o.getId())))); + assemblyNosortCfgList.forEach(o -> productionAssemblyNosortContextList.add(new MesProductionAssemblyNosortContext().copy(o, prodRuleContext))); return productionAssemblyNosortContextList; @@ -122,11 +118,10 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //获取非排序装配件配置信息 @Override - public List getAssemblyNosortCfgList(String organizeCode, Long... pids) { - if (StringUtils.isEmpty(organizeCode) || null == pids) return null; + public List getAssemblyNosortCfgList(String organizeCode, Long pid) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(pid)) return null; DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - if (pids.length == 1) DdlPreparedPack.getNumEqualPack(pids[0], MesPcnExtConstWords.PID, packBean); - else DdlPreparedPack.getInPackArray(pids, MesPcnExtConstWords.PID, packBean); + DdlPreparedPack.getNumEqualPack(pid, MesPcnExtConstWords.PID, packBean); return assemblyNosortCfgRepository.findByHqlWhere(packBean); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java index 7213d69..0c89b48 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java @@ -73,11 +73,9 @@ public class MesProdRuleCfgExtService implements IMesProdRuleCfgExtService { //【非排序线】获取产品加工规则对应的装配件信息 @Override - public MesProdRuleContext getProdRuleContext(MesProdRuleNosortCfg prodRuleNosortCfg, Integer foreignKey) { - MesProdRuleContext prodRuleContext = new MesProdRuleContext().foreignKey(foreignKey).pid(prodRuleNosortCfg.getId()); - BeanUtils.copyProperties(prodRuleNosortCfg, prodRuleContext); + public MesProdRuleContext getProdRuleContext(MesProdRuleContext prodRuleContext) { //获取非排序装配件配置信息 - if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == prodRuleContext.getIsHasBind()) prodRuleContext.assemblyDataJson(assemblyExtService.getProductionAssemblyNosortContextList(prodRuleContext.getOrganizeCode(), prodRuleContext.getPid())); + if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == prodRuleContext.getIsHasBind()) prodRuleContext.assemblyDataJson(assemblyExtService.getProductionAssemblyNosortContextList(prodRuleContext)); return prodRuleContext; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesNumberRuleMatchRegularExpressionService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesNumberRuleMatchRegularExpressionService.java index 9095ac5..9183f60 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesNumberRuleMatchRegularExpressionService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesNumberRuleMatchRegularExpressionService.java @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNumberRuleMatchDispatchService; import com.google.common.base.Objects; import jdk.nashorn.internal.runtime.regexp.joni.Regex; +import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -22,11 +23,8 @@ public class MesNumberRuleMatchRegularExpressionService implements IMesNumberRul String matchRule = params[1].toString(); - if (sn.matches(matchRule)){ - return true; - } + return match(matchRule, sn); - return false; } private boolean match(String ruleStr, String barCode) { @@ -52,10 +50,31 @@ public class MesNumberRuleMatchRegularExpressionService implements IMesNumberRul Matcher matcher = regex.matcher(rule); return matcher.matches(); } + + String ruleNoSpecialChar = transfer(rule); + String barcodeNoSpecialChar = transfer(barCode); + ///将规则转换为正则表达式,使用正则表达式进行匹配,正则中去除二维码的起始特殊符号 + //update by huxj 2020.04.07 添加二维码前缀正则匹配 + String regStr = "^" + ruleNoSpecialChar.toLowerCase().replace(")", "\\)").replace("?", "(?:.|\n){1}").replace("*", "(?:.|-\n)*").replace("[", "\\[") + "$"; + //Regex rgx = new Regex("^" + ruleNoSpecialChar.ToLower().Replace("?", @"(?:.|\n){1}").Replace("*", @"(?:.|\n)*") + "$"); + Pattern regex = Pattern.compile(regStr); + //end update + if (regex.matcher(barcodeNoSpecialChar.toLowerCase()).matches()) return true; + if (rule == barCode) return true; + } return false; } + public String transfer(String str){ + // 1. 定义正则表达式,匹配特殊字符 + String regex = "[^a-zA-Z0-9^\\s^*?[)>.:^/]]"; + + // 2. 使用正则表达式替换特殊字符为空字符串 + return str.replaceAll(regex, ""); + + } + public static void main(String[] args) { String sn = "1574110000123"; String matchRule = "1574110000*"; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java new file mode 100644 index 0000000..219a99e --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java @@ -0,0 +1,195 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNumberRuleMatchDispatchService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProdRuleCfgExtService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmCommonService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @Description : 装配件匹配工步 【非排序】 + * @Author : wangjie + **/ +@Slf4j +@Service("mesAssemblyMatchNosortStepService") +public class MesAssemblyMatchNosortStepService extends BaseStepService { + + @Autowired + private IFsmCommonService fsmCommonService; + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + private IMesProductionDispatchContextStepService productionDispatchContextStepService; + + @Autowired + private IMesProdRuleCfgExtService prodRuleCfgExtService; + + @Autowired + private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.saveProductionProcessContext(reqBean, productionProcessContext); + + //从上下文中取出生产线对象 + MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); + + //获取上下文产出零件数据信息集合 + List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + + //获取上下文进料零件条码信息集合 + List productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean); + + //获取上下文产品加工规则数据信息集合 + List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + + //获取上下文生产扫/读信息:装配件条码 + List equipVariableCollectContextList = productionDispatchContextStepService.getScanAssemblySnContext(reqBean); + + //删除上下文扫/读信息:装配件条码 + if (!CollectionUtils.isEmpty(equipVariableCollectContextList)) productionDispatchContextStepService.deleteScanAssemblySnContext(reqBean); + + //计算实际需要的加工规则个数 + Integer needProdRuleContextSize = calcNeedProdRuleContextSize(productionPartContextList, productionPsInContextList, cellEquipContext); + + //未知腔数[工位参数] + String cavityUnknownCfg = fsmCommonService.doHandleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CAVITY_UNKNOWN_CFG); + + if (!CollectionUtils.isEmpty(productionPartContextList) && !CollectionUtils.isEmpty(productionPsInContextList)) //存在产出零件 存在进料主条码 + doMatchAssemblyHasPpAndPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList, needProdRuleContextSize); + else if (!CollectionUtils.isEmpty(productionPartContextList)) //存在产出零件 不存在进料主条码 + doMatchAssemblyHasPp(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, prodRuleContextList, equipVariableCollectContextList, needProdRuleContextSize); + else if (!CollectionUtils.isEmpty(productionPsInContextList)) //不存在产出零件 存在进料主条码 + doMatchAssemblyHasPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList, needProdRuleContextSize); + else if (StringUtils.isEmpty(cavityUnknownCfg)) //不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则 + doMatchAssemblyHasCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList, needProdRuleContextSize); + else //不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则 + doMatchAssemblyUnknowCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList); + + + + + + return stepResult; + + } + + //计算实际需要的加工规则个数 + private Integer calcNeedProdRuleContextSize(List productionPartContextList, List productionPsInContextList, MesCellEquipContext cellEquipContext) { + + List ppList = CollectionUtils.isEmpty(productionPartContextList) ? null : + productionPartContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()); + + List ppiList = CollectionUtils.isEmpty(productionPsInContextList) ? null : + productionPsInContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()); + + if (!CollectionUtils.isEmpty(ppList)) return ppList.size(); + + if (!CollectionUtils.isEmpty(ppiList)) return ppiList.size(); + + + + return cellEquipContext.getCavity(); + + } + + //存在产出零件 存在进料主条码 + private StepResult doMatchAssemblyHasPpAndPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List productionPartContextList, List productionPsInContextList, List prodRuleContextList, List equipVariableCollectContextList, Integer needProdRuleContextSize) { + + if (CollectionUtils.isEmpty(prodRuleContextList)) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前上下文中不存在非排序加工规则数据,请重置工序!"); + + //存在产出零件 存在进料主条码 不存在待验证装配件条码 + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) return doMatchAssemblyHasPpAndPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, productionPsInContextList, prodRuleContextList, needProdRuleContextSize); + + + + + + + return stepResult; + + } + + //存在产出零件 存在进料主条码 不存在待验证装配件条码 + private StepResult doMatchAssemblyHasPpAndPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List productionPartContextList, List productionPsInContextList, List prodRuleContextList, Integer needProdRuleContextSize) { + + Boolean hasUnBindAssembly = false; + + for (MesProdRuleContext prodRuleContext : prodRuleContextList) { + + if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; + + List productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext(); + + Optional optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst(); + + if (null == optional || !optional.isPresent()) continue; + + hasUnBindAssembly = true; + + break; + + } + + return hasUnBindAssembly ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg("当前上下文中不存在待验证的装配件条码,但存在未装配的装配件清单!") : + (needProdRuleContextSize.compareTo(prodRuleContextList.size()) != 0 ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg("当前上下文中不存在待验证的装配件条码,当前上下文中的主条码数量未满足腔数!请扫描第") : stepResult); + + } + + + + + + + + + + + //存在产出零件 不存在进料主条码 + private void doMatchAssemblyHasPp(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List productionPartContextList, List prodRuleContextList, List equipVariableCollectContextList, Integer needProdRuleContextSize) { + } + + //不存在产出零件 存在进料主条码 + private void doMatchAssemblyHasPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List productionPsInContextList, List prodRuleContextList, List equipVariableCollectContextList, Integer needProdRuleContextSize) { + } + + //不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则 + private void doMatchAssemblyHasCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List prodRuleContextList, List equipVariableCollectContextList, Integer needProdRuleContextSize) { + } + + //不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则 + private void doMatchAssemblyUnknowCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List prodRuleContextList, List equipVariableCollectContextList) { + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchStepService.java new file mode 100644 index 0000000..535a340 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchStepService.java @@ -0,0 +1,63 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import cn.estsh.impp.framework.boot.util.SpringContextsUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Description : 装配件匹配工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesAssemblyMatchStepService") +public class MesAssemblyMatchStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Override + public StepResult init(StationRequestBean reqBean) { + + //显示装配件扫描项工步 + return ((IStepService) SpringContextsUtil.getBean("mesAssemblyShowStepService")).execute(reqBean); + + } + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.saveProductionProcessContext(reqBean, productionProcessContext); + + //从上下文中取出生产线对象 + MesWorkCenter workCenter = productionProcessContext.getWorkCenter(); + + //排序线 装配件匹配工步 + if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenter.getCenterType()) return stepResult; + + //非排序线 装配件匹配工步 + return ((IStepService) SpringContextsUtil.getBean("mesAssemblyMatchNosortStepService")).execute(reqBean); + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java index 4148caa..b752356 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java @@ -2,10 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesMouldMultiCavityService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesCellEquipContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipLogDispatchContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; @@ -21,6 +18,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.util.List; import java.util.Map; @@ -76,9 +74,18 @@ public class MesAssemblyReadStepService extends BaseStepService { //获取上下文信息 MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean, stepParamMap); + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + //当前工序已存在读取待验证的装配件条码 if (productionDispatchContextStepService.checkScanAssemblySnIsExistContext(reqBean)) return stepResult; + //当前工位使用的设备 + MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); + + //验证当前是否需要读装配件条码 + if (!checkIsNeedReedAssembly(reqBean)) return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前上下文中的加工规则未配置装配件扫描项,无需读设备[%s]装配件条码!", cellEquipContext.getEquipmentCode())); + //获取生产过程上下文对象有异常信息 抛出异常 if (!productionProcessContextStepService.getEquipmentVariableCfgList(productionProcessContext).getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); @@ -88,9 +95,6 @@ public class MesAssemblyReadStepService extends BaseStepService { //根据变量类别[装配件]搜集设备数据变量接口逻辑信息 equipmentVariableCfgList = productionProcessContextStepService.collectEquipmentVariableCfgList(equipmentVariableCfgList, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.ASSEMBLY.getValue()); - //当前工位使用的设备 - MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); - //配置错误 抛出异常 if (!productionProcessContextStepService.checkNecessaryEquipmentVariableCfg(productionProcessContext, cellEquipContext, equipmentVariableCfgList, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.ASSEMBLY.getValue()).getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); @@ -123,6 +127,22 @@ public class MesAssemblyReadStepService extends BaseStepService { } + private Boolean checkIsNeedReedAssembly(StationRequestBean reqBean) { + + //获取上下文产品加工规则数据信息集合 + List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + + //没有加工规则代表需要反向匹配出加工规则, 需要直接读取 + if (CollectionUtils.isEmpty(prodRuleContextList)) return true; + + //判断加工规则中是否存在还有装配件的数据 + Optional optional = prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getAssemblyDataJson()))).findFirst(); + + //不存在返回fasle不用读取 + return (null == optional || !optional.isPresent()) ? false : true; + + } + //匹配读取的装配件的有效性 private StepResult matchAssemblySnValid(StationRequestBean reqBean, StationResultBean resultBean, Optional> stepParamMap, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, MesEquipLogDispatchContext equipLogDispatchContext) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java index 89fdf14..e2fec04 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java @@ -4,6 +4,8 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepServi import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -14,10 +16,12 @@ import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; +import java.util.Optional; /** * @Description : 扫描装配件条码工步 @@ -52,6 +56,9 @@ public class MesAssemblyScanStepService extends BaseStepService { StepResult stepResult = StepResult.getSuccessComplete(); + //验证当前是否需要读装配件条码 【当前验证只能对内部触发生效】 + if (!checkIsNeedScanAssembly(reqBean)) return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前上下文中的加工规则未配置装配件扫描项,无需扫描装配件条码!"); + if (StringUtils.isEmpty(reqBean.getScanInfo())) execSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(), "请扫描装配件条码!"); //扫描信息置空 @@ -76,6 +83,25 @@ public class MesAssemblyScanStepService extends BaseStepService { } + private Boolean checkIsNeedScanAssembly(StationRequestBean reqBean) { + + //获取上下文产出零件信息 + List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + + //获取上下文产品加工规则数据信息集合 + List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + + //没有加工规则代表需要反向匹配出加工规则, 需要直接读取 + if (CollectionUtils.isEmpty(prodRuleContextList)) return true; + + //判断加工规则中是否存在还有装配件的数据 + Optional optional = prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getAssemblyDataJson()))).findFirst(); + + //不存在返回fasle不用读取 + return (null == optional || !optional.isPresent()) ? false : true; + + } + private List getAssemblySnJson(StationRequestBean reqBean, String scanInfo) { List equipVariableCollectContextList = new ArrayList<>(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java index c5a41d1..302b069 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java @@ -153,7 +153,9 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { if (CollectionUtils.isEmpty(prodRuleNosortCfgList)) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查非排序产品加工规则信息,未查询到设备[%s]产出零件[%s]进料零件[空]进料零件规则[空]的配置信息", cellEquipContext.getEquipmentCode(), productionPartContext.getPartNo())); //【非排序线】获取产品加工规则对应的装配件信息 - if (prodRuleNosortCfgList.size() == 1) prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext(prodRuleNosortCfgList.get(0), productionPartContext.foreignKey(foreignKey += 1).getForeignKey())); + if (prodRuleNosortCfgList.size() == 1) prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext( + new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode()). + copy(prodRuleNosortCfgList.get(0)).workOrderNo(productionPartContext.getWorkOrderNo()).foreignKey(productionPartContext.foreignKey(foreignKey += 1).getForeignKey()))); if (prodRuleNosortCfgList.size() > 1) this.sendMessage(reqBean, resultBean, String.format( "显示装配件匹配非排序产品加工规则[%s]条,直接跳过,后续通过装配件规则匹配加工规则,数据源:[%s]!", prodRuleNosortCfgList.size(), JSONObject.toJSONString(productionPartContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); @@ -187,7 +189,8 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { cellEquipContext.getEquipmentCode(), !StringUtils.isEmpty(productionPsInContext.getPartNo()) ? String.format("号匹配[%s]", productionPsInContext.getPartNo()) : String.format("规则匹配[%s]", productionPsInContext.getProductSn()))); //【非排序线】获取产品加工规则对应的装配件信息 - if (filterList.size() == 1) prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext(filterList.get(0), productionPsInContext.foreignKey(foreignKey += 1).getForeignKey())); + if (filterList.size() == 1) prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext( + new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode()).copy(prodRuleNosortCfgList.get(0)).productSn(productionPsInContext.getProductSn()).foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey()))); if (filterList.size() > 1) this.sendMessage(reqBean, resultBean, String.format( "显示装配件匹配非排序产品加工规则[%s]条,直接跳过,后续通过装配件规则匹配加工规则,数据源:[%s]!", filterList.size(), JSONObject.toJSONString(productionPsInContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); @@ -199,7 +202,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { private List getProdRuleNosortCfgList(StationRequestBean reqBean, MesCellEquipContext cellEquipContext, List productionPsInContextList, List outPartNoList) { //【非排序线】获取产品加工规则 ; 分别根据 进料零件有值 与 进料规则不为空 查询 再合并数据返回, 条件可能携带产出零件 List inPartNoList = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && !StringUtils.isEmpty(o.getPartNo()))).map(MesProductionPsInContext::getPartNo).collect(Collectors.toList()); - Optional optional = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && StringUtils.isEmpty(o.getPartNo()))).findFirst(); + Optional optional = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0 && StringUtils.isEmpty(o.getPartNo()))).findFirst(); List prodRuleNosortCfgList = prodRuleCfgExtService.getProdRuleNosortCfgList( !CollectionUtils.isEmpty(inPartNoList) ? new MesProdRuleContext(reqBean.getOrganizeCode()).equipmentCode(cellEquipContext.getEquipmentCode()).inPartNos(inPartNoList).outPartNos(outPartNoList) : null, (null != optional && optional.isPresent()) ? new MesProdRuleContext(reqBean.getOrganizeCode()).equipmentCode(cellEquipContext.getEquipmentCode()).inPartRuleIsNotEmpty().outPartNos(outPartNoList) : null); @@ -224,8 +227,10 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { List outPartNoProdRuleList = !CollectionUtils.isEmpty(prodRuleNosortCfgMap) ? prodRuleNosortCfgMap.get(productionPartContext.getPartNo()) : null; MesProdRuleNosortCfg filter = null; + String productSn = null; - Optional optional = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()))).findFirst(); + //判断是否还存在待匹配的主条码信息, 内部循环匹配成功会标记 foreignKey + Optional optional = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).findFirst(); if (null == optional || !optional.isPresent()) break; for (MesProductionPsInContext productionPsInContext : productionPsInContextList) { @@ -244,6 +249,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { productionPartContext.foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey()); filter = innerfilterList.get(0); + productSn = productionPsInContext.getProductSn(); break; @@ -252,7 +258,8 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { if (null == filter) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查非排序产品加工规则信息,未查询到设备[%s]产出零件[%s]匹配任意一个主条码的配置信息", cellEquipContext.getEquipmentCode(), productionPartContext.getPartName())); //【非排序线】获取产品加工规则对应的装配件信息 - prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext(filter, productionPartContext.getForeignKey())); + prodRuleContextList.add(prodRuleCfgExtService.getProdRuleContext( + new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode()).copy(filter).workOrderNo(productionPartContext.getWorkOrderNo()).productSn(productSn).foreignKey(productionPartContext.getForeignKey()))); } @@ -330,12 +337,6 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o, MesProdRuleContext prodRuleContext, String workOrderNo) { MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext(); BeanUtils.copyProperties(o, assemblyShowContext); - if (!StringUtils.isEmpty(workOrderNo)) assemblyShowContext.setWorkOrderNo(workOrderNo); - assemblyShowContext.setPartNo(prodRuleContext.getOutPartNo()); - if (StringUtils.isEmpty(assemblyShowContext.getRouteSeq())) assemblyShowContext.setRouteSeq(MesPcnExtConstWords.ZERO); - if (StringUtils.isEmpty(assemblyShowContext.getAssemblyStatus())) assemblyShowContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()); - if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() == assemblyShowContext.getAssemblyStatus() && (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == assemblyShowContext.getMatchType() || - MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == assemblyShowContext.getMatchType())) assemblyShowContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()); assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(assemblyShowContext.getAssemblyStatus())); if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() != assemblyShowContext.getAssemblyStatus()) assemblyShowContext.setColor(StringUtils.isEmpty(assemblyShowContext.getShowColor()) ? MesExtEnumUtil.COLOR.GREEN.getValue() : assemblyShowContext.getShowColor()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java index 848fc40..b12ea22 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java @@ -121,8 +121,8 @@ public class MesAssemblyShowSortStepService extends BaseStepService { if (null == productionPsInContext || productionPsInContext.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || !StringUtils.isEmpty(productionPsInContext.getForeignKey())) continue; //【排序线】获取产品加工规则(条码对应的装配件绑定记录,目前条码等同工单) - prodRuleContextList.add(prodRuleCfgExtService.getProdRuleSortContext(new MesProdRuleContext( - reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionPsInContext.getProductSn()).foreignKey( + prodRuleContextList.add(prodRuleCfgExtService.getProdRuleSortContext( + new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode()).workOrderNo(productionPsInContext.getWorkOrderNo()).productSn(productionPsInContext.getProductSn()).foreignKey( productionPartContextList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(productionPsInContext.getWorkOrderNo()))).findFirst().get().foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey()).getForeignKey()))); } @@ -185,9 +185,6 @@ public class MesAssemblyShowSortStepService extends BaseStepService { private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) { MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext(); BeanUtils.copyProperties(o, assemblyShowContext); - if (StringUtils.isEmpty(assemblyShowContext.getRouteSeq())) assemblyShowContext.setRouteSeq(MesPcnExtConstWords.ZERO); - if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() == assemblyShowContext.getAssemblyStatus() && (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == assemblyShowContext.getMatchType() || - MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == assemblyShowContext.getMatchType())) assemblyShowContext.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()); assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(o.getAssemblyStatus())); if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() != assemblyShowContext.getAssemblyStatus()) assemblyShowContext.setColor(StringUtils.isEmpty(assemblyShowContext.getShowColor()) ? MesExtEnumUtil.COLOR.GREEN.getValue() : assemblyShowContext.getShowColor()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java index fa1ba05..6c697db 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable; import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariableCfg; @@ -163,8 +164,6 @@ public class MesProductSnReadStepService extends BaseStepService { execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(), stepResult.isCompleted(false).msg(String.format("当前读取到设备[%s]主条码全部为空腔,持续监听中...", cellEquipContext.getEquipmentCode())), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - - //根据读取条码分组数据 Map> produceSnCollectMap = productSnList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesEquipVariableCollectContext::getEquipVariableValue)); @@ -183,6 +182,10 @@ public class MesProductSnReadStepService extends BaseStepService { execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(), stepResult.isCompleted(false).msg(String.format("当前读取到设备[%s]主条码数量[%s]与工位设备维护的腔数[%s]不一致,持续监听中...", cellEquipContext.getEquipmentCode(), equipVariableCollectContextList.size(), cellEquipContext.getCavity())), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + //比对产出零件的空腔数量与主条码的空腔数量, 产出零件的空腔数必须小于主条码的空腔数 + if (!checkFinishCodeSizeValid(stepResult, cellEquipContext, productionPartContextList, finishCodeList).isCompleted()) + execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(), stepResult.isCompleted(false).msg(stepResult.getMsg()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + //保存设备当前一轮工序的待验证的主条码信息 productionDispatchContextStepService.saveScanProductSnContext(reqBean, productSnList); @@ -192,6 +195,22 @@ public class MesProductSnReadStepService extends BaseStepService { } + //比对产出零件的空腔数量与主条码的空腔数量, 产出零件的空腔数必须小于主条码的空腔数 + private StepResult checkFinishCodeSizeValid(StepResult stepResult, MesCellEquipContext cellEquipContext, List productionPartContextList, List finishCodeList) { + + //没有产出零件 不需要对比空腔数量 + if (CollectionUtils.isEmpty(productionPartContextList)) return stepResult; + + List finishCodePpList = productionPartContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0)).collect(Collectors.toList()); + + Integer ppSize = CollectionUtils.isEmpty(finishCodePpList) ? MesPcnExtConstWords.ZERO : finishCodePpList.size(); + Integer psSize = CollectionUtils.isEmpty(finishCodeList) ? MesPcnExtConstWords.ZERO : finishCodeList.size(); + + return ppSize.compareTo(psSize) <= 0 ? stepResult : + stepResult.isCompleted(false).msg(String.format("当前读取到设备[%s]主条码空腔数量[%s]小于产出零件对应的空腔数量[%s],持续监听中...", cellEquipContext.getEquipmentCode(), psSize, ppSize)); + + } + //封装无需验证的finishCode空腔数据 private List getProductionPsInContextList(List finishCodeList) { List productionPsInContextList = new ArrayList<>(); @@ -199,6 +218,7 @@ public class MesProductSnReadStepService extends BaseStepService { return productionPsInContextList; } + //搜集主条码值与空腔值 private List filterEquipVariableCollectContextList(MesProductionProcessContext productionProcessContext, List equipVariableCollectContextList, Boolean flag) { return flag ? equipVariableCollectContextList.stream().filter(o -> (null != o && !o.getEquipVariableValue().equals(productionProcessContext.getFinishCode()))).collect(Collectors.toList()) : equipVariableCollectContextList.stream().filter(o -> (null != o && o.getEquipVariableValue().equals(productionProcessContext.getFinishCode()))).collect(Collectors.toList()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java index 520278d..dc6f36d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java @@ -124,8 +124,13 @@ public class MesProductSnScanNosortStepService extends BaseStepService { //验证是否存在重复主条码 if (checkIsExistRepeatScan(productionProcessContext, equipVariableCollectContextList, productionPsInContextList)) return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前扫描信息主条码[%s],上下文中存在重复扫描的主条码!", scanInfo)); + Boolean scanInfoIsFinishCode = !scanInfo.equals(productionProcessContext.getFinishCode()) ? false : true; + + //比对产出零件的空腔数量与主条码的空腔数量, 产出零件的空腔数必须小于 剩余待扫描主条码数量加上已扫描的空腔数量 + if (!checkFinishCodeSize(stepResult, productionPartContextList, productionPsInContextList, scanInfoIsFinishCode).isCompleted()) return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, stepResult.getMsg()); + //保存上下文扫/读信息:主条码 或者 添加了finishCode后的主条码数据 - if (!scanInfo.equals(productionProcessContext.getFinishCode())) productionDispatchContextStepService.saveScanProductSnContext(reqBean, equipVariableCollectContextList); + if (!scanInfoIsFinishCode) productionDispatchContextStepService.saveScanProductSnContext(reqBean, equipVariableCollectContextList); else productionPsInContextList = saveProductionPsInContextList(reqBean, productionPsInContextList); //前期扫描数量已等于腔数 @@ -141,7 +146,7 @@ public class MesProductSnScanNosortStepService extends BaseStepService { MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前扫描信息%s[%s],已知腔数[%s],还需要再连续扫描[%s]次主条码!", scanInfoName, scanInfo, needQty, needQty - equipVariableCollectContextList.size())); //扫描场景 验证是否全部为空腔 - if (!checkIsAllFinishCode(equipVariableCollectContextList, productionPartContextList)) + if (!checkIsAllFinishCode(productionPsInContextList, equipVariableCollectContextList)) return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前扫描信息%s[%s]%s!", scanInfoName, scanInfo, scanedQty.compareTo(needQty) == 0 ? String.format(",上下文中的主条码个数[%s]已满足腔数", scanedQty) : MesPcnExtConstWords.EMPTY)); //删除上下文扫/读信息:主条码 @@ -252,10 +257,31 @@ public class MesProductSnScanNosortStepService extends BaseStepService { } - //验证是否全部为空腔 - private Boolean checkIsAllFinishCode(List equipVariableCollectContextList, List productionPartContextList) { - Optional optional = productionPartContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).findFirst(); - return ((null != optional && optional.isPresent()) || !CollectionUtils.isEmpty(equipVariableCollectContextList)) ? false : true; + ////比对产出零件的空腔数量与主条码的空腔数量, 产出零件的空腔数必须小于 剩余待扫描主条码数量加上已扫描的空腔数量 + private StepResult checkFinishCodeSize(StepResult stepResult, List productionPartContextList, List productionPsInContextList, Boolean scanInfoIsFinishCode) { + + //没有产出零件 不需要对比空腔数量 + if (CollectionUtils.isEmpty(productionPartContextList)) return stepResult; + + List finishCodePpList = productionPartContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0)).collect(Collectors.toList()); + List finishCodePsList = CollectionUtils.isEmpty(productionPsInContextList) ? null : productionPsInContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0)).collect(Collectors.toList()); + + //产出零件的空腔数 + Integer ppSize = CollectionUtils.isEmpty(finishCodePpList) ? MesPcnExtConstWords.ZERO : finishCodePpList.size(); + //已扫描的主条码空腔数量 + Integer psSize = (CollectionUtils.isEmpty(finishCodePsList) ? MesPcnExtConstWords.ZERO : finishCodePsList.size()) + (!scanInfoIsFinishCode ? MesPcnExtConstWords.ZERO : MesPcnExtConstWords.ONE); + //剩余待扫描主条码数量 + Integer remainSize = productionPartContextList.size() - (CollectionUtils.isEmpty(productionPsInContextList) ? MesPcnExtConstWords.ZERO : productionPsInContextList.size()) - MesPcnExtConstWords.ONE; + + return ppSize.compareTo(remainSize + psSize) < 0 ? stepResult : stepResult.isCompleted(false).msg(String.format("产出零件存在空腔数[%s],扫描的主条码空腔数[%s],当前主条码必须扫描空腔码!", ppSize, psSize)); + + } + + private Boolean checkIsAllFinishCode(List productionPsInContextList, List equipVariableCollectContextList) { + //扫描场景 验证是否全部为空腔 + Optional optional = productionPsInContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).findFirst(); + //已验证的主条码全部空腔 并且 当前待验证主条码不存在数据 则全部空腔 + return ((null == optional || !optional.isPresent()) && CollectionUtils.isEmpty(equipVariableCollectContextList)) ? true : false; } } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java index bea3e83..c0192af 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java @@ -1,15 +1,18 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; +import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleNosortCfg; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.ApiParam; import lombok.Data; +import org.springframework.beans.BeanUtils; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.io.Serializable; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -27,14 +30,15 @@ public class MesProdRuleContext implements Serializable { @ApiParam(name = "数据关联键") private Integer foreignKey; + @ApiParam(name = "工单号,不一定有值") + private String workOrderNo; + @ApiParam(name = "读/扫主条码信息(内制件/外协件/排序条码即工单号),不一定有值") private String productSn; @ApiParam("装配件绑定清单 [JSON]List") public String assemblyDataJson; - //-------以下排序属性------------- - @ApiParam("生产线代码") public String workCenterCode; @@ -44,6 +48,9 @@ public class MesProdRuleContext implements Serializable { @ApiParam("工序代码") public String processCode; + @ApiParam(name = "是否验证装配件扫描顺序") + private Integer isCheckBindSeq; + //-------以下非排序属性------------- @ApiParam("非排序产品加工规则ID") @@ -78,9 +85,6 @@ public class MesProdRuleContext implements Serializable { @ApiParam(name = "是否包装") private Integer isPackage; - @ApiParam(name = "是否验证装配件扫描顺序") - private Integer isCheckBindSeq; - @ApiParam(name = "成品站点") private String partLocation; @@ -107,12 +111,27 @@ public class MesProdRuleContext implements Serializable { this.organizeCode = organizeCode; } - public MesProdRuleContext(String organizeCode, String workCenterCode, String workCellCode, String processCode, String productSn) { + public MesProdRuleContext(String organizeCode, String workCenterCode, String workCellCode, String processCode) { this.organizeCode = organizeCode; this.workCenterCode = workCenterCode; this.workCellCode = workCellCode; this.processCode = processCode; + } + + public MesProdRuleContext copy(MesProdRuleNosortCfg prodRuleNosortCfg) { + BeanUtils.copyProperties(prodRuleNosortCfg, this); + this.pid = prodRuleNosortCfg.getId(); + return this; + } + + public MesProdRuleContext workOrderNo(String workOrderNo) { + this.workOrderNo = workOrderNo; + return this; + } + + public MesProdRuleContext productSn(String productSn) { this.productSn = productSn; + return this; } public MesProdRuleContext foreignKey(Integer foreignKey) { @@ -183,14 +202,21 @@ public class MesProdRuleContext implements Serializable { public List getAssemblyDataContext(MesWorkCenter workCenter) { if (StringUtils.isEmpty(this.assemblyDataJson)) return null; List productionAssemblyContextList = new ArrayList<>(); - if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenter.getCenterType()) { - List productionAssemblySortContextList = JSONObject.parseArray(this.assemblyDataJson, MesProductionAssemblySortContext.class); - productionAssemblySortContextList.forEach(o -> productionAssemblyContextList.add(o)); - } else { - List productionAssemblyNosortContextList = JSONObject.parseArray(this.assemblyDataJson, MesProductionAssemblyNosortContext.class); - productionAssemblyNosortContextList.forEach(o -> productionAssemblyContextList.add(o)); - } + if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenter.getCenterType()) getSortAssemblyDataContext().forEach(o -> productionAssemblyContextList.add(o)); + else getNosortAssemblyDataContext().forEach(o -> productionAssemblyContextList.add(o)); return productionAssemblyContextList; } + //非排序装配件清单 + public List getNosortAssemblyDataContext() { + List nosortAssemblyList = !StringUtils.isEmpty(this.assemblyDataJson) ? JSONObject.parseArray(this.assemblyDataJson, MesProductionAssemblyNosortContext.class) : null; + return CollectionUtils.isEmpty(nosortAssemblyList) ? null : nosortAssemblyList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesProductionAssemblyNosortContext::getRouteSeq)).collect(Collectors.toList()); + } + + //排序装配件清单 + public List getSortAssemblyDataContext() { + List sortAssemblyList = !StringUtils.isEmpty(this.assemblyDataJson) ? JSONObject.parseArray(this.assemblyDataJson, MesProductionAssemblySortContext.class) : null; + return CollectionUtils.isEmpty(sortAssemblyList) ? null : sortAssemblyList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesProductionAssemblySortContext::getRouteSeq)).collect(Collectors.toList()); + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java index 313ab93..ecbdbc8 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java @@ -1,10 +1,12 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.pojo.mes.bean.MesAssemblyNosortCfg; -import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import io.swagger.annotations.ApiParam; import lombok.Data; import org.springframework.beans.BeanUtils; +import org.springframework.util.StringUtils; import java.io.Serializable; @@ -28,9 +30,17 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon @ApiParam(value = "工序用量") private Integer qty; - public MesProductionAssemblyNosortContext(MesAssemblyNosortCfg assemblyNosortCfg, MesProductionAssembly productionAssembly) { + public MesProductionAssemblyNosortContext() {} + + public MesProductionAssemblyNosortContext copy(MesAssemblyNosortCfg assemblyNosortCfg, MesProdRuleContext prodRuleContext) { if (null != assemblyNosortCfg) BeanUtils.copyProperties(assemblyNosortCfg, this); - if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this); + if (null != prodRuleContext) BeanUtils.copyProperties(prodRuleContext, this); + this.partNo = prodRuleContext.getOutPartNo(); + if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + if (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType) + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); + return this; } } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java index 31e480e..43c887a 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java @@ -1,10 +1,13 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderAssembly; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import io.swagger.annotations.ApiParam; import lombok.Data; import org.springframework.beans.BeanUtils; +import org.springframework.util.StringUtils; import java.io.Serializable; @@ -105,9 +108,14 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte public MesProductionAssemblySortContext() {} - public MesProductionAssemblySortContext(MesWorkOrderAssembly workOrderAssembly, MesProductionAssembly productionAssembly) { + public MesProductionAssemblySortContext copy(MesWorkOrderAssembly workOrderAssembly, MesProductionAssembly productionAssembly) { if (null != workOrderAssembly) BeanUtils.copyProperties(workOrderAssembly, this); if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this); + if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && + (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType)) + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); + return this; } } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 231c38d..b40032d 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -191,6 +191,10 @@ public class MesPcnExtConstWords { // 工位参数按钮事件: 解除锁定 public static final String FUNCTION_PRODUCTION_UNLOCK = "FUNCTION_PRODUCTION_UNLOCK"; + // 自定义触发事件: 装配件 + public static final String NEXT_TRIGGER_EVENT_ASSEMBLY = "ASSEMBLY"; + // 自定义触发事件: 主条码 + public static final String NEXT_TRIGGER_EVENT_PRODUCT_SN = "PRODUCT_SN"; // 0 public static final String ZERO_STR = "0";