|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.aucma.api.service.impl;
|
|
|
|
package com.aucma.api.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.aucma.api.domain.vo.SAPResultBomVo;
|
|
|
|
|
|
|
|
import com.aucma.api.domain.vo.SAPResultOrderInfoVo;
|
|
|
|
import com.aucma.api.domain.vo.SAPResultOrderInfoVo;
|
|
|
|
import com.aucma.api.domain.vo.SAPResultVo;
|
|
|
|
import com.aucma.api.domain.vo.SAPResultVo;
|
|
|
|
import com.aucma.api.service.ISAPPutStorageService;
|
|
|
|
import com.aucma.api.service.ISAPPutStorageService;
|
|
|
@ -13,19 +12,13 @@ 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.base.service.IOrderBomInfoService;
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
import com.aucma.common.utils.SecurityUtils;
|
|
|
|
|
|
|
|
import com.aucma.production.domain.BaseBomInfo;
|
|
|
|
|
|
|
|
import com.aucma.production.service.IBaseBomInfoService;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.security.core.parameters.P;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
@ -46,6 +39,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IBaseOrderInfoService baseOrderInfoService;
|
|
|
|
private IBaseOrderInfoService baseOrderInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IOrderBomInfoService orderBomInfoService;
|
|
|
|
private IOrderBomInfoService orderBomInfoService;
|
|
|
|
|
|
|
|
|
|
|
@ -60,6 +54,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) {
|
|
|
|
BaseMaterialInfo baseMaterialInfo = new BaseMaterialInfo();
|
|
|
|
BaseMaterialInfo baseMaterialInfo = new BaseMaterialInfo();
|
|
|
|
|
|
|
|
baseMaterialInfo.setPlantCode(map.get("WERKS"));
|
|
|
|
baseMaterialInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
baseMaterialInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
List<BaseMaterialInfo> baseMaterialInfoList = baseMaterialInfoService.selectBaseMaterialInfoList(baseMaterialInfo);
|
|
|
|
List<BaseMaterialInfo> baseMaterialInfoList = baseMaterialInfoService.selectBaseMaterialInfoList(baseMaterialInfo);
|
|
|
|
if (baseMaterialInfoList.isEmpty()) {
|
|
|
|
if (baseMaterialInfoList.isEmpty()) {
|
|
|
@ -84,9 +79,10 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
ArrayList<BaseOrderInfo> baseOrderInfoList = new ArrayList<>();
|
|
|
|
ArrayList<BaseOrderInfo> baseOrderInfoList = new ArrayList<>();
|
|
|
|
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) {
|
|
|
|
String aufnr = map.get("AUFNR");
|
|
|
|
|
|
|
|
BaseOrderInfo boInfo = new BaseOrderInfo();
|
|
|
|
BaseOrderInfo boInfo = new BaseOrderInfo();
|
|
|
|
boInfo.setOrderCode(aufnr);
|
|
|
|
boInfo.setOrderCode(map.get("AUFNR"));
|
|
|
|
|
|
|
|
boInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
|
|
|
|
boInfo.setFactoryCode(map.get("WERKS"));
|
|
|
|
List<BaseOrderInfo> baseOrderInfos = baseOrderInfoService.selectBaseOrderInfoList(boInfo);
|
|
|
|
List<BaseOrderInfo> baseOrderInfos = baseOrderInfoService.selectBaseOrderInfoList(boInfo);
|
|
|
|
if (baseOrderInfos.isEmpty()) {
|
|
|
|
if (baseOrderInfos.isEmpty()) {
|
|
|
|
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
|
|
|
|
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
|
|
|
@ -104,7 +100,6 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
baseOrderInfo.setCreatedTime(DateUtils.getNowDate());
|
|
|
|
baseOrderInfo.setCreatedTime(DateUtils.getNowDate());
|
|
|
|
baseOrderInfoService.insertBaseOrderInfo(baseOrderInfo);
|
|
|
|
baseOrderInfoService.insertBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
|
|
|
|
|
|
|
baseOrderInfoList.add(baseOrderInfo);
|
|
|
|
baseOrderInfoList.add(baseOrderInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -126,9 +121,10 @@ 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) {
|
|
|
|
BaseDeviceLedger device = new BaseDeviceLedger();
|
|
|
|
BaseDeviceLedger device = new BaseDeviceLedger();
|
|
|
|
|
|
|
|
device.setCostCenter(map.get("KOSTL"));;
|
|
|
|
device.setDeviceCode(map.get("EQUNR"));
|
|
|
|
device.setDeviceCode(map.get("EQUNR"));
|
|
|
|
|
|
|
|
device.setFactoryCode(map.get("IWERK"));
|
|
|
|
List<BaseDeviceLedger> baseDeviceLedgers = baseDeviceLedgerService.selectBaseDeviceLedgerList(device);
|
|
|
|
List<BaseDeviceLedger> baseDeviceLedgers = baseDeviceLedgerService.selectBaseDeviceLedgerList(device);
|
|
|
|
|
|
|
|
|
|
|
|
if (!baseDeviceLedgers.isEmpty()) {
|
|
|
|
if (!baseDeviceLedgers.isEmpty()) {
|
|
|
|
BaseDeviceLedger deviceLedger = new BaseDeviceLedger();
|
|
|
|
BaseDeviceLedger deviceLedger = new BaseDeviceLedger();
|
|
|
|
deviceLedger.setCostCenter(map.get("KOSTL"));//
|
|
|
|
deviceLedger.setCostCenter(map.get("KOSTL"));//
|
|
|
@ -147,15 +143,20 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
return baseDeviceLedgerArrayList;
|
|
|
|
return baseDeviceLedgerArrayList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 转换产品bom信息实体类 保存数据
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* */
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException {
|
|
|
|
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException {
|
|
|
|
ArrayList<OrderBomInfo> orderBomInfoList = 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");
|
|
|
|
|
|
|
|
|
|
|
|
for (HashMap<String, String> map : itemList) {
|
|
|
|
for (HashMap<String, String> map : itemList) {
|
|
|
|
OrderBomInfo orderBomInfo1 = new OrderBomInfo();
|
|
|
|
OrderBomInfo bomInfo = new OrderBomInfo();
|
|
|
|
orderBomInfo1.setMaterialCode(map.get("IDNRK"));
|
|
|
|
bomInfo.setMaterialCode(map.get("IDNRK"));
|
|
|
|
List<OrderBomInfo> orderBomInfos = orderBomInfoService.selectOrderBomInfoList(orderBomInfo1);
|
|
|
|
bomInfo.setParentId(map.get("MATNR"));
|
|
|
|
|
|
|
|
bomInfo.setFactoryCode(map.get("WERKS"));
|
|
|
|
|
|
|
|
List<OrderBomInfo> orderBomInfos = orderBomInfoService.selectOrderBomInfoList(bomInfo);
|
|
|
|
if (orderBomInfos.isEmpty()) {
|
|
|
|
if (orderBomInfos.isEmpty()) {
|
|
|
|
OrderBomInfo orderBomInfo = new OrderBomInfo();
|
|
|
|
OrderBomInfo orderBomInfo = new OrderBomInfo();
|
|
|
|
orderBomInfo.setFactoryCode(map.get("WERKS"));
|
|
|
|
orderBomInfo.setFactoryCode(map.get("WERKS"));
|
|
|
@ -167,8 +168,6 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
orderBomInfo.setSort(map.get("SORTF"));
|
|
|
|
orderBomInfo.setSort(map.get("SORTF"));
|
|
|
|
orderBomInfo.setVbeln(map.get("VBELN"));
|
|
|
|
orderBomInfo.setVbeln(map.get("VBELN"));
|
|
|
|
orderBomInfo.setVbpos(map.get("VBPOS"));
|
|
|
|
orderBomInfo.setVbpos(map.get("VBPOS"));
|
|
|
|
orderBomInfo.setCreatedTime(DateUtils.getNowDate());
|
|
|
|
|
|
|
|
// baseBomInfo.setCreatedBy(SecurityUtils.getLoginUser().getUsername());
|
|
|
|
|
|
|
|
orderBomInfoService.insertOrderBomInfo(orderBomInfo);
|
|
|
|
orderBomInfoService.insertOrderBomInfo(orderBomInfo);
|
|
|
|
orderBomInfoList.add(orderBomInfo);
|
|
|
|
orderBomInfoList.add(orderBomInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|