From e92c29a07a58d73d96cf8d82ece6b8ed7d157672 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 16 Oct 2024 15:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E9=85=8D=E4=BB=B6=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=20=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/busi/IMesAssemblyExtService.java | 2 +- .../pcn/api/busi/IMesProdRuleCfgExtService.java | 2 +- .../serviceimpl/busi/MesAssemblyExtService.java | 19 ++++---- .../serviceimpl/busi/MesProdRuleCfgExtService.java | 4 +- .../step/MesAssemblyMatchSortStepService.java | 2 +- .../step/MesAssemblySaveStepService.java | 15 ++++-- .../step/MesAssemblyShowNosortStepService.java | 34 +++++++++++-- .../MesAssemblyShowSortPreCraftStepService.java | 7 ++- .../step/MesAssemblyShowSortStepService.java | 57 ++++++++++++++++------ .../pcn/pojo/context/MesAssemblyShowContext.java | 9 ++++ .../mes/pcn/pojo/context/MesProdRuleContext.java | 5 -- .../pojo/context/MesProductionAssemblyContext.java | 3 ++ .../MesProductionAssemblyNosortContext.java | 7 +++ .../context/MesProductionAssemblySortContext.java | 6 +++ 14 files changed, 123 insertions(+), 49 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java index 66db2f7..8d5c3eb 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesAssemblyExtService.java @@ -15,7 +15,7 @@ public interface IMesAssemblyExtService { List getProductionAssemblySortContextList(MesProdRuleContext prodRuleContext); @ApiOperation(value = "【排序线】获取生产工单装配件绑定记录 [前道所有装配件]") - List getProductionAssemblySortPreCraftContextList(MesProdRuleContext prodRuleContext, Map workCellMap, String workCellCode); + List getProductionAssemblySortPreCraftContextList(MesProdRuleContext prodRuleContext, Map workCellMap); @ApiOperation(value = "【排序线】获取生产工单装配件清单") List getWorkOrderAssemblyList(MesProdRuleContext prodRuleContext, Boolean isShowAll); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java index 90dc9b5..578f292 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProdRuleCfgExtService.java @@ -26,7 +26,7 @@ public interface IMesProdRuleCfgExtService { MesProdRuleContext getProdRuleSortContext(MesProdRuleContext prodRuleContext); @ApiOperation(value = "【排序线】获取产品加工规则 [前道所有装配件]") - MesProdRuleContext getProdRuleSortPreCraftContext(MesProdRuleContext prodRuleContext, Map workCellMap, String workCellCode); + MesProdRuleContext getProdRuleSortPreCraftContext(MesProdRuleContext prodRuleContext, Map workCellMap); @ApiOperation(value = "【非排序线】获取产品加工规则 【根据PID获取】") MesProdRuleNosortCfg getProdRuleNosortCfg(String organizeCode, Long id); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java index 1967c9b..36318e4 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java @@ -60,8 +60,9 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //【排序线】获取生产工单装配件清单 List workOrderAssemblyList = getWorkOrderAssemblyList(prodRuleContext, false); - //搜集匹配当前设备的装配件信息 - workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && o.getEquipmentCode().equals(prodRuleContext.getEquipmentCode()))).collect(Collectors.toList()); + + // 搜集待装配的数据 + workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).collect(Collectors.toList()); if (CollectionUtils.isEmpty(workOrderAssemblyList)) return null; @@ -77,18 +78,16 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //【排序线】获取生产工单装配件绑定记录 [前道所有装配件,无爆炸图与音频文件逻辑] @Override - public List getProductionAssemblySortPreCraftContextList(MesProdRuleContext prodRuleContext, Map workCellMap, String workCellCode) { + public List getProductionAssemblySortPreCraftContextList(MesProdRuleContext prodRuleContext, Map workCellMap) { if (null == prodRuleContext) return null; - if (StringUtils.isEmpty(prodRuleContext.getOrganizeCode()) || StringUtils.isEmpty(prodRuleContext.getWorkCenterCode()) || StringUtils.isEmpty(prodRuleContext.getProductSn())) return null; + if (StringUtils.isEmpty(prodRuleContext.getOrganizeCode()) || StringUtils.isEmpty(prodRuleContext.getWorkCenterCode()) || + StringUtils.isEmpty(prodRuleContext.getWorkCellCode()) || StringUtils.isEmpty(prodRuleContext.getProcessCode()) || StringUtils.isEmpty(prodRuleContext.getProductSn())) return null; //【排序线】获取生产工单装配件清单 List workOrderAssemblyList = getWorkOrderAssemblyList(prodRuleContext, true); - //搜集匹配当前工位设备及其他工位的的装配件信息 - workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && (!o.getWorkCellCode().equals(workCellCode) || (o.getWorkCellCode().equals(workCellCode) && o.getEquipmentCode().equals(prodRuleContext.getEquipmentCode()))))).collect(Collectors.toList()); - // 搜集非已装配的数据 workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0)).collect(Collectors.toList()); @@ -116,9 +115,11 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { DdlPackBean packBean = DdlPackBean.getDdlPackBean(prodRuleContext.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(prodRuleContext.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); - DdlPreparedPack.getStringEqualPack(prodRuleContext.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); - DdlPreparedPack.getStringEqualPack(prodRuleContext.getProcessCode(), MesPcnExtConstWords.PROCESS_CODE, packBean); DdlPreparedPack.getStringEqualPack(prodRuleContext.getProductSn(), MesPcnExtConstWords.PRODUCT_SN, packBean); + if (!isShowAll) { + DdlPreparedPack.getStringEqualPack(prodRuleContext.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); + DdlPreparedPack.getStringEqualPack(prodRuleContext.getProcessCode(), MesPcnExtConstWords.PROCESS_CODE, packBean); + } return workOrderAssemblyRepository.findByHqlWhere(packBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java index ff0be65..3d7ec7e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProdRuleCfgExtService.java @@ -117,8 +117,8 @@ public class MesProdRuleCfgExtService implements IMesProdRuleCfgExtService { //【排序线】获取产品加工规则 [前道所有装配件] @Override - public MesProdRuleContext getProdRuleSortPreCraftContext(MesProdRuleContext prodRuleContext, Map workCellMap, String workCellCode) { - return prodRuleContext.assemblyDataJson(assemblyExtService.getProductionAssemblySortPreCraftContextList(prodRuleContext, workCellMap, workCellCode)); + public MesProdRuleContext getProdRuleSortPreCraftContext(MesProdRuleContext prodRuleContext, Map workCellMap) { + return prodRuleContext.assemblyDataJson(assemblyExtService.getProductionAssemblySortPreCraftContextList(prodRuleContext, workCellMap)); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java index 4367372..f7f741b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java @@ -106,7 +106,7 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { //匹配成功 【result=true 代表单次扫描匹配成功; hasUnBindAssembly=false 代表浑腔模式全部匹配成功】 if (result || !hasUnBindAssembly) { productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList); - ((MesAssemblyShowSortStepService) SpringContextsUtil.getBean("mesAssemblyShowSortStepService")).showProductionAssembly(reqBean, resultBean, productionProcessContext.getWorkCenter(), prodRuleContextList, true); + ((MesAssemblyShowSortStepService) SpringContextsUtil.getBean("mesAssemblyShowSortStepService")).showProductionAssembly(reqBean, resultBean, productionProcessContext.getWorkCenter(), prodRuleContextList, true, true); suffix = (isSkip || isCavitySkip) ? stepResult.getMsg() : String.format("装配件条码%s匹配成功!", assemblySn); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java index c2060e0..b0bf149 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java @@ -122,7 +122,7 @@ public class MesAssemblySaveStepService extends BaseStepService { MesProductionAssembly productionAssembly = new MesProductionAssembly(); BeanUtils.copyProperties(productionAssemblyContext, productionAssembly); - productionAssembly.setDataSource(MesExtEnumUtil.PRODUCTION_ASSEMBLY_DATA_SOURCE.NOSORT.getValue()); + productionAssembly.setDataSource(workCenter.getCenterType()); productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); productionAssembly.setAreaCode(reqBean.getWorkCenterCode()); @@ -151,11 +151,15 @@ public class MesAssemblySaveStepService extends BaseStepService { if (null != scanMonitorContext) productionAssembly.setMouldRecordId(scanMonitorContext.getMouldRecordId()); productionAssembly.setOrganizeCode(reqBean.getOrganizeCode()); - ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo()); - productionAssembly.setFid(UUID.randomUUID().toString()); - - productionAssembly = productionAssemblyRepository.insert(productionAssembly); + if (StringUtils.isEmpty(productionAssembly.getId())) { + ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo()); + productionAssembly.setFid(UUID.randomUUID().toString()); + productionAssembly = productionAssemblyRepository.insert(productionAssembly); + } else { + ConvertBean.serviceModelUpdate(productionAssembly, reqBean.getUserInfo()); + productionAssemblyRepository.update(productionAssembly); + } if (productionAssemblyContext.getMatchType().compareTo(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_30.getValue()) == 0) saveProductionAssemblyUnique(productionAssembly); @@ -171,6 +175,7 @@ public class MesAssemblySaveStepService extends BaseStepService { } private void saveProductionAssemblyUnique(MesProductionAssembly productionAssembly) { + if (productionAssembly.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0) return; MesProductionAssemblyUnique productionAssemblyUnique = new MesProductionAssemblyUnique(); BeanUtils.copyProperties(productionAssembly, productionAssemblyUnique, MesPcnExtConstWords.ID); productionAssemblyUnique.setPid(productionAssembly.getId()); 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 a5fc886..441fd16 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 @@ -434,9 +434,25 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { return CollectionUtils.isEmpty(prodRuleNosortCfgList) ? null : prodRuleNosortCfgList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesProdRuleNosortCfg::getOutPartNo)); } - //显示装配件信息 + //显示或者匹配装配件信息 公共调用 public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List prodRuleContextList) { + //用于获取前端置顶ID + List allAssemblyList = new ArrayList<>(); + + for (MesProdRuleContext prodRuleContext : prodRuleContextList) { + + if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; + + List productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext(); + + allAssemblyList.addAll(productionAssemblyNosortContextList); + + } + + //获取前端置顶ID + Long sourceId = getTopSourceId(allAssemblyList); + Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean); for (MesProdRuleContext prodRuleContext : prodRuleContextList) { @@ -444,7 +460,7 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; //封装匹配当前设备的装配件信息 - List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule); + List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, sourceId); if (CollectionUtils.isEmpty(assemblyShowContextList)) continue; //装配件清单列表标题 @@ -464,6 +480,13 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } + //获取前端置顶ID + private Long getTopSourceId(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(); + } + //未知腔数配置【工位参数】 private Boolean checkIsNeedShowMatchRule(StationRequestBean reqBean) { String assemblyShowMrCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.ASSEMBLY_SHOW_MR_CFG); @@ -475,13 +498,13 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } //封装匹配当前设备的装配件信息 - private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule) { + private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) { 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)); + assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, sourceId)); } assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList()); @@ -493,13 +516,14 @@ public class MesAssemblyShowNosortStepService 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; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortPreCraftStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortPreCraftStepService.java index 45d658a..35cc9cb 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortPreCraftStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortPreCraftStepService.java @@ -30,14 +30,13 @@ public class MesAssemblyShowSortPreCraftStepService extends MesAssemblyShowSortS public MesProdRuleContext getProdRuleSortContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext) { Map workCellMap = productionProcessContextStepService.dispatchWorkCellMap(reqBean); - //不携带工位工序条件 - MesProdRuleContext prodRuleContext = new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()) + MesProdRuleContext prodRuleContext = new MesProdRuleContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode()) .equipmentCode(cellEquipContext.getEquipmentCode()).workOrderNo(productionPsInContext.getWorkOrderNo()).productSn(productionPsInContext.getProductSn()).foreignKey(productionPsInContext.getForeignKey()); - return prodRuleCfgExtService.getProdRuleSortPreCraftContext(prodRuleContext, workCellMap, reqBean.getWorkCellCode()); + return prodRuleCfgExtService.getProdRuleSortPreCraftContext(prodRuleContext, workCellMap); } public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List prodRuleContextList) { - return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, true); + return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, true, false); } } 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 56f1e4d..1f04584 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 @@ -163,24 +163,50 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } + //显示装配件信息(子类进行重写) public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List 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 prodRuleContextList, Boolean isNeedShowCell) { + //显示或者匹配装配件信息 公共调用 + public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List prodRuleContextList, Boolean isNeedCheckShowCell, Boolean isNeedCalcTop) { - List attrBeanList = null; + //用于获取前端置顶ID + List allAssemblyList = null; + + //验证是否需要显示工位代码列 + Boolean isNeedShowCell = false; + for (MesProdRuleContext prodRuleContext : prodRuleContextList) { + + if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; + + List 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 attrBeanList = null; + for (MesProdRuleContext prodRuleContext : prodRuleContextList) { if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; //封装匹配当前设备的装配件信息 - List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule); + List 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 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 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 getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule) { + private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, Long sourceId) { 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)); + 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; } 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 6035bc6..dec156a 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 @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import io.swagger.annotations.ApiParam; import lombok.Data; @@ -61,9 +62,17 @@ public class MesAssemblyShowContext implements Serializable { @ApiParam("序号") private Integer index; + @ApiParam(value = "是否置顶") + private Integer isTop = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + public MesAssemblyShowContext index(Integer index){ this.index = index; return this; } + public MesAssemblyShowContext isTop(){ + this.isTop = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + return this; + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java index ae3a980..fc4ba40 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProdRuleContext.java @@ -124,11 +124,6 @@ public class MesProdRuleContext implements Serializable { this.craftCode = craftCode; } - public MesProdRuleContext(String organizeCode, String workCenterCode) { - this.organizeCode = organizeCode; - this.workCenterCode = workCenterCode; - } - public MesProdRuleContext copy(MesProdRuleNosortCfg prodRuleNosortCfg) { BeanUtils.copyProperties(prodRuleNosortCfg, this); this.pid = prodRuleNosortCfg.getId(); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyContext.java index 304c2db..cab11d6 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyContext.java @@ -116,4 +116,7 @@ public class MesProductionAssemblyContext implements Serializable { @ApiParam(value = "是否可复用条码是否写入上下文进行复用") public Integer isRepeat2Cache = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + @ApiParam("匹配时间") + public String matchDatetime; + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java index d48d55e..3479dc2 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java @@ -12,6 +12,8 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.Map; /** @@ -78,18 +80,21 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon public MesProductionAssemblyNosortContext assemblyStatus(String assemblySn) { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); this.assemblySn = assemblySn; + matchDatetime(); return this; } public MesProductionAssemblyNosortContext assemblySkip() { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue(); this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + matchDatetime(); return this; } public MesProductionAssemblyNosortContext assemblyStatusReset() { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); this.assemblySn = null; + this.matchDatetime = null; this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); return this; } @@ -129,4 +134,6 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon return this; } + private void matchDatetime() { this.matchDatetime = (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()); } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java index 8e49b27..c3c46d1 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java @@ -13,6 +13,8 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.Map; /** @@ -173,12 +175,14 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte public MesProductionAssemblySortContext assemblyStatus(String assemblySn) { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); this.assemblySn = assemblySn; + matchDatetime(); return this; } public MesProductionAssemblySortContext assemblySkip() { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue(); this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + matchDatetime(); return this; } @@ -211,4 +215,6 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte return this; } + private void matchDatetime() { this.matchDatetime = (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()); } + }