From 6dc7d4ac7cd4af7047b050e36d094bcd5f3ec158 Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 28 Nov 2023 18:01:51 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E7=BC=BA=E9=99=B7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SAPPutStorageServiceImpl.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java index 07eff24..3724dec 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java +++ b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java @@ -99,6 +99,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService { boInfo.setMaterialCode(map.get("MATNR")); boInfo.setFactoryCode(map.get("WERKS")); List 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 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; }