Commit 7592468b by yinyong

aims--动态备货规则-安全库存天数匹配规则新增采购员判断

parent d8ff60eb
......@@ -152,6 +152,15 @@ public class DcAutoJitTag {
private Integer groupId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_jit_tag.buyer_name
*
* @mbg.generated
*/
private String buyerName;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_jit_tag
*
......@@ -179,6 +188,7 @@ public class DcAutoJitTag {
sb.append(", isEliminate=").append(isEliminate);
sb.append(", gmtUpdate=").append(gmtUpdate);
sb.append(", groupId=").append(groupId);
sb.append(", buyerName=").append(buyerName);
sb.append("]");
return sb.toString();
}
......@@ -216,7 +226,8 @@ public class DcAutoJitTag {
&& (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel()))
&& (this.getIsEliminate() == null ? other.getIsEliminate() == null : this.getIsEliminate().equals(other.getIsEliminate()))
&& (this.getGmtUpdate() == null ? other.getGmtUpdate() == null : this.getGmtUpdate().equals(other.getGmtUpdate()))
&& (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()));
&& (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
&& (this.getBuyerName() == null ? other.getBuyerName() == null : this.getBuyerName().equals(other.getBuyerName()));
}
/**
......@@ -245,6 +256,7 @@ public class DcAutoJitTag {
result = prime * result + ((getIsEliminate() == null) ? 0 : getIsEliminate().hashCode());
result = prime * result + ((getGmtUpdate() == null) ? 0 : getGmtUpdate().hashCode());
result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
result = prime * result + ((getBuyerName() == null) ? 0 : getBuyerName().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -1340,6 +1340,76 @@ public class DcAutoJitTagExample {
addCriterion("group_id not between", value1, value2, "groupId");
return (Criteria) this;
}
public Criteria andBuyerNameIsNull() {
addCriterion("buyer_name is null");
return (Criteria) this;
}
public Criteria andBuyerNameIsNotNull() {
addCriterion("buyer_name is not null");
return (Criteria) this;
}
public Criteria andBuyerNameEqualTo(String value) {
addCriterion("buyer_name =", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotEqualTo(String value) {
addCriterion("buyer_name <>", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameGreaterThan(String value) {
addCriterion("buyer_name >", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameGreaterThanOrEqualTo(String value) {
addCriterion("buyer_name >=", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLessThan(String value) {
addCriterion("buyer_name <", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLessThanOrEqualTo(String value) {
addCriterion("buyer_name <=", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameLike(String value) {
addCriterion("buyer_name like", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotLike(String value) {
addCriterion("buyer_name not like", value, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameIn(List<String> values) {
addCriterion("buyer_name in", values, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotIn(List<String> values) {
addCriterion("buyer_name not in", values, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameBetween(String value1, String value2) {
addCriterion("buyer_name between", value1, value2, "buyerName");
return (Criteria) this;
}
public Criteria andBuyerNameNotBetween(String value1, String value2) {
addCriterion("buyer_name not between", value1, value2, "buyerName");
return (Criteria) this;
}
}
/**
......
......@@ -22,6 +22,7 @@
<result column="is_eliminate" jdbcType="INTEGER" property="isEliminate" />
<result column="gmt_update" jdbcType="TIMESTAMP" property="gmtUpdate" />
<result column="group_id" jdbcType="INTEGER" property="groupId" />
<result column="buyer_name" jdbcType="VARCHAR" property="buyerName" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -96,7 +97,7 @@
-->
id, tag_name, is_gt_7, enable_7, quantity_sales7, is_gt_14, enable_14, quantity_sales14,
is_gt_30, enable_30, quantity_sales30, quantity_safe_inventory, level, is_eliminate,
gmt_update, group_id
gmt_update, group_id, buyer_name
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcAutoJitTagExample" resultMap="BaseResultMap">
<!--
......@@ -160,13 +161,13 @@
enable_14, quantity_sales14, is_gt_30,
enable_30, quantity_sales30, quantity_safe_inventory,
level, is_eliminate, gmt_update,
group_id)
group_id, buyer_name)
values (#{id,jdbcType=INTEGER}, #{tagName,jdbcType=VARCHAR}, #{isGt7,jdbcType=INTEGER},
#{enable7,jdbcType=INTEGER}, #{quantitySales7,jdbcType=DECIMAL}, #{isGt14,jdbcType=INTEGER},
#{enable14,jdbcType=INTEGER}, #{quantitySales14,jdbcType=DECIMAL}, #{isGt30,jdbcType=INTEGER},
#{enable30,jdbcType=INTEGER}, #{quantitySales30,jdbcType=DECIMAL}, #{quantitySafeInventory,jdbcType=DECIMAL},
#{level,jdbcType=INTEGER}, #{isEliminate,jdbcType=INTEGER}, #{gmtUpdate,jdbcType=TIMESTAMP},
#{groupId,jdbcType=INTEGER})
#{groupId,jdbcType=INTEGER}, #{buyerName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcAutoJitTag">
<!--
......@@ -223,6 +224,9 @@
<if test="groupId != null">
group_id,
</if>
<if test="buyerName != null">
buyer_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -273,6 +277,9 @@
<if test="groupId != null">
#{groupId,jdbcType=INTEGER},
</if>
<if test="buyerName != null">
#{buyerName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcAutoJitTagExample" resultType="java.lang.Long">
......@@ -340,6 +347,9 @@
<if test="record.groupId != null">
group_id = #{record.groupId,jdbcType=INTEGER},
</if>
<if test="record.buyerName != null">
buyer_name = #{record.buyerName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -366,7 +376,8 @@
level = #{record.level,jdbcType=INTEGER},
is_eliminate = #{record.isEliminate,jdbcType=INTEGER},
gmt_update = #{record.gmtUpdate,jdbcType=TIMESTAMP},
group_id = #{record.groupId,jdbcType=INTEGER}
group_id = #{record.groupId,jdbcType=INTEGER},
buyer_name = #{record.buyerName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -423,6 +434,9 @@
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER},
</if>
<if test="buyerName != null">
buyer_name = #{buyerName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -446,7 +460,8 @@
level = #{level,jdbcType=INTEGER},
is_eliminate = #{isEliminate,jdbcType=INTEGER},
gmt_update = #{gmtUpdate,jdbcType=TIMESTAMP},
group_id = #{groupId,jdbcType=INTEGER}
group_id = #{groupId,jdbcType=INTEGER},
buyer_name = #{buyerName,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcAutoJitTag">
......@@ -505,6 +520,9 @@
<if test="groupId != null">
group_id,
</if>
<if test="buyerName != null">
buyer_name,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -556,6 +574,9 @@
<if test="groupId != null">
#{groupId,jdbcType=INTEGER},
</if>
<if test="buyerName != null">
#{buyerName,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
......@@ -607,6 +628,9 @@
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER},
</if>
<if test="buyerName != null">
buyer_name = #{buyerName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcAutoJitTag">
......@@ -618,14 +642,14 @@
insert into dc_auto_jit_tag
(id, tag_name, is_gt_7, enable_7, quantity_sales7, is_gt_14, enable_14, quantity_sales14,
is_gt_30, enable_30, quantity_sales30, quantity_safe_inventory, level, is_eliminate,
gmt_update, group_id)
gmt_update, group_id, buyer_name)
values
(#{id,jdbcType=INTEGER}, #{tagName,jdbcType=VARCHAR}, #{isGt7,jdbcType=INTEGER},
#{enable7,jdbcType=INTEGER}, #{quantitySales7,jdbcType=DECIMAL}, #{isGt14,jdbcType=INTEGER},
#{enable14,jdbcType=INTEGER}, #{quantitySales14,jdbcType=DECIMAL}, #{isGt30,jdbcType=INTEGER},
#{enable30,jdbcType=INTEGER}, #{quantitySales30,jdbcType=DECIMAL}, #{quantitySafeInventory,jdbcType=DECIMAL},
#{level,jdbcType=INTEGER}, #{isEliminate,jdbcType=INTEGER}, #{gmtUpdate,jdbcType=TIMESTAMP},
#{groupId,jdbcType=INTEGER})
#{groupId,jdbcType=INTEGER}, #{buyerName,jdbcType=VARCHAR})
on duplicate key update
id = #{id,jdbcType=INTEGER},
tag_name = #{tagName,jdbcType=VARCHAR},
......@@ -642,7 +666,8 @@
level = #{level,jdbcType=INTEGER},
is_eliminate = #{isEliminate,jdbcType=INTEGER},
gmt_update = #{gmtUpdate,jdbcType=TIMESTAMP},
group_id = #{groupId,jdbcType=INTEGER}
group_id = #{groupId,jdbcType=INTEGER},
buyer_name = #{buyerName,jdbcType=VARCHAR}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcAutoJitTagExample" resultMap="BaseResultMap">
<!--
......
......@@ -42,7 +42,6 @@ public class AutoTurnoverJob extends PointJob {
@Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
Long st = System.currentTimeMillis();
long count = getTotalCount(shardingContext.getJobParameter());
int totalPage = getTotalPage(count, jobPointLog.getPageSize());
/*
......@@ -89,10 +88,6 @@ public class AutoTurnoverJob extends PointJob {
} finally {
SessionUtil.closeSession();
}
Long st2 = System.currentTimeMillis();
if(st2-st > 1000) {
System.out.println(" t0:" + String.valueOf(st2-st));
}
if (dcBaseStockList != null && dcBaseStockList.size() > 0) {
for (DcBaseStock dcBaseStock : dcBaseStockList) {
try {
......@@ -151,7 +146,6 @@ public class AutoTurnoverJob extends PointJob {
* @throws Exception
*/
public void autoTurnoverFromStock(String queryTime, DcBaseStock dcBaseStock) throws Exception {
Long st = System.currentTimeMillis();
String bailunSku = dcBaseStock.getBailunSku();
String warehouseCode = dcBaseStock.getWarehouseCode();
DcAutoSales dcAutoSales = null;
......@@ -202,12 +196,7 @@ public class AutoTurnoverJob extends PointJob {
} finally {
SessionUtil.closeSession();
}
Long st1 = System.currentTimeMillis();
autoTurnoverUseDcAutoSales(bailunSku, warehouseCode, dcAutoSales, dcBaseStock, dcBaseWarehouse, dcAutoWarehouseweekSales);
Long st2 = System.currentTimeMillis();
if(st2-st > 2000) {
System.out.println("sku:"+ bailunSku + " warehouse:"+ warehouseCode + "st1:" + String.valueOf(st1 - st) + " t2:" + String.valueOf(st2-st));
}
}
/*
......@@ -260,10 +249,7 @@ public class AutoTurnoverJob extends PointJob {
}
}
Long st1 = System.currentTimeMillis();
Integer bailunFirstLevelCatagoryId = getBailunCatagoryId(turnoverSku); //百伦第一级分类Id, 可以为null
Long st2 = System.currentTimeMillis();
System.out.println("调用接口耗时:" + String.valueOf(st2-st1));
// 获取调拨头程 + 调拨打包 + 海外仓入库天数 的配置
DcAutoConfigDelivery dcAutoConfigDelivery = getDcAutoConfigDelivery(bailunSku, warehouseCode, dcBaseWarehouse);
//获取周转天数计算配置, 数据来源于.net同事计算的均值
......@@ -1292,7 +1278,7 @@ public class AutoTurnoverJob extends PointJob {
dcAutoStockUpRange.setWarehouseName("百伦【广州-03仓】");
dcAutoStockUpRangeMapper.insertSelective(dcAutoStockUpRange);
}
BigDecimal saveDays = getSaveDays(dcAutoSales, dcAutoTurnover, bailunSku, "weightingAvgSales", dcAutoStockUpRange);
BigDecimal saveDays = getSaveDays(dcAutoSales, dcAutoTurnover, bailunSku, turnoverSku.getBuyerName(), "weightingAvgSales", dcAutoStockUpRange);
saveDaysMap.put("saveDays", saveDays);
dcAutoTurnover.setDailyWeightedSales(weightingAvgSales);
weightingAvgSales = weightingAvgSales.multiply(saveDays);
......@@ -2057,7 +2043,7 @@ public class AutoTurnoverJob extends PointJob {
return (int) totalPage;
}
public BigDecimal getSaveDays(DcAutoSales dcAutoSales, DcAutoTurnover dcAutoTurnover, String bailunSku, String autoForecastDay, DcAutoStockUpRange dcAutoStockUpRange) {
public BigDecimal getSaveDays(DcAutoSales dcAutoSales, DcAutoTurnover dcAutoTurnover, String bailunSku, String buyerName, String autoForecastDay, DcAutoStockUpRange dcAutoStockUpRange) {
List<Integer> historySalesList = JSON.parseObject(dcAutoSales.getHistorySalesDetails(), new TypeReference<List<Integer>>() {
});
/*
......@@ -2206,7 +2192,8 @@ public class AutoTurnoverJob extends PointJob {
continue;
}
}
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);
......
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