Commit 0383f2ad by 泽锋 李

出建议之前,先清空旧数据

parent 4e487353
......@@ -578,6 +578,15 @@ and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0
) as t1 where t1.quantity_final_advise>0
", new { main_id = mainID, btime = date }, commandTimeout: 0).ToList();
Console.WriteLine("开始出建议 完");
if(datas1!=null && datas1.Count >= 1)
{
_connection.Execute(" update dc_auto_purchase_advise_detailed set status=-1 where bailun_sku_warehouse_code in @bailun_sku_warehouse_codes ", new
{
bailun_sku_warehouse_codes = datas1.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
}
foreach (var item in datas1)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -965,8 +974,13 @@ 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) )
", new { main_id = mainID }, commandTimeout: 0).ToList();
if (datas != null)
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
{
bailun_sku_warehouse_codes = datas.Select(s=>$"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1035,8 +1049,12 @@ 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();
if (datas != null)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1102,8 +1120,12 @@ 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 ((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)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1169,8 +1191,12 @@ 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 ((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)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1237,8 +1263,12 @@ 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 ((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)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1505,8 +1535,12 @@ 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 t8.quantity>0
", new { main_id = mainID, time = last_date }, commandTimeout: 0).ToList();
if (datas != null)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......@@ -1568,8 +1602,12 @@ 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') )
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();
if (datas != null)
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
{
bailun_sku_warehouse_codes = datas.Select(s => $"{s.bailun_sku}{s.warehouse_code}").ToList()
}, commandTimeout: 0);
foreach (var item in datas)
{
item.bailun_sku_warehouse_code = $"{item.bailun_sku}{item.warehouse_code}";
......
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