装配件 匹配后 前端列表滚动条自动定位

tags/yfai-pcn-ext-v2.3
王杰 7 months ago
parent 7767805389
commit cddd64250b

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

@ -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;
}

@ -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();

Loading…
Cancel
Save