获取bom产品信息接口

master
zhouhy 1 year ago
parent 580b7d3107
commit ed808b559d

@ -6,6 +6,7 @@ import com.aucma.api.service.ISAPPortService;
import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.common.core.controller.BaseController; import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult; import com.aucma.common.core.domain.AjaxResult;
import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.domain.BaseBomInfo;
@ -93,7 +94,7 @@ public class SAPPortController extends BaseController {
WERKSDto werksDto = new WERKSDto(); WERKSDto werksDto = new WERKSDto();
werksDto.setItem(werksMap.get("item")); werksDto.setItem(werksMap.get("item"));
sapPortDto.setFactoryCodes(werksDto); sapPortDto.setFactoryCodes(werksDto);
List<BaseBomInfo> BaeeBomVoList = sapPortService.getSapBaseBomInfo(sapPortDto); List<OrderBomInfo> BaeeBomVoList = sapPortService.getSapOrderBomInfo(sapPortDto);
return AjaxResult.success(BaeeBomVoList); return AjaxResult.success(BaeeBomVoList);
} }

@ -4,6 +4,7 @@ import com.aucma.api.domain.dto.SAPPortDto;
import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.domain.BaseBomInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -26,7 +27,7 @@ public interface ISAPPortService {
List<BaseOrderInfo> getSapBaseOrderInfo(SAPPortDto sapPortDto); List<BaseOrderInfo> getSapBaseOrderInfo(SAPPortDto sapPortDto);
List<BaseDeviceLedger> getSapDeviceLedgers(SAPPortDto sapPortDto); List<BaseDeviceLedger> getSapDeviceLedgers(SAPPortDto sapPortDto);
List<BaseBomInfo> getSapBaseBomInfo(SAPPortDto sapPortDto); List<OrderBomInfo> getSapOrderBomInfo(SAPPortDto sapPortDto);

@ -5,6 +5,7 @@ import com.aucma.api.domain.vo.SAPResultVo;
import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.domain.BaseBomInfo;
import java.text.ParseException; import java.text.ParseException;
@ -41,6 +42,6 @@ public interface ISAPPutStorageService {
* bom * bom
* *
* */ * */
public ArrayList<BaseBomInfo> insertSAPBaseBomInfo(SAPResultBomVo resultVo) throws ParseException; public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException;
} }

@ -11,10 +11,10 @@ import com.aucma.api.utils.SAPConstants;
import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.common.exception.base.BaseException; import com.aucma.common.exception.base.BaseException;
import com.aucma.common.utils.StringUtils; import com.aucma.common.utils.StringUtils;
import com.aucma.common.utils.http.HttpUtils; import com.aucma.common.utils.http.HttpUtils;
import com.aucma.production.domain.BaseBomInfo;
import com.aucma.system.utils.PortLogUtils; import com.aucma.system.utils.PortLogUtils;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired; 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 = 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\"}]}}"; // 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("========================================================");
System.out.println(result); // System.out.println(result);
System.out.println("========================================================"); // System.out.println("========================================================");
ObjectMapper resultMapper = new ObjectMapper(); ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象 // 将 JSON 字符串转换为 Java 对象
SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class); SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class);
@ -172,7 +172,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
} }
@Override @Override
public List<BaseBomInfo> getSapBaseBomInfo(SAPPortDto sapPortDto) { public List<OrderBomInfo> getSapOrderBomInfo(SAPPortDto sapPortDto) {
String startDate = sapPortDto.getStartDate(); String startDate = sapPortDto.getStartDate();
String endDate = sapPortDto.getEndDate(); String endDate = sapPortDto.getEndDate();
WERKSDto werks = sapPortDto.getFactoryCodes(); WERKSDto werks = sapPortDto.getFactoryCodes();
@ -180,7 +180,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate) || StringUtils.isNull(werks)) { if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate) || StringUtils.isNull(werks)) {
return null; return null;
} }
ArrayList<BaseBomInfo> baseBomInfosVos = new ArrayList<>(); ArrayList<OrderBomInfo> orderBomInfosVos = new ArrayList<>();
String requestParam = null; String requestParam = null;
String result = null; String result = null;
try { try {
@ -191,9 +191,9 @@ public class SAPPortServiceImpl implements ISAPPortService {
requestParam = objectMapper.writeValueAsString(sapPortDto); requestParam = objectMapper.writeValueAsString(sapPortDto);
result = HttpUtils.sendHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.PRODUCTS_BOM_URL, requestParam); result = HttpUtils.sendHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.PRODUCTS_BOM_URL, requestParam);
// 处理接口返回消息 // 处理接口返回消息
System.out.println("========================================================"); // System.out.println("========================================================");
System.out.println(result); // System.out.println(result);
System.out.println("========================================================"); // 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\"}]}}"; // 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(); ObjectMapper resultMapper = new ObjectMapper();
@ -204,7 +204,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
// throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空"); // 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); PortLogUtils.savePortLog(werks.getItem().get(0).get("IWERK"), "获取SAP物料主数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, null);
} catch (Exception e) { } catch (Exception e) {
@ -212,7 +212,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
PortLogUtils.savePortLog(werks.getItem().get(0).get("IWERK"), "获取SAP物料主数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, e.toString()); PortLogUtils.savePortLog(werks.getItem().get(0).get("IWERK"), "获取SAP物料主数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, e.toString());
} }
return baseBomInfosVos; return orderBomInfosVos;
} }

@ -6,9 +6,11 @@ import com.aucma.api.service.ISAPPutStorageService;
import com.aucma.base.domain.BaseDeviceLedger; import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo; import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo; import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.base.service.IBaseDeviceLedgerService; import com.aucma.base.service.IBaseDeviceLedgerService;
import com.aucma.base.service.IBaseMaterialInfoService; import com.aucma.base.service.IBaseMaterialInfoService;
import com.aucma.base.service.IBaseOrderInfoService; import com.aucma.base.service.IBaseOrderInfoService;
import com.aucma.base.service.IOrderBomInfoService;
import com.aucma.common.utils.DateUtils; import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.SecurityUtils; import com.aucma.common.utils.SecurityUtils;
import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.domain.BaseBomInfo;
@ -42,7 +44,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
@Autowired @Autowired
private IBaseOrderInfoService baseOrderInfoService; private IBaseOrderInfoService baseOrderInfoService;
@Autowired @Autowired
private IBaseBomInfoService baseBomInfoService; private IOrderBomInfoService orderBomInfoService;
/** /**
* *
@ -150,26 +152,26 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
} }
@Override @Override
public ArrayList<BaseBomInfo> insertSAPBaseBomInfo(SAPResultBomVo resultVo) throws ParseException { public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException {
ArrayList<BaseBomInfo> baseBomInfoList = new ArrayList<>(); ArrayList<OrderBomInfo> orderBomInfoList = new ArrayList<>();
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item"); List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
BaseBomInfo bbInfo = new BaseBomInfo();
for (HashMap<String, String> map : itemList) { for (HashMap<String, String> map : itemList) {
BaseBomInfo baseBomInfo = new BaseBomInfo(); OrderBomInfo orderBomInfo = new OrderBomInfo();
baseBomInfo.setPlantCode(map.get("WERKS")); orderBomInfo.setFactoryCode(map.get("WERKS"));
baseBomInfo.setParentId(map.get("MATNR")); orderBomInfo.setParentId(map.get("MATNR"));
baseBomInfo.setMaterialCode(map.get("IDNRK")); orderBomInfo.setMaterialCode(map.get("IDNRK"));
if (!map.get("MENGE").isEmpty()){ 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()); // baseBomInfo.setCreatedBy(SecurityUtils.getLoginUser().getUsername());
baseBomInfoService.insertBaseBomInfo(baseBomInfo); orderBomInfoService.insertOrderBomInfo(orderBomInfo);
baseBomInfoList.add(baseBomInfo); orderBomInfoList.add(orderBomInfo);
} }
return baseBomInfoList; return orderBomInfoList;
} }

Loading…
Cancel
Save