|
|
|
@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepSer
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmCommonService;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
@ -46,6 +47,9 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
@Autowired
|
|
|
|
|
public IMesProdRuleCfgExtService prodRuleCfgExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFsmCommonService fsmCommonService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
|
@ -95,7 +99,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示装配件信息
|
|
|
|
|
if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false))
|
|
|
|
|
if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList))
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "当前未查询到相关的装配件清单");
|
|
|
|
|
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "显示装配件扫描项成功!");
|
|
|
|
@ -110,16 +114,18 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell) {
|
|
|
|
|
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell, Boolean isNeedShowMatchRule) {
|
|
|
|
|
List<AttrBean> attrBeanList = new ArrayList<>();
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
|
|
|
|
|
if (isNeedShowCell) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_CELL_CODE, "工位代码");
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
|
|
|
|
|
if (prodRuleContextList.size() > 1) 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, "原料条码");
|
|
|
|
|
if (isNeedShowMatchRule) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
|
|
|
|
|
if (prodRuleContextList.size() > 1) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
@ -157,22 +163,28 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell) {
|
|
|
|
|
|
|
|
|
|
List<AttrBean> attrBeanList = null;
|
|
|
|
|
|
|
|
|
|
if (isNeedShowCell) isNeedShowCell = checkIsNeedShowCell(reqBean, workCenter, prodRuleContextList);
|
|
|
|
|
if (isNeedShowCell) isNeedShowCell = checkIsNeedShowCell(reqBean, prodRuleContextList);
|
|
|
|
|
|
|
|
|
|
Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean);
|
|
|
|
|
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter));
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule);
|
|
|
|
|
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
|
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(prodRuleContextList, isNeedShowCell);
|
|
|
|
|
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(prodRuleContextList, isNeedShowCell, isNeedShowMatchRule);
|
|
|
|
|
|
|
|
|
|
//封装多表格
|
|
|
|
|
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
|
|
|
|
@ -189,22 +201,28 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证是否需要演示工位代码列
|
|
|
|
|
private Boolean checkIsNeedShowCell(StationRequestBean reqBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
private Boolean checkIsNeedShowCell(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
if (!prodRuleContext.getAssemblyDataContext(workCenter).get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) return true;
|
|
|
|
|
if (!prodRuleContext.getSortAssemblyDataContext().get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//未知腔数配置【工位参数】
|
|
|
|
|
private Boolean checkIsNeedShowMatchRule(StationRequestBean reqBean) {
|
|
|
|
|
String assemblyShowMrCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.ASSEMBLY_SHOW_MR_CFG);
|
|
|
|
|
return (!StringUtils.isEmpty(assemblyShowMrCfg) && assemblyShowMrCfg.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList) {
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule) {
|
|
|
|
|
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.add(assemblyShowContext(item, isNeedShowMatchRule));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assemblyShowContextList = sortAssemblyShowContextList(assemblyShowContextList);
|
|
|
|
@ -216,18 +234,19 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装装配件信息
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule) {
|
|
|
|
|
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
|
|
|
|
|
BeanUtils.copyProperties(o, assemblyShowContext);
|
|
|
|
|
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) {
|
|
|
|
|
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()));
|
|
|
|
|
} else {
|
|
|
|
|
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】");
|
|
|
|
|
}
|
|
|
|
|
assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(o.getAssemblyStatus()));
|
|
|
|
|
BeanUtils.copyProperties(productionAssemblyContext, assemblyShowContext);
|
|
|
|
|
if (isNeedShowMatchRule) assemblyShowContext.setMatchTypeName(showMatchRule(assemblyShowContext));
|
|
|
|
|
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 String showMatchRule(MesAssemblyShowContext assemblyShowContext) {
|
|
|
|
|
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType());
|
|
|
|
|
return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|