change - 获取生产工单测试

master
yinq 8 months ago
parent fdc6c881cc
commit 11b7689360

@ -73,6 +73,17 @@ public class SAPPortController extends BaseController {
return AjaxResult.success(BaseOrderInfoVoList); return AjaxResult.success(BaseOrderInfoVoList);
} }
/**
*
* @param params
* @return
*/
@PostMapping ("/getProduceWorkTest")
public AjaxResult getProduceWorkTest(@RequestBody String params){
List<BaseOrderInfo> BaseOrderInfoVoList = sapPortService.getProduceWorkTest(params);
return AjaxResult.success(BaseOrderInfoVoList);
}
/** /**
* *
* @param paramMap * @param paramMap

@ -8,8 +8,10 @@ import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo; import com.aucma.base.domain.OrderBomInfo;
import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.domain.BaseBomInfo;
import com.aucma.production.domain.CalendarInfo; import com.aucma.production.domain.CalendarInfo;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.List; import java.util.List;
/** /**
@ -55,4 +57,11 @@ public interface ISAPPortService {
* @return * @return
*/ */
public int addSAPCalendar(CalendarInfo calendarInfo); public int addSAPCalendar(CalendarInfo calendarInfo);
/**
*
* @param params
* @return
*/
List<BaseOrderInfo> getProduceWorkTest(String params);
} }

@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -239,4 +240,30 @@ public class SAPPortServiceImpl implements ISAPPortService {
this.getSapBaseOrderInfo(sapPortDto); this.getSapBaseOrderInfo(sapPortDto);
return 1; return 1;
} }
/**
*
* @param params
* @return
*/
@Override
public List<BaseOrderInfo> getProduceWorkTest(String params) {
// 处理接口返回消息
ArrayList<BaseOrderInfo> baseOrderInfoVos = null;
try {
ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象
SAPResultOrderInfoVo resultVo = resultMapper.readValue(params, SAPResultOrderInfoVo.class);
//判断返回数据是否正确
if (StringUtils.isNull(resultVo.getO_RETURN()) || !resultVo.getO_RETURN().getItem().get(0).get("ID").contains("0")){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
}
//转工单实体类 保存数据
baseOrderInfoVos = storageService.insertSAPBaseOrderInfo(resultVo);
} catch (JsonProcessingException | BaseException | ParseException e) {
e.printStackTrace();
}
return baseOrderInfoVos;
}
} }

@ -170,7 +170,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item"); List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
for (HashMap<String, String> map : itemList) { for (HashMap<String, String> map : itemList) {
if (StringUtils.isEmpty(map.get("WERKS")) || !map.get("WERKS").equals(SAPConstants.FACTORY_CODE) if (StringUtils.isEmpty(map.get("WERKS")) || !map.get("WERKS").equals(SAPConstants.FACTORY_CODE)
|| !map.get("MATNR").startsWith("90")) { || StringUtils.isEmpty(map.get("MATNR")) || !map.get("MATNR").startsWith("90")) {
continue; continue;
} }
BaseOrderInfo boInfo = new BaseOrderInfo(); BaseOrderInfo boInfo = new BaseOrderInfo();

Loading…
Cancel
Save