Commit 05deeb43 by lizefeng

任意一个仓库有库存,这个sku都不算0库存

parent c6b2aefc
......@@ -464,7 +464,9 @@ left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join china_warehouse_stock as t3 on t1.bailun_sku = t3.bailun_sku and t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' )
left join china_warehouse_unshipped as t4 on t1.bailun_sku = t4.bailun_sku and t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' )
where ( t_db.hq_type!='国内仓' or t2.buyer_name not in ('张莹霞','张莹霞1') )
where
t1.warehouse_code in ('AU4PXBL','BLGZ03','DYGXC','GB4PXBL','GBBLJW','GBYKD','GZBLWH','QYBLZZ','US4PXBL','USGCBL')
and ( t_db.hq_type!='国内仓' or t2.buyer_name not in ('张莹霞','张莹霞1') )
and t_db.hq_type!='fba仓'
and (case when t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' ) and t2.buyer_name not in ('张莹霞','张莹霞1') then (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0)) else t1.quantity_out_stock end )>0
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 )";
......@@ -476,10 +478,18 @@ t1.warehouse_code,
now() as 'push_date',
2 as 'type' from dc_base_stock as t1
left join dc_mid_transit as t2 on t1.warehouse_code =t2.warehouse_code and t1.bailun_sku =t2.bailun_sku
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
where t1.usable_stock<=0 and t1.bailun_sku!=''
and t2.quantity_purchase<=0 and t2.quantity_transfer<=0
and t1.warehouse_code in ('AU4PXBL','BLGZ03','DYGXC','GB4PXBL','GBBLJW','GBYKD','GZBLWH','QYBLZZ','US4PXBL','USGCBL')
and (
case
when t_db.hq_type='国内仓' then t2.quantity_purchase
else t2.quantity_transfer
end
)<=0
and not EXISTS ( select * from dc_base_stock as t_stock where t_stock.bailun_sku= t1.bailun_sku and t1.usable_stock>0 )
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 )";
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql,commandTimeout: 0));
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, commandTimeout: 0));
return shortage_list;
......
......@@ -11,6 +11,7 @@ namespace ShortagePush
static async Task Main(string[] args)
{
Console.WriteLine("推送缺货数据服务");
new ReportServices().ShortagePush();
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ShortagePushBackgroundService>();
......
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