Commit ac7b77a7 by huluobin

# update

parent 46093596
...@@ -30,7 +30,7 @@ public interface DcAutoSalesForecastStageConfigMapper extends BaseMapper<DcAutoS ...@@ -30,7 +30,7 @@ public interface DcAutoSalesForecastStageConfigMapper extends BaseMapper<DcAutoS
*/ */
DcAutoSalesForecastStageConfig selectMatchStage(@Param("bailunSku") String bailunSku, DcAutoSalesForecastStageConfig selectMatchStage(@Param("bailunSku") String bailunSku,
@Param("warehouseCode") String warehouseCode, @Param("warehouseCode") String warehouseCode,
@Param("firstOrderDays") Integer firstOrderDays, @Param("firstOrderDays") Long firstOrderDays,
@Param("avgOrderCount30") BigDecimal avgOrderCount30); @Param("avgOrderCount30") BigDecimal avgOrderCount30);
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<configuration> <configuration>
<!--<properties resource="db-tj.properties"/>--> <!--<properties resource="db-tj.properties"/>-->
<properties resource="db-dev.properties"/> <!-- <properties resource="db-dev.properties"/>-->
<!-- <properties resource="db-prod.properties"/>--> <properties resource="db-prod.properties"/>
<settings> <settings>
<setting name="mapUnderscoreToCamelCase" value="true"/> <setting name="mapUnderscoreToCamelCase" value="true"/>
</settings> </settings>
......
...@@ -369,19 +369,29 @@ public class AutoTurnoverJob extends PointJob { ...@@ -369,19 +369,29 @@ public class AutoTurnoverJob extends PointJob {
* forecastSalesList * forecastSalesList
* forecastShortSupplyList * forecastShortSupplyList
*/ */
//预测采购入库
List<Integer> forecastPurchaseInboundList = new ArrayList<>(autoForecastDay); List<Integer> forecastPurchaseInboundList = new ArrayList<>(autoForecastDay);
//预测调拨入库
List<Integer> forecastTransferInboundList = new ArrayList<>(autoForecastDay); List<Integer> forecastTransferInboundList = new ArrayList<>(autoForecastDay);
//预测库存
List<BigDecimal> forecastInventoryList = new ArrayList<>(autoForecastDay); List<BigDecimal> forecastInventoryList = new ArrayList<>(autoForecastDay);
//预测入库
List<Integer> forecastInboundList = new ArrayList<>(autoForecastDay); List<Integer> forecastInboundList = new ArrayList<>(autoForecastDay);
//预测入库释义
List<String> forecastInboundRelationList = new ArrayList<>(autoForecastDay); List<String> forecastInboundRelationList = new ArrayList<>(autoForecastDay);
//预测销量
List<BigDecimal> forecastSalesList = new ArrayList<>(autoForecastDay); List<BigDecimal> forecastSalesList = new ArrayList<>(autoForecastDay);
//预测销量释义
List<String> forecastSalesExplainList = new ArrayList<>(forecastSalesList.size()); List<String> forecastSalesExplainList = new ArrayList<>(forecastSalesList.size());
//七天实际断货+预测断货 //七天实际断货+预测断货
List<BigDecimal> forecastShortSupplyList = new ArrayList<>(autoForecastDay); List<BigDecimal> forecastShortSupplyList = new ArrayList<>(autoForecastDay);
//预测采购建议
List<BigDecimal> forecastPurchaseAdvisedList = new ArrayList<>(autoForecastDay); List<BigDecimal> forecastPurchaseAdvisedList = new ArrayList<>(autoForecastDay);
//moq数
List<BigDecimal> moqPurchaseAdvisedList = new ArrayList<>(autoForecastDay); List<BigDecimal> moqPurchaseAdvisedList = new ArrayList<>(autoForecastDay);
Map<String, BigDecimal> saveDaysMap = new HashMap<>(); Map<String, BigDecimal> saveDaysMap = new HashMap<>();
initForecastList(forecastInboundRelationList, forecastInventoryList, forecastPurchaseInboundList, forecastTransferInboundList, forecastInboundList, forecastSalesList, forecastShortSupplyList, autoForecastDay, forecastSalesExplainList); initForecastList(forecastInboundRelationList, forecastInventoryList, forecastPurchaseInboundList, forecastTransferInboundList, forecastInboundList, forecastSalesList, forecastShortSupplyList, autoForecastDay, forecastSalesExplainList);
/* /*
...@@ -969,14 +979,14 @@ public class AutoTurnoverJob extends PointJob { ...@@ -969,14 +979,14 @@ public class AutoTurnoverJob extends PointJob {
//冗余或缺货天数索引 //冗余或缺货天数索引
int index = -1; int index = -1;
//
for (int i = 0; i <= turnoverDays; i++) { for (int i = 0; i <= turnoverDays; i++) {
if (forecastShortSupplyList.get(i).setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) >= 0) { if (forecastShortSupplyList.get(i).setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) >= 0) {
days++; days++;
if (index < 0) { if (index < 0) {
index = i; index = i;
} }
if (i - 1 == turnoverDays) { //如果是最后一天 if (i + 1 == turnoverDays) { //如果是最后一天
handleForecastFluctuation(2, forecastFluctuationList, recordTime, days, index); handleForecastFluctuation(2, forecastFluctuationList, recordTime, days, index);
days = 0; days = 0;
index = -1; index = -1;
......
...@@ -19,6 +19,8 @@ import java.time.LocalTime; ...@@ -19,6 +19,8 @@ import java.time.LocalTime;
import java.time.Period; import java.time.Period;
import java.util.*; import java.util.*;
import static java.time.temporal.ChronoUnit.DAYS;
/** /**
* <p> * <p>
* *
...@@ -47,7 +49,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService { ...@@ -47,7 +49,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService {
DcBaseOmsSku orderFirstCreateTime = dcAutoSalesForecastStageConfigMapper.firsOrder(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode()); DcBaseOmsSku orderFirstCreateTime = dcAutoSalesForecastStageConfigMapper.firsOrder(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode());
Integer day = Optional.ofNullable(orderFirstCreateTime).map(var -> Period.between(var.getCreateTime().toLocalDate(), LocalDateTime.now().toLocalDate()).getDays()).orElse(null); Long day = Optional.ofNullable(orderFirstCreateTime).map(item -> DAYS.between(item.getCreateTime().toLocalDate(), LocalDate.now())).orElse(null);
BigDecimal avgOrderCount30 = dcAutoSalesForecastStageConfigMapper.avgOrderCount30(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode()); BigDecimal avgOrderCount30 = dcAutoSalesForecastStageConfigMapper.avgOrderCount30(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode());
...@@ -126,7 +128,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService { ...@@ -126,7 +128,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService {
.add(dcBaseOmsSkuMapper.omsSkuSellerCount(midNight.minusDays(dcAutoSalesForecastStageConfig.getThreeN3().intValue()), midNight, bailunSku, warehouseCode, threeN3 == 0 ? 1 : threeN3, dcAutoSalesForecastConfig.getDataSourcePlatform()) .add(dcBaseOmsSkuMapper.omsSkuSellerCount(midNight.minusDays(dcAutoSalesForecastStageConfig.getThreeN3().intValue()), midNight, bailunSku, warehouseCode, threeN3 == 0 ? 1 : threeN3, dcAutoSalesForecastConfig.getDataSourcePlatform())
.multiply(dcAutoSalesForecastStageConfig.getThreeN4())) .multiply(dcAutoSalesForecastStageConfig.getThreeN4()))
.add(dcBaseOmsSkuMapper.omsSkuSellerCount(midNight.minusDays(dcAutoSalesForecastStageConfig.getThreeN5().intValue()), midNight, bailunSku, warehouseCode, threeN5 == 0 ? 1 : threeN5, dcAutoSalesForecastConfig.getDataSourcePlatform()) .add(dcBaseOmsSkuMapper.omsSkuSellerCount(midNight.minusDays(dcAutoSalesForecastStageConfig.getThreeN5().intValue()), midNight, bailunSku, warehouseCode, threeN5 == 0 ? 1 : threeN5, dcAutoSalesForecastConfig.getDataSourcePlatform())
.multiply(dcAutoSalesForecastStageConfig.getThreeN6())); .multiply(dcAutoSalesForecastStageConfig.getThreeN6()));
for (int i = 0; i < duration3; i++) { for (int i = 0; i < duration3; i++) {
if (autoForecastDay >= forecastSalesDetails.size()) { if (autoForecastDay >= forecastSalesDetails.size()) {
...@@ -169,7 +171,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService { ...@@ -169,7 +171,7 @@ public class AutoTurnoverServiceImpl implements AutoTurnoverService {
DcAutoSalesForecastConfigMapper dcAutoSalesForecastConfigMapper = session.getMapper(DcAutoSalesForecastConfigMapper.class); DcAutoSalesForecastConfigMapper dcAutoSalesForecastConfigMapper = session.getMapper(DcAutoSalesForecastConfigMapper.class);
DcBaseOmsSku orderFirstCreateTime = dcAutoSalesForecastStageConfigMapper.firsOrder(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode()); DcBaseOmsSku orderFirstCreateTime = dcAutoSalesForecastStageConfigMapper.firsOrder(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode());
Integer day = Optional.ofNullable(orderFirstCreateTime).map(var -> Period.between(var.getCreateTime().toLocalDate(), LocalDateTime.now().toLocalDate()).getDays()).orElse(null); Long day = Optional.ofNullable(orderFirstCreateTime).map(item -> DAYS.between(item.getCreateTime().toLocalDate(), LocalDate.now())).orElse(null);
BigDecimal avgOrderCount30 = dcAutoSalesForecastStageConfigMapper.avgOrderCount30(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode()); BigDecimal avgOrderCount30 = dcAutoSalesForecastStageConfigMapper.avgOrderCount30(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode());
......
...@@ -258,7 +258,7 @@ public class AutoTurnoverTest { ...@@ -258,7 +258,7 @@ public class AutoTurnoverTest {
public void testXX2() { public void testXX2() {
DcBaseStock dcBaseStock = SessionUtil.getSession().getMapper(DcBaseStockMapper.class) DcBaseStock dcBaseStock = SessionUtil.getSession().getMapper(DcBaseStockMapper.class)
.selectOneByExample(DcBaseStockExample.newAndCreateCriteria() .selectOneByExample(DcBaseStockExample.newAndCreateCriteria()
.andBailunSkuEqualTo("949980008") .andBailunSkuEqualTo("951265201")
.andWarehouseCodeEqualTo("GZBLWH") .andWarehouseCodeEqualTo("GZBLWH")
.example()); .example());
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment