Commit 8f5caf75 by wutong

自动周转新增30天平均历史销量, 且修改对JIT的判定

parent 7608bd55
......@@ -442,6 +442,15 @@ public class DcAutoTurnover {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_turnover.history_thirtyday_sales
*
* @mbg.generated
*/
private BigDecimal historyThirtydaySales;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_turnover.sales_explain_details
*
* @mbg.generated
......@@ -553,6 +562,7 @@ public class DcAutoTurnover {
sb.append(", turnoverInbound=").append(turnoverInbound);
sb.append(", historySevendaySales=").append(historySevendaySales);
sb.append(", historyFourteendaySales=").append(historyFourteendaySales);
sb.append(", historyThirtydaySales=").append(historyThirtydaySales);
sb.append(", salesExplainDetails=").append(salesExplainDetails);
sb.append(", forecastTurnoverdaySales=").append(forecastTurnoverdaySales);
sb.append(", stockUpSales=").append(stockUpSales);
......@@ -629,6 +639,7 @@ public class DcAutoTurnover {
&& (this.getTurnoverInbound() == null ? other.getTurnoverInbound() == null : this.getTurnoverInbound().equals(other.getTurnoverInbound()))
&& (this.getHistorySevendaySales() == null ? other.getHistorySevendaySales() == null : this.getHistorySevendaySales().equals(other.getHistorySevendaySales()))
&& (this.getHistoryFourteendaySales() == null ? other.getHistoryFourteendaySales() == null : this.getHistoryFourteendaySales().equals(other.getHistoryFourteendaySales()))
&& (this.getHistoryThirtydaySales() == null ? other.getHistoryThirtydaySales() == null : this.getHistoryThirtydaySales().equals(other.getHistoryThirtydaySales()))
&& (this.getSalesExplainDetails() == null ? other.getSalesExplainDetails() == null : this.getSalesExplainDetails().equals(other.getSalesExplainDetails()))
&& (this.getForecastTurnoverdaySales() == null ? other.getForecastTurnoverdaySales() == null : this.getForecastTurnoverdaySales().equals(other.getForecastTurnoverdaySales()))
&& (this.getStockUpSales() == null ? other.getStockUpSales() == null : this.getStockUpSales().equals(other.getStockUpSales()))
......@@ -695,6 +706,7 @@ public class DcAutoTurnover {
result = prime * result + ((getTurnoverInbound() == null) ? 0 : getTurnoverInbound().hashCode());
result = prime * result + ((getHistorySevendaySales() == null) ? 0 : getHistorySevendaySales().hashCode());
result = prime * result + ((getHistoryFourteendaySales() == null) ? 0 : getHistoryFourteendaySales().hashCode());
result = prime * result + ((getHistoryThirtydaySales() == null) ? 0 : getHistoryThirtydaySales().hashCode());
result = prime * result + ((getSalesExplainDetails() == null) ? 0 : getSalesExplainDetails().hashCode());
result = prime * result + ((getForecastTurnoverdaySales() == null) ? 0 : getForecastTurnoverdaySales().hashCode());
result = prime * result + ((getStockUpSales() == null) ? 0 : getStockUpSales().hashCode());
......
......@@ -3371,6 +3371,66 @@ public class DcAutoTurnoverExample {
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesIsNull() {
addCriterion("history_thirtyday_sales is null");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesIsNotNull() {
addCriterion("history_thirtyday_sales is not null");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales =", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesNotEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales <>", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesGreaterThan(BigDecimal value) {
addCriterion("history_thirtyday_sales >", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales >=", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesLessThan(BigDecimal value) {
addCriterion("history_thirtyday_sales <", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesLessThanOrEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales <=", value, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesIn(List<BigDecimal> values) {
addCriterion("history_thirtyday_sales in", values, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesNotIn(List<BigDecimal> values) {
addCriterion("history_thirtyday_sales not in", values, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_thirtyday_sales between", value1, value2, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_thirtyday_sales not between", value1, value2, "historyThirtydaySales");
return (Criteria) this;
}
public Criteria andSalesExplainDetailsIsNull() {
addCriterion("sales_explain_details is null");
return (Criteria) this;
......
......@@ -16,6 +16,8 @@ public interface Constant {
String BUYER_JIT_1 = "张莹霞";
String BUYER_JIT_2 = "张莹霞1";
String BUYER_JIT_3 = "冯兆欣";
String WAREHOUSE_JIT = "GZBLWH";
BigDecimal BIGDECIMAL_THIRTY = BigDecimal.valueOf(30);
BigDecimal BIGDECIMAL_FOURTEEN = BigDecimal.valueOf(14);
BigDecimal BIGDECIMAL_SEVEN = BigDecimal.valueOf(7);
BigDecimal BIGDECIMAL_THREE = BigDecimal.valueOf(3);
......
......@@ -330,17 +330,23 @@ public class AutoTurnoverJob extends PointJob {
Integer historyFourteenSales = 0;
Integer historySevenSales = 0;
Integer historyThreeSales = 0;
for (int i = 0; i < 14; i++) {
Integer historyThirtySales = 0;
for (int i = 0; i < 30; i++) {
if (i < 3) {
historyThreeSales += historySalesList.get(27 + i);
}
if (i < 7) {
historySevenSales += historySalesList.get(23 + i);
}
historyFourteenSales += historySalesList.get(16 + i);
if (i < 14) {
historyFourteenSales += historySalesList.get(16 + i);
}
historyThirtySales += historySalesList.get(i);
}
BigDecimal avgHistoryFourteendaySales = BigDecimal.valueOf(historyFourteenSales.longValue()).divide(Constant.BIGDECIMAL_FOURTEEN, 3, RoundingMode.HALF_EVEN);
BigDecimal avgHistoryThreedaySales = BigDecimal.valueOf(historyThreeSales.longValue()).divide(Constant.BIGDECIMAL_THREE, 3, RoundingMode.HALF_EVEN);
BigDecimal avgHistorySevendaySales = BigDecimal.valueOf(historySevenSales.longValue()).divide(Constant.BIGDECIMAL_SEVEN, 3, RoundingMode.HALF_EVEN);
BigDecimal avgHistoryFourteendaySales = BigDecimal.valueOf(historyFourteenSales.longValue()).divide(Constant.BIGDECIMAL_FOURTEEN, 3, RoundingMode.HALF_EVEN);
BigDecimal avgHistoryThirtydaySales = BigDecimal.valueOf(historyFourteenSales.longValue()).divide(Constant.BIGDECIMAL_THIRTY, 3, RoundingMode.HALF_EVEN);
/*
* forecastFluctuationList 用于存放预计缺货 实际缺货 预计冗余 实际冗余的数据
* dcAutoConfigSkuWarehouse 看是否监控状态
......@@ -435,8 +441,9 @@ public class AutoTurnoverJob extends PointJob {
dcAutoTurnover.setQuantityBeginAdvise(forecastPurchaseAdvisedList.get(0));
dcAutoTurnover.setForecastTurnoverdaySales(avgForecastFourteendaySales.divide(BigDecimal.valueOf(turnoverDays), 3, RoundingMode.HALF_EVEN));
dcAutoTurnover.setSalesExplainDetails(forecastSalesExplainList.toString());
dcAutoTurnover.setHistorySevendaySales(BigDecimal.valueOf(historySevenSales.doubleValue()).divide(Constant.BIGDECIMAL_SEVEN, 3, RoundingMode.HALF_EVEN));
dcAutoTurnover.setHistorySevendaySales(avgHistorySevendaySales);
dcAutoTurnover.setHistoryFourteendaySales(avgHistoryFourteendaySales);
dcAutoTurnover.setHistoryThirtydaySales(avgHistoryThirtydaySales);
dcAutoTurnover.setSupplementarySales(forecastSalesList.get(turnoverDays));
dcAutoTurnover.setAverageSupplierDelivery(dcAutoTurnover.getSupplierDelivery());
dcAutoTurnover.setSalesUpperLimit(salesUpperLimit);
......@@ -546,7 +553,8 @@ public class AutoTurnoverJob extends PointJob {
try {
DcAutoForecastFluctuationMapper mapper = SessionUtil.getSession().getMapper(DcAutoForecastFluctuationMapper.class);
//JIT的 可以不做 冗余 和 缺货预测 实际冗余和实际缺货也不用提醒
if ( !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1) && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2) && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_3)) {
//如果仓库是广州01 且 是这三个销售员, 就不提醒
if (!warehouseCode.equals(Constant.WAREHOUSE_JIT) && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_1) && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_2) && !turnoverSku.getBuyerName().equals(Constant.BUYER_JIT_3)) {
if (dcAutoConfigSkuWarehouse == null || dcAutoConfigSkuWarehouse.getStatus().equals(0)) {
if (forecastFluctuationList != null && forecastFluctuationList.size() > 0) {
//拿最早的时间 + 最晚的时间, SKU-仓库维度只放一条
......
......@@ -54,6 +54,7 @@
<result column="turnover_inbound" jdbcType="DECIMAL" property="turnoverInbound" />
<result column="history_sevenday_sales" jdbcType="DECIMAL" property="historySevendaySales" />
<result column="history_fourteenday_sales" jdbcType="DECIMAL" property="historyFourteendaySales" />
<result column="history_thirtyday_sales" jdbcType="DECIMAL" property="historyThirtydaySales" />
<result column="sales_explain_details" jdbcType="VARCHAR" property="salesExplainDetails" />
<result column="forecast_turnoverday_sales" jdbcType="DECIMAL" property="forecastTurnoverdaySales" />
<result column="stock_up_sales" jdbcType="DECIMAL" property="stockUpSales" />
......@@ -142,8 +143,8 @@
transfer_bale_config_delivery, abroad_inbound_config_delivery, inspection_config_delivery,
inspection_delivery, transfer_delivery, transfer_bale_delivery, abroad_inbound_delivery,
supplementary_sales, turnover_sales, turnover_inbound, history_sevenday_sales, history_fourteenday_sales,
sales_explain_details, forecast_turnoverday_sales, stock_up_sales, quantity_begin_advise,
stock_up_days, payment_before_delivery
history_thirtyday_sales, sales_explain_details, forecast_turnoverday_sales, stock_up_sales,
quantity_begin_advise, stock_up_days, payment_before_delivery
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcAutoTurnoverExample" resultMap="BaseResultMap">
<!--
......@@ -222,10 +223,10 @@
transfer_delivery, transfer_bale_delivery,
abroad_inbound_delivery, supplementary_sales,
turnover_sales, turnover_inbound, history_sevenday_sales,
history_fourteenday_sales, sales_explain_details,
forecast_turnoverday_sales, stock_up_sales,
quantity_begin_advise, stock_up_days, payment_before_delivery
)
history_fourteenday_sales, history_thirtyday_sales,
sales_explain_details, forecast_turnoverday_sales,
stock_up_sales, quantity_begin_advise, stock_up_days,
payment_before_delivery)
values (#{id,jdbcType=INTEGER}, #{purchaseAdviceId,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR},
#{warehouseCode,jdbcType=VARCHAR}, #{quantityInitAdvise,jdbcType=DECIMAL}, #{quantityMinimumOrder,jdbcType=INTEGER},
#{quantityFinalAdvise,jdbcType=DECIMAL}, #{warehouseName,jdbcType=VARCHAR}, #{quantityPromotion,jdbcType=INTEGER},
......@@ -244,10 +245,10 @@
#{transferDelivery,jdbcType=INTEGER}, #{transferBaleDelivery,jdbcType=INTEGER},
#{abroadInboundDelivery,jdbcType=INTEGER}, #{supplementarySales,jdbcType=DECIMAL},
#{turnoverSales,jdbcType=DECIMAL}, #{turnoverInbound,jdbcType=DECIMAL}, #{historySevendaySales,jdbcType=DECIMAL},
#{historyFourteendaySales,jdbcType=DECIMAL}, #{salesExplainDetails,jdbcType=VARCHAR},
#{forecastTurnoverdaySales,jdbcType=DECIMAL}, #{stockUpSales,jdbcType=DECIMAL},
#{quantityBeginAdvise,jdbcType=DECIMAL}, #{stockUpDays,jdbcType=INTEGER}, #{paymentBeforeDelivery,jdbcType=INTEGER}
)
#{historyFourteendaySales,jdbcType=DECIMAL}, #{historyThirtydaySales,jdbcType=DECIMAL},
#{salesExplainDetails,jdbcType=VARCHAR}, #{forecastTurnoverdaySales,jdbcType=DECIMAL},
#{stockUpSales,jdbcType=DECIMAL}, #{quantityBeginAdvise,jdbcType=DECIMAL}, #{stockUpDays,jdbcType=INTEGER},
#{paymentBeforeDelivery,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcAutoTurnover">
<!--
......@@ -400,6 +401,9 @@
<if test="historyFourteendaySales != null">
history_fourteenday_sales,
</if>
<if test="historyThirtydaySales != null">
history_thirtyday_sales,
</if>
<if test="salesExplainDetails != null">
sales_explain_details,
</if>
......@@ -564,6 +568,9 @@
<if test="historyFourteendaySales != null">
#{historyFourteendaySales,jdbcType=DECIMAL},
</if>
<if test="historyThirtydaySales != null">
#{historyThirtydaySales,jdbcType=DECIMAL},
</if>
<if test="salesExplainDetails != null">
#{salesExplainDetails,jdbcType=VARCHAR},
</if>
......@@ -745,6 +752,9 @@
<if test="record.historyFourteendaySales != null">
history_fourteenday_sales = #{record.historyFourteendaySales,jdbcType=DECIMAL},
</if>
<if test="record.historyThirtydaySales != null">
history_thirtyday_sales = #{record.historyThirtydaySales,jdbcType=DECIMAL},
</if>
<if test="record.salesExplainDetails != null">
sales_explain_details = #{record.salesExplainDetails,jdbcType=VARCHAR},
</if>
......@@ -822,6 +832,7 @@
turnover_inbound = #{record.turnoverInbound,jdbcType=DECIMAL},
history_sevenday_sales = #{record.historySevendaySales,jdbcType=DECIMAL},
history_fourteenday_sales = #{record.historyFourteendaySales,jdbcType=DECIMAL},
history_thirtyday_sales = #{record.historyThirtydaySales,jdbcType=DECIMAL},
sales_explain_details = #{record.salesExplainDetails,jdbcType=VARCHAR},
forecast_turnoverday_sales = #{record.forecastTurnoverdaySales,jdbcType=DECIMAL},
stock_up_sales = #{record.stockUpSales,jdbcType=DECIMAL},
......@@ -980,6 +991,9 @@
<if test="historyFourteendaySales != null">
history_fourteenday_sales = #{historyFourteendaySales,jdbcType=DECIMAL},
</if>
<if test="historyThirtydaySales != null">
history_thirtyday_sales = #{historyThirtydaySales,jdbcType=DECIMAL},
</if>
<if test="salesExplainDetails != null">
sales_explain_details = #{salesExplainDetails,jdbcType=VARCHAR},
</if>
......@@ -1054,6 +1068,7 @@
turnover_inbound = #{turnoverInbound,jdbcType=DECIMAL},
history_sevenday_sales = #{historySevendaySales,jdbcType=DECIMAL},
history_fourteenday_sales = #{historyFourteendaySales,jdbcType=DECIMAL},
history_thirtyday_sales = #{historyThirtydaySales,jdbcType=DECIMAL},
sales_explain_details = #{salesExplainDetails,jdbcType=VARCHAR},
forecast_turnoverday_sales = #{forecastTurnoverdaySales,jdbcType=DECIMAL},
stock_up_sales = #{stockUpSales,jdbcType=DECIMAL},
......@@ -1214,6 +1229,9 @@
<if test="historyFourteendaySales != null">
history_fourteenday_sales,
</if>
<if test="historyThirtydaySales != null">
history_thirtyday_sales,
</if>
<if test="salesExplainDetails != null">
sales_explain_details,
</if>
......@@ -1379,6 +1397,9 @@
<if test="historyFourteendaySales != null">
#{historyFourteendaySales,jdbcType=DECIMAL},
</if>
<if test="historyThirtydaySales != null">
#{historyThirtydaySales,jdbcType=DECIMAL},
</if>
<if test="salesExplainDetails != null">
#{salesExplainDetails,jdbcType=VARCHAR},
</if>
......@@ -1544,6 +1565,9 @@
<if test="historyFourteendaySales != null">
history_fourteenday_sales = #{historyFourteendaySales,jdbcType=DECIMAL},
</if>
<if test="historyThirtydaySales != null">
history_thirtyday_sales = #{historyThirtydaySales,jdbcType=DECIMAL},
</if>
<if test="salesExplainDetails != null">
sales_explain_details = #{salesExplainDetails,jdbcType=VARCHAR},
</if>
......@@ -1581,8 +1605,9 @@
transfer_config_delivery, transfer_bale_config_delivery, abroad_inbound_config_delivery,
inspection_config_delivery, inspection_delivery, transfer_delivery, transfer_bale_delivery,
abroad_inbound_delivery, supplementary_sales, turnover_sales, turnover_inbound,
history_sevenday_sales, history_fourteenday_sales, sales_explain_details, forecast_turnoverday_sales,
stock_up_sales, quantity_begin_advise, stock_up_days, payment_before_delivery)
history_sevenday_sales, history_fourteenday_sales, history_thirtyday_sales, sales_explain_details,
forecast_turnoverday_sales, stock_up_sales, quantity_begin_advise, stock_up_days,
payment_before_delivery)
values
(#{id,jdbcType=INTEGER}, #{purchaseAdviceId,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR},
#{warehouseCode,jdbcType=VARCHAR}, #{quantityInitAdvise,jdbcType=DECIMAL}, #{quantityMinimumOrder,jdbcType=INTEGER},
......@@ -1602,10 +1627,10 @@
#{transferDelivery,jdbcType=INTEGER}, #{transferBaleDelivery,jdbcType=INTEGER},
#{abroadInboundDelivery,jdbcType=INTEGER}, #{supplementarySales,jdbcType=DECIMAL},
#{turnoverSales,jdbcType=DECIMAL}, #{turnoverInbound,jdbcType=DECIMAL}, #{historySevendaySales,jdbcType=DECIMAL},
#{historyFourteendaySales,jdbcType=DECIMAL}, #{salesExplainDetails,jdbcType=VARCHAR},
#{forecastTurnoverdaySales,jdbcType=DECIMAL}, #{stockUpSales,jdbcType=DECIMAL},
#{quantityBeginAdvise,jdbcType=DECIMAL}, #{stockUpDays,jdbcType=INTEGER}, #{paymentBeforeDelivery,jdbcType=INTEGER}
)
#{historyFourteendaySales,jdbcType=DECIMAL}, #{historyThirtydaySales,jdbcType=DECIMAL},
#{salesExplainDetails,jdbcType=VARCHAR}, #{forecastTurnoverdaySales,jdbcType=DECIMAL},
#{stockUpSales,jdbcType=DECIMAL}, #{quantityBeginAdvise,jdbcType=DECIMAL}, #{stockUpDays,jdbcType=INTEGER},
#{paymentBeforeDelivery,jdbcType=INTEGER})
on duplicate key update
id = #{id,jdbcType=INTEGER},
purchase_advice_id = #{purchaseAdviceId,jdbcType=VARCHAR},
......@@ -1655,6 +1680,7 @@
turnover_inbound = #{turnoverInbound,jdbcType=DECIMAL},
history_sevenday_sales = #{historySevendaySales,jdbcType=DECIMAL},
history_fourteenday_sales = #{historyFourteendaySales,jdbcType=DECIMAL},
history_thirtyday_sales = #{historyThirtydaySales,jdbcType=DECIMAL},
sales_explain_details = #{salesExplainDetails,jdbcType=VARCHAR},
forecast_turnoverday_sales = #{forecastTurnoverdaySales,jdbcType=DECIMAL},
stock_up_sales = #{stockUpSales,jdbcType=DECIMAL},
......@@ -1680,7 +1706,6 @@
limit 1
</select>
<delete id="truncateAutoInboundTable">
TRUNCATE dc_auto_inbound
</delete>
......
table-name=dc_mid_cost_first_order
table-name=dc_auto_turnover
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