change - 产品BOM接口

master
yinq 2 years ago
parent 11ca444308
commit db71fec6ee

@ -204,7 +204,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
//转物料实体类 保存数据
orderBomInfosVos = storageService.insertSAPOrderBomInfo(resultVo);
//保存接口日志
PortLogUtils.savePortLog(werks.getItem().get(0).get("WERKS"), "获取产品bom数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, null);
//PortLogUtils.savePortLog(werks.getItem().get(0).get("WERKS"), "获取产品bom数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, null);
} catch (Exception e) {
//保存接口日志
PortLogUtils.savePortLog(werks.getItem().get(0).get("WERKS"), "获取产品bom数据" + intervalDate, "getSapBaseBomInfo", requestParam, result, e.toString());

@ -81,10 +81,19 @@ public class SAPTask {
public void SAPBaseBomInfoDataTask(String factoryCode, Long startDays, Long endDays) {
SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, startDays, endDays);
SAPBOMPortDto sapbomPortDto = new SAPBOMPortDto();
sapbomPortDto.setStartDate(sapPortDto.getStartDate());
sapbomPortDto.setEndDate(sapPortDto.getEndDate());
sapbomPortDto.setFactoryCodes(sapPortDto.getFactoryCodes());
portService.getSapOrderBomInfo(sapbomPortDto);
String startDate = sapPortDto.getStartDate();
String endDate = sapPortDto.getEndDate();
List<String> dateList = DateUtils.getDifferenceDateList(startDate, endDate);
for (String date : dateList) {
sapbomPortDto.setStartDate(date);
sapbomPortDto.setEndDate(date);
try {
portService.getSapOrderBomInfo(sapbomPortDto);
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -9,7 +9,10 @@ import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
@ -214,4 +217,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return targetDate.format(formatter);
}
/**
* List
* @param startDateStr
* @param endDateStr
* @return
*/
public static List<String> getDifferenceDateList(String startDateStr, String endDateStr) {
List<String> dateList = new ArrayList<>();
LocalDate startDate = LocalDate.parse(startDateStr);
LocalDate endDate = LocalDate.parse(endDateStr);
while (!startDate.isAfter(endDate)) {
dateList.add(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
startDate = startDate.plusDays(1);
}
return dateList;
}
}

Loading…
Cancel
Save