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 441fd16..8c155d7 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 @@ -450,8 +450,8 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } - //获取前端置顶ID - Long sourceId = getTopSourceId(allAssemblyList); + //获取前端置顶信息 【sourceId&MatchDatetime】 + String topRowInfo = getTopRowInfo(allAssemblyList); Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean); @@ -460,7 +460,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; //封装匹配当前设备的装配件信息 - List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, sourceId); + List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, topRowInfo); if (CollectionUtils.isEmpty(assemblyShowContextList)) continue; //装配件清单列表标题 @@ -480,11 +480,11 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } - //获取前端置顶ID - private Long getTopSourceId(List allAssemblyList) { + //获取前端置顶信息 【sourceId&MatchDatetime】 + private String getTopRowInfo(List allAssemblyList) { if (CollectionUtils.isEmpty(allAssemblyList)) return null; allAssemblyList = allAssemblyList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getMatchDatetime()))).sorted(Comparator.comparing(MesProductionAssemblyNosortContext::getMatchDatetime).reversed()).collect(Collectors.toList()); - return CollectionUtils.isEmpty(allAssemblyList) ? null : allAssemblyList.get(0).getSourceId(); + return CollectionUtils.isEmpty(allAssemblyList) ? null : new StringJoiner(MesPcnExtConstWords.AND).add(allAssemblyList.get(0).getSourceId().toString()).add(allAssemblyList.get(0).getMatchDatetime()).toString(); } //未知腔数配置【工位参数】 @@ -498,13 +498,13 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } //封装匹配当前设备的装配件信息 - private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) { + private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, String topRowInfo) { if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null; List assemblyShowContextList = new ArrayList<>(); for (MesProductionAssemblyContext item : productionAssemblyContextList) { //不显示且不扫描/仅目视的不显示出来 if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue; - assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, sourceId)); + assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, topRowInfo)); } assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList()); @@ -516,14 +516,15 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } //封装装配件信息 - private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule, Long sourceId) { + private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule, String topRowInfo) { 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(); + if (!StringUtils.isEmpty(topRowInfo) && !StringUtils.isEmpty(productionAssemblyContext.getSourceId()) && !StringUtils.isEmpty(productionAssemblyContext.getMatchDatetime()) && + topRowInfo.equals(new StringJoiner(MesPcnExtConstWords.AND).add(productionAssemblyContext.getSourceId().toString()).add(productionAssemblyContext.getMatchDatetime()).toString())) assemblyShowContext.isTop(); 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 c8625a8..262a2bd 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 @@ -26,10 +26,7 @@ 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.Optional; +import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -212,8 +209,8 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } - //获取前端置顶ID - Long sourceId = getTopSourceId(allAssemblyList); + //获取前端置顶信息 【sourceId&MatchDatetime】 + String topRowInfo = getTopRowInfo(allAssemblyList); //装配件显示规则配置 Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean); @@ -226,7 +223,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService { if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; //封装匹配当前设备的装配件信息 - List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, sourceId); + List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, topRowInfo); if (CollectionUtils.isEmpty(assemblyShowContextList)) continue; //装配件清单列表标题 @@ -246,11 +243,11 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } - //获取前端置顶ID - private Long getTopSourceId(List allAssemblyList) { + //获取前端置顶信息 【sourceId&MatchDatetime】 + private String getTopRowInfo(List 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(); + return CollectionUtils.isEmpty(allAssemblyList) ? null : new StringJoiner(MesPcnExtConstWords.AND).add(allAssemblyList.get(0).getSourceId().toString()).add(allAssemblyList.get(0).getMatchDatetime()).toString(); } //装配件显示规则配置【工位参数】 @@ -260,13 +257,13 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } //封装匹配当前设备的装配件信息 - private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) { + private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, String topRowInfo) { if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null; List assemblyShowContextList = new ArrayList<>(); for (MesProductionAssemblyContext item : productionAssemblyContextList) { //不显示且不扫描/仅目视的不显示出来 if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue; - assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, sourceId)); + assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, topRowInfo)); } assemblyShowContextList = sortAssemblyShowContextList(assemblyShowContextList); @@ -278,14 +275,16 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } //封装装配件信息 - private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule, Long sourceId) { + private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule, String topRowInfo) { 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(); + if (!StringUtils.isEmpty(topRowInfo) && !StringUtils.isEmpty(productionAssemblyContext.getSourceId()) && !StringUtils.isEmpty(productionAssemblyContext.getMatchDatetime()) && + topRowInfo.equals(new StringJoiner(MesPcnExtConstWords.AND).add(productionAssemblyContext.getSourceId().toString()).add(productionAssemblyContext.getMatchDatetime()).toString())) assemblyShowContext.isTop(); + return assemblyShowContext; } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesAssemblyShowContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesAssemblyShowContext.java index dec156a..0187f30 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesAssemblyShowContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesAssemblyShowContext.java @@ -62,6 +62,9 @@ public class MesAssemblyShowContext implements Serializable { @ApiParam("序号") private Integer index; + @ApiParam("匹配时间") + public String matchDatetime; + @ApiParam(value = "是否置顶") private Integer isTop = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();