( sum(t7.quantity_out_stock) - ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t1.quantity_transfer) + sum(t7.quantity_purchase) ) ) as 'quantity_init_advise', -- 原始采购建议数量 new
( sum(t7.quantity_out_stock) - ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t1.quantity_transfer) + sum(t7.quantity_purchase) ) ) as 'quantity_init_advise', -- 原始采购建议数量 new
...
@@ -583,10 +577,15 @@ and t1.quantity_init_advise>=0 and ( t3.buyer_name in ('张莹霞1') and t1.ware
...
@@ -583,10 +577,15 @@ and t1.quantity_init_advise>=0 and ( t3.buyer_name in ('张莹霞1') and t1.ware
where t6.`status`=2 and ( t6.buyer_name in ('张莹霞') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
where t6.`status`=2 and ( t6.buyer_name in ('张莹霞') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
GROUP BY t1.bailun_sku
GROUP BY t1.bailun_sku
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);
if(datas!=null)
{
foreach(varitemindatas)
{
_connection.Insert(item);
}
}
returnmainID;
returnmainID;
}
}
...
@@ -605,14 +604,10 @@ and t1.quantity_init_advise>=0 and ( t3.buyer_name in ('张莹霞1') and t1.ware
...
@@ -605,14 +604,10 @@ and t1.quantity_init_advise>=0 and ( t3.buyer_name in ('张莹霞1') and t1.ware
@@ -646,10 +641,16 @@ sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress'
...
@@ -646,10 +641,16 @@ sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress'
where t6.`status`=2 and ( t6.buyer_name in ('张莹霞1') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
where t6.`status`=2 and ( t6.buyer_name in ('张莹霞1') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
and ( t5.`status`=0 or t5.`status` is null )
and ( t5.`status`=0 or t5.`status` is null )
GROUP BY t1.bailun_sku
GROUP BY t1.bailun_sku
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) < 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_out_stock) ) ",new{main_id=mainID},commandTimeout:0).ToList();
) ",new{main_id=mainID},commandTimeout:0);
if(datas!=null)
{
foreach(varitemindatas)
{
_connection.Insert(item);
}
}
returnmainID;
returnmainID;
}
}
...
@@ -669,12 +670,7 @@ sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress'
...
@@ -669,12 +670,7 @@ sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress'
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03','GZBLWH') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03','GZBLWH') )
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)
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();
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t6.`status`=2 and ( t1.warehouse_code in ('YWWH01') )
where t6.`status`=2 and ( t1.warehouse_code in ('YWWH01') )
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)
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();
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪_独立站') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪_独立站') )
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)
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();
) ",new{main_id=mainID},commandTimeout:0);
if(datas!=null)
{
foreach(varitemindatas)
{
_connection.Insert(item);
}
}
returnmainID;
returnmainID;
}
}
...
@@ -924,12 +928,7 @@ update dc_mid_transit set quantity_out_stock =0,quantity_out_stock_aliexpress =
...
@@ -924,12 +928,7 @@ update dc_mid_transit set quantity_out_stock =0,quantity_out_stock_aliexpress =
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
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)
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();
vardatas=_connection.Query<dc_report_stock_week_warehouse_dto>(" select t1.*,t2.warehouse_name from dc_report_stock_week as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.web_site=@web_site and t1.week_tag =@week_tag ",new{web_site,week_tag=date_tag}).ToList();
vardatas=_connection.Query<dc_report_stock_week_warehouse_dto>(" select t1.*,t2.warehouse_name from dc_report_stock_week as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.web_site=@web_site and t1.week_tag =@week_tag ",new{web_site,week_tag=date_tag}).ToList();
data.id=_connection.QueryFirstOrDefault<int?>(" select id from dc_auto_fastest_storage where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku ",new{