_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
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
dc_base_oms_sku
WHERE
bailun_order_status = 'Handling'
and bailun_interception_status in('None','Failed')
and warehouse_code != ''
and platform_type != 'FBA'
and has_delete = 0
and has_scalp = 0
and has_fba_s = 0
and has_innersale = 0
and paid_time >= '2019-03-01 12:00:00'
and bailun_sku_quantity_ordered > bailun_sku_quantity_shipped
GROUP BY
bailun_sku,
warehouse_code
) t1 INNER JOIN dc_base_stock t2 ON t1.bailun_sku=t2.bailun_sku and t1.warehouse_code=t2.warehouse_code
LEFT JOIN dc_auto_jit_inventory t3 ON t1.bailun_sku=t3.bailun_sku and t1.warehouse_code=t3.warehouse_code