forked from I3-YF/i3plus-mes-pcn-yfai
Merge remote-tracking branch 'origin/dev' into dev
commit
a4dd49bde5
@ -1,239 +1,293 @@
|
|||||||
//package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
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.IMesNumberRuleMatchDispatchService;
|
||||||
//import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProdRuleCfgExtService;
|
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.IMesProductionDispatchContextStepService;
|
||||||
//import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
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.context.*;
|
||||||
//import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
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.actor.shipping.dispatch.IFsmCommonService;
|
||||||
//import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||||
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
//import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleNosortCfg;
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||||
//import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||||
//import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||||
//import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||||
//import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
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.CollectionUtils;
|
import org.springframework.util.StringUtils;
|
||||||
//import org.springframework.util.StringUtils;
|
|
||||||
//
|
import java.util.List;
|
||||||
//import java.util.ArrayList;
|
import java.util.Optional;
|
||||||
//import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
//import java.util.Optional;
|
import java.util.stream.Stream;
|
||||||
//import java.util.stream.Collectors;
|
|
||||||
//import java.util.stream.Stream;
|
/**
|
||||||
//
|
* @Description : 装配件匹配工步 【非排序】
|
||||||
///**
|
* @Author : wangjie
|
||||||
// * @Description : 装配件匹配工步 【非排序】
|
**/
|
||||||
// * @Author : wangjie
|
@Slf4j
|
||||||
// **/
|
@Service("mesAssemblyMatchNosortStepService")
|
||||||
//@Slf4j
|
public class MesAssemblyMatchNosortStepService extends BaseStepService {
|
||||||
//@Service("mesAssemblyMatchNosortStepService")
|
|
||||||
//public class MesAssemblyMatchNosortStepService extends BaseStepService {
|
@Autowired
|
||||||
//
|
private IFsmCommonService fsmCommonService;
|
||||||
// @Autowired
|
|
||||||
// private IFsmCommonService fsmCommonService;
|
@Autowired
|
||||||
//
|
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||||
// @Autowired
|
|
||||||
// private IMesProductionProcessContextStepService productionProcessContextStepService;
|
@Autowired
|
||||||
//
|
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||||
// @Autowired
|
|
||||||
// private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
@Autowired
|
||||||
//
|
private IMesProdRuleCfgExtService prodRuleCfgExtService;
|
||||||
// @Autowired
|
|
||||||
// private IMesProdRuleCfgExtService prodRuleCfgExtService;
|
@Autowired
|
||||||
//
|
private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService;
|
||||||
// @Autowired
|
|
||||||
// private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService;
|
@Override
|
||||||
//
|
public StepResult execute(StationRequestBean reqBean) {
|
||||||
// @Override
|
|
||||||
// public StepResult execute(StationRequestBean reqBean) {
|
StationResultBean resultBean = new StationResultBean();
|
||||||
//
|
|
||||||
// StationResultBean resultBean = new StationResultBean();
|
StepResult stepResult = StepResult.getSuccessComplete();
|
||||||
//
|
|
||||||
// StepResult stepResult = StepResult.getSuccessComplete();
|
//获取上下文信息
|
||||||
//
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
|
||||||
// //获取上下文信息
|
|
||||||
// MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
|
//配置错误 抛出异常
|
||||||
//
|
if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||||
// //配置错误 抛出异常
|
|
||||||
// if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
//存储生产过程上下文对象
|
||||||
//
|
productionProcessContextStepService.saveProductionProcessContext(reqBean, productionProcessContext);
|
||||||
// //存储生产过程上下文对象
|
|
||||||
// productionProcessContextStepService.saveProductionProcessContext(reqBean, productionProcessContext);
|
//获取上下文产品加工规则数据信息集合
|
||||||
//
|
List<MesProdRuleContext> prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean);
|
||||||
// //从上下文中取出生产线对象
|
|
||||||
// MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
if (CollectionUtils.isEmpty(prodRuleContextList)) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前上下文中不存在非排序加工规则数据,请重置工序!");
|
||||||
//
|
|
||||||
// //获取上下文产出零件数据信息集合
|
//从上下文中取出生产线对象
|
||||||
// List<MesProductionPartContext> productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
|
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
||||||
//
|
|
||||||
// //获取上下文进料零件条码信息集合
|
|
||||||
// List<MesProductionPsInContext> productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
|
//获取上下文产出零件数据信息集合
|
||||||
//
|
List<MesProductionPartContext> productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
|
||||||
// //获取上下文产品加工规则数据信息集合
|
|
||||||
// List<MesProdRuleContext> prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean);
|
//获取上下文进料零件条码信息集合
|
||||||
//
|
List<MesProductionPsInContext> productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
|
||||||
// //获取上下文生产扫/读信息:装配件条码
|
|
||||||
// List<MesEquipVariableCollectContext> equipVariableCollectContextList = productionDispatchContextStepService.getScanAssemblySnContext(reqBean);
|
//获取上下文生产扫/读信息:装配件条码
|
||||||
//
|
List<MesEquipVariableCollectContext> equipVariableCollectContextList = productionDispatchContextStepService.getScanAssemblySnContext(reqBean);
|
||||||
// //删除上下文扫/读信息:装配件条码
|
|
||||||
// if (!CollectionUtils.isEmpty(equipVariableCollectContextList)) productionDispatchContextStepService.deleteScanAssemblySnContext(reqBean);
|
//删除上下文扫/读信息:装配件条码
|
||||||
//
|
if (!CollectionUtils.isEmpty(equipVariableCollectContextList)) productionDispatchContextStepService.deleteScanAssemblySnContext(reqBean);
|
||||||
// //未知腔数[工位参数]
|
|
||||||
// String cavityUnknownCfg = fsmCommonService.doHandleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CAVITY_UNKNOWN_CFG);
|
//未知腔数[工位参数]
|
||||||
//
|
String cavityUnknownCfg = fsmCommonService.doHandleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CAVITY_UNKNOWN_CFG);
|
||||||
// //计算实际需要的腔数
|
|
||||||
//// Integer needCavity = getNeedCavity(productionPartContextList, productionPsInContextList, cellEquipContext);
|
if (!CollectionUtils.isEmpty(productionPartContextList) && !CollectionUtils.isEmpty(productionPsInContextList)) //存在产出零件 存在进料主条码
|
||||||
//
|
doMatchAssemblyHasPpAndPs(reqBean, resultBean, stepResult, productionPartContextList, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList);
|
||||||
// if (!CollectionUtils.isEmpty(productionPartContextList) && !CollectionUtils.isEmpty(productionPsInContextList)) //存在产出零件 存在进料主条码
|
else if (!CollectionUtils.isEmpty(productionPartContextList)) //存在产出零件 不存在进料主条码
|
||||||
// doMatchAssemblyHasPpAndPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList);
|
doMatchAssemblyHasPp(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, prodRuleContextList, equipVariableCollectContextList);
|
||||||
// else if (!CollectionUtils.isEmpty(productionPartContextList)) //存在产出零件 不存在进料主条码
|
else if (!CollectionUtils.isEmpty(productionPsInContextList)) //不存在产出零件 存在进料主条码
|
||||||
// doMatchAssemblyHasPp(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPartContextList, prodRuleContextList, equipVariableCollectContextList);
|
doMatchAssemblyHasPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList);
|
||||||
// else if (!CollectionUtils.isEmpty(productionPsInContextList)) //不存在产出零件 存在进料主条码
|
else if (StringUtils.isEmpty(cavityUnknownCfg)) //不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则
|
||||||
// doMatchAssemblyHasPs(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, productionPsInContextList, prodRuleContextList, equipVariableCollectContextList);
|
doMatchAssemblyHasCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList);
|
||||||
// else if (StringUtils.isEmpty(cavityUnknownCfg)) //不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则
|
else //不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则
|
||||||
// doMatchAssemblyHasCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList);
|
doMatchAssemblyUnknowCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList);
|
||||||
// else //不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则
|
|
||||||
// doMatchAssemblyUnknowCavity(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext, prodRuleContextList, equipVariableCollectContextList);
|
return stepResult;
|
||||||
//
|
|
||||||
//
|
}
|
||||||
// return stepResult;
|
|
||||||
//
|
//存在产出零件 存在进料主条码
|
||||||
// }
|
private StepResult doMatchAssemblyHasPpAndPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult,
|
||||||
//
|
List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList,
|
||||||
//// //计算实际需要的腔数
|
List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
||||||
//// private Integer getNeedCavity(List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList, MesCellEquipContext cellEquipContext) {
|
|
||||||
////
|
//存在产出零件 存在进料主条码 不存在待验证装配件条码
|
||||||
//// List<MesProductionPartContext> ppList = CollectionUtils.isEmpty(productionPartContextList) ? null : productionPartContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList());
|
if (CollectionUtils.isEmpty(equipVariableCollectContextList))
|
||||||
//// List<MesProductionPsInContext> psList = CollectionUtils.isEmpty(productionPsInContextList) ? null : productionPsInContextList.stream().filter(o -> (null != o && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList());
|
return hasUnBindAssembly(prodRuleContextList) ?
|
||||||
////
|
stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg("当前上下文中不存在待验证的装配件条码,但还存在未装配的装配件清单!") :
|
||||||
//// Integer ppSize = CollectionUtils.isEmpty(ppList) ? MesPcnExtConstWords.ZERO : ppList.size();
|
(productionPartContextList.size() == productionPsInContextList.size() ? stepResult :
|
||||||
//// Integer psSize = CollectionUtils.isEmpty(psList) ? MesPcnExtConstWords.ZERO : psList.size();
|
stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(
|
||||||
////
|
String.format("当前上下文中不存在待验证的装配件条码,请扫描第[%s]腔主条码,共[%s]腔!", productionPsInContextList.size() + MesPcnExtConstWords.ONE, productionPartContextList.size())));
|
||||||
//// if (!CollectionUtils.isEmpty(productionPartContextList) && !CollectionUtils.isEmpty(productionPsInContextList)) return (productionPartContextList.size() == productionPsInContextList.size()) ? psSize
|
|
||||||
////
|
//遍历产品加工规则
|
||||||
////
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
||||||
//// }
|
|
||||||
//
|
//没有装配件的条件
|
||||||
// //存在产出零件 存在进料主条码
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
||||||
// private StepResult doMatchAssemblyHasPpAndPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
|
||||||
//
|
//获取非排序装配件清单
|
||||||
// if (CollectionUtils.isEmpty(prodRuleContextList)) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前上下文中不存在非排序加工规则数据,请重置工序!");
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
||||||
//
|
|
||||||
// //存在产出零件 存在进料主条码 不存在待验证装配件条码
|
//遍历装配件清单
|
||||||
// if (CollectionUtils.isEmpty(equipVariableCollectContextList))
|
for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
|
||||||
// return hasUnBindAssembly(prodRuleContextList) ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg("当前上下文中不存在待验证的装配件条码,但存在未装配的装配件清单!") :
|
|
||||||
// (productionPartContextList.size() == productionPsInContextList.size() ? stepResult :
|
//已装配
|
||||||
// stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(String.format("当前上下文中不存在待验证的装配件条码,请扫描第[%s]腔主条码,共[%s]腔", productionPsInContextList.size() + MesPcnExtConstWords.ONE, productionPartContextList.size())));
|
if (null == productionAssemblyNosortContext || productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) continue;
|
||||||
//
|
|
||||||
// Boolean result = false;
|
//遍历装配件条码
|
||||||
//
|
for (MesEquipVariableCollectContext equipVariableCollectContext : equipVariableCollectContextList) {
|
||||||
// //遍历产品加工规则
|
|
||||||
// for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
//已被消费
|
||||||
//
|
if (null == equipVariableCollectContext || equipVariableCollectContext.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) continue;
|
||||||
// //没有装配件的条件
|
|
||||||
// if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
//匹配规则
|
||||||
//
|
List<MesProductionAssemblyNosortContext> filterList = (List<MesProductionAssemblyNosortContext>)
|
||||||
// //获取非排序装配件清单
|
numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), Stream.of(productionAssemblyNosortContext).collect(Collectors.toList()));
|
||||||
// List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
|
||||||
//
|
//匹配失败
|
||||||
// //遍历装配件清单
|
if (CollectionUtils.isEmpty(filterList)) continue;
|
||||||
// for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
|
|
||||||
//
|
//匹配成功
|
||||||
// //已装配
|
equipVariableCollectContext.isConsume();
|
||||||
// if (null == productionAssemblyNosortContext || productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) continue;
|
|
||||||
//
|
//装配件清单该数据标记已装配
|
||||||
// //遍历装配件条码
|
productionAssemblyNosortContext.assemblyStatus().assemblySn(equipVariableCollectContext.getEquipVariableValue());
|
||||||
// for (MesEquipVariableCollectContext equipVariableCollectContext : equipVariableCollectContextList) {
|
|
||||||
//
|
}
|
||||||
// //已被消费
|
|
||||||
// if (null == equipVariableCollectContext || equipVariableCollectContext.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) continue;
|
//是否验证顺序装配
|
||||||
//
|
if (!StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) &&
|
||||||
// //匹配规则
|
prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 &&
|
||||||
// List<MesProductionAssemblyNosortContext> filterList = (List<MesProductionAssemblyNosortContext>) numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), Stream.of(productionAssemblyNosortContext).collect(Collectors.toList()));
|
productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) break;
|
||||||
//
|
|
||||||
// //匹配失败
|
}
|
||||||
// if (CollectionUtils.isEmpty(filterList)) continue;
|
|
||||||
//
|
//TODO 发送设备加工参数
|
||||||
// result = true;
|
if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0) doSendEquipProdParam(reqBean, resultBean, stepResult, prodRuleContext, productionAssemblyNosortContextList);
|
||||||
//
|
|
||||||
// //匹配成功
|
}
|
||||||
// equipVariableCollectContext.isConsume();
|
|
||||||
//
|
List<MesEquipVariableCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList());
|
||||||
// //装配件清单该数据标记已装配
|
|
||||||
// productionAssemblyNosortContext.assemblyStatus().assemblySn(equipVariableCollectContext.getEquipVariableValue());
|
if (CollectionUtils.isEmpty(filterList)) {
|
||||||
//
|
|
||||||
// }
|
Boolean hasUnBindAssembly = hasUnBindAssembly(prodRuleContextList);
|
||||||
//
|
if ((!hasUnBindAssembly && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) == 0) || equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0)
|
||||||
// //是否验证顺序装配
|
productionDispatchContextStepService.saveProdRuleDataContext(reqBean, prodRuleContextList);
|
||||||
// if (!StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) &&
|
|
||||||
// prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 &&
|
String msg = String.format("当前上下文中的装配件条码%s匹配完成", filterList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString());
|
||||||
// productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) break;
|
return hasUnBindAssembly ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(String.format("%s,但还存在未装配的装配件清单!", msg)) :
|
||||||
//
|
(productionPartContextList.size() == productionPsInContextList.size() ? stepResult.msg(msg) :
|
||||||
// }
|
stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(
|
||||||
//
|
String.format("%s,请扫描第[%s]腔主条码,共[%s]腔!", msg, productionPsInContextList.size() + MesPcnExtConstWords.ONE, productionPartContextList.size())));
|
||||||
// //TODO 发送设备加工参数
|
} else {
|
||||||
// if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0) doSendEquipProdParam(reqBean, resultBean, stepResult, prodRuleContext, productionAssemblyNosortContextList);
|
String msg = String.format("当前上下文中的装配件条码%s匹配失败", filterList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString());
|
||||||
//
|
return hasUnBindAssembly(prodRuleContextList) ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(String.format("%s,但还存在未装配的装配件清单!", msg)) :
|
||||||
// }
|
(productionPartContextList.size() == productionPsInContextList.size() ? stepResult.msg(String.format("%s,但不存在未装配的装配件清单!", msg)) :
|
||||||
//
|
stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(
|
||||||
// if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 && result)
|
String.format("%s,请扫描第[%s]腔主条码,共[%s]腔!", msg, productionPsInContextList.size() + MesPcnExtConstWords.ONE, productionPartContextList.size())));
|
||||||
//
|
|
||||||
//
|
}
|
||||||
//
|
|
||||||
//
|
}
|
||||||
// return stepResult;
|
|
||||||
//
|
//验证是否存在待绑定数据
|
||||||
// }
|
private Boolean hasUnBindAssembly(List<MesProdRuleContext> prodRuleContextList) {
|
||||||
//
|
Boolean hasUnBindAssembly = false;
|
||||||
// //验证是否存在待绑定数据
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
||||||
// private Boolean hasUnBindAssembly(List<MesProdRuleContext> prodRuleContextList) {
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
||||||
// Boolean hasUnBindAssembly = false;
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
||||||
// for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
Optional<MesProductionAssemblyNosortContext> optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
|
||||||
// if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
if (null == optional || !optional.isPresent()) continue;
|
||||||
// List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
hasUnBindAssembly = true;
|
||||||
// Optional<MesProductionAssemblyNosortContext> optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
|
break;
|
||||||
// if (null == optional || !optional.isPresent()) continue;
|
}
|
||||||
// hasUnBindAssembly = true;
|
return hasUnBindAssembly;
|
||||||
// break;
|
}
|
||||||
// }
|
|
||||||
// return hasUnBindAssembly;
|
//存在产出零件 不存在进料主条码
|
||||||
// }
|
private StepResult doMatchAssemblyHasPp(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProductionPartContext> productionPartContextList, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
||||||
//
|
|
||||||
//
|
//存在产出零件 存在进料主条码 不存在待验证装配件条码
|
||||||
//
|
if (CollectionUtils.isEmpty(equipVariableCollectContextList))
|
||||||
//
|
return hasUnBindAssembly(prodRuleContextList) ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg("当前上下文中不存在待验证的装配件条码,但还存在未装配的装配件清单!") : stepResult;
|
||||||
//
|
|
||||||
//
|
//遍历产品加工规则
|
||||||
//
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
||||||
//
|
|
||||||
//
|
//没有装配件的条件
|
||||||
//
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
||||||
// //存在产出零件 不存在进料主条码
|
|
||||||
// private void doMatchAssemblyHasPp(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProductionPartContext> productionPartContextList, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
//获取非排序装配件清单
|
||||||
// }
|
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
|
||||||
//
|
|
||||||
// //不存在产出零件 存在进料主条码
|
//遍历装配件清单
|
||||||
// private void doMatchAssemblyHasPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProductionPsInContext> productionPsInContextList, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
|
||||||
// }
|
|
||||||
//
|
//已装配
|
||||||
// //不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则
|
if (null == productionAssemblyNosortContext || productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) continue;
|
||||||
// private void doMatchAssemblyHasCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
|
||||||
// }
|
//遍历装配件条码
|
||||||
//
|
for (MesEquipVariableCollectContext equipVariableCollectContext : equipVariableCollectContextList) {
|
||||||
// //不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则
|
|
||||||
// private void doMatchAssemblyUnknowCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
//已被消费
|
||||||
// }
|
if (null == equipVariableCollectContext || equipVariableCollectContext.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) continue;
|
||||||
//
|
|
||||||
// //TODO 发送设备加工参数
|
//匹配规则
|
||||||
// private void doSendEquipProdParam(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProdRuleContext prodRuleContext, List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList) {
|
List<MesProductionAssemblyNosortContext> filterList = (List<MesProductionAssemblyNosortContext>)
|
||||||
// Optional<MesProductionAssemblyNosortContext> optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
|
numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), Stream.of(productionAssemblyNosortContext).collect(Collectors.toList()));
|
||||||
// if (null != optional && optional.isPresent()) return;
|
|
||||||
//
|
//匹配失败
|
||||||
// }
|
if (CollectionUtils.isEmpty(filterList)) continue;
|
||||||
//
|
|
||||||
//}
|
//匹配成功
|
||||||
|
equipVariableCollectContext.isConsume();
|
||||||
|
|
||||||
|
//装配件清单该数据标记已装配
|
||||||
|
productionAssemblyNosortContext.assemblyStatus().assemblySn(equipVariableCollectContext.getEquipVariableValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//是否验证顺序装配
|
||||||
|
if (!StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) &&
|
||||||
|
prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0 &&
|
||||||
|
productionAssemblyNosortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO 发送设备加工参数
|
||||||
|
if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0) doSendEquipProdParam(reqBean, resultBean, stepResult, prodRuleContext, productionAssemblyNosortContextList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MesEquipVariableCollectContext> filterList = equipVariableCollectContextList.stream().filter(o -> (null != o && o.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(filterList)) {
|
||||||
|
Boolean hasUnBindAssembly = hasUnBindAssembly(prodRuleContextList);
|
||||||
|
if ((!hasUnBindAssembly && equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) == 0) || equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()) != 0)
|
||||||
|
productionDispatchContextStepService.saveProdRuleDataContext(reqBean, prodRuleContextList);
|
||||||
|
String msg = String.format("当前上下文中的装配件条码%s匹配完成", filterList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString());
|
||||||
|
return hasUnBindAssembly ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(String.format("%s,但还存在未装配的装配件清单!", msg)) : stepResult.msg(msg);
|
||||||
|
} else {
|
||||||
|
String msg = String.format("当前上下文中的装配件条码%s匹配失败", filterList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString());
|
||||||
|
return hasUnBindAssembly(prodRuleContextList) ? stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY).msg(String.format("%s,但还存在未装配的装配件清单!", msg)) : stepResult.msg(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//不存在产出零件 存在进料主条码
|
||||||
|
private void doMatchAssemblyHasPs(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProductionPsInContext> productionPsInContextList, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//不存在产出零件 不存在进料主条码 根据设备腔数反向匹配加工规则
|
||||||
|
private void doMatchAssemblyHasCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//不存在产出零件 不存在进料主条码 未知腔数 反向完成匹配后获取对应的加工规则
|
||||||
|
private void doMatchAssemblyUnknowCavity(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO 发送设备加工参数
|
||||||
|
private void doSendEquipProdParam(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesProdRuleContext prodRuleContext, List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList) {
|
||||||
|
Optional<MesProductionAssemblyNosortContext> optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
|
||||||
|
if (null != optional && optional.isPresent()) return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue