From ed808b559d265f158c20dbdfd49ebe74a341ebfe Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sun, 8 Oct 2023 14:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96bom=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/SAPPortController.java | 3 +- .../aucma/api/service/ISAPPortService.java | 3 +- .../api/service/ISAPPutStorageService.java | 3 +- .../api/service/impl/SAPPortServiceImpl.java | 22 +++++++-------- .../impl/SAPPutStorageServiceImpl.java | 28 ++++++++++--------- ...aterialinfo.java => BaseMaterialInfo.java} | 0 6 files changed, 32 insertions(+), 27 deletions(-) rename aucma-base/src/main/java/com/aucma/base/domain/{BaseMaterialinfo.java => BaseMaterialInfo.java} (100%) diff --git a/aucma-api/src/main/java/com/aucma/api/controller/SAPPortController.java b/aucma-api/src/main/java/com/aucma/api/controller/SAPPortController.java index d26b2be..d548172 100644 --- a/aucma-api/src/main/java/com/aucma/api/controller/SAPPortController.java +++ b/aucma-api/src/main/java/com/aucma/api/controller/SAPPortController.java @@ -6,6 +6,7 @@ import com.aucma.api.service.ISAPPortService; import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.domain.OrderBomInfo; import com.aucma.common.core.controller.BaseController; import com.aucma.common.core.domain.AjaxResult; import com.aucma.production.domain.BaseBomInfo; @@ -93,7 +94,7 @@ public class SAPPortController extends BaseController { WERKSDto werksDto = new WERKSDto(); werksDto.setItem(werksMap.get("item")); sapPortDto.setFactoryCodes(werksDto); - List BaeeBomVoList = sapPortService.getSapBaseBomInfo(sapPortDto); + List BaeeBomVoList = sapPortService.getSapOrderBomInfo(sapPortDto); return AjaxResult.success(BaeeBomVoList); } diff --git a/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java b/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java index 922ad2e..1852972 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java +++ b/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java @@ -4,6 +4,7 @@ import com.aucma.api.domain.dto.SAPPortDto; import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.domain.OrderBomInfo; import com.aucma.production.domain.BaseBomInfo; import org.springframework.stereotype.Service; @@ -26,7 +27,7 @@ public interface ISAPPortService { List getSapBaseOrderInfo(SAPPortDto sapPortDto); List getSapDeviceLedgers(SAPPortDto sapPortDto); - List getSapBaseBomInfo(SAPPortDto sapPortDto); + List getSapOrderBomInfo(SAPPortDto sapPortDto); diff --git a/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java b/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java index afe0236..0ba9eb0 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java +++ b/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java @@ -5,6 +5,7 @@ import com.aucma.api.domain.vo.SAPResultVo; import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.domain.OrderBomInfo; import com.aucma.production.domain.BaseBomInfo; import java.text.ParseException; @@ -41,6 +42,6 @@ public interface ISAPPutStorageService { * 转换产品bom信息实体类 保存数据 * * */ - public ArrayList insertSAPBaseBomInfo(SAPResultBomVo resultVo) throws ParseException; + public ArrayList insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException; } diff --git a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java index 352336f..e6b6fb4 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java +++ b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java @@ -11,10 +11,10 @@ import com.aucma.api.utils.SAPConstants; import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.domain.OrderBomInfo; import com.aucma.common.exception.base.BaseException; import com.aucma.common.utils.StringUtils; import com.aucma.common.utils.http.HttpUtils; -import com.aucma.production.domain.BaseBomInfo; import com.aucma.system.utils.PortLogUtils; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -149,9 +149,9 @@ public class SAPPortServiceImpl implements ISAPPortService { result = HttpUtils.sendHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.EQUIPMENT_URL, requestParam); // 处理接口返回消息 // result = "{\"O_TAB\":{\"item\":[{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"盖后加固体,BC/BD-127FA\",\"WERKS\":\"2004\",\"MTART\":\"HALB\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-06\",\"MATNR\":\"000000008106000102\"},{\"MAKTX\":\"SC-246,YZXGWB乳品\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009002003478\"},{\"MAKTX\":\"SD-460,YZXGW蒙牛冰品\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009000004735\"},{\"MAKTX\":\"BC-100E,特需\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-02\",\"MATNR\":\"000000009001002406\"},{\"MAKTX\":\"BD(C)-310T,特需\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-20\",\"MATNR\":\"000000009000000225\"}]},\"WERKS\":null,\"O_RETURN\":{\"item\":[{\"MESSAGE\":\"查询成功1!\",\"ID\":\" 0\",\"TYPE\":\"S\"}]}}"; - System.out.println("========================================================"); - System.out.println(result); - System.out.println("========================================================"); +// System.out.println("========================================================"); +// System.out.println(result); +// System.out.println("========================================================"); ObjectMapper resultMapper = new ObjectMapper(); // 将 JSON 字符串转换为 Java 对象 SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class); @@ -172,7 +172,7 @@ public class SAPPortServiceImpl implements ISAPPortService { } @Override - public List getSapBaseBomInfo(SAPPortDto sapPortDto) { + public List getSapOrderBomInfo(SAPPortDto sapPortDto) { String startDate = sapPortDto.getStartDate(); String endDate = sapPortDto.getEndDate(); WERKSDto werks = sapPortDto.getFactoryCodes(); @@ -180,7 +180,7 @@ public class SAPPortServiceImpl implements ISAPPortService { if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate) || StringUtils.isNull(werks)) { return null; } - ArrayList baseBomInfosVos = new ArrayList<>(); + ArrayList orderBomInfosVos = new ArrayList<>(); String requestParam = null; String result = null; try { @@ -191,9 +191,9 @@ public class SAPPortServiceImpl implements ISAPPortService { requestParam = objectMapper.writeValueAsString(sapPortDto); result = HttpUtils.sendHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.PRODUCTS_BOM_URL, requestParam); // 处理接口返回消息 - System.out.println("========================================================"); - System.out.println(result); - System.out.println("========================================================"); +// System.out.println("========================================================"); +// System.out.println(result); +// System.out.println("========================================================"); // result = "{\"O_TAB\":{\"item\":[{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"盖后加固体,BC/BD-127FA\",\"WERKS\":\"2004\",\"MTART\":\"HALB\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-06\",\"MATNR\":\"000000008106000102\"},{\"MAKTX\":\"SC-246,YZXGWB乳品\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009002003478\"},{\"MAKTX\":\"SD-460,YZXGW蒙牛冰品\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009000004735\"},{\"MAKTX\":\"BC-100E,特需\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-02\",\"MATNR\":\"000000009001002406\"},{\"MAKTX\":\"BD(C)-310T,特需\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-20\",\"MATNR\":\"000000009000000225\"}]},\"WERKS\":null,\"O_RETURN\":{\"item\":[{\"MESSAGE\":\"查询成功1!\",\"ID\":\" 0\",\"TYPE\":\"S\"}]}}"; ObjectMapper resultMapper = new ObjectMapper(); @@ -204,7 +204,7 @@ public class SAPPortServiceImpl implements ISAPPortService { // throw new BaseException("处理接口返回消息错误!(ID不为0或O_RETURN为空)"); // } //转物料实体类 保存数据 - baseBomInfosVos = storageService.insertSAPBaseBomInfo(resultVo); + orderBomInfosVos = storageService.insertSAPOrderBomInfo(resultVo); //保存接口日志 PortLogUtils.savePortLog(werks.getItem().get(0).get("IWERK"), "获取SAP物料主数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, null); } catch (Exception e) { @@ -212,7 +212,7 @@ public class SAPPortServiceImpl implements ISAPPortService { System.out.println(e.getMessage()); PortLogUtils.savePortLog(werks.getItem().get(0).get("IWERK"), "获取SAP物料主数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, e.toString()); } - return baseBomInfosVos; + return orderBomInfosVos; } diff --git a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java index 3810cd8..dc21f54 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java +++ b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java @@ -6,9 +6,11 @@ import com.aucma.api.service.ISAPPutStorageService; import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.domain.OrderBomInfo; import com.aucma.base.service.IBaseDeviceLedgerService; import com.aucma.base.service.IBaseMaterialInfoService; import com.aucma.base.service.IBaseOrderInfoService; +import com.aucma.base.service.IOrderBomInfoService; import com.aucma.common.utils.DateUtils; import com.aucma.common.utils.SecurityUtils; import com.aucma.production.domain.BaseBomInfo; @@ -42,7 +44,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService { @Autowired private IBaseOrderInfoService baseOrderInfoService; @Autowired - private IBaseBomInfoService baseBomInfoService; + private IOrderBomInfoService orderBomInfoService; /** * 转物料实体类 保存数据 @@ -150,26 +152,26 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService { } @Override - public ArrayList insertSAPBaseBomInfo(SAPResultBomVo resultVo) throws ParseException { - ArrayList baseBomInfoList = new ArrayList<>(); + public ArrayList insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException { + ArrayList orderBomInfoList = new ArrayList<>(); List> itemList = resultVo.getO_TAB().get("item"); - BaseBomInfo bbInfo = new BaseBomInfo(); + for (HashMap map : itemList) { - BaseBomInfo baseBomInfo = new BaseBomInfo(); - baseBomInfo.setPlantCode(map.get("WERKS")); - baseBomInfo.setParentId(map.get("MATNR")); - baseBomInfo.setMaterialCode(map.get("IDNRK")); + OrderBomInfo orderBomInfo = new OrderBomInfo(); + orderBomInfo.setFactoryCode(map.get("WERKS")); + orderBomInfo.setParentId(map.get("MATNR")); + orderBomInfo.setMaterialCode(map.get("IDNRK")); if (!map.get("MENGE").isEmpty()){ - baseBomInfo.setStandardAmount(Long.parseLong(map.get("MENGE"))); + orderBomInfo.setStandardAmount(Long.parseLong(map.get("MENGE"))); } - baseBomInfo.setCreatedTime(DateUtils.getNowDate()); + orderBomInfo.setCreatedTime(DateUtils.getNowDate()); // baseBomInfo.setCreatedBy(SecurityUtils.getLoginUser().getUsername()); - baseBomInfoService.insertBaseBomInfo(baseBomInfo); - baseBomInfoList.add(baseBomInfo); + orderBomInfoService.insertOrderBomInfo(orderBomInfo); + orderBomInfoList.add(orderBomInfo); } - return baseBomInfoList; + return orderBomInfoList; } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseMaterialinfo.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseMaterialInfo.java similarity index 100% rename from aucma-base/src/main/java/com/aucma/base/domain/BaseMaterialinfo.java rename to aucma-base/src/main/java/com/aucma/base/domain/BaseMaterialInfo.java