Commit fbf3f46e by 泽锋 李

fix

parent 88e2bd53
...@@ -464,7 +464,8 @@ t1.warehouse_code, ...@@ -464,7 +464,8 @@ t1.warehouse_code,
now() as 'push_date', now() as 'push_date',
1 as 'type', 1 as 'type',
t5.usable_stock as 'stocks', t5.usable_stock as 'stocks',
@platform as 'platform' @platform as 'platform',
0 as 'has_return_goods'
from dc_mid_transit as t1 from dc_mid_transit as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku 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 dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
...@@ -491,7 +492,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -491,7 +492,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
"; ";
if (!is_all) if (!is_all)
{ {
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}' ) "; 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 ) ";
} }
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql,new { platform = platform },commandTimeout: 0)); shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql,new { platform = platform },commandTimeout: 0));
...@@ -501,6 +502,7 @@ t1.warehouse_code, ...@@ -501,6 +502,7 @@ t1.warehouse_code,
now() as 'push_date', now() as 'push_date',
0 as 'stocks', 0 as 'stocks',
@platform as 'platform', @platform as 'platform',
0 as 'has_return_goods',
2 as 'type' from dc_base_stock as t1 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_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 left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
...@@ -527,7 +529,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -527,7 +529,7 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
"; ";
if (!is_all) if (!is_all)
{ {
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}' ) "; 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 ) ";
} }
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, new { platform = platform },commandTimeout: 0)); shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, new { platform = platform },commandTimeout: 0));
...@@ -551,7 +553,8 @@ t1.warehouse_code, ...@@ -551,7 +553,8 @@ t1.warehouse_code,
now() as 'push_date', now() as 'push_date',
1 as 'type', 1 as 'type',
t5.usable_stock as 'stocks', t5.usable_stock as 'stocks',
@platform as 'platform' @platform as 'platform',
0 as 'has_return_goods'
from dc_mid_transit as t1 from dc_mid_transit as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku 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 dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
...@@ -574,7 +577,7 @@ and ( ifnull(t6.usable_stock,0)<ifnull(t7.quantity_unshipped,0) ) -- 有缺货 ...@@ -574,7 +577,7 @@ and ( ifnull(t6.usable_stock,0)<ifnull(t7.quantity_unshipped,0) ) -- 有缺货
"; ";
if (!is_all) if (!is_all)
{ {
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}' ) "; 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 ) ";
} }
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql,new { warehouse_codes = warehouse_codes, platform = platform }, commandTimeout: 0)); shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql,new { warehouse_codes = warehouse_codes, platform = platform }, commandTimeout: 0));
...@@ -584,7 +587,8 @@ t1.warehouse_code, ...@@ -584,7 +587,8 @@ t1.warehouse_code,
now() as 'push_date', now() as 'push_date',
0 as 'stocks', 0 as 'stocks',
@platform as 'platform', @platform as 'platform',
2 as 'type' 2 as 'type' ,
0 as 'has_return_goods'
from dc_base_stock as t1 from dc_base_stock as t1
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join ( left join (
...@@ -595,7 +599,7 @@ left join ( ...@@ -595,7 +599,7 @@ left join (
) as t6 on t1.bailun_sku = t6.bailun_sku and t_db.area_id = t6.area_id ) as t6 on t1.bailun_sku = t6.bailun_sku and t_db.area_id = t6.area_id
where t1.warehouse_code in @warehouse_codes where t1.warehouse_code in @warehouse_codes
and ifnull(t6.usable_stock,0)<=0 and ifnull(t6.usable_stock,0)<=0
and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku ) and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku and dc_auto_shortage_push.has_return_goods=0 )
"; ";
if (!is_all) if (!is_all)
{ {
...@@ -714,10 +718,11 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh ...@@ -714,10 +718,11 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
public static void removeShortagePush(IEnumerable<int> datas) public static void removeShortagePush(IEnumerable<int> datas)
{ {
var conn = _connection; var conn = _connection;
foreach (var item in datas) //foreach (var item in datas)
{ //{
conn.Delete<dc_auto_shortage_push>(item); // conn.Delete<dc_auto_shortage_push>(item);
} //}
conn.Execute(" update dc_auto_shortage_push set has_return_goods=0 where id in @ids ", new {ids = datas });
} }
...@@ -905,7 +910,7 @@ left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code ...@@ -905,7 +910,7 @@ left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join china_warehouse_unshipped as t5 on t1.bailun_sku = t5.bailun_sku and t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' ) left join china_warehouse_unshipped as t5 on t1.bailun_sku = t5.bailun_sku and t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' )
left join dc_base_stock as t_stock on t1.bailun_sku = t_stock.bailun_sku and t1.warehouse_code = t_stock.warehouse_code left join dc_base_stock as t_stock on t1.bailun_sku = t_stock.bailun_sku and t1.warehouse_code = t_stock.warehouse_code
left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t1.platform=@platform where t1.platform=@platform and t1.has_return_goods=0
and (case and (case
when t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' ) and t2.buyer_name not in ('张莹霞','张莹霞1') and (ifnull(t4.sum_usable_stock, 0) - ifnull(t5.sum_unshipped_quantity, 0) > 0) then 1 when t_db.warehouse_code in ( 'GZBLWH', 'QYBLZZ' ) and t2.buyer_name not in ('张莹霞','张莹霞1') and (ifnull(t4.sum_usable_stock, 0) - ifnull(t5.sum_unshipped_quantity, 0) > 0) then 1
when(t3.quantity_out_stock is null or t3.quantity_out_stock <= 0) and ifnull(t_stock.usable_stock,0)> ifnull(t3.quantity_unshipped, 0) then 1 when(t3.quantity_out_stock is null or t3.quantity_out_stock <= 0) and ifnull(t_stock.usable_stock,0)> ifnull(t3.quantity_unshipped, 0) then 1
......
...@@ -16,6 +16,11 @@ namespace AutoTurnOver.Models ...@@ -16,6 +16,11 @@ namespace AutoTurnOver.Models
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
/// <summary> /// <summary>
/// 是否回货
/// </summary>
public bool has_return_goods { get; set; }
/// <summary>
/// 推送时间 /// 推送时间
/// </summary> /// </summary>
public DateTime push_date { get; set; } public DateTime push_date { get; set; }
......
...@@ -13,7 +13,6 @@ namespace AutoTurnOver.Models ...@@ -13,7 +13,6 @@ namespace AutoTurnOver.Models
public string bailun_sku { get; set; } public string bailun_sku { get; set; }
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
public string platform { get; set; }
public DateTime push_time { get; set; } public DateTime push_time { get; set; }
......
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