forked from I3-YF/i3plus-mes-pcn-yfai
step
parent
d314fb46d7
commit
002c30ef4b
@ -1,72 +1,156 @@
|
|||||||
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.IMesAssemblyExtService;
|
//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.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.MesCellEquipContext;
|
//import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
|
||||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext;
|
//import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||||
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.BaseStepService;
|
//import cn.estsh.i3plus.mes.pcn.util.LocaleUtil;
|
||||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
//import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil;
|
||||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
//import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||||
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
//import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
||||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
//import cn.estsh.i3plus.pojo.mes.model.AttrBean;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||||
import org.springframework.stereotype.Service;
|
//import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||||
|
//import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||||
import java.util.List;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.springframework.beans.BeanUtils;
|
||||||
/**
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
* @Description : 显示装配件扫描项工步【非排序】
|
//import org.springframework.stereotype.Service;
|
||||||
* @Author : wangjie
|
//import org.springframework.util.CollectionUtils;
|
||||||
**/
|
//import org.springframework.util.StringUtils;
|
||||||
@Slf4j
|
//
|
||||||
@Service("mesAssemblyShowNosortStepService")
|
//import java.util.ArrayList;
|
||||||
public class MesAssemblyShowNosortStepService extends BaseStepService {
|
//import java.util.Comparator;
|
||||||
|
//import java.util.List;
|
||||||
@Autowired
|
//import java.util.Map;
|
||||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
//import java.util.stream.Collectors;
|
||||||
|
//
|
||||||
@Autowired
|
///**
|
||||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
// * @Description : 显示装配件扫描项工步【非排序】
|
||||||
|
// * @Author : wangjie
|
||||||
|
// **/
|
||||||
|
//@Slf4j
|
||||||
|
//@Service("mesAssemblyShowNosortStepService")
|
||||||
|
//public class MesAssemblyShowNosortStepService extends BaseStepService {
|
||||||
|
//
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private IMesProdRuleCfgExtService prodRuleCfgExtService;
|
// private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
private IMesAssemblyExtService assemblyExtService;
|
// private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||||
|
//
|
||||||
@Override
|
// @Autowired
|
||||||
public StepResult execute(StationRequestBean reqBean) {
|
// private IMesAssemblyExtService assemblyExtService;
|
||||||
|
//
|
||||||
StationResultBean resultBean = new StationResultBean();
|
// @Override
|
||||||
|
// public StepResult execute(StationRequestBean reqBean) {
|
||||||
StepResult stepResult = StepResult.getSuccessComplete();
|
//
|
||||||
|
// StationResultBean resultBean = new StationResultBean();
|
||||||
//获取上下文信息
|
//
|
||||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
|
// StepResult stepResult = StepResult.getSuccessComplete();
|
||||||
|
//
|
||||||
//配置错误 抛出异常
|
// //获取上下文信息
|
||||||
if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
// MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
|
||||||
|
//
|
||||||
//从上下文中取出生产线对象
|
// //配置错误 抛出异常
|
||||||
MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
|
// if (!productionProcessContext.getSuccess()) execExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||||
|
//
|
||||||
//从上下文中取出生产线对象
|
// //从上下文中取出生产线对象
|
||||||
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
// MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
|
||||||
|
//
|
||||||
//获取上下文装配件数据信息集合
|
// //从上下文中取出生产线对象
|
||||||
List<MesProductionAssemblyContext> productionAssemblyContextList = productionDispatchContextStepService.getAssemblyDataContext(reqBean, workCenter);
|
// MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
|
||||||
|
//
|
||||||
|
// //获取上下文装配件数据信息集合
|
||||||
|
// List<MesProdRuleNoSortContext> productionAssemblyContextList = productionDispatchContextStepService.getAssemblyDataContext(reqBean, workCenter);
|
||||||
|
//
|
||||||
return stepResult;
|
// //搜集当前设备对应的装配件数据信息
|
||||||
|
// 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<MesProductionAssemblyContext> doHandleAssemblyData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesCellEquipContext cellEquipContext) {
|
||||||
|
//
|
||||||
|
// //从上下文中取出生产工单数据信息集合
|
||||||
|
// List<MesWorkOrderContext> workOrderContextList = productionDispatchContextStepService.getWorkOrderDataContext(reqBean);
|
||||||
|
//
|
||||||
|
// //上下文中不存在生产工单数据信息集合
|
||||||
|
// if (CollectionUtils.isEmpty(workOrderContextList)) execNonCompleteAndSendMsg(reqBean, resultBean.writeDbLog(), stepResult, String.format("生产线[%s]工位[%s]的上下文中已不存在生产工单数据信息,请重新扫描加工单!", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode()));
|
||||||
|
//
|
||||||
|
// //获取排序线的装配件清单
|
||||||
|
// List<MesProductionAssemblyContext> 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<MesProductionAssemblyContext> filterProductionAssemblyContextList(MesCellEquipContext cellEquipContext, List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
||||||
|
// return CollectionUtils.isEmpty(productionAssemblyContextList) ? null :
|
||||||
|
// productionAssemblyContextList.stream().filter(o -> (null != o && o.getEquipmentCode().equals(cellEquipContext.getEquipmentCode()))).collect(Collectors.toList());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
||||||
|
// List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
|
||||||
|
// Map<String, List<MesProductionAssemblyContext>> assemblyMap = productionAssemblyContextList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesProductionAssemblyContext::getWorkOrderNo));
|
||||||
|
// for (Map.Entry<String, List<MesProductionAssemblyContext>> entry : assemblyMap.entrySet()) {
|
||||||
|
// if (null == entry) continue;
|
||||||
|
// List<MesAssemblyShowContext> 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<MesAssemblyShowContext> assemblyShowContextList) {
|
||||||
|
// List<AttrBean> 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;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
Loading…
Reference in New Issue