diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingSnUniqueService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingSnUniqueService.java index 41ec763..dbdda93 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingSnUniqueService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingSnUniqueService.java @@ -20,4 +20,7 @@ public interface IMesShippingSnUniqueService { @ApiOperation("新增唯一性校验") void insertMesShippingSnUnique(String organizeCode, String productSn,String shippingCode,String userName); + + @ApiOperation("唯一性校验") + MesShippingSnUnique getMesShippingSnUnique(String organizeCode, String productSn,String shippingCode,String userName); } 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 fe9bf75..87fb10b 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 @@ -61,14 +61,15 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //【排序线】获取生产工单装配件清单 List workOrderAssemblyList = getWorkOrderAssemblyList(prodRuleContext, false); - // 搜集待装配或者解绑的数据 - workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && - (o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 || o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0))).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(workOrderAssemblyList)) return null; + // 搜集待装配或者解绑的数据 + List unBindList = workOrderAssemblyList.stream().filter(o -> (null != o && + (o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 || + o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0))).collect(Collectors.toList()); + //获取排序FILE文件URL - Map fileMap = getFileMap(prodRuleContext.getOrganizeCode(), filterSortFileIdList(workOrderAssemblyList)); + Map fileMap = getFileMap(prodRuleContext.getOrganizeCode(), filterSortFileIdList(unBindList)); List productionAssemblySortContextList = new ArrayList<>(); @@ -89,11 +90,12 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { //【排序线】获取生产工单装配件清单 List workOrderAssemblyList = getWorkOrderAssemblyList(prodRuleContext, true); - // 搜集非已装配的数据 - 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()); - if (CollectionUtils.isEmpty(workOrderAssemblyList)) return null; + // 搜集非已装配的数据 + List unBindList = workOrderAssemblyList.stream().filter(o -> (null != o && + o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0)).collect(Collectors.toList()); + //获取装配件绑定记录 Map> productionAssemblyMap = groupProductionAssembly(getProductionAssemblySortList(prodRuleContext.getOrganizeCode(), prodRuleContext.getProductSn())); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingSnUniqueServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingSnUniqueServiceImpl.java index b342ca5..8213a5a 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingSnUniqueServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingSnUniqueServiceImpl.java @@ -50,4 +50,14 @@ public class MesShippingSnUniqueServiceImpl implements IMesShippingSnUniqueServi ConvertBean.serviceModelInitialize(mesShippingSnUnique,userName); mesShippingSnUniqueRepository.insert(mesShippingSnUnique); } + + @Override + public MesShippingSnUnique getMesShippingSnUnique(String organizeCode, String productSn, String shippingCode,String userName) { + MesShippingSnUnique mesShippingSnUnique = new MesShippingSnUnique(); + mesShippingSnUnique.setOrganizeCode(organizeCode); + mesShippingSnUnique.setProductSn(productSn); + mesShippingSnUnique.setShippingCode(shippingCode); + ConvertBean.serviceModelInitialize(mesShippingSnUnique,userName); + return mesShippingSnUnique; + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index ec8830d..bde60b1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -97,6 +97,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService @Autowired private IMesShippingSnUniqueService mesShippingSnUniqueService; + @Autowired + private MesShippingSnUniqueRepository mesShippingSnUniqueRepository; + @Override public MesSortShippingCheckModel doShippingOrderNoQuery(MesShippingOrderManagement shippingOrderManagement) { //校验发运单 @@ -138,8 +141,11 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService if (!Objects.isNull(model.getIsPass()) && Objects.equals(MesPcnExtConstWords.ONE, model.getIsPass())) { skipShippingDetails(model, model.getUserInfo(), orderManagement); //扫描条码 - } else{ - model = ((IMesShippingScanStrategyService) SpringContextsUtil.getBean(MesExtEnumUtil.SHIPPING_GROUP_CONFIRM_PART_TYPE.valueOfServiceImpl(Integer.parseInt(shippingGroup.getConfirmPartType())))).doScan(model,orderManagement,shippingGroup); + } else { + if (StringUtils.isEmpty(shippingGroup.getConfirmPartType())) { + MesPcnException.throwMesBusiException("零件发运组【%s】扫描确认方式未维护,请检查数据!"); + } + model = ((IMesShippingScanStrategyService) SpringContextsUtil.getBean(MesExtEnumUtil.SHIPPING_GROUP_CONFIRM_PART_TYPE.valueOfServiceImpl(Integer.parseInt(shippingGroup.getConfirmPartType())))).doScan(model, orderManagement, shippingGroup); } model.setDetailList(model.getDetailList()); //当前发运单全部扫描完成 并且不需要扫位置码 @@ -466,22 +472,21 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService List produceSnList = new ArrayList<>(); List mesWorkOrderList = new ArrayList<>(); + List mesShippingSnUniqueList = new ArrayList<>(); for (MesShippingOrderManagementDetail detail : orderManagementDetailList) { //根据扫描的条码查询条码是否存在 packBean = DdlPackBean.getDdlPackBean(organizeCode); - if (Objects.equals(orderManagement.getIsEnableMemory(), MesCommonConstant.TRUE_INTEGER)) { - DdlPreparedPack.getStringEqualPack(detail.getBarcode(), "custSn", packBean); - } else { + if (!Objects.equals(orderManagement.getIsEnableMemory(), MesCommonConstant.TRUE_INTEGER)){ List mesShippingOrderManagementDetails = custInfoSeqMap.get(detail.getId()); MesShippingOrderManagementDetail managementDetail = mesShippingOrderManagementDetails.get(0); detail.setRemark(managementDetail.getRemark()); detail.setStatus(managementDetail.getStatus()); detail.setBarcode(managementDetail.getBarcode()); detail.setVisualOrderNo(managementDetail.getVisualOrderNo()); - DdlPreparedPack.getStringEqualPack(detail.getBarcode(), "custSn", packBean); } //更新条码信息,更新目视单信息 if(!StringUtils.isEmpty(detail.getBarcode()) && !Objects.equals(orderManagement.getIsEnableMemory(), MesCommonConstant.TRUE_INTEGER)){ + packBean.setWhereAppend(packBean.getWhereAppend() + " and (model.productSn = '"+detail.getBarcode()+"' or model.custSn = '"+detail.getBarcode()+"'"); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); MesProduceSn produceSn = produceSnRepository.getByProperty(packBean); if(!Objects.isNull(produceSn)){ @@ -491,7 +496,7 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService produceSnList.add(produceSn); } else { //记录唯一性校验表 - mesShippingSnUniqueService.insertMesShippingSnUnique(organizeCode, detail.getBarcode(), orderManagement.getShippingCode(), userInfo); + mesShippingSnUniqueList.add(mesShippingSnUniqueService.getMesShippingSnUnique(organizeCode, detail.getBarcode(), orderManagement.getShippingCode(), userInfo)); } //更新工单 if(!StringUtils.isEmpty(detail.getVisualOrderNo())){ @@ -516,6 +521,10 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService detail.setActualQty(MesPcnExtConstWords.ONE); ConvertBean.serviceModelUpdate(detail, userInfo); } + //保存唯一性表 + if(!CollectionUtils.isEmpty(mesShippingSnUniqueList)){ + mesShippingSnUniqueRepository.saveAll(mesShippingSnUniqueList); + } //更新条码 if(!CollectionUtils.isEmpty(produceSnList)){ produceSnRepository.saveAll(produceSnList); 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 44fdcb2..9a84aa3 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 @@ -218,7 +218,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService { if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue; //封装匹配当前设备的装配件信息 - List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule, topRowInfo); + List assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getSortAssemblyDataContext(), isNeedShowMatchRule, topRowInfo); if (CollectionUtils.isEmpty(assemblyShowContextList)) continue; //装配件清单列表标题 @@ -252,12 +252,12 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } //封装匹配当前设备的装配件信息 - private List getAssemblyShowContextList(List productionAssemblyContextList, Boolean isNeedShowMatchRule, String topRowInfo) { - if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null; + private List getAssemblyShowContextList(List productionAssemblySortContextList, Boolean isNeedShowMatchRule, String topRowInfo) { + if (CollectionUtils.isEmpty(productionAssemblySortContextList)) return null; List assemblyShowContextList = new ArrayList<>(); - for (MesProductionAssemblyContext item : productionAssemblyContextList) { - //不显示且不扫描/仅目视的不显示出来 - if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue; + for (MesProductionAssemblySortContext item : productionAssemblySortContextList) { + //不显示且不扫描/仅目视的不显示出来, 已经存在于DB的不显示出来 + if (null == item || item.getIsExistDb().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue; assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule, topRowInfo)); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java index 44b5d1b..7a1d6d5 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java @@ -234,8 +234,8 @@ public class MesProductionCustomContextStepService extends BaseStepService imple @Override public String getRepeatAssemblySn(String organizeCode, String workCenterCode, String workCellCode, String repeatKey) { String repeatAssemblySnJson = getFsmBusiData(organizeCode, getRepeatAssemblySnContextKey(organizeCode, workCenterCode, workCellCode), repeatKey); - MesProductionAssemblyContext productionAssemblyContext = !StringUtils.isEmpty(repeatAssemblySnJson) ? JSONObject.parseObject(repeatAssemblySnJson, MesProductionAssemblyContext.class) : null; - return null != productionAssemblyContext ? productionAssemblyContext.getAssemblySn() : null; + //MesProductionAssemblyContext productionAssemblyContext = !StringUtils.isEmpty(repeatAssemblySnJson) ? JSONObject.parseObject(repeatAssemblySnJson, MesProductionAssemblyContext.class) : null; + return repeatAssemblySnJson; } //根据设备代码获取可复用条码的个数 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 7f3b4f8..894e5d9 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 @@ -133,6 +133,9 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte @ApiParam(name = "是否保存到DB") private Integer isSaveDb = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + @ApiParam(name = "是否已经存在于DB") + private Integer isExistDb = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + public MesProductionAssemblySortContext() {} //前道工位 @@ -149,10 +152,19 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte if (StringUtils.isEmpty(this.processSeq)) this.processSeq = MesPcnExtConstWords.ZERO; if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0 || - this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0) { + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + } - if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType)) + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) == 0 || + this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue()) == 0) { + this.fileIsFinished().isSaveDb().setIsExistDb(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && + !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType)) { this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); + } return this; } @@ -183,6 +195,8 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0 || this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) == 0) this.isSaveDb().setIsExistDb(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType)) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();