|
|
|
@ -163,24 +163,50 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示装配件信息(子类进行重写)
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false);
|
|
|
|
|
return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell) {
|
|
|
|
|
//显示或者匹配装配件信息 公共调用
|
|
|
|
|
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList, Boolean isNeedCheckShowCell, Boolean isNeedCalcTop) {
|
|
|
|
|
|
|
|
|
|
List<AttrBean> attrBeanList = null;
|
|
|
|
|
//用于获取前端置顶ID
|
|
|
|
|
List<MesProductionAssemblySortContext> allAssemblyList = null;
|
|
|
|
|
|
|
|
|
|
//验证是否需要显示工位代码列
|
|
|
|
|
Boolean isNeedShowCell = false;
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
List<MesProductionAssemblySortContext> productionAssemblySortContextList = prodRuleContext.getSortAssemblyDataContext();
|
|
|
|
|
|
|
|
|
|
if (isNeedShowCell) isNeedShowCell = checkIsNeedShowCell(reqBean, prodRuleContextList);
|
|
|
|
|
//存在其他工位的装配件的时候需要显示出工位代码列
|
|
|
|
|
if (isNeedCheckShowCell && !isNeedShowCell && !productionAssemblySortContextList.get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) isNeedShowCell = true;
|
|
|
|
|
|
|
|
|
|
if (isNeedCalcTop) {
|
|
|
|
|
if (CollectionUtils.isEmpty(allAssemblyList)) allAssemblyList = new ArrayList<>();
|
|
|
|
|
allAssemblyList.addAll(productionAssemblySortContextList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取前端置顶ID
|
|
|
|
|
Long sourceId = getTopSourceId(allAssemblyList);
|
|
|
|
|
|
|
|
|
|
//装配件显示规则配置
|
|
|
|
|
Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean);
|
|
|
|
|
|
|
|
|
|
//列名集合
|
|
|
|
|
List<AttrBean> attrBeanList = null;
|
|
|
|
|
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
|
|
|
|
|
//封装匹配当前设备的装配件信息
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule);
|
|
|
|
|
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, sourceId);
|
|
|
|
|
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
|
|
|
|
|
|
|
|
|
|
//装配件清单列表标题
|
|
|
|
@ -200,29 +226,27 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证是否需要演示工位代码列
|
|
|
|
|
private Boolean checkIsNeedShowCell(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList) {
|
|
|
|
|
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
|
|
|
|
|
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
|
|
|
|
|
if (!prodRuleContext.getSortAssemblyDataContext().get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
//获取前端置顶ID
|
|
|
|
|
private Long getTopSourceId(List<MesProductionAssemblySortContext> allAssemblyList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(allAssemblyList)) return null;
|
|
|
|
|
allAssemblyList = allAssemblyList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getMatchDatetime()))).sorted(Comparator.comparing(MesProductionAssemblySortContext::getMatchDatetime).reversed()).collect(Collectors.toList());
|
|
|
|
|
return CollectionUtils.isEmpty(allAssemblyList) ? null : allAssemblyList.get(0).getSourceId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//未知腔数配置【工位参数】
|
|
|
|
|
//装配件显示规则配置【工位参数】
|
|
|
|
|
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, Boolean isNeedShowMatchRule) {
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) {
|
|
|
|
|
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, isNeedShowMatchRule));
|
|
|
|
|
assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, sourceId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assemblyShowContextList = sortAssemblyShowContextList(assemblyShowContextList);
|
|
|
|
@ -234,13 +258,14 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装装配件信息
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule) {
|
|
|
|
|
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule, Long sourceId) {
|
|
|
|
|
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
|
|
|
|
|
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());
|
|
|
|
|
if (!StringUtils.isEmpty(sourceId) && !StringUtils.isEmpty(productionAssemblyContext.getSourceId()) && sourceId.compareTo(productionAssemblyContext.getSourceId()) == 0) assemblyShowContext.isTop();
|
|
|
|
|
return assemblyShowContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|