add - API模块、SAP物料接口
parent
cdf764338a
commit
748baeaff1
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>aucma</artifactId>
|
||||||
|
<groupId>com.aucma</groupId>
|
||||||
|
<version>3.8.6</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>aucma-api</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
API接口
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- 基础数据-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aucma</groupId>
|
||||||
|
<artifactId>aucma-base</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.aucma.api.controller;
|
||||||
|
|
||||||
|
import com.aucma.api.domain.dto.SAPPortDto;
|
||||||
|
import com.aucma.api.domain.dto.WERKSDto;
|
||||||
|
import com.aucma.api.service.ISAPPortService;
|
||||||
|
import com.aucma.base.domain.BaseMaterialInfo;
|
||||||
|
import com.aucma.common.core.controller.BaseController;
|
||||||
|
import com.aucma.common.core.domain.AjaxResult;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-26 14:29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sap/port")
|
||||||
|
public class SAPPortController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISAPPortService sapPortService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取SAP物料主数据
|
||||||
|
* @param paramMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getSAPMaterialData")
|
||||||
|
public AjaxResult getSAPMaterialData(@RequestBody Map paramMap) {
|
||||||
|
SAPPortDto sapPortDto = new SAPPortDto();
|
||||||
|
sapPortDto.setStartDate(String.valueOf(paramMap.get("NDATE")));
|
||||||
|
sapPortDto.setEndDate(String.valueOf(paramMap.get("EDATE")));
|
||||||
|
HashMap<String,List<HashMap<String,String>>> werksMap = (HashMap<String,List<HashMap<String,String>>>)paramMap.get("WERKS");
|
||||||
|
WERKSDto werksDto = new WERKSDto();
|
||||||
|
werksDto.setItem(werksMap.get("item"));
|
||||||
|
sapPortDto.setFactoryCodes(werksDto);
|
||||||
|
List<BaseMaterialInfo> materialVoList = sapPortService.getSAPMaterialData(sapPortDto);
|
||||||
|
return AjaxResult.success(materialVoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.aucma.api.domain.dto;
|
||||||
|
|
||||||
|
import com.aucma.common.core.domain.BaseEntity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-26 14:46
|
||||||
|
*/
|
||||||
|
public class SAPPortDto {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "NDATE")
|
||||||
|
private String startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "EDATE")
|
||||||
|
private String endDate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工厂编号
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "WERKS")
|
||||||
|
private WERKSDto factoryCodes;
|
||||||
|
|
||||||
|
|
||||||
|
public String getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(String startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(String endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WERKSDto getFactoryCodes() {
|
||||||
|
return factoryCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFactoryCodes(WERKSDto factoryCodes) {
|
||||||
|
this.factoryCodes = factoryCodes;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.aucma.api.domain.dto;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-26 15:13
|
||||||
|
*/
|
||||||
|
public class WERKSDto {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工厂请求Map
|
||||||
|
*/
|
||||||
|
List<HashMap<String, String>> item;
|
||||||
|
|
||||||
|
|
||||||
|
public List<HashMap<String, String>> getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItem(List<HashMap<String, String>> item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WERKSDto{" +
|
||||||
|
"item=" + item +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.aucma.api.domain.vo;
|
||||||
|
|
||||||
|
import com.aucma.api.domain.dto.WERKSDto;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据
|
||||||
|
*
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-27 13:37
|
||||||
|
*/
|
||||||
|
public class SAPResultVo {
|
||||||
|
|
||||||
|
@JsonProperty(value = "O_TAB")
|
||||||
|
private HashMap<String, List<HashMap<String, String>>> O_TAB;
|
||||||
|
|
||||||
|
@JsonProperty(value = "WERKS")
|
||||||
|
private String WERKS;
|
||||||
|
|
||||||
|
@JsonProperty(value = "O_RETURN")
|
||||||
|
private WERKSDto O_RETURN;
|
||||||
|
|
||||||
|
public HashMap<String, List<HashMap<String, String>>> getO_TAB() {
|
||||||
|
return O_TAB;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO_TAB(HashMap<String, List<HashMap<String, String>>> o_TAB) {
|
||||||
|
O_TAB = o_TAB;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWERKS() {
|
||||||
|
return WERKS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWERKS(String WERKS) {
|
||||||
|
this.WERKS = WERKS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WERKSDto getO_RETURN() {
|
||||||
|
return O_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setO_RETURN(WERKSDto o_RETURN) {
|
||||||
|
O_RETURN = o_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SAPResultVo{" +
|
||||||
|
"O_TAB=" + O_TAB +
|
||||||
|
", WERKS='" + WERKS + '\'' +
|
||||||
|
", O_RETURN=" + O_RETURN +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.aucma.api.service;
|
||||||
|
|
||||||
|
import com.aucma.api.domain.dto.SAPPortDto;
|
||||||
|
import com.aucma.base.domain.BaseMaterialInfo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-26 14:33
|
||||||
|
*/
|
||||||
|
@Service("SAPPort")
|
||||||
|
public interface ISAPPortService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取SAP物料主数据
|
||||||
|
* @param sapPortDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BaseMaterialInfo> getSAPMaterialData(SAPPortDto sapPortDto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.aucma.api.service;
|
||||||
|
|
||||||
|
import com.aucma.api.domain.vo.SAPResultVo;
|
||||||
|
import com.aucma.base.domain.BaseDeviceLedger;
|
||||||
|
import com.aucma.base.domain.BaseMaterialInfo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-27 15:07
|
||||||
|
*/
|
||||||
|
public interface ISAPPutStorageService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转物料实体类 保存数据
|
||||||
|
* @param resultVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ArrayList<BaseMaterialInfo> insertSAPMaterialInfo(SAPResultVo resultVo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转设备台账实体类 保存数据
|
||||||
|
* @param resultVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultVo resultVo);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.aucma.api.service.impl;
|
||||||
|
|
||||||
|
import com.aucma.api.domain.vo.SAPResultVo;
|
||||||
|
import com.aucma.api.service.ISAPPutStorageService;
|
||||||
|
import com.aucma.base.domain.BaseDeviceLedger;
|
||||||
|
import com.aucma.base.domain.BaseMaterialInfo;
|
||||||
|
import com.aucma.base.service.IBaseDeviceLedgerService;
|
||||||
|
import com.aucma.base.service.IBaseMaterialInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAP接口存入数据业务层
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-27 15:07
|
||||||
|
*/
|
||||||
|
public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBaseMaterialInfoService baseMaterialInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBaseDeviceLedgerService baseDeviceLedgerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转物料实体类 保存数据
|
||||||
|
* @param resultVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ArrayList<BaseMaterialInfo> insertSAPMaterialInfo(SAPResultVo resultVo){
|
||||||
|
ArrayList<BaseMaterialInfo> baseMaterialInfoArrayList = new ArrayList<>();
|
||||||
|
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
|
||||||
|
for (HashMap<String, String> map : itemList) {
|
||||||
|
BaseMaterialInfo materialInfo = new BaseMaterialInfo();
|
||||||
|
materialInfo.setMaterialCode(map.get("MATNR"));
|
||||||
|
materialInfo.setMaterialName(map.get("MAKTX"));
|
||||||
|
materialInfo.setMaterialType(map.get("MTART"));
|
||||||
|
materialInfo.setPlantCode(map.get("WERKS"));
|
||||||
|
materialInfo.setMaterialUnit(map.get("MEINS"));
|
||||||
|
baseMaterialInfoService.insertBaseMaterialInfo(materialInfo);
|
||||||
|
baseMaterialInfoArrayList.add(materialInfo);
|
||||||
|
}
|
||||||
|
return baseMaterialInfoArrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转设备台账实体类 保存数据
|
||||||
|
* @param resultVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultVo resultVo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.aucma.api.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author YinQ
|
||||||
|
* @create 2023-09-26 15:39
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class SAPConstants {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAP-URL前缀
|
||||||
|
*/
|
||||||
|
public static String SAP_PREFIX_URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取物料主数据(MES2019)
|
||||||
|
*/
|
||||||
|
public static final String MATERIAL_URL = "/SdGetSB/SdSapGetMaterialToMesSvcRSProxy/merge";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取生产工单(MES2019)
|
||||||
|
*/
|
||||||
|
public static final String PRODUCTION_ORDERS_URL = "/SdGetSB/SdSapGetPOToMesSvcRSProxy/merge";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备模具信息(MES2019)
|
||||||
|
*/
|
||||||
|
public static final String EQUIPMENT_URL = "/SdGetSB/SdSapGetEQToMesSvcRSProxy/merge";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取产品BOM信息(MES2019)
|
||||||
|
*/
|
||||||
|
public static final String PRODUCTS_BOM_URL = "/SdGetSB/SdSapGetBomToMesSvcRSProxy/merge";
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${sap.prefix}")
|
||||||
|
public void setPrefix(String value) {
|
||||||
|
SAP_PREFIX_URL = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue