|
|
|
@ -99,6 +99,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
boInfo.setMaterialCode(map.get("MATNR"));
|
|
|
|
|
boInfo.setFactoryCode(map.get("WERKS"));
|
|
|
|
|
List<BaseOrderInfo> baseOrderInfos = baseOrderInfoService.selectBaseOrderInfoList(boInfo);
|
|
|
|
|
//首次存SAP计划
|
|
|
|
|
if (baseOrderInfos.isEmpty()) {
|
|
|
|
|
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
|
|
|
|
|
baseOrderInfo.setOrderCode(map.get("AUFNR"));
|
|
|
|
@ -124,14 +125,42 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
calendarInfo.setSchedulingDate(baseOrderInfo.getBeginDate());
|
|
|
|
|
calendarInfo.setPlanAmount(baseOrderInfo.getOrderAmount());
|
|
|
|
|
calendarInfoService.insertCalendarInfo(calendarInfo);
|
|
|
|
|
|
|
|
|
|
baseOrderInfoService.insertBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
baseOrderInfoList.add(baseOrderInfo);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//更新SAP计划
|
|
|
|
|
BaseOrderInfo baseOrderInfo = baseOrderInfos.get(0);
|
|
|
|
|
if (baseOrderInfo.getIsRelease() == 0){
|
|
|
|
|
//SAP计划已下达到工位不更新数据
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
baseOrderInfo.setOrderStatus(map.get("STTXT"));
|
|
|
|
|
baseOrderInfo.setSaleOrderCode(map.get("KDAUF"));
|
|
|
|
|
baseOrderInfo.setMaterialName(map.get("MAKTX"));
|
|
|
|
|
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")));
|
|
|
|
|
baseOrderInfoService.updateBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
|
|
|
|
|
// 同步生产日历
|
|
|
|
|
CalendarInfo calendar = new CalendarInfo();
|
|
|
|
|
calendar.setSapPlanCode(baseOrderInfo.getOrderCode());
|
|
|
|
|
List<CalendarInfo> calendarInfos = calendarInfoService.selectCalendarInfoList(calendar);
|
|
|
|
|
if (calendarInfos.size() == 1){
|
|
|
|
|
CalendarInfo calendarInfo = calendarInfos.get(0);
|
|
|
|
|
calendarInfo.setMaterialName(baseOrderInfo.getMaterialName());
|
|
|
|
|
calendarInfo.setPlanStartDate(baseOrderInfo.getBeginDate());
|
|
|
|
|
calendarInfo.setPlanEndDate(baseOrderInfo.getEndDate());
|
|
|
|
|
calendarInfo.setSchedulingDate(baseOrderInfo.getBeginDate());
|
|
|
|
|
calendarInfo.setPlanAmount(baseOrderInfo.getOrderAmount());
|
|
|
|
|
baseOrderInfoService.updateBaseOrderInfo(baseOrderInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return baseOrderInfoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|