|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
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.SAPResultVo;
|
|
|
|
|
import com.aucma.api.service.ISAPPutStorageService;
|
|
|
|
|
@ -67,6 +68,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
baseMaterialInfo.setPlantCode(map.get("WERKS"));
|
|
|
|
|
baseMaterialInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
|
List<BaseMaterialInfo> baseMaterialInfoList = baseMaterialInfoService.selectBaseMaterialInfoList(baseMaterialInfo);
|
|
|
|
|
// 插入物料数据
|
|
|
|
|
if (baseMaterialInfoList.isEmpty()) {
|
|
|
|
|
BaseMaterialInfo materialInfo = new BaseMaterialInfo();
|
|
|
|
|
materialInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
|
@ -76,14 +78,62 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
materialInfo.setMaterialUnit(map.get("MEINS"));
|
|
|
|
|
materialInfo.setMaterialMatkl(map.get("MATKL"));
|
|
|
|
|
materialInfo.setDISPO(map.get("DISPO"));
|
|
|
|
|
this.getMaterialType(materialInfo);
|
|
|
|
|
materialInfo.setMaterialCategories("100");
|
|
|
|
|
materialInfo.setIncrementDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD, map.get("UDATE")));
|
|
|
|
|
baseMaterialInfoService.insertBaseMaterialInfo(materialInfo);
|
|
|
|
|
baseMaterialInfoArrayList.add(materialInfo);
|
|
|
|
|
} else {
|
|
|
|
|
//修改物料数据
|
|
|
|
|
BaseMaterialInfo materialInfo = baseMaterialInfoList.get(0);
|
|
|
|
|
materialInfo.setMaterialName(map.get("MAKTX"));
|
|
|
|
|
materialInfo.setMaterialType(map.get("MTART"));
|
|
|
|
|
materialInfo.setMaterialUnit(map.get("MEINS"));
|
|
|
|
|
materialInfo.setMaterialMatkl(map.get("MATKL"));
|
|
|
|
|
String dispo = map.get("DISPO");
|
|
|
|
|
materialInfo.setDISPO(dispo);
|
|
|
|
|
this.getMaterialType(materialInfo);
|
|
|
|
|
materialInfo.setMaterialCategories("100");
|
|
|
|
|
materialInfo.setIncrementDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD, map.get("UDATE")));
|
|
|
|
|
baseMaterialInfoService.updateBaseMaterialInfo(materialInfo);
|
|
|
|
|
baseMaterialInfoArrayList.add(materialInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return baseMaterialInfoArrayList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取物料类型
|
|
|
|
|
*
|
|
|
|
|
* @param materialInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private BaseMaterialInfo getMaterialType(BaseMaterialInfo materialInfo) {
|
|
|
|
|
String dispo = materialInfo.getDISPO();
|
|
|
|
|
if (StringUtils.isNotEmpty(dispo)) {
|
|
|
|
|
//(100=成品;200=箱体;300=门体)
|
|
|
|
|
if (dispo.equals("100") || dispo.equals("200") || dispo.equals("300")) {
|
|
|
|
|
materialInfo.setMaterialSubclass(dispo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//400=围板;500=内胆
|
|
|
|
|
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("内胆部件")) {
|
|
|
|
|
materialInfo.setMaterialSubclass("500");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("预装箱体")) {
|
|
|
|
|
materialInfo.setMaterialSubclass("400");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("箱壳部件")) {
|
|
|
|
|
materialInfo.setMaterialSubclass("400");
|
|
|
|
|
}
|
|
|
|
|
//其他
|
|
|
|
|
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass())) {
|
|
|
|
|
materialInfo.setMaterialSubclass("900");
|
|
|
|
|
}
|
|
|
|
|
return materialInfo;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 转换生产工单实体类 保存数据
|
|
|
|
|
*/
|
|
|
|
|
@ -113,8 +163,10 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
}
|
|
|
|
|
baseOrderInfo.setFactoryCode(map.get("WERKS"));
|
|
|
|
|
baseOrderInfo.setOrderType(map.get("AUART"));
|
|
|
|
|
baseOrderInfo.setBeginDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GLTRP")));
|
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
|
baseOrderInfo.setWorkCenterCode(map.get("ARBPL"));
|
|
|
|
|
baseOrderInfo.setRoutingCode(map.get("AUFPL"));
|
|
|
|
|
baseOrderInfo.setBeginDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GLTRP")));
|
|
|
|
|
|
|
|
|
|
// 同步生产日历
|
|
|
|
|
CalendarInfo calendarInfo = new CalendarInfo();
|
|
|
|
|
@ -132,23 +184,27 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
//更新SAP计划
|
|
|
|
|
BaseOrderInfo baseOrderInfo = baseOrderInfos.get(0);
|
|
|
|
|
if (baseOrderInfo.getIsRelease() == 0) {
|
|
|
|
|
//SAP计划已下达到工位不更新数据
|
|
|
|
|
//SAP计划已下达到生产计划工位不更新数据
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
baseOrderInfo.setOrderStatus(map.get("STTXT"));
|
|
|
|
|
baseOrderInfo.setSaleOrderCode(map.get("KDAUF"));
|
|
|
|
|
baseOrderInfo.setMaterialName(map.get("MAKTX"));
|
|
|
|
|
baseOrderInfo.setOrderType(map.get("AUART"));
|
|
|
|
|
if (!map.get("GAMNG").equals(null)) {
|
|
|
|
|
baseOrderInfo.setOrderAmount(new BigDecimal(map.get("GAMNG")));
|
|
|
|
|
}
|
|
|
|
|
baseOrderInfo.setOrderType(map.get("AUART"));
|
|
|
|
|
baseOrderInfo.setBeginDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GLTRP")));
|
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
|
|
|
|
|
|
baseOrderInfo.setWorkCenterCode(map.get("ARBPL"));
|
|
|
|
|
baseOrderInfo.setRoutingCode(map.get("AUFPL"));
|
|
|
|
|
baseOrderInfo.setBeginDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GSTRP")));
|
|
|
|
|
baseOrderInfo.setEndDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("GLTRP")));
|
|
|
|
|
baseOrderInfoService.updateBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
|
|
|
|
|
// 同步生产日历
|
|
|
|
|
CalendarInfo calendar = new CalendarInfo();
|
|
|
|
|
calendar.setSapPlanCode(baseOrderInfo.getOrderCode());
|
|
|
|
|
calendar.setMaterialCode(baseOrderInfo.getMaterialCode());
|
|
|
|
|
List<CalendarInfo> calendarInfos = calendarInfoService.selectCalendarInfoList(calendar);
|
|
|
|
|
if (calendarInfos.size() == 1) {
|
|
|
|
|
CalendarInfo calendarInfo = calendarInfos.get(0);
|
|
|
|
|
@ -180,7 +236,8 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BaseDeviceLedger device = new BaseDeviceLedger();
|
|
|
|
|
device.setCostCenter(map.get("KOSTL"));;
|
|
|
|
|
device.setCostCenter(map.get("KOSTL"));
|
|
|
|
|
;
|
|
|
|
|
device.setDeviceCode(map.get("EQUNR"));
|
|
|
|
|
device.setFactoryCode(map.get("IWERK"));
|
|
|
|
|
List<BaseDeviceLedger> baseDeviceLedgers = baseDeviceLedgerService.selectBaseDeviceLedgerList(device);
|
|
|
|
|
@ -204,10 +261,9 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 转换产品bom信息实体类 保存数据
|
|
|
|
|
*
|
|
|
|
|
* */
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException {
|
|
|
|
|
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException {
|
|
|
|
|
ArrayList<OrderBomInfo> orderBomInfoList = new ArrayList<>();
|
|
|
|
|
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
|
|
|
|
|
for (HashMap<String, String> map : itemList) {
|
|
|
|
|
@ -230,7 +286,11 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
orderBomInfo.setSort(map.get("SORTF"));
|
|
|
|
|
orderBomInfo.setVbeln(map.get("VBELN"));
|
|
|
|
|
orderBomInfo.setVbpos(map.get("VBPOS"));
|
|
|
|
|
try {
|
|
|
|
|
orderBomInfoService.insertOrderBomInfo(orderBomInfo);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
orderBomInfoList.add(orderBomInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|