|
|
|
@ -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<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, sourceId);
|
|
|
|
|
List<MesAssemblyShowContext> 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<MesProductionAssemblySortContext> allAssemblyList) {
|
|
|
|
|
//获取前端置顶信息 【sourceId&MatchDatetime】
|
|
|
|
|
private String getTopRowInfo(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();
|
|
|
|
|
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<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) {
|
|
|
|
|
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule, String topRowInfo) {
|
|
|
|
|
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, 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|