Commit 7345390f by wutong

同步WMS库存新添加多个字段

parent 28f61875
......@@ -15,12 +15,25 @@ public class WmsStockItem {
private String skuTitle;
@JSONField(name = "warehouseCode")
private String warehouseCode;
//待上架库存
@JSONField(name = "pendingStock")
private Integer waitPutaway;
//占用库存
@JSONField(name = "reserveStock")
private Integer occupyStock;
//可用库存
@JSONField(name = "availabelStock")
private Integer usableStock;
//在途库存
@JSONField(name = "inboundStock")
private Integer quantityTransit;
//不可用库存
@JSONField(name = "unSellStock")
private Integer quantityFreeze;
//已发货库存
@JSONField(name = "shippedStock")
private Integer shippedStock;
@JSONField(name = "lastModificationTime")
private LocalDateTime updateTime;
}
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.entity.DcBaseStock;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseStockExample;
import com.bailuntec.domain.pojo.*;
import com.bailuntec.mapper.DcBaseStockMapper;
import com.bailuntec.mapper.DcBaseWarehouseMapper;
......@@ -81,11 +82,12 @@ public class WmsStockJob extends PointJob {
e.printStackTrace();
throw new RuntimeException("WMS库存BeanUtils.copyProperties失败");
}
mapper.upsertSelective(dcBaseStock);
SessionUtil.getSession().commit();
int i = mapper.updateByExampleSelective(dcBaseStock, DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo(dcBaseStock.getBailunSku()).andWarehouseCodeEqualTo(dcBaseStock.getWarehouseCode()).example());
if (i == 0) {
mapper.insertSelective(dcBaseStock);
}
});
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYBATIS操作DB失败", e);
} finally {
SessionUtil.closeSession();
......@@ -99,7 +101,6 @@ public class WmsStockJob extends PointJob {
}
jobPointLog.setPageIndex(jobPointLog.getPageIndex() + 1);
} while (jobPointLog.getPageIndex() <= totalPage);
if (jobPointLog.getPageIndex() > totalPage) jobPointLog.setPageIndex(1);
jobPointLog.setStartTime(now);
jobPointLog.setEndTime(LocalDateTime.now());
}
......
......@@ -121,6 +121,4 @@ public interface DcBaseStockMapper {
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseStock record);
void insertDailyStock();
}
\ No newline at end of file
......@@ -38,6 +38,7 @@
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="shipped_stock" jdbcType="INTEGER" property="shippedStock" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -115,7 +116,7 @@
quantity_transit, wait_check, wait_putaway, usable_stock, usable_sales, usable_sales_private,
usable_sales_share, in_warehouse_share, in_warehouse_private, in_warehouse, occupy_stock_share,
occupy_stock_private, occupy_stock, occupy_activity, occupy_order_private, occupy_order_share,
occupy_order, gmt_create, gmt_modified, create_time, update_time
occupy_order, gmt_create, gmt_modified, create_time, update_time, shipped_stock
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseStockExample" resultMap="BaseResultMap">
<!--
......@@ -186,7 +187,8 @@
occupy_stock_share, occupy_stock_private, occupy_stock,
occupy_activity, occupy_order_private, occupy_order_share,
occupy_order, gmt_create, gmt_modified,
create_time, update_time)
create_time, update_time, shipped_stock
)
values (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR},
#{ownerCode,jdbcType=VARCHAR}, #{quantityReservation,jdbcType=INTEGER}, #{quantityTransport,jdbcType=INTEGER},
#{quantityTransfer,jdbcType=INTEGER}, #{quantityFreeze,jdbcType=INTEGER}, #{quantitySupplier,jdbcType=INTEGER},
......@@ -197,7 +199,8 @@
#{occupyStockShare,jdbcType=INTEGER}, #{occupyStockPrivate,jdbcType=INTEGER}, #{occupyStock,jdbcType=INTEGER},
#{occupyActivity,jdbcType=INTEGER}, #{occupyOrderPrivate,jdbcType=INTEGER}, #{occupyOrderShare,jdbcType=INTEGER},
#{occupyOrder,jdbcType=INTEGER}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{shippedStock,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseStock">
<!--
......@@ -302,6 +305,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="shippedStock != null">
shipped_stock,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -400,6 +406,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shippedStock != null">
#{shippedStock,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseStockExample" resultType="java.lang.Long">
......@@ -515,6 +524,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.shippedStock != null">
shipped_stock = #{record.shippedStock,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -557,7 +569,8 @@
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
shipped_stock = #{record.shippedStock,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -662,6 +675,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shippedStock != null">
shipped_stock = #{shippedStock,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -701,7 +717,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
shipped_stock = #{shippedStock,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseStock">
......@@ -808,6 +825,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="shippedStock != null">
shipped_stock,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -907,6 +927,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shippedStock != null">
#{shippedStock,jdbcType=INTEGER},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
......@@ -1006,6 +1029,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shippedStock != null">
shipped_stock = #{shippedStock,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseStock">
......@@ -1020,7 +1046,8 @@
quantity_transit, wait_check, wait_putaway, usable_stock, usable_sales, usable_sales_private,
usable_sales_share, in_warehouse_share, in_warehouse_private, in_warehouse, occupy_stock_share,
occupy_stock_private, occupy_stock, occupy_activity, occupy_order_private, occupy_order_share,
occupy_order, gmt_create, gmt_modified, create_time, update_time)
occupy_order, gmt_create, gmt_modified, create_time, update_time, shipped_stock
)
values
(#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR},
#{ownerCode,jdbcType=VARCHAR}, #{quantityReservation,jdbcType=INTEGER}, #{quantityTransport,jdbcType=INTEGER},
......@@ -1032,7 +1059,8 @@
#{occupyStockShare,jdbcType=INTEGER}, #{occupyStockPrivate,jdbcType=INTEGER}, #{occupyStock,jdbcType=INTEGER},
#{occupyActivity,jdbcType=INTEGER}, #{occupyOrderPrivate,jdbcType=INTEGER}, #{occupyOrderShare,jdbcType=INTEGER},
#{occupyOrder,jdbcType=INTEGER}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{shippedStock,jdbcType=INTEGER}
)
on duplicate key update
id = #{id,jdbcType=INTEGER},
bailun_sku = #{bailunSku,jdbcType=VARCHAR},
......@@ -1065,7 +1093,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
shipped_stock = #{shippedStock,jdbcType=INTEGER}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseStockExample" resultMap="BaseResultMap">
<!--
......@@ -1084,75 +1113,4 @@
</if>
limit 1
</select>
<insert id="insertDailyStock">
INSERT INTO dc_daily_stock (
`bailun_sku`,
`warehouse_code`,
`owner_code`,
`quantity_reservation`,
`quantity_transport`,
`quantity_transfer`,
`quantity_freeze`,
`quantity_supplier`,
`quantity_presell`,
`quantity_defective`,
`quantity_transit`,
`wait_check`,
`wait_putaway`,
`usable_stock`,
`usable_sales`,
`usable_sales_private`,
`usable_sales_share`,
`in_warehouse_share`,
`in_warehouse_private`,
`in_warehouse`,
`occupy_stock_share`,
`occupy_stock_private`,
`occupy_stock`,
`occupy_activity`,
`occupy_order_private`,
`occupy_order_share`,
`occupy_order`,
`gmt_create`,
`gmt_modified`,
`record_time`,
`create_time`,
`update_time`
) SELECT
`bailun_sku`,
`warehouse_code`,
`owner_code`,
`quantity_reservation`,
`quantity_transport`,
`quantity_transfer`,
`quantity_freeze`,
`quantity_supplier`,
`quantity_presell`,
`quantity_defective`,
`quantity_transit`,
`wait_check`,
`wait_putaway`,
`usable_stock`,
`usable_sales`,
`usable_sales_private`,
`usable_sales_share`,
`in_warehouse_share`,
`in_warehouse_private`,
`in_warehouse`,
`occupy_stock_share`,
`occupy_stock_private`,
`occupy_stock`,
`occupy_activity`,
`occupy_order_private`,
`occupy_order_share`,
`occupy_order`,
`gmt_create`,
`gmt_modified`,
DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),
`create_time`,
`update_time`
FROM
dc_base_stock
</insert>
</mapper>
\ No newline at end of file
......@@ -295,6 +295,15 @@ public class DcBaseStock {
private LocalDateTime updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock.shipped_stock
*
* @mbg.generated
*/
private Integer shippedStock;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
......@@ -338,6 +347,7 @@ public class DcBaseStock {
sb.append(", gmtModified=").append(gmtModified);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", shippedStock=").append(shippedStock);
sb.append("]");
return sb.toString();
}
......@@ -391,7 +401,8 @@ public class DcBaseStock {
&& (this.getGmtCreate() == null ? other.getGmtCreate() == null : this.getGmtCreate().equals(other.getGmtCreate()))
&& (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getShippedStock() == null ? other.getShippedStock() == null : this.getShippedStock().equals(other.getShippedStock()));
}
/**
......@@ -436,6 +447,7 @@ public class DcBaseStock {
result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getShippedStock() == null) ? 0 : getShippedStock().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -218,6 +218,36 @@ public class DcBaseStockExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcBaseStockExample when(boolean condition, IExampleWhen then) {
if (condition) {
then.example(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcBaseStockExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) {
if (condition) {
then.example(this);
} else {
otherwise.example(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void setOffset(Integer offset) {
this.offset = offset;
}
......@@ -2289,6 +2319,66 @@ public class DcBaseStockExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andShippedStockIsNull() {
addCriterion("shipped_stock is null");
return (Criteria) this;
}
public Criteria andShippedStockIsNotNull() {
addCriterion("shipped_stock is not null");
return (Criteria) this;
}
public Criteria andShippedStockEqualTo(Integer value) {
addCriterion("shipped_stock =", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockNotEqualTo(Integer value) {
addCriterion("shipped_stock <>", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockGreaterThan(Integer value) {
addCriterion("shipped_stock >", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockGreaterThanOrEqualTo(Integer value) {
addCriterion("shipped_stock >=", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockLessThan(Integer value) {
addCriterion("shipped_stock <", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockLessThanOrEqualTo(Integer value) {
addCriterion("shipped_stock <=", value, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockIn(List<Integer> values) {
addCriterion("shipped_stock in", values, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockNotIn(List<Integer> values) {
addCriterion("shipped_stock not in", values, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockBetween(Integer value1, Integer value2) {
addCriterion("shipped_stock between", value1, value2, "shippedStock");
return (Criteria) this;
}
public Criteria andShippedStockNotBetween(Integer value1, Integer value2) {
addCriterion("shipped_stock not between", value1, value2, "shippedStock");
return (Criteria) this;
}
}
/**
......@@ -2337,6 +2427,7 @@ public class DcBaseStockExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
@Deprecated
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
......@@ -2345,12 +2436,43 @@ public class DcBaseStockExample {
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria when(boolean condition, ICriteriaWhen then) {
if (condition) {
then.criteria(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) {
if (condition) {
then.criteria(this);
} else {
otherwise.criteria(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
@Deprecated
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
......@@ -2454,4 +2576,40 @@ public class DcBaseStockExample {
this(condition, value, secondValue, null);
}
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaWhen {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
void criteria(Criteria criteria);
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface IExampleWhen {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_stock
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
void example(DcBaseStockExample example);
}
}
\ No newline at end of file
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