Commit 3d2e23fb by wutong

修改缺货数计算

parent 89f4886a
...@@ -726,32 +726,32 @@ ...@@ -726,32 +726,32 @@
<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)
SELECT SELECT
t1.bailun_sku, t1.bailun_sku,
t1.warehouse_code, t1.warehouse_code,
t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_picked - t2.usable_stock - t2.occupy_stock, t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock,
CURRENT_TIMESTAMP CURRENT_TIMESTAMP
FROM FROM
( (
SELECT SELECT
bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_picked) AS bailun_sku_quantity_picked bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_pushed) AS bailun_sku_quantity_pushed
FROM FROM
dc_base_oms_sku dc_base_oms_sku
WHERE WHERE
bailun_order_status = 'Handling' bailun_order_status = 'Handling'
and bailun_interception_status in('None','Failed') and bailun_interception_status in('None','Failed')
and warehouse_code != '' and warehouse_code != ''
and platform_type != 'FBA' and platform_type != 'FBA'
and has_delete = 0 and has_delete = 0
and has_scalp = 0 and has_scalp = 0
and has_fba_s = 0 and has_fba_s = 0
and has_innersale = 0 and has_innersale = 0
and paid_time >= '2019-03-01 12:00:00' and paid_time >= '2019-03-01 12:00:00'
and bailun_sku_quantity_ordered > bailun_sku_quantity_picked and bailun_sku_quantity_ordered > bailun_sku_quantity_shipped
GROUP BY GROUP BY
bailun_sku, bailun_sku,
warehouse_code warehouse_code
) t1 INNER JOIN dc_base_stock t2 ON t1.bailun_sku=t2.bailun_sku and t1.warehouse_code=t2.warehouse_code ) t1 INNER JOIN dc_base_stock t2 ON t1.bailun_sku=t2.bailun_sku and t1.warehouse_code=t2.warehouse_code
WHERE (t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_picked - t2.usable_stock - t2.occupy_stock) >= 0 WHERE (t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock) >= 0
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)
</insert> </insert>
<update id="updateOldOutStockToZero"> <update id="updateOldOutStockToZero">
......
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