Commit 47e64c27 by huluobin

jitTag如果都没命中 就setTagId(0);

parent 6b1c8e8b
......@@ -2376,7 +2376,10 @@ public class AutoTurnoverJob extends PointJob {
dcAutoJitTags = dcAutoJitTagMapper.selectByExample(DcAutoJitTagExample.newAndCreateCriteria().andGroupIdEqualTo(1).example());
}
BigDecimal saveDays = BigDecimal.ZERO;
if (dcAutoJitTags != null) {
boolean hitTag = false;
for (DcAutoJitTag dcAutoJitTag : dcAutoJitTags) {
if (dcAutoJitTag.getEnable7() == 1) {
switch (dcAutoJitTag.getIsGt7()) {
......@@ -2486,8 +2489,12 @@ public class AutoTurnoverJob extends PointJob {
continue;
}
}
if (StringUtils.isNotBlank(buyerName) && StringUtils.isNotBlank(dcAutoJitTag.getBuyerName()) && !buyerName.equals(dcAutoJitTag.getBuyerName()))
if (StringUtils.isNotBlank(buyerName) &&
StringUtils.isNotBlank(dcAutoJitTag.getBuyerName())
&& !buyerName.equals(dcAutoJitTag.getBuyerName())) {
continue;
}
saveDays = dcAutoJitTag.getQuantitySafeInventory();
if ("weightingAvgSales".equals(autoForecastDay)) {
DcAutoJitTagLogMapper dcAutoJitTagLogMapper = SessionUtil.getSession().getMapper(DcAutoJitTagLogMapper.class);
......@@ -2501,9 +2508,15 @@ public class AutoTurnoverJob extends PointJob {
dcAutoJitTagLog.setTagJson(JSONObject.toJSONString(dcAutoJitTag));
dcAutoJitTagLogMapper.upsertSelective(dcAutoJitTagLog);
dcAutoTurnover.setTagId(dcAutoJitTag.getId());
hitTag = true;
}
break;
}
//如果一条规则都没命中
if (!hitTag) {
dcAutoTurnover.setTagId(0);
}
}
return saveDays;
}
......
......@@ -62,4 +62,34 @@ public class AutoTurnoverJobTest {
}
}
@Test
public void testOneSku() {
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
try (SqlSession sqlSession = SessionUtil.getFactory().openSession(true)) {
DcAutoSalesForecastStageConfigMapper dcAutoSalesForecastStageConfigMapper = sqlSession.getMapper(DcAutoSalesForecastStageConfigMapper.class);
DcBaseStockMapper dcBaseStockMapper = sqlSession.getMapper(DcBaseStockMapper.class);
DcBaseStock dcBaseStock = dcBaseStockMapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria()
.andBailunSkuEqualTo("228442801")
.andWarehouseCodeEqualTo("GZBLWH")
.example());
try {
if (dcBaseStock != null) {
log.info("计算周转开始 bailunSku:{} , warehouseCode:{}", dcBaseStock.getBailunSku(), dcBaseStock.getWarehouseCode());
autoTurnoverJob.autoTurnoverFromStock(DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT).format(LocalDate.now()), dcBaseStock);
log.info("计算周转结束 bailunSku:{} , warehouseCode:{}", dcBaseStock.getBailunSku(), dcBaseStock.getWarehouseCode());
} else {
log.error("没有找到周转对应的baseStock");
}
} catch (Exception e) {
log.error("计算周转失败 :{}", e.getMessage(), e);
}
}
}
}
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