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/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 6023b996..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 @@ -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 (!"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); //物料类型(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(); 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/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 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..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 @@ -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); @@ -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); @@ -236,7 +237,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);