Commit 9640959a by yinyong

实时缺货计算新增速卖通缺货数据

parent 4241d9e0
...@@ -10,5 +10,6 @@ public class OutStockQuantity { ...@@ -10,5 +10,6 @@ public class OutStockQuantity {
private String bailunSku; private String bailunSku;
private String warehouseCode; private String warehouseCode;
private Integer quantityOutStock; private Integer quantityOutStock;
private Integer aliexpressQuantity;
private LocalDateTime gmtOutStockModified; private LocalDateTime gmtOutStockModified;
} }
...@@ -690,11 +690,11 @@ ...@@ -690,11 +690,11 @@
</insert> </insert>
<insert id="calculateOutStock"> <insert id="calculateOutStock">
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_out_stock,gmt_out_stock_modified) insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_out_stock,gmt_out_stock_modified, quantity_out_stock_aliexpress)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.bailunSku,jdbcType=VARCHAR}, #{item.warehouseCode,jdbcType=VARCHAR}, #{item.quantityOutStock,jdbcType=INTEGER}, #{localDateTime,jdbcType=TIMESTAMP} #{item.bailunSku,jdbcType=VARCHAR}, #{item.warehouseCode,jdbcType=VARCHAR}, #{item.quantityOutStock,jdbcType=INTEGER}, #{localDateTime,jdbcType=TIMESTAMP}, #{item.aliexpressQuantity, jdbcType=INTEGER}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE quantity_out_stock = values(quantity_out_stock) ,gmt_out_stock_modified = values(gmt_out_stock_modified) ON DUPLICATE KEY UPDATE quantity_out_stock = values(quantity_out_stock) ,gmt_out_stock_modified = values(gmt_out_stock_modified)
...@@ -722,11 +722,13 @@ ...@@ -722,11 +722,13 @@
SELECT SELECT
t1.bailun_sku as bailunSku, t1.bailun_sku as bailunSku,
t1.warehouse_code as warehouseCode, t1.warehouse_code as warehouseCode,
t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0) as quantityOutStock t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0) as quantityOutStock,
if((t1.aliexpress_quantity - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0)) &lt; 0, 0, (t1.aliexpress_quantity - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0))) as aliexpressQuantity
FROM FROM
( (
SELECT SELECT
bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_pushed) AS bailun_sku_quantity_pushed bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_pushed) AS bailun_sku_quantity_pushed,
sum(case when platform_type = 'Aliexpress' then bailun_sku_quantity_ordered - bailun_sku_quantity_pushed else 0 end) as aliexpress_quantity
FROM FROM
dc_base_oms_sku dc_base_oms_sku
WHERE WHERE
...@@ -811,7 +813,7 @@ ...@@ -811,7 +813,7 @@
<update id="updateOldOutStockToZero"> <update id="updateOldOutStockToZero">
update dc_mid_transit set quantity_out_stock =0 where gmt_out_stock_modified &lt; #{outStockModified,jdbcType=TIMESTAMP} update dc_mid_transit set quantity_out_stock =0, quantity_out_stock_aliexpress = 0 where gmt_out_stock_modified &lt; #{outStockModified,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateOldTransferToZero"> <update id="updateOldTransferToZero">
update dc_mid_transit set quantity_transfer =0 where gmt_transfer_modified &lt; #{transferModified,jdbcType=TIMESTAMP} update dc_mid_transit set quantity_transfer =0 where gmt_transfer_modified &lt; #{transferModified,jdbcType=TIMESTAMP}
......
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