|
|
@ -79,16 +79,26 @@ public class InterfaceServiceImpl implements InterfaceService {
|
|
|
|
revision = StringUtil.notBlank(revision) ? revision : "A";
|
|
|
|
revision = StringUtil.notBlank(revision) ? revision : "A";
|
|
|
|
//物料描述
|
|
|
|
//物料描述
|
|
|
|
String itemDescription = itemSyncRequest.getMAKTX();
|
|
|
|
String itemDescription = itemSyncRequest.getMAKTX();
|
|
|
|
|
|
|
|
//计量单位
|
|
|
|
|
|
|
|
String unitOfMeasure = itemSyncRequest.getUNIT_OF_MEASURE();
|
|
|
|
|
|
|
|
|
|
|
|
//状态
|
|
|
|
//状态
|
|
|
|
String status = itemSyncRequest.getSTATUS();
|
|
|
|
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);
|
|
|
|
String statusBo = HandleEnum.STATUS.getHandle(site, status);
|
|
|
|
//物料类型(FERT(已完成)/ROH(原始)/HALB(半成品)/KMAT(可配置)/INST(安装)/VERP(包装)/FHMI(生产资源/工具)/CSTM(自定义))
|
|
|
|
//物料类型(FERT(已完成)/ROH(原始)/HALB(半成品)/KMAT(可配置)/INST(安装)/VERP(包装)/FHMI(生产资源/工具)/CSTM(自定义))
|
|
|
|
String itemType = itemSyncRequest.getITEM_TYPE();
|
|
|
|
String itemType = itemSyncRequest.getITEM_TYPE();
|
|
|
|
|
|
|
|
if (!"FERT".equals(itemType) && !"ROH".equals(itemType) && !"HALB".equals(itemType)) {
|
|
|
|
|
|
|
|
throw BusinessException.build("物料类型可维护的值为:FERT(已完成)、ROH(原始)、HALB(半成品)");
|
|
|
|
|
|
|
|
}
|
|
|
|
//采购类型(M(制造)/P(采购)/B(制造/采购))
|
|
|
|
//采购类型(M(制造)/P(采购)/B(制造/采购))
|
|
|
|
String procurementType = itemSyncRequest.getPROCUREMENT_TYPE();
|
|
|
|
String procurementType = itemSyncRequest.getPROCUREMENT_TYPE();
|
|
|
|
if (!"M".equals(procurementType) && !"P".equals(procurementType) && !"B".equals(procurementType)) {
|
|
|
|
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();
|
|
|
|
String lotSize = itemSyncRequest.getLOT_SIZE();
|
|
|
|
lotSize = StringUtil.notBlank(lotSize) ? lotSize : "999999";
|
|
|
|
lotSize = StringUtil.notBlank(lotSize) ? lotSize : "999999";
|
|
|
@ -96,8 +106,6 @@ public class InterfaceServiceImpl implements InterfaceService {
|
|
|
|
String assyDataType = itemSyncRequest.getASSY_DATA_TYPE();
|
|
|
|
String assyDataType = itemSyncRequest.getASSY_DATA_TYPE();
|
|
|
|
//库存接收数据类型
|
|
|
|
//库存接收数据类型
|
|
|
|
String invAssyDataType = itemSyncRequest.getINV_ASSY_DATA_TYPE();
|
|
|
|
String invAssyDataType = itemSyncRequest.getINV_ASSY_DATA_TYPE();
|
|
|
|
//计量单位
|
|
|
|
|
|
|
|
String unitOfMeasure = itemSyncRequest.getUNIT_OF_MEASURE();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物料标准API
|
|
|
|
//物料标准API
|
|
|
|
ItemConfigurationServiceInterface itemServiceInterFace = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site);
|
|
|
|
ItemConfigurationServiceInterface itemServiceInterFace = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site);
|
|
|
@ -118,6 +126,8 @@ public class InterfaceServiceImpl implements InterfaceService {
|
|
|
|
itemConfiguration.setUnitOfMeasurement(unitOfMeasure);
|
|
|
|
itemConfiguration.setUnitOfMeasurement(unitOfMeasure);
|
|
|
|
itemConfiguration.setMaterialType(MaterialType.fromValue(itemType));
|
|
|
|
itemConfiguration.setMaterialType(MaterialType.fromValue(itemType));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String dataTypeBo = "DataTypeBO:" +site+ ",ASSEMBLY,INV_NAC";
|
|
|
|
|
|
|
|
itemConfiguration.setInventoryAssemblyDataTypeRef(dataTypeBo);
|
|
|
|
//物料描述赋值
|
|
|
|
//物料描述赋值
|
|
|
|
List<ItemTranslation> itemTranslationList = new ArrayList<>();
|
|
|
|
List<ItemTranslation> itemTranslationList = new ArrayList<>();
|
|
|
|
ItemTranslation itemTranslation = new ItemTranslation();
|
|
|
|
ItemTranslation itemTranslation = new ItemTranslation();
|
|
|
@ -521,34 +531,44 @@ public class InterfaceServiceImpl implements InterfaceService {
|
|
|
|
RouterStepDto routerStepDto = routerStepDtoList.get(i);
|
|
|
|
RouterStepDto routerStepDto = routerStepDtoList.get(i);
|
|
|
|
String stepId = routerStepDto.getSTEP_ID();
|
|
|
|
String stepId = routerStepDto.getSTEP_ID();
|
|
|
|
String erpWorkCenter = routerStepDto.getOPERATION().trim();
|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
if (StringUtil.isBlank(entryRouterStep)) {
|
|
|
|
* 工序参数说明:
|
|
|
|
entryRouterStep = stepId;
|
|
|
|
* 1.接口传过来的参数是ERP工作中心
|
|
|
|
}
|
|
|
|
* 2.MES资源类型=生产车间_ERP工作中心
|
|
|
|
|
|
|
|
* 3.MES资源类型=MES工序
|
|
|
|
//上一步骤添加当前步骤为下一步骤
|
|
|
|
*/
|
|
|
|
if (i > 0) {
|
|
|
|
Operation operationModel = operationService.queryOperationByErpWorkCenter(site, erpWorkCenter);
|
|
|
|
RouterNextStep routerNextStep = new RouterNextStep();
|
|
|
|
if (operationModel == null) {
|
|
|
|
routerNextStep.setNextStepId(stepId);
|
|
|
|
throw BusinessException.build("步骤标识【" +stepId+ "】下ERP工作中心【" +erpWorkCenter+"】对应的MES工序未维护");
|
|
|
|
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();
|
|
|
|
RouterStep routerStep = new RouterStep();
|
|
|
|