Commit 3d2e23fb by wutong

修改缺货数计算

parent 89f4886a
...@@ -728,12 +728,12 @@ ...@@ -728,12 +728,12 @@
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
...@@ -746,12 +746,12 @@ ...@@ -746,12 +746,12 @@
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