From 002c30ef4b07c5473aab3a9c14d5455b0427a475 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Fri, 31 May 2024 17:07:56 +0800 Subject: [PATCH] step --- .../step/MesAssemblyScanStepService.java | 2 +- .../step/MesAssemblyShowNosortStepService.java | 226 ++++++++++++++------- .../step/MesAssemblyShowSortStepService.java | 4 - 3 files changed, 156 insertions(+), 76 deletions(-) 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 fc9c074..4ec7b6b 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 @@ -56,7 +56,7 @@ public class MesAssemblyScanStepService extends BaseStepService { MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean); //获取生产过程上下文对象有异常信息 抛出异常 - if (!productionProcessContext.getSuccess()) return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + if (!productionProcessContext.getSuccess()) return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, productionProcessContext.getMessage()); //保存设备当前一轮工序待验证的装配件条码信息 productionDispatchContextStepService.saveScanAssemblySnContext(reqBean, getAssemblySnJson(reqBean, scanInfo)); 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 3aff091..df26179 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 @@ -1,72 +1,156 @@ -package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; - -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesAssemblyExtService; -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.MesCellEquipContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; -import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; -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 lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @Description : 显示装配件扫描项工步【非排序】 - * @Author : wangjie - **/ -@Slf4j -@Service("mesAssemblyShowNosortStepService") -public class MesAssemblyShowNosortStepService extends BaseStepService { - - @Autowired - private IMesProductionProcessContextStepService productionProcessContextStepService; - - @Autowired - private IMesProductionDispatchContextStepService productionDispatchContextStepService; - +//package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; +// +//import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesAssemblyExtService; +//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.serviceimpl.fsm.BaseStepService; +//import cn.estsh.i3plus.mes.pcn.util.LocaleUtil; +//import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil; +//import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +//import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; +//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 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.ArrayList; +//import java.util.Comparator; +//import java.util.List; +//import java.util.Map; +//import java.util.stream.Collectors; +// +///** +// * @Description : 显示装配件扫描项工步【非排序】 +// * @Author : wangjie +// **/ +//@Slf4j +//@Service("mesAssemblyShowNosortStepService") +//public class MesAssemblyShowNosortStepService extends BaseStepService { +// // @Autowired -// private IMesProdRuleCfgExtService prodRuleCfgExtService; - - @Autowired - private IMesAssemblyExtService assemblyExtService; - - @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()); - - //从上下文中取出生产线对象 - MesWorkCenter workCenter = productionProcessContext.getWorkCenter(); - - //从上下文中取出生产线对象 - MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); - - //获取上下文装配件数据信息集合 - List productionAssemblyContextList = productionDispatchContextStepService.getAssemblyDataContext(reqBean, workCenter); - - - - - return stepResult; - - - - } - - -} +// private IMesProductionProcessContextStepService productionProcessContextStepService; +// +// @Autowired +// private IMesProductionDispatchContextStepService productionDispatchContextStepService; +// +// @Autowired +// private IMesAssemblyExtService assemblyExtService; +// +// @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()); +// +// //从上下文中取出生产线对象 +// MesWorkCenter workCenter = productionProcessContext.getWorkCenter(); +// +// //从上下文中取出生产线对象 +// MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); +// +// //获取上下文装配件数据信息集合 +// List productionAssemblyContextList = productionDispatchContextStepService.getAssemblyDataContext(reqBean, workCenter); +// +// //搜集当前设备对应的装配件数据信息 +// productionAssemblyContextList = filterProductionAssemblyContextList(cellEquipContext, productionAssemblyContextList); +// +// //不存在装配件数据信息则进行查询 +// if (CollectionUtils.isEmpty(productionAssemblyContextList)) productionAssemblyContextList = doHandleAssemblyData(reqBean, resultBean, stepResult, cellEquipContext); +// +// if (!stepResult.isCompleted()) return stepResult; +// +// if (CollectionUtils.isEmpty(productionAssemblyContextList)) return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前未查询到相关的装配件清单"); +// +// //显示装配件信息 +// showProductionAssembly(reqBean, resultBean, getAssemblyShowContextList(productionAssemblyContextList)); +// +// return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "显示装配件扫描项成功!"); +// +// } +// +// private List doHandleAssemblyData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesCellEquipContext cellEquipContext) { +// +// //从上下文中取出生产工单数据信息集合 +// List workOrderContextList = productionDispatchContextStepService.getWorkOrderDataContext(reqBean); +// +// //上下文中不存在生产工单数据信息集合 +// if (CollectionUtils.isEmpty(workOrderContextList)) execNonCompleteAndSendMsg(reqBean, resultBean.writeDbLog(), stepResult, String.format("生产线[%s]工位[%s]的上下文中已不存在生产工单数据信息,请重新扫描加工单!", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode())); +// +// //获取排序线的装配件清单 +// List productionAssemblyContextList = assemblyExtService.getProductionAssemblySortContextList( +// new MesProductionAssemblySortContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode()), workOrderContextList.stream().filter(o -> null != o).map(MesWorkOrderContext::getWorkOrderNo).collect(Collectors.toList())); +// +// //保存设备当前一轮工序的装配件清单信息 +// if (!CollectionUtils.isEmpty(productionAssemblyContextList)) productionDispatchContextStepService.saveAssemblyDataContext(reqBean, productionAssemblyContextList); +// +// return filterProductionAssemblyContextList(cellEquipContext, productionAssemblyContextList); +// +// } +// +// private List filterProductionAssemblyContextList(MesCellEquipContext cellEquipContext, List productionAssemblyContextList) { +// return CollectionUtils.isEmpty(productionAssemblyContextList) ? null : +// productionAssemblyContextList.stream().filter(o -> (null != o && o.getEquipmentCode().equals(cellEquipContext.getEquipmentCode()))).collect(Collectors.toList()); +// } +// +// private List getAssemblyShowContextList(List productionAssemblyContextList) { +// List assemblyShowContextList = new ArrayList<>(); +// Map> assemblyMap = productionAssemblyContextList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesProductionAssemblyContext::getWorkOrderNo)); +// for (Map.Entry> entry : assemblyMap.entrySet()) { +// if (null == entry) continue; +// List itemList = new ArrayList<>(); +// for (MesProductionAssemblyContext item : entry.getValue()) { +// if (null == item) continue; +// itemList.add(assemblyShowContext(item)); +// } +// itemList = itemList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList()); +// assemblyShowContextList.addAll(itemList); +// } +// return assemblyShowContextList; +// } +// +// private void showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, List assemblyShowContextList) { +// List attrBeanList = new ArrayList<>(); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "序号")); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "零件编码")); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "原料编码")); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "原料名称")); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "原料条码")); +// PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, LocaleUtil.transferLanguage(reqBean.getUserInfo(), "是否装配")); +// +// resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_CUSTOM_CONTENT.getValue()); +// resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()); +// resultBean.setResultList(assemblyShowContextList); +// resultBean.setDataAttrList(attrBeanList); +// this.sendMessage(reqBean, resultBean); +// } +// +// 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()); +// return assemblyShowContext; +// } +// +// +//} 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 614612c..3f911f4 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 @@ -1,7 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesAssemblyExtService; -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.*; @@ -44,9 +43,6 @@ public class MesAssemblyShowSortStepService extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProdRuleCfgExtService prodRuleCfgExtService; - - @Autowired private IMesAssemblyExtService assemblyExtService; @Override