@@ -602,7 +602,7 @@ left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_
...
@@ -602,7 +602,7 @@ left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
left join holiday_supplier_view as t_sp on t2.suppliers_id = t_sp.supplier_id
where
where
t_sp.supplier_id is not null or
(
( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01') ) -- 义务仓 只要停止监控 或者停售就推送
( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01') ) -- 义务仓 只要停止监控 或者停售就推送
and ( t2.`status`=1 or t6.`status`=1 )
and ( t2.`status`=1 or t6.`status`=1 )
and (ifnull(t1.quantity_unshipped,0) - ifnull(t5.usable_stock,0))>0 -- 有缺货
and (ifnull(t1.quantity_unshipped,0) - ifnull(t5.usable_stock,0))>0 -- 有缺货
...
@@ -612,6 +612,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
...
@@ -612,6 +612,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
{
{
sql+=$" and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=1 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
sql+=$" and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=1 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
@@ -632,7 +633,7 @@ left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
...
@@ -632,7 +633,7 @@ left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_config_sku_warehouse as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join holiday_supplier_view as t_sp on t3.suppliers_id = t_sp.supplier_id
left join holiday_supplier_view as t_sp on t3.suppliers_id = t_sp.supplier_id
where
where
t_sp.supplier_id is not null or
(
t1.usable_stock<=0 and t1.bailun_sku!=''
t1.usable_stock<=0 and t1.bailun_sku!=''
and ( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01'))
and ( t1.warehouse_code in ('GZBLWH','BLGZ03','YWWH01'))
and ( t3.`status`=1 or t6.`status`=1)
and ( t3.`status`=1 or t6.`status`=1)
...
@@ -642,6 +643,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
...
@@ -642,6 +643,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
{
{
no_library_sql+=$" and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=2 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
no_library_sql+=$" and not exists ( select * from dc_auto_shortage_push where dc_auto_shortage_push.warehouse_code = t1.warehouse_code and dc_auto_shortage_push.bailun_sku = t1.bailun_sku and dc_auto_shortage_push.`type`=2 and dc_auto_shortage_push.platform='{platform}' and dc_auto_shortage_push.has_return_goods=0 ) ";
}
}
no_library_sql+=" ) or t_sp.supplier_id is not null ";
@@ -1056,12 +1063,12 @@ left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku an
...
@@ -1056,12 +1063,12 @@ left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku an
left join (
left join (
select t1.bailun_sku,t2.area_id,sum(t1.usable_stock) as 'sum_usable_stock' from dc_base_stock as t1
select t1.bailun_sku,t2.area_id,sum(t1.usable_stock) as 'sum_usable_stock' from dc_base_stock as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
where t1.warehouse_code in ( 'GZBLWH', 'BLGZ03' )
where t1.warehouse_code in @ch_rule1
GROUP BY t1.bailun_sku,t2.area_id
GROUP BY t1.bailun_sku,t2.area_id
) as tc1 on t1.bailun_sku = tc1.bailun_sku and t_db.area_id = tc1.area_id
) as tc1 on t1.bailun_sku = tc1.bailun_sku and t_db.area_id = tc1.area_id
left join (
left join (
select t1.bailun_sku,t2.area_id,sum(t1.quantity_unshipped) as 'sum_unshipped_quantity',sum(t1.quantity_purchase) as 'sum_quantity_purchase' from dc_mid_transit as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
select t1.bailun_sku,t2.area_id,sum(t1.quantity_unshipped) as 'sum_unshipped_quantity',sum(t1.quantity_purchase) as 'sum_quantity_purchase' from dc_mid_transit as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
where t1.quantity_unshipped>0 and t1.warehouse_code in ( 'GZBLWH', 'BLGZ03' )
where t1.quantity_unshipped>0 and t1.warehouse_code in @ch_rule1
GROUP BY t1.bailun_sku,t2.area_id
GROUP BY t1.bailun_sku,t2.area_id
) as tc2 on t1.bailun_sku = tc2.bailun_sku and t_db.area_id = tc2.area_id
) as tc2 on t1.bailun_sku = tc2.bailun_sku and t_db.area_id = tc2.area_id