From 38731a1cdab21a3125746db4da50823c6b9081b6 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Mon, 9 Aug 2021 17:15:55 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=B7=A5=E8=89=BA=E8=B7=AF=E7=BA=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=98=E6=9B=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/InterfaceServiceImpl.java | 76 ++++++++++++------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java index 6023b996..88183454 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java @@ -79,16 +79,26 @@ public class InterfaceServiceImpl implements InterfaceService { revision = StringUtil.notBlank(revision) ? revision : "A"; //物料描述 String itemDescription = itemSyncRequest.getMAKTX(); + //计量单位 + String unitOfMeasure = itemSyncRequest.getUNIT_OF_MEASURE(); + //状态 String status = itemSyncRequest.getSTATUS(); + if (!"210".equals(status) && !"202".equals(status) && !"203".equals(status) && !"204".equals(status) && !"205".equals(status)) { + throw BusinessException.build("物料状态可维护的值为:201(可下达)、202(冻结)、203(作废)、204(保留)、205(新建)"); + } String statusBo = HandleEnum.STATUS.getHandle(site, status); //物料类型(FERT(已完成)/ROH(原始)/HALB(半成品)/KMAT(可配置)/INST(安装)/VERP(包装)/FHMI(生产资源/工具)/CSTM(自定义)) String itemType = itemSyncRequest.getITEM_TYPE(); + if (!"FERT".equals(itemType) && !"ROH".equals(itemType) && !"HALB".equals(itemType)) { + throw BusinessException.build("物料类型可维护的值为:FERT(已完成)、ROH(原始)、HALB(半成品)"); + } //采购类型(M(制造)/P(采购)/B(制造/采购)) String procurementType = itemSyncRequest.getPROCUREMENT_TYPE(); if (!"M".equals(procurementType) && !"P".equals(procurementType) && !"B".equals(procurementType)) { - throw BusinessException.build("参数【PROCUREMENT_TYPE】支持的值为【M、P、B】"); + throw BusinessException.build("采购类型可维护的值为:M(制造)、P(采购)、B(制造/采购)"); } + //批次大小 String lotSize = itemSyncRequest.getLOT_SIZE(); lotSize = StringUtil.notBlank(lotSize) ? lotSize : "999999"; @@ -96,8 +106,6 @@ public class InterfaceServiceImpl implements InterfaceService { String assyDataType = itemSyncRequest.getASSY_DATA_TYPE(); //库存接收数据类型 String invAssyDataType = itemSyncRequest.getINV_ASSY_DATA_TYPE(); - //计量单位 - String unitOfMeasure = itemSyncRequest.getUNIT_OF_MEASURE(); //物料标准API ItemConfigurationServiceInterface itemServiceInterFace = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site); @@ -118,6 +126,8 @@ public class InterfaceServiceImpl implements InterfaceService { itemConfiguration.setUnitOfMeasurement(unitOfMeasure); itemConfiguration.setMaterialType(MaterialType.fromValue(itemType)); + String dataTypeBo = "DataTypeBO:" +site+ ",ASSEMBLY,INV_NAC"; + itemConfiguration.setInventoryAssemblyDataTypeRef(dataTypeBo); //物料描述赋值 List itemTranslationList = new ArrayList<>(); ItemTranslation itemTranslation = new ItemTranslation(); @@ -521,34 +531,44 @@ public class InterfaceServiceImpl implements InterfaceService { RouterStepDto routerStepDto = routerStepDtoList.get(i); String stepId = routerStepDto.getSTEP_ID(); String erpWorkCenter = routerStepDto.getOPERATION().trim(); - if (StringUtil.isBlank(erpWorkCenter)) { - continue; - } - - if (StringUtil.isBlank(entryRouterStep)) { - entryRouterStep = stepId; - } - - //上一步骤添加当前步骤为下一步骤 - if (i > 0) { - RouterNextStep routerNextStep = new RouterNextStep(); - routerNextStep.setNextStepId(stepId); - routerStepList.get(i-1).getRouterNextStepList().add(routerNextStep); - } + String operation = null; + String operationBo = null; + if (StringUtil.isBlank(erpWorkCenter)) { + operation = (i == 0) ? "HJ01_6106GX" : "6106GX"; + Operation operationModel = operationService.getCurrentRevisionRef(site, operation); + if (operationModel == null) { + throw BusinessException.build("工序编号【" +operation+ "】不存在"); + } + operation = operationModel.getOperation(); + operationBo = operationModel.getHandle(); + } else { - /** - * 工序参数说明: - * 1.接口传过来的参数是ERP工作中心 - * 2.MES资源类型=生产车间_ERP工作中心 - * 3.MES资源类型=MES工序 - */ - Operation operationModel = operationService.queryOperationByErpWorkCenter(site, erpWorkCenter); - if (operationModel == null) { - throw BusinessException.build("步骤标识【" +stepId+ "】下ERP工作中心【" +erpWorkCenter+"】对应的MES工序未维护"); + if (StringUtil.isBlank(entryRouterStep)) { + entryRouterStep = stepId; + } + + //上一步骤添加当前步骤为下一步骤 + if (i > 0) { + RouterNextStep routerNextStep = new RouterNextStep(); + routerNextStep.setNextStepId(stepId); + routerStepList.get(i - 1).getRouterNextStepList().add(routerNextStep); + } + + + /** + * 工序参数说明: + * 1.接口传过来的参数是ERP工作中心 + * 2.MES资源类型=生产车间_ERP工作中心 + * 3.MES资源类型=MES工序 + */ + Operation operationModel = operationService.queryOperationByErpWorkCenter(site, erpWorkCenter); + if (operationModel == null) { + throw BusinessException.build("步骤标识【" + stepId + "】下ERP工作中心【" + erpWorkCenter + "】对应的MES工序未维护"); + } + operation = operationModel.getOperation(); + operationBo = operationModel.getHandle(); } - String operation = operationModel.getOperation(); - String operationBo = operationModel.getHandle(); //工艺路线步骤 RouterStep routerStep = new RouterStep(); From 555f19771239f89aea6a1c1b29effaf4050c9d34 Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Mon, 9 Aug 2021 17:25:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=9B=9E=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/common/constant/IntegrationTypeConstant.java | 2 ++ .../mesnac/meapi/controller/InventoryController.java | 2 ++ .../production/service/impl/PodTemplateServiceImpl.java | 3 +-- .../mesnac/production/service/impl/SplitSfcServiceImpl.java | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java index 8a9ff61b..821dd2e8 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java @@ -15,4 +15,6 @@ public class IntegrationTypeConstant { public static final String DIS_ROUTER = "DIS_ROUTER"; public static final String SHOP_ORDER = "SHOP_ORDER"; public static final String ITEM_BATCH_RECEIVE = "ITEM_BATCH_RECEIVE"; + public static final String REPORT_ORDER = "REPORT_ORDER"; + } diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/InventoryController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/InventoryController.java index 7faab2b5..3199a0e6 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/InventoryController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/InventoryController.java @@ -1,5 +1,6 @@ package com.foreverwin.mesnac.meapi.controller; +import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.R; import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -48,6 +49,7 @@ public class InventoryController { public R getInventoryList(Inventory inventory){ List result; QueryWrapper queryWrapper = new QueryWrapper<>(); + inventory.setSite(CommonMethods.getSite()); queryWrapper.setEntity(inventory); result = inventoryService.list(queryWrapper); return R.ok(result); diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java index 8a6db676..0fb83bc6 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java @@ -223,7 +223,6 @@ public class PodTemplateServiceImpl implements PodTemplateService { QueryWrapper queryWrapper=new QueryWrapper<>(); queryWrapper.eq(InspectionTask.CATEGORY,Constants.INSPECTION_TYPE_P); queryWrapper.eq(InspectionTask.SFC,sfc); - queryWrapper.ne(InspectionTask.STATUS,Constants.INSPECTION_TASK_STATUS_COMPLETE); queryWrapper.ne(InspectionTask.RESULT,Constants.RSESULT_OK); List list = inspectionTaskService.list(queryWrapper); if (!list.isEmpty()) { @@ -489,7 +488,7 @@ public class PodTemplateServiceImpl implements PodTemplateService { IntegrationLog log = new IntegrationLog(); log.setHandle(UUID.randomUUID().toString()); log.setSite(CommonMethods.getSite()); - log.setIntegrationType(IntegrationTypeConstant.ROUTER); + log.setIntegrationType(IntegrationTypeConstant.REPORT_ORDER); log.setCategory("REQUEST"); log.setIntegrationWay("ERP"); log.setIntegrationMethod("erpWebService.zmesProdordconf"); diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java index f307a1a1..e77b24e8 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java @@ -143,7 +143,7 @@ public class SplitSfcServiceImpl extends ServiceImpl i save(splitSfc); String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo(); Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc)); - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),sfc, sfcData.getShopOrder(),routerBySfcBo.getHandle()); + sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle()); return splitSfc; } catch (Exception e) { ExceptionUtil.throwException(e); @@ -236,7 +236,7 @@ public class SplitSfcServiceImpl extends ServiceImpl i splitSfc.setCreatedDateTime(LocalDateTime.now()); save(splitSfc); String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo(); - sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),sfc, sfcData.getShopOrder(),routerBo); + sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),newSfc, sfcData.getShopOrder(),routerBo); return splitSfc; } catch (Exception e) { ExceptionUtil.throwException(e); From 648f09992c2a5ba12a76e5255f3789b8eda74f1c Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Mon, 9 Aug 2021 17:32:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8B=86=E5=88=86=E6=89=BE=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E7=89=88=E6=9C=AC=E5=B7=A5=E8=89=BA=E8=B7=AF=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/production/service/impl/SplitSfcServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java index e77b24e8..ca2dd264 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java @@ -220,7 +220,8 @@ public class SplitSfcServiceImpl extends ServiceImpl i dispositionSfcsRequest.setSfcs(sfcs); dispositionSfcsRequest.setBypassStepValidation(true); DispositionSelection dispositionSelection=new DispositionSelection(); - dispositionSelection.setRouterRef(routerBo); + Router maxRevisionRouter = routerService.getMaxRevisionRouter(site, StringUtil.trimHandle(routerBo)); + dispositionSelection.setRouterRef(maxRevisionRouter.getHandle()); dispositionSfcsRequest.setDispositionSelection(dispositionSelection); dispositionSfcsRequest.setProdCtx(new ProductionContext()); ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest); From 6b71552fd099b60030fb1190ebf0f1cffbad3ef7 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Mon, 9 Aug 2021 17:56:09 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B7=A5=E8=89=BA=E8=B7=AF=E7=BA=BF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=98=E6=9B=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integration/service/impl/CAPPAPIWebServiceImpl.java | 4 ++-- .../mesnac/integration/service/impl/InterfaceServiceImpl.java | 2 +- .../mesnac/meapi/service/impl/OperationServiceImpl.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java index 58325e56..d5aa31a2 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/CAPPAPIWebServiceImpl.java @@ -52,10 +52,10 @@ public class CAPPAPIWebServiceImpl implements CAPPAPIWebService { site = itemSyncRequest.getSITE(); String item = itemSyncRequest.getITEM(); if (StringUtil.isBlank(site)) { - throw BusinessException.build("参数【SITE】不能为空"); + throw BusinessException.build("站点不能为空"); } if (StringUtil.isBlank(item)) { - throw BusinessException.build("参数【ITEM】不能为空"); + throw BusinessException.build("物料编号不能为空"); } //调用业务接口 diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java index 88183454..d4c2d035 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java @@ -84,7 +84,7 @@ public class InterfaceServiceImpl implements InterfaceService { //状态 String status = itemSyncRequest.getSTATUS(); - if (!"210".equals(status) && !"202".equals(status) && !"203".equals(status) && !"204".equals(status) && !"205".equals(status)) { + if (!"201".equals(status) && !"202".equals(status) && !"203".equals(status) && !"204".equals(status) && !"205".equals(status)) { throw BusinessException.build("物料状态可维护的值为:201(可下达)、202(冻结)、203(作废)、204(保留)、205(新建)"); } String statusBo = HandleEnum.STATUS.getHandle(site, status); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java index 93215114..1c894695 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/OperationServiceImpl.java @@ -56,7 +56,7 @@ public class OperationServiceImpl extends ServiceImpl