Commit 4fe27d36 by wutong

自动周转若平均交期为负, 则不采用.

parent c166ae9e
...@@ -81,7 +81,7 @@ public class AutoTurnoverJob extends PointJob { ...@@ -81,7 +81,7 @@ public class AutoTurnoverJob extends PointJob {
DcAutoException dcAutoException = new DcAutoException(dcBaseStock.getBailunSku(),dcBaseStock.getWarehouseCode(),e.toString()); DcAutoException dcAutoException = new DcAutoException(dcBaseStock.getBailunSku(),dcBaseStock.getWarehouseCode(),e.toString());
dcAutoExceptionMapper.insertSelective(dcAutoException); dcAutoExceptionMapper.insertSelective(dcAutoException);
} catch (Exception ex) { } catch (Exception ex) {
log.error("保存错误SKU失败,sku="+ dcBaseStock.getBailunSku() + ",仓库=" + dcBaseStock.getWarehouseCode()); ; log.error("保存错误SKU失败,sku="+ dcBaseStock.getBailunSku() + ",仓库=" + dcBaseStock.getWarehouseCode());
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
...@@ -260,9 +260,7 @@ public class AutoTurnoverJob extends PointJob { ...@@ -260,9 +260,7 @@ public class AutoTurnoverJob extends PointJob {
Integer purchase = 0;//采购在途 Integer purchase = 0;//采购在途
Integer transfer = 0;//调拨在途 Integer transfer = 0;//调拨在途
//通过SKU拿到MOQ和缺货数 Integer outStock = 0 ;//缺货数
Integer outStock = 0 ;
// Integer outStock = getOutStock(bailunSku, warehouseCode);
DcMidTransit dcMidTransit = null; DcMidTransit dcMidTransit = null;
try { try {
DcMidTransitMapper midTransitMapper = SessionUtil.getSession().getMapper(DcMidTransitMapper.class); DcMidTransitMapper midTransitMapper = SessionUtil.getSession().getMapper(DcMidTransitMapper.class);
...@@ -300,14 +298,13 @@ public class AutoTurnoverJob extends PointJob { ...@@ -300,14 +298,13 @@ public class AutoTurnoverJob extends PointJob {
BigDecimal safeInventory = calculateSafeInventory(bailunSku, warehouseCode, bailunFirstLevelCatagoryId, dcAutoSales, JSON.toJSONString(forecastSalesList)); BigDecimal safeInventory = calculateSafeInventory(bailunSku, warehouseCode, bailunFirstLevelCatagoryId, dcAutoSales, JSON.toJSONString(forecastSalesList));
//平均逾期 = 平均交期(dc_average_purchase) - 供应商交期(根据仓库判断, 非国内就取调拨交期) , 小于0的取0 //平均逾期 = 平均交期(dc_average_purchase) - 供应商交期(根据仓库判断, 非国内就取调拨交期) , 小于0的取0
BigDecimal overdue = BigDecimal.ZERO; BigDecimal overdue = BigDecimal.ZERO;
if (dcAveragePurchase != null) { if (dcAveragePurchase != null && dcAveragePurchase.getDeliveryDays() >= 0) {
overdue = BigDecimal.valueOf((dcAveragePurchase.getDeliveryDays().longValue() - dcAutoTurnover.getSupplierDelivery().longValue())); overdue = BigDecimal.valueOf((dcAveragePurchase.getDeliveryDays().longValue() - dcAutoTurnover.getSupplierDelivery().longValue()));
overdue = overdue.compareTo(BigDecimal.ZERO) == 1 ? overdue : BigDecimal.ZERO; overdue = overdue.compareTo(BigDecimal.ZERO) == 1 ? overdue : BigDecimal.ZERO;
} }
//安全库存 * 平均逾期 //安全库存 * 平均逾期
BigDecimal totalSafeInventory = safeInventory.multiply((overdue.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ONE : overdue)); BigDecimal totalSafeInventory = safeInventory.multiply((overdue.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ONE : overdue));
Integer moq = turnoverSku.getMoq(); Integer moq = turnoverSku.getMoq();
/* /*
* 预测库存 = 前一日库存 - 前一日销量(没有考虑实际缺货) * 预测库存 = 前一日库存 - 前一日销量(没有考虑实际缺货)
...@@ -589,7 +586,7 @@ public class AutoTurnoverJob extends PointJob { ...@@ -589,7 +586,7 @@ public class AutoTurnoverJob extends PointJob {
* 先取dc_average_purchase,如果平均交期没有 * 先取dc_average_purchase,如果平均交期没有
* 再去SKUMS取, 取SKUMS数据的时候如果是国内仓,就还取dc_base_sku原来那个字段,否则就要取dc_base_sku原新字段(调拨交期) * 再去SKUMS取, 取SKUMS数据的时候如果是国内仓,就还取dc_base_sku原来那个字段,否则就要取dc_base_sku原新字段(调拨交期)
*/ */
Integer turnoverSupplierDelivery = dcAveragePurchase != null? dcAveragePurchase.getDeliveryDays() : -1; Integer turnoverSupplierDelivery = dcAveragePurchase != null && dcAveragePurchase.getDeliveryDays() >= 0? dcAveragePurchase.getDeliveryDays() : -1;
if (turnoverSupplierDelivery == null || turnoverSupplierDelivery.equals(-1)) { if (turnoverSupplierDelivery == null || turnoverSupplierDelivery.equals(-1)) {
turnoverSupplierDelivery = turnoverSku.getSupplierDelivery(); turnoverSupplierDelivery = turnoverSku.getSupplierDelivery();
//如果是国内仓,就还取原来那个字段,否则就要取新字段(调拨交期) //如果是国内仓,就还取原来那个字段,否则就要取新字段(调拨交期)
......
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