Commit 7df359f8 by yinyong

采购特例计算:广州-03仓,赵美聪-日均加权*备货天数-库存-广州-01仓库存-广州-01仓在途

parent aeedc5bc
......@@ -411,7 +411,7 @@ public class AutoTurnoverJob extends PointJob {
* 获取采购建议-普通仓库
* 实际缺货 + 总销量 - 总预计入库 + (安全库存 - 预测库存) + 周转天的销量
*/
inventoryAvailableDays = commonAdvise(turnoverSku, warehouseCode, hasMonitorFluctuation, forecastFluctuationList, recordTime, dcAutoTurnover, turnoverDays, autoForecastDay, forecastInventoryList, forecastInboundList, forecastSalesList, forecastShortSupplyList, forecastPurchaseAdvisedList, moqPurchaseAdvisedList, realInventory, totalSafeInventory, outStock, inventoryAvailableDays, totalSales, totalInbound, moqDecimal, saveDaysMap);
inventoryAvailableDays = commonAdvise(turnoverSku, bailunSku, warehouseCode, hasMonitorFluctuation, forecastFluctuationList, recordTime, dcAutoTurnover, turnoverDays, autoForecastDay, forecastInventoryList, forecastInboundList, forecastSalesList, forecastShortSupplyList, forecastPurchaseAdvisedList, moqPurchaseAdvisedList, realInventory, totalSafeInventory, outStock, inventoryAvailableDays, totalSales, totalInbound, moqDecimal, saveDaysMap);
}
/*
......@@ -1477,7 +1477,7 @@ public class AutoTurnoverJob extends PointJob {
forecastFluctuationList.add(forecastFluctuation);
}
private Integer commonAdvise(DcBaseSku turnoverSku, String warehouseCode, boolean hasMonitorFluctuation, List<DcAutoForecastFluctuation> forecastFluctuationList, LocalDate
private Integer commonAdvise(DcBaseSku turnoverSku, String bailunSku, String warehouseCode, boolean hasMonitorFluctuation, List<DcAutoForecastFluctuation> forecastFluctuationList, LocalDate
recordTime, DcAutoTurnover dcAutoTurnover, Integer turnoverDays, Integer
autoForecastDay, List<BigDecimal> forecastInventoryList, List<Integer> forecastInboundList, List<BigDecimal> forecastSalesList, List<BigDecimal> forecastShortSupplyList, List<BigDecimal> forecastPurchaseAdvisedList, List<BigDecimal> moqPurchaseAdvisedList, Integer
realInventory, BigDecimal totalSafeInventory, Integer outStock, Integer inventoryAvailableDays, BigDecimal
......@@ -1539,7 +1539,7 @@ public class AutoTurnoverJob extends PointJob {
BigDecimal totalAdvised = BigDecimal.ZERO;
Boolean firstAdvice = true;
if (j == turnoverDays) {
if (warehouseCode.equals(Constant.WAREHOUSE_JIT) && (turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1) || turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2)) || (warehouseCode.equals(Constant.WAREHOUSE_JIT1) && (turnoverSku.getBuyerName().equals(Constant.BUTER_JIT_5)))) {
if (warehouseCode.equals(Constant.WAREHOUSE_JIT) && (turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1) || turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2))) {
BigDecimal saveDays = saveDaysMap.get("saveDays");
totalSales = dcAutoTurnover.getDailyWeightedSales().multiply(BigDecimal.valueOf(turnoverDays));
dcAutoTurnover.setTurnoverSales(totalSales);
......@@ -1556,6 +1556,39 @@ public class AutoTurnoverJob extends PointJob {
.add(BigDecimal.valueOf(outStock.longValue())); //今天的实际缺货
firstAdvice = false;
}
}else if(warehouseCode.equals(Constant.WAREHOUSE_JIT1) && (turnoverSku.getBuyerName().equals(Constant.BUTER_JIT_5))) {
DcBaseStockMapper dcBaseStockMapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);
DcBaseStock dcBaseStock = dcBaseStockMapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo(bailunSku).andWarehouseCodeEqualTo(Constant.WAREHOUSE_JIT).example());
Integer purchase = 0;//采购在途
Integer transfer = 0;//调拨在途
Integer outStock01 = 0;//缺货数
DcMidTransit dcMidTransit = null;
try {
DcMidTransitMapper midTransitMapper = SessionUtil.getSession().getMapper(DcMidTransitMapper.class);
dcMidTransit = midTransitMapper.selectOneByExample(DcMidTransitExample.newAndCreateCriteria().andBailunSkuEqualTo(bailunSku).andWarehouseCodeEqualTo(Constant.WAREHOUSE_JIT).example());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Mybatis操作DB失败", e);
} finally {
SessionUtil.closeSession();
}
if (dcMidTransit != null) {
purchase = dcMidTransit.getQuantityPurchase();
transfer = dcMidTransit.getQuantityTransfer();
outStock01 = dcMidTransit.getQuantityOutStock();
}
BigDecimal saveDays = saveDaysMap.get("saveDays");
totalSales = dcAutoTurnover.getDailyWeightedSales().multiply(BigDecimal.valueOf(turnoverDays));
dcAutoTurnover.setTurnoverSales(totalSales);
BigDecimal forecastInbound = BigDecimal.ZERO;
if(saveDays != null) {
totalSales = dcAutoTurnover.getDailyWeightedSales().multiply(saveDays);
totalAdvised = totalSales.subtract(outStock > 0 ? BigDecimal.ZERO : BigDecimal.valueOf(realInventory.longValue())) //真实库存,如果缺货就不减
.subtract(outStock01 > 0 ? BigDecimal.ZERO : ((dcBaseStock != null && dcBaseStock.getUsableStock() != null) ? BigDecimal.valueOf(dcBaseStock.getUsableStock()) : BigDecimal.ZERO)) //广州014仓库存
.subtract(BigDecimal.valueOf(purchase + transfer)); //广州001仓在途数
firstAdvice = false;
}
}else{
dcAutoTurnover.setTurnoverSales(totalSales);
}
......
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