Commit 02f9474b by huluobin

# 更新

parent 75b6df89
...@@ -1067,63 +1067,67 @@ public class AutoTurnoverJob extends PointJob { ...@@ -1067,63 +1067,67 @@ public class AutoTurnoverJob extends PointJob {
//status` '监控状态, 默认0监控, 停止监控1', //status` '监控状态, 默认0监控, 停止监控1',
try {
DcAutoForecastFluctuationMapper mapper = SessionUtil.getSession().getMapper(DcAutoForecastFluctuationMapper.class); if (StringUtils.isBlank(transferStrategy.get())) {
//JIT的 可以不做 冗余 和 缺货预测 实际冗余和实际缺货也不用提醒 try {
//如果仓库是广州01 且 是这三个销售员, 就不提醒 DcAutoForecastFluctuationMapper mapper = SessionUtil.getSession().getMapper(DcAutoForecastFluctuationMapper.class);
if (!warehouseCode.equals(Constant.WAREHOUSE_JIT) //JIT的 可以不做 冗余 和 缺货预测 实际冗余和实际缺货也不用提醒
|| !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1) //如果仓库是广州01 且 是这三个销售员, 就不提醒
&& !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2) if (!warehouseCode.equals(Constant.WAREHOUSE_JIT)
&& !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_3)) { || !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1)
if (dcAutoConfigSkuWarehouse == null || dcAutoConfigSkuWarehouse.getStatus().equals(0)) { && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2)
if (forecastFluctuationList != null && forecastFluctuationList.size() > 0) { && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_3)) {
if (dcAutoConfigSkuWarehouse == null || dcAutoConfigSkuWarehouse.getStatus().equals(0)) {
//拿最早的时间 + 最晚的时间, SKU-仓库维度只放一条 if (forecastFluctuationList != null && forecastFluctuationList.size() > 0) {
DcAutoForecastFluctuation dcAutoForecastFluctuation = forecastFluctuationList.get(0);
dcAutoForecastFluctuation.setStartTime(forecastFluctuationList.get(0).getStartTime()); //拿最早的时间 + 最晚的时间, SKU-仓库维度只放一条
dcAutoForecastFluctuation.setEndTime(forecastFluctuationList.get(0).getEndTime()); DcAutoForecastFluctuation dcAutoForecastFluctuation = forecastFluctuationList.get(0);
dcAutoForecastFluctuation.setBailunSku(turnoverSku.getBailunSku()); dcAutoForecastFluctuation.setStartTime(forecastFluctuationList.get(0).getStartTime());
dcAutoForecastFluctuation.setWarehouseCode(warehouseCode); dcAutoForecastFluctuation.setEndTime(forecastFluctuationList.get(0).getEndTime());
dcAutoForecastFluctuation.setWarehouseName(dcAutoTurnover.getWarehouseName()); dcAutoForecastFluctuation.setBailunSku(turnoverSku.getBailunSku());
dcAutoForecastFluctuation.setAvgSalesThree(avgHistoryThreedaySales); dcAutoForecastFluctuation.setWarehouseCode(warehouseCode);
dcAutoForecastFluctuation.setWarehouseName(dcAutoTurnover.getWarehouseName());
/* dcAutoForecastFluctuation.setAvgSalesThree(avgHistoryThreedaySales);
* 增加是否断货计算
* Add by Allan at 2020-07-23 10:58 /*
* 断货=前一天还有库存,但是今天库存为0了则是已经断货 * 增加是否断货计算
* */ * Add by Allan at 2020-07-23 10:58
if (forecastFluctuationList.get(0).getType() != 1 && dcBaseStock.getUsableStock() == 0) { * 断货=前一天还有库存,但是今天库存为0了则是已经断货
//获取前一天库存 * */
Integer yesterdayStock = mapper.yesterdayStock(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode()); if (forecastFluctuationList.get(0).getType() != 1 && dcBaseStock.getUsableStock() == 0) {
if (yesterdayStock != null && yesterdayStock > 0) { //获取前一天库存
dcAutoForecastFluctuation.setType(5); //实际断货 Integer yesterdayStock = mapper.yesterdayStock(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode());
dcAutoForecastFluctuation.setStartTime(LocalDate.now()); //保存当天日期 if (yesterdayStock != null && yesterdayStock > 0) {
dcAutoForecastFluctuation.setEndTime(LocalDate.now()); //保存当天日期 dcAutoForecastFluctuation.setType(5); //实际断货
dcAutoForecastFluctuation.setStartTime(LocalDate.now()); //保存当天日期
dcAutoForecastFluctuation.setEndTime(LocalDate.now()); //保存当天日期
}
} }
}
//End Add //End Add
int i = mapper.updateByExampleSelective(dcAutoForecastFluctuation, DcAutoForecastFluctuationExample.newAndCreateCriteria().andBailunSkuEqualTo(dcAutoForecastFluctuation.getBailunSku()).andWarehouseCodeEqualTo(dcAutoForecastFluctuation.getWarehouseCode()).example()); int i = mapper.updateByExampleSelective(dcAutoForecastFluctuation, DcAutoForecastFluctuationExample.newAndCreateCriteria().andBailunSkuEqualTo(dcAutoForecastFluctuation.getBailunSku()).andWarehouseCodeEqualTo(dcAutoForecastFluctuation.getWarehouseCode()).example());
if (i == 0) { if (i == 0) {
mapper.insertSelective(dcAutoForecastFluctuation); mapper.insertSelective(dcAutoForecastFluctuation);
}
} else {
mapper.deleteByExample(DcAutoForecastFluctuationExample.newAndCreateCriteria()
.andBailunSkuEqualTo(turnoverSku.getBailunSku())
.andWarehouseCodeEqualTo(warehouseCode).example());
} }
} else { } else if (dcAutoConfigSkuWarehouse.getStatus().equals(1)) {
mapper.deleteByExample(DcAutoForecastFluctuationExample.newAndCreateCriteria() mapper.deleteByExample(DcAutoForecastFluctuationExample.newAndCreateCriteria()
.andBailunSkuEqualTo(turnoverSku.getBailunSku()) .andBailunSkuEqualTo(turnoverSku.getBailunSku())
.andWarehouseCodeEqualTo(warehouseCode).example()); .andWarehouseCodeEqualTo(warehouseCode).example());
} }
} else if (dcAutoConfigSkuWarehouse.getStatus().equals(1)) {
mapper.deleteByExample(DcAutoForecastFluctuationExample.newAndCreateCriteria()
.andBailunSkuEqualTo(turnoverSku.getBailunSku())
.andWarehouseCodeEqualTo(warehouseCode).example());
} }
} catch (Exception e) {
throw new RuntimeException("MYBATIS操作DB存DcAutoForecastFluctuation失败", e);
} finally {
SessionUtil.closeSession();
} }
} catch (Exception e) {
throw new RuntimeException("MYBATIS操作DB存DcAutoForecastFluctuation失败", e);
} finally {
SessionUtil.closeSession();
} }
} }
......
...@@ -30,12 +30,12 @@ public class QueueConsumerJob implements SimpleJob { ...@@ -30,12 +30,12 @@ public class QueueConsumerJob implements SimpleJob {
@Data @Data
public static class BaseQueueMessage { public static class BaseQueueMessage {
@JSONField(name = "bailun_sku") @JSONField(name = "bailun_sku")
private String bailunSku; private String bailunSku;
@JSONField(name = "warehouse_code") @JSONField(name = "warehouse_code")
private String warehouseCode; private String warehouseCode;
} }
@Override @Override
public void execute(ShardingContext shardingContext) { public void execute(ShardingContext shardingContext) {
...@@ -53,7 +53,7 @@ public class QueueConsumerJob implements SimpleJob { ...@@ -53,7 +53,7 @@ public class QueueConsumerJob implements SimpleJob {
DcBaseStock dcBaseStock = dcBaseStockMapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria() DcBaseStock dcBaseStock = dcBaseStockMapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria()
.andBailunSkuEqualTo(baseQueueMessage.getBailunSku()) .andBailunSkuEqualTo(baseQueueMessage.getBailunSku())
.andWarehouseCodeEqualTo(baseQueueMessage.getWarehouseCode()) .andWarehouseCodeEqualTo(baseQueueMessage.getWarehouseCode())
.example()); .example());
try { try {
autoTurnoverJob.autoTurnoverFromStock(dcBaseStock); autoTurnoverJob.autoTurnoverFromStock(dcBaseStock);
......
...@@ -256,7 +256,7 @@ public class AutoTurnoverTest { ...@@ -256,7 +256,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("217632401") .andBailunSkuEqualTo("LM-EO-007")
.andWarehouseCodeEqualTo("MMDUSFBA") .andWarehouseCodeEqualTo("MMDUSFBA")
.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