|
|
|
@ -1,32 +1,29 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
|
|
|
|
|
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.api.busi.IMesWorkOrderCutService;
|
|
|
|
|
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.mes.pcn.util.PojoAttrUtil;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCutSchemeEquipment;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleIgnoreCfg;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleNosortCfg;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.AttrBean;
|
|
|
|
|
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 com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
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.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -48,15 +45,6 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
private IMesProdRuleCfgExtService prodRuleCfgExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesTimeEfficientCfgMatchService timeEfficientCfgMatchService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesWorkOrderExtService workOrderExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesWorkOrderCutService workOrderCutService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -66,8 +54,8 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
|
|
|
|
|
StepResult stepResult = StepResult.getSuccessComplete();
|
|
|
|
|
|
|
|
|
|
//获取上下文信息
|
|
|
|
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
|
|
|
|
//获取上下文信息: 处理加工不可用规则
|
|
|
|
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchProdRuleIgnoreCfgContext(reqBean);
|
|
|
|
|
|
|
|
|
|
//配置错误 抛出异常
|
|
|
|
|
if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
|
|
|
@ -92,15 +80,9 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
Integer initSize = prodRuleContextList.size();
|
|
|
|
|
|
|
|
|
|
//封装非排序加工规则
|
|
|
|
|
if (!doHandleProdRuleData(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext,
|
|
|
|
|
if (!doHandleProdRuleDataByProductionPart(reqBean, resultBean, stepResult, productionProcessContext, cellEquipContext,
|
|
|
|
|
prodRuleContextList, productionPartContextList, productionPsInContextList).isCompleted()) return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, stepResult.getMsg());
|
|
|
|
|
|
|
|
|
|
//匹配失败需要清除本次扫描/读取信息
|
|
|
|
|
//if (!stepResult.isCompleted() && doBusiCheckToDelete(reqBean, stepResult, productionPartContextList, productionPsInContextList))
|
|
|
|
|
// return stepResult.nextTriggerEvent(CollectionUtils.isEmpty(productionPsInContextList) ?
|
|
|
|
|
// MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PART_NO :
|
|
|
|
|
// (!StringUtils.isEmpty(stepResult.getObj()) ? MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PART_NO : MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN));
|
|
|
|
|
|
|
|
|
|
if (prodRuleContextList.size() != initSize) {
|
|
|
|
|
//保存上下文产品加工规则信息集合
|
|
|
|
|
productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList);
|
|
|
|
@ -113,18 +95,6 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "匹配完成!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StepResult doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult,
|
|
|
|
|
MesProductionProcessContext productionProcessContext,
|
|
|
|
|
MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList,
|
|
|
|
|
List<MesProductionPartContext> productionPartContextList,
|
|
|
|
|
List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//根据是否存在【产出零件数据】获取剩余待匹配的加工规则数据 (只能查询到一条,否则报错)
|
|
|
|
|
return doHandleProdRuleDataByProductionPart(reqBean, resultBean, stepResult, productionProcessContext,
|
|
|
|
|
cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据是否存在【产出零件数据】获取剩余待匹配的加工规则数据 (只能查询到一条,否则报错)
|
|
|
|
|
private StepResult doHandleProdRuleDataByProductionPart(StationRequestBean reqBean, StationResultBean resultBean,
|
|
|
|
|
StepResult stepResult,
|
|
|
|
@ -134,9 +104,6 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
List<MesProductionPartContext> productionPartContextList,
|
|
|
|
|
List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//加工规则的数据已与产出零件的数量一致
|
|
|
|
|
//if (!CollectionUtils.isEmpty(prodRuleContextList) && prodRuleContextList.size() == productionPartContextList.size()) return stepResult;
|
|
|
|
|
|
|
|
|
|
log.info("doHandleProdRuleDataByProductionPart --- productionPartContextList --- outPartNoList:{}", productionPartContextList.stream().map(MesProductionPartContext::getPartNo).collect(Collectors.toList()));
|
|
|
|
|
|
|
|
|
|
log.info("doHandleProdRuleDataByProductionPart --- productionPartContextList:{}", productionPartContextList);
|
|
|
|
@ -157,8 +124,6 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
//根据产出零件条件获取匹配当前产出零件的加工规则数据(只能查询到一条,否则报错)
|
|
|
|
|
return doHandleProdRuleDataByProductionPartAndEmptyProductSn(reqBean, resultBean, stepResult, productionProcessContext,
|
|
|
|
|
cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList, outPartNoList, foreignKey);
|
|
|
|
|
//存在【产出零件数据】信息, 存在【进料零件条码信息】 获取匹配当前产出零件的加工规则数据 (只能查询到一条,否则报错)
|
|
|
|
|
//else return doHandleProdRuleDataByProductionPartAndProductSn(reqBean, resultBean, stepResult, workCenter, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList, outPartNoList, foreignKey);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -167,6 +132,9 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesProductionPartContext> productionPartContextList,
|
|
|
|
|
List<MesProductionPsInContext> productionPsInContextList, List<String> outPartNoList, Integer foreignKey) {
|
|
|
|
|
|
|
|
|
|
//获取加工不可用规则
|
|
|
|
|
Map<String, List<MesProdRuleIgnoreCfg>> prodRuleIgnoreCfgMap = productionProcessContextStepService.getProdRuleIgnoreCfgContextMap(reqBean, productionProcessContext);
|
|
|
|
|
|
|
|
|
|
//【非排序线】获取产品加工规则 ; 条件进料[NULL]
|
|
|
|
|
List<MesProdRuleNosortCfg> prodRuleNosortCfgList = prodRuleCfgExtService.getProdRuleNosortCfgList(new MesProdRuleContext(reqBean.getOrganizeCode()).equipmentCode(cellEquipContext.getEquipmentCode()).outPartNos(outPartNoList).inPartIsEmpty(true));
|
|
|
|
|
|
|
|
|
@ -198,10 +166,11 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format(
|
|
|
|
|
"设备[%s]产出零件[%s]进料零件[空]%s加工规则配置信息!", cellEquipContext.getEquipmentName(), productionPartContext.getPartNo(), CollectionUtils.isEmpty(filterList) ? "未匹配到" : String.format("匹配到[%s]条", filterList.size())));
|
|
|
|
|
}
|
|
|
|
|
//【非排序线】获取产品加工规则对应的装配件信息
|
|
|
|
|
//【非排序线】获取产品加工规则对应的装配件信息 -同时- 关联不可用规则
|
|
|
|
|
MesProdRuleContext prodRuleContext = prodRuleCfgExtService.getProdRuleNosortContext(
|
|
|
|
|
new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode())
|
|
|
|
|
.copy(filterList.get(0)).workOrderNo(productionPartContext.getWorkOrderNo()).foreignKey(productionPartContext.foreignKey(foreignKey += 1).getForeignKey()));
|
|
|
|
|
.copy(filterList.get(0)).workOrderNo(productionPartContext.getWorkOrderNo()).foreignKey(productionPartContext.foreignKey(foreignKey += 1).getForeignKey()),
|
|
|
|
|
prodRuleIgnoreCfgMap);
|
|
|
|
|
//prodRuleContext.setIsPrint(cutSchemeEquipment.getIsPrint());
|
|
|
|
|
prodRuleContextList.add(prodRuleContext);
|
|
|
|
|
|
|
|
|
@ -216,353 +185,10 @@ public class MesWorkOrderCutMatchingProdRuleStepService extends BaseStepService
|
|
|
|
|
return stepResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 1 遍历 MesProductionPartContext 对工单号分组
|
|
|
|
|
* 2 不同的单号,查询对应的工单数量和完成数量,进行对比
|
|
|
|
|
* 3 是否超报工和报工比例,
|
|
|
|
|
* @param reqBean
|
|
|
|
|
* @param productionPartContextList
|
|
|
|
|
* @param workCenter
|
|
|
|
|
* @param stepResult
|
|
|
|
|
* @param resultBean
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private StepResult validSuperWorkOrder(StationRequestBean reqBean, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList, MesWorkCenter workCenter, StepResult stepResult, StationResultBean resultBean) {
|
|
|
|
|
// 验证超工单
|
|
|
|
|
log.info("验证是否超工单begin ->");
|
|
|
|
|
|
|
|
|
|
//判断是否还存在待匹配的主条码信息, 内部循环匹配成功会标记 foreignKey
|
|
|
|
|
Optional<MesProductionPartContext> optional = productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkOrderNo()))).findFirst();
|
|
|
|
|
if (null == optional || !optional.isPresent()) return stepResult;
|
|
|
|
|
|
|
|
|
|
// 对MesProductionPartContext中的工单号经行分组,每个工单可能对应多条数据,筛选掉foreignkey为空的数据
|
|
|
|
|
Map<String, List<MesProductionPartContext>> productionPartContextMap = productionPartContextList.stream().filter(productionPartContext -> !StringUtils.isEmpty(productionPartContext.getForeignKey()))
|
|
|
|
|
.collect(Collectors.groupingBy(MesProductionPartContext::getWorkOrderNo));
|
|
|
|
|
// 获取涉及到的所有工单列表
|
|
|
|
|
List<MesWorkOrder> workOrderList = workOrderExtService.getWorkOrderList(reqBean.getOrganizeCode(), new ArrayList<>(productionPartContextMap.keySet()));
|
|
|
|
|
|
|
|
|
|
// 对工单经行分组
|
|
|
|
|
Map<String, List<MesWorkOrder>> orderListMap = workOrderList.stream().collect(Collectors.groupingBy(MesWorkOrder::getWorkOrderNo));
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<MesProductionPartContext>> entry : productionPartContextMap.entrySet()) {
|
|
|
|
|
String workOrder = entry.getKey();
|
|
|
|
|
List<MesProductionPartContext> productionPartContexts = entry.getValue();
|
|
|
|
|
MesWorkOrder mesWorkOrder = orderListMap.get(workOrder).get(0);
|
|
|
|
|
|
|
|
|
|
Double complateQty = mesWorkOrder.getCompleteQty() + productionPartContexts.size();
|
|
|
|
|
Double qty = mesWorkOrder.getQty();
|
|
|
|
|
log.info("验证超工单,工单号【{}】,qty=【{}】,complateQty =【{}】begin ->", mesWorkOrder.getWorkOrderNo(), qty, complateQty);
|
|
|
|
|
// 如果预完成数量 小于等于工单数量,则直接过
|
|
|
|
|
if (complateQty <= qty) continue;
|
|
|
|
|
|
|
|
|
|
// 以下则是超工单逻辑
|
|
|
|
|
// 如果产线中没有配置超工单,则直接阻断
|
|
|
|
|
if (!Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), workCenter.getIsCheckOrderQty())) {
|
|
|
|
|
productionPartContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.obj(false), String.format("请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],且未配置超工单!", workOrder, mesWorkOrder.getQty().intValue(), complateQty.intValue()));
|
|
|
|
|
}
|
|
|
|
|
// 如果配置了超工单,且比例已经超过了配置的超工单比例,也需要阻断
|
|
|
|
|
Double rate = (complateQty - qty)/qty;
|
|
|
|
|
if (rate > workCenter.getOrderRate()/100) {
|
|
|
|
|
productionPartContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList)) productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult.obj(false), String.format("请检查工单数量,工单号[%s],工单数量[%s]预完成数量[%s],配置了超工单,但超过了比例[%s]!", workOrder, mesWorkOrder.getQty().intValue(), complateQty.intValue(), workCenter.getOrderRate()));
|
|
|
|
|
}
|
|
|
|
|
log.info("验证超工单,工单号【{}】,qty=【{}】,complateQty =【{}】,isCheckOrderQty=【{}】, rate = 【{}】end ->", mesWorkOrder.getWorkOrderNo(), qty, complateQty,workCenter.getIsCheckOrderQty(),rate);
|
|
|
|
|
}
|
|
|
|
|
log.info("验证是否超工单end ->");
|
|
|
|
|
return stepResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//没有【产出零件数据】信息 , 根据进料条件获取匹配加工规则数据(只能查询到一条,否则报错)
|
|
|
|
|
private StepResult doHandleProdRuleDataByProductSn(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter, MesProductionProcessContext productionProcessContext,
|
|
|
|
|
MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList, List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//【非排序线】获取产品加工规则 ; 分别根据 进料零件有值 与 进料规则不为空 查询 再合并数据返回
|
|
|
|
|
List<MesProdRuleNosortCfg> prodRuleNosortCfgList = getProdRuleNosortCfgList(reqBean, cellEquipContext, productionPsInContextList, null);
|
|
|
|
|
|
|
|
|
|
//拿到当前最大的foreignKey
|
|
|
|
|
Optional<MesProductionPsInContext> maxForeignKeyOptional = productionPsInContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).max(Comparator.comparing(MesProductionPsInContext::getForeignKey));
|
|
|
|
|
Integer foreignKey = (null != maxForeignKeyOptional && maxForeignKeyOptional.isPresent()) ? maxForeignKeyOptional.get().getForeignKey() : MesPcnExtConstWords.ZERO;
|
|
|
|
|
|
|
|
|
|
for (MesProductionPsInContext productionPsInContext : productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//foreignKey有值代表已经匹配过产品加工规则
|
|
|
|
|
if (null == productionPsInContext || productionPsInContext.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || !StringUtils.isEmpty(productionPsInContext.getForeignKey())) continue;
|
|
|
|
|
|
|
|
|
|
List<MesProdRuleNosortCfg> filterList;
|
|
|
|
|
//搜集进料零件号匹配的产品加工规则
|
|
|
|
|
if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) filterList = filterProdRuleNosortCfgList(prodRuleNosortCfgList, productionPsInContext.getPartNo());
|
|
|
|
|
//进料零件条码匹配进料零件规则
|
|
|
|
|
else filterList = (List<MesProdRuleNosortCfg>) numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), filterProdRuleNosortCfgList(prodRuleNosortCfgList));
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(filterList) || filterList.size() > 1) {
|
|
|
|
|
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
|
|
|
|
|
else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("设备[%s]与进料零件条码%s加工规则配置信息! 进料零件条码[%s]%s",
|
|
|
|
|
cellEquipContext.getEquipmentName(), CollectionUtils.isEmpty(filterList) ? "未匹配到" : String.format("匹配到[%s]条", filterList.size()), productionPsInContext.getProductSn(),
|
|
|
|
|
StringUtils.isEmpty(productionPsInContext.getPartNo()) ? "为外协件" : String.format("当前零件号[%s]", productionPsInContext.getPartNo())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时效性验证
|
|
|
|
|
if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) {
|
|
|
|
|
Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), filterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
|
|
|
|
|
|
|
|
|
|
if (!(Boolean) result.get(MesPcnExtConstWords.RESULT)) {
|
|
|
|
|
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
|
|
|
|
|
else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(productionPsInContext.getProductSn()), stepResult, (String) result.get(MesPcnExtConstWords.MESSAGE));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//【非排序线】获取产品加工规则对应的装配件信息
|
|
|
|
|
MesProdRuleContext prodRuleContext = prodRuleCfgExtService.getProdRuleNosortContext(
|
|
|
|
|
new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode())
|
|
|
|
|
.copy(filterList.get(0)).productSn(productionPsInContext.getProductSn()).foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey()));
|
|
|
|
|
prodRuleContextList.add(prodRuleContext);
|
|
|
|
|
|
|
|
|
|
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- 设备:{} 进料零件条码:{} 产品加工规则:{} ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
|
|
|
|
|
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), cellEquipContext.getEquipmentCode(), JSONObject.toJSONString(productionPsInContext), JSONObject.toJSONString(prodRuleContext));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stepResult;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesProdRuleNosortCfg> getProdRuleNosortCfgList(StationRequestBean reqBean, MesCellEquipContext cellEquipContext, List<MesProductionPsInContext> productionPsInContextList, List<String> outPartNoList) {
|
|
|
|
|
//【非排序线】获取产品加工规则 ; 分别根据 进料零件有值 与 进料规则不为空 查询 再合并数据返回, 条件可能携带产出零件
|
|
|
|
|
List<String> inPartNoList = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && !StringUtils.isEmpty(o.getPartNo()))).map(MesProductionPsInContext::getPartNo).collect(Collectors.toList());
|
|
|
|
|
Optional<MesProductionPsInContext> 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<MesProdRuleNosortCfg> 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()).inPartIsEmpty(true).inPartRuleIsEmpty(false).outPartNos(outPartNoList) : null);
|
|
|
|
|
return prodRuleNosortCfgList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//存在【产出零件数据】信息, 存在【进料零件条码信息】 获取匹配当前产出零件的加工规则数据 (只能查询到一条,否则报错)
|
|
|
|
|
private StepResult doHandleProdRuleDataByProductionPartAndProductSn(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext,
|
|
|
|
|
List<MesProdRuleContext> prodRuleContextList, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList, List<String> outPartNoList, Integer foreignKey) {
|
|
|
|
|
|
|
|
|
|
//【非排序线】获取产品加工规则 ; 分别根据 进料零件有值 与 进料规则不为空 查询 再合并数据返回, 条件携带产出零件
|
|
|
|
|
List<MesProdRuleNosortCfg> prodRuleNosortCfgList = getProdRuleNosortCfgList(reqBean, cellEquipContext, productionPsInContextList, outPartNoList);
|
|
|
|
|
|
|
|
|
|
//TODO 提示优化 直接根除产出零件去查询,判断产出零件对应的加工规则是不是仅仅维护了一个
|
|
|
|
|
//List<MesProdRuleNosortCfg> prodRuleNosortCfgList = prodRuleCfgExtService.getProdRuleNosortCfgList(new MesProdRuleContext(reqBean.getOrganizeCode()).equipmentCode(cellEquipContext.getEquipmentCode()).outPartNos(outPartNoList));
|
|
|
|
|
|
|
|
|
|
//根据产出零件分组数据
|
|
|
|
|
Map<String, List<MesProdRuleNosortCfg>> prodRuleNosortCfgMap = groupProdRuleNosortCfgList(prodRuleNosortCfgList);
|
|
|
|
|
|
|
|
|
|
for (MesProductionPartContext productionPartContext : productionPartContextList) {
|
|
|
|
|
|
|
|
|
|
//foreignKey有值代表已经匹配过产品加工规则
|
|
|
|
|
if (null == productionPartContext || productionPartContext.getIsFinishCode()
|
|
|
|
|
.compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || !StringUtils.isEmpty(productionPartContext.getForeignKey())) continue;
|
|
|
|
|
|
|
|
|
|
//获取匹配产出零件的所有加工规则
|
|
|
|
|
List<MesProdRuleNosortCfg> outPartNoProdRuleList = !CollectionUtils.isEmpty(prodRuleNosortCfgMap) ? prodRuleNosortCfgMap.get(productionPartContext.getPartNo()) : null;
|
|
|
|
|
|
|
|
|
|
MesProductionPsInContext productSn = null;
|
|
|
|
|
|
|
|
|
|
//判断是否还存在待匹配的主条码信息, 内部循环匹配成功会标记 foreignKey
|
|
|
|
|
Optional<MesProductionPsInContext> 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;
|
|
|
|
|
|
|
|
|
|
List<MesProdRuleNosortCfg> innerfilterList = null;
|
|
|
|
|
for (MesProductionPsInContext productionPsInContext : productionPsInContextList) {
|
|
|
|
|
|
|
|
|
|
//foreignKey有值代表已经匹配过产品加工规则
|
|
|
|
|
if (null == productionPsInContext || productionPartContext.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || !StringUtils.isEmpty(productionPsInContext.getForeignKey())) continue;
|
|
|
|
|
|
|
|
|
|
//搜集进料零件号匹配的产品加工规则
|
|
|
|
|
if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) innerfilterList = filterProdRuleNosortCfgList(outPartNoProdRuleList, productionPsInContext.getPartNo());
|
|
|
|
|
//进料零件条码匹配进料零件规则
|
|
|
|
|
else innerfilterList = (List<MesProdRuleNosortCfg>) numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), filterProdRuleNosortCfgList(outPartNoProdRuleList));
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(innerfilterList) || innerfilterList.size() > 1) continue;
|
|
|
|
|
|
|
|
|
|
//验证进出一致
|
|
|
|
|
if (!StringUtils.isEmpty(productionPsInContext.getPartNo()) && productionPsInContext.getPartNo().equals(productionPartContext.getPartNo())) {
|
|
|
|
|
|
|
|
|
|
//进料工单必须与产出工单一致
|
|
|
|
|
if (!StringUtils.isEmpty(productionPartContext.getWorkOrderNo()) && !StringUtils.isEmpty(productionPsInContext.getWorkOrderNo()) && !productionPsInContext.getWorkOrderNo().equals(productionPartContext.getWorkOrderNo())) {
|
|
|
|
|
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
|
|
|
|
|
else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(productionPsInContext.getProductSn()), stepResult, String.format("主条码[%s]零件号[%s]关联的加工单[%s]与产出零件[%s]关联的加工单[%s]不一致!",
|
|
|
|
|
productionPsInContext.getProductSn(), productionPsInContext.getPartNo(), productionPsInContext.getWorkOrderNo(), productionPartContext.getPartNo(), productionPartContext.getWorkOrderNo()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//进料存在工单且已经过某工序生产, 不能匹配无工单的产出零件
|
|
|
|
|
if (StringUtils.isEmpty(productionPartContext.getWorkOrderNo()) && !StringUtils.isEmpty(productionPsInContext.getWorkOrderNo()) && !StringUtils.isEmpty(productionPsInContext.getProcessCode())) {
|
|
|
|
|
if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
|
|
|
|
|
else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(productionPsInContext.getProductSn()), stepResult, String.format("主条码[%s]零件号[%s]已关联加工单[%s]且已经过工序[%s]工艺[%s],不支持匹配当前未关联加工单的产出零件[%s]",
|
|
|
|
|
productionPsInContext.getProductSn(), productionPsInContext.getPartNo(), productionPsInContext.getWorkOrderNo(), productionPsInContext.getProcessCode(), productionPsInContext.getCraftCode(), productionPartContext.getPartNo()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时效性验证
|
|
|
|
|
//if (!StringUtils.isEmpty(productionPsInContext.getPartNo())) {
|
|
|
|
|
// Map<String, Object> result = timeEfficientCfgMatchService.checkSnTimeliness(reqBean.getOrganizeCode(), productionPsInContext.getProductSn(), innerfilterList.get(0).getId(), MesExtEnumUtil.TIME_DATA_SOURCE.DATA_SOURCE20.getValue());
|
|
|
|
|
//
|
|
|
|
|
// if (!(Boolean)result.get(MesPcnExtConstWords.RESULT)) {
|
|
|
|
|
// if (productionPsInContext.getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) productionPsInContext.busiCheckToDelete();
|
|
|
|
|
// else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
// return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(productionPsInContext.getProductSn()), stepResult, (String) result.get(MesPcnExtConstWords.MESSAGE));
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
productionPartContext.foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey());
|
|
|
|
|
productSn = productionPsInContext;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//【非排序线】获取产品加工规则对应的装配件信息
|
|
|
|
|
if (!CollectionUtils.isEmpty(innerfilterList) && innerfilterList.size() == 1) {
|
|
|
|
|
|
|
|
|
|
MesProdRuleContext prodRuleContext = prodRuleCfgExtService.getProdRuleNosortContext(new MesProdRuleContext(
|
|
|
|
|
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
|
|
|
|
|
reqBean.getProcessCode(), productionProcessContext.getCraftCode()).
|
|
|
|
|
copy(innerfilterList.get(0)).workOrderNo(productionPartContext.getWorkOrderNo()).productSn(productSn.getProductSn()))
|
|
|
|
|
.foreignKey(productionPartContext.getForeignKey());
|
|
|
|
|
prodRuleContextList.add(prodRuleContext);
|
|
|
|
|
|
|
|
|
|
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- 设备:{} 产出零件信息:{} 进料零件条码:{} 产品加工规则:{} ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
|
|
|
|
|
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), cellEquipContext.getEquipmentCode(), JSONObject.toJSONString(productionPartContext), JSONObject.toJSONString(productSn), JSONObject.toJSONString(prodRuleContext));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////判断是否还存在待匹配的主条码信息
|
|
|
|
|
//Optional<MesProductionPsInContext> 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()) {
|
|
|
|
|
// if (optional.get().getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) == 0) optional.get().busiCheckToDelete();
|
|
|
|
|
// else productionPsInContextList.forEach(o -> o.busiCheckToDelete());
|
|
|
|
|
// String productSnStr = productionPsInContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0))
|
|
|
|
|
// .map(o -> String.format(" 进料零件条码[%s]%s", o.getProductSn(), StringUtils.isEmpty(o.getPartNo()) ? "为外协件" : String.format("当前零件号[%s]", o.getPartNo()))).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON));
|
|
|
|
|
// return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(productSnStr), stepResult, String.format("设备[%s]产出零件%s与进料零件条码未匹配到唯一的加工规则配置信息!%s", cellEquipContext.getEquipmentName(),
|
|
|
|
|
// productionPartContextList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getForeignKey()) && o.getIsFinishCode().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).map(MesProductionPartContext::getPartNo).collect(Collectors.toList()).toString(),
|
|
|
|
|
// productSnStr));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// 默认头道才有超工单
|
|
|
|
|
//validSuperWorkOrder(reqBean, productionPartContextList,productionPsInContextList,workCenter, stepResult, resultBean);
|
|
|
|
|
return stepResult;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//搜集进料零件号匹配的产品加工规则
|
|
|
|
|
private List<MesProdRuleNosortCfg> filterProdRuleNosortCfgList(List<MesProdRuleNosortCfg> prodRuleNosortCfgList, String partNo) {
|
|
|
|
|
return CollectionUtils.isEmpty(prodRuleNosortCfgList) ? null : prodRuleNosortCfgList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getInPartNo()) && o.getInPartNo().equals(partNo))).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//搜集进料零件规则有值的产品加工规则
|
|
|
|
|
private List<MesProdRuleNosortCfg> filterProdRuleNosortCfgList(List<MesProdRuleNosortCfg> prodRuleNosortCfgList) {
|
|
|
|
|
return CollectionUtils.isEmpty(prodRuleNosortCfgList) ? null : prodRuleNosortCfgList.stream().filter(o -> (null != o && StringUtils.isEmpty(o.getInPartNo()) && !StringUtils.isEmpty(o.getInPartNoRule()))).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据产出零件分组数据
|
|
|
|
|
private Map<String, List<MesProdRuleNosortCfg>> groupProdRuleNosortCfgList(List<MesProdRuleNosortCfg> prodRuleNosortCfgList) {
|
|
|
|
|
return CollectionUtils.isEmpty(prodRuleNosortCfgList) ? null :
|
|
|
|
|
prodRuleNosortCfgList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesProdRuleNosortCfg::getOutPartNo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示装配件信息
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, MesCellEquipContext cellEquipContext, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(cellEquipContext, prodRuleContext.getAssemblyDataContext(workCenter));
|
|
|
|
|
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
List<AttrBean> attrBeanList = dataAttrList(prodRuleContext.getWorkOrderNo());
|
|
|
|
|
|
|
|
|
|
//封装多表格
|
|
|
|
|
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(resultBean.getStationResultBeans())) return false;
|
|
|
|
|
|
|
|
|
|
resultBean.busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_CUSTOM_CONTENT.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLES.getValue());
|
|
|
|
|
this.sendMessage(reqBean, resultBean);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getWorkOrderNo(Map<Integer, MesProductionPartContext> productionPartMap, Integer foreignKey) {
|
|
|
|
|
return (!CollectionUtils.isEmpty(productionPartMap) && productionPartMap.containsKey(foreignKey)) ? productionPartMap.get(foreignKey).getWorkOrderNo() : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null;
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
|
|
|
|
|
for (MesProductionAssemblyContext item : productionAssemblyContextList) {
|
|
|
|
|
//不显示且不扫描/仅目视的不显示出来
|
|
|
|
|
if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue;
|
|
|
|
|
assemblyShowContextList.add(assemblyShowContext(item));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
AtomicReference<Integer> index = new AtomicReference<>(0);
|
|
|
|
|
assemblyShowContextList.forEach(o -> o.index(index.updateAndGet(v -> v + 1)));
|
|
|
|
|
|
|
|
|
|
return assemblyShowContextList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装装配件信息
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
|
|
|
|
|
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
|
|
|
|
|
BeanUtils.copyProperties(o, assemblyShowContext);
|
|
|
|
|
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()));
|
|
|
|
|
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());
|
|
|
|
|
return assemblyShowContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
private List<AttrBean> dataAttrList(String workOrderNo) {
|
|
|
|
|
List<AttrBean> attrBeanList = new ArrayList<>();
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
|
|
|
|
|
if (!StringUtils.isEmpty(workOrderNo)) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "原料编码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "原料名称");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "原料条码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, "装配状态");
|
|
|
|
|
return attrBeanList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//清除本次扫描/读取信息 有进料【只】需要清除进料,否则存在产出零件需要清除产出零件 【只需要清除被标记的数据】
|
|
|
|
|
private Boolean doBusiCheckToDelete(StationRequestBean reqBean, StepResult stepResult, List<MesProductionPartContext> productionPartContextList, List<MesProductionPsInContext> productionPsInContextList) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPsInContextList) && StringUtils.isEmpty(stepResult.getObj())) {
|
|
|
|
|
productionDispatchContextStepService.dispatchProductionPsInContext(reqBean, productionPsInContextList.stream().filter(o -> (null != o && o.getBusiCheckToDelete().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0)).collect(Collectors.toList()));
|
|
|
|
|
} else if (!CollectionUtils.isEmpty(productionPartContextList)) {
|
|
|
|
|
if (!StringUtils.isEmpty(stepResult.getObj())) productionDispatchContextStepService.removeProductionPsInContext(reqBean);
|
|
|
|
|
productionDispatchContextStepService.removeProductionPartContext(reqBean);
|
|
|
|
|
productionDispatchContextStepService.removeProdRuleDataContext(reqBean);
|
|
|
|
|
productionProcessContextStepService.removeFunctionChooseCavityOrderContext(reqBean);
|
|
|
|
|
if (productionDispatchContextStepService.checkFirstMouldNoIsExistContext(reqBean)) {
|
|
|
|
|
//存在头道模具号场景下 必须抛出异常 因为头道模具号的接口逻辑会配置非常变值,也就是每次返回回去都会拿到头道模具号 就会出现死循环线程
|
|
|
|
|
productionDispatchContextStepService.removeFirstMouldNoContext(reqBean);
|
|
|
|
|
foundExThrowNoShowMsg();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|