_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
{
{
...
@@ -974,20 +974,45 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -974,20 +974,45 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t7.quantity_transfer) + sum(t7.quantity_purchase) < sum(t7.quantity_out_stock) )
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t7.quantity_transfer) + sum(t7.quantity_purchase) < sum(t7.quantity_out_stock) )
",new{main_id=mainID},commandTimeout:0).ToList();
",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
varoldCreateDate=_connection.QuerySingleOrDefault<DateTime?>(" select create_time from dc_auto_purchase_advise_detailed where bailun_sku_warehouse_code = @bailun_sku_warehouse_code and status=0 and ispush=0 limit 1 ",new
@@ -1049,17 +1074,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -1049,17 +1074,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) < sum(t7.quantity_out_stock) ) ",new{main_id=mainID},commandTimeout:0).ToList();
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) < sum(t7.quantity_out_stock) ) ",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
@@ -1120,17 +1137,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -1120,17 +1137,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock) ",new{main_id=mainID},commandTimeout:0).ToList();
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock) ",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
@@ -1191,17 +1200,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -1191,17 +1200,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
@@ -1263,17 +1264,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -1263,17 +1264,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
@@ -1602,17 +1587,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
...
@@ -1602,17 +1587,9 @@ left join dc_mid_transit as t9 on t1.bailun_sku = t9.bailun_sku and t1.warehouse
where t6.`status`=2 and ( t6.buyer_name in ('陈嘉雯1','黎艳漫') and t1.warehouse_code in ('BLGZ03') )
where t6.`status`=2 and ( t6.buyer_name in ('陈嘉雯1','黎艳漫') and t1.warehouse_code in ('BLGZ03') )
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)",new{main_id=mainID},commandTimeout:0).ToList();
if(datas!=null&&datas.Count>=1)
if(datas!=null&&datas.Count>=1)
{
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ",new
t1.*,(case when t2.hq_type='fba仓' then t2.bailun_account else t2.warehouse_name end) as 'warehouse_name',t3.sku_title_cn as 'sku_name',t4.create_time,t3.buyer_name,
t1.*,(case when t2.hq_type='fba仓' then t2.bailun_account else t2.warehouse_name end) as 'warehouse_name',t3.sku_title_cn as 'sku_name',t3.buyer_name,
(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
(t5.daily_weighted_sales) as 'daily_weighted_sales', -- 日均加权
(t5.daily_weighted_sales) as 'daily_weighted_sales', -- 日均加权
(t7.quantity_out_stock) as 'realtime_quantity_out_stock', -- 实时缺货
(t7.quantity_out_stock) as 'realtime_quantity_out_stock', -- 实时缺货