Commit e973e846 by lizefeng

采购建议新增 jit 备货类型字段

parent 254f3555
...@@ -49,7 +49,7 @@ namespace AutoTurnOver.DB ...@@ -49,7 +49,7 @@ namespace AutoTurnOver.DB
INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`, INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`, `product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`, `quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`) `forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`)
( (
select * from ( select * from (
select select
...@@ -89,14 +89,24 @@ select ...@@ -89,14 +89,24 @@ select
0 as 'ispush', 0 as 'ispush',
(case when t1.quantity_out_stock>0 then 2 when t1.`status` then 1 else 3 end) as 'type', (case when t1.quantity_out_stock>0 then 2 when t1.`status` then 1 else 3 end) as 'type',
t6.suppliers_id, t6.suppliers_id,
t1.quantity_out_stock t1.quantity_out_stock,
(
case when t6.buyer_name in ('张莹霞','张莹霞1') and t1.warehouse_code='GZBLWH' then 1
else 0
end
) as 'purchase_type_jit'
from dc_auto_turnover as t1 from dc_auto_turnover as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join view_goods_moq as t7 on t6.product_inner_code = t7.product_inner_code and t1.warehouse_code = t7.warehouse_code and t6.suppliers_id = t7.suppliers_id left join view_goods_moq as t7 on t6.product_inner_code = t7.product_inner_code and t1.warehouse_code = t7.warehouse_code and t6.suppliers_id = t7.suppliers_id
left join dc_auto_jit_tag as t8 on t1.tag_id = t8.id
where t6.`status`=2 and t1.warehouse_code!='BLGZ03' and (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0 where t6.`status`=2 and t1.warehouse_code!='BLGZ03' and (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0
and ( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') ) and (
( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') )
or
( t1.tag_id > 0 and t8.is_eliminate = 0 )
) -- 非jit 或者 jit 备货
) as t1 where t1.quantity_final_advise>0 ) as t1 where t1.quantity_final_advise>0
) )
...@@ -210,7 +220,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -210,7 +220,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`, _connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`, `product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`, `quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`) `forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`)
( (
select select
t1.bailun_sku, t1.bailun_sku,
...@@ -235,7 +245,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -235,7 +245,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
0 as 'ispush', 0 as 'ispush',
2 as 'type', 2 as 'type',
t6.suppliers_id, t6.suppliers_id,
t7.quantity_out_stock t7.quantity_out_stock,
2 as 'purchase_type_jit'
from dc_base_stock as t1 from dc_base_stock as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
...@@ -264,7 +275,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -264,7 +275,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`, _connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`, `product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`, `quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`) `forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`)
( (
select select
t1.bailun_sku, t1.bailun_sku,
...@@ -289,7 +300,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -289,7 +300,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
0 as 'ispush', 0 as 'ispush',
2 as 'type', 2 as 'type',
t6.suppliers_id, t6.suppliers_id,
t7.quantity_out_stock t7.quantity_out_stock,
0 as 'purchase_type_jit'
from dc_base_stock as t1 from dc_base_stock as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
...@@ -316,7 +328,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -316,7 +328,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`, _connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`, `product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`, `quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`) `forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`)
( (
select select
t1.bailun_sku, t1.bailun_sku,
...@@ -341,7 +353,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -341,7 +353,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
0 as 'ispush', 0 as 'ispush',
2 as 'type', 2 as 'type',
t6.suppliers_id, t6.suppliers_id,
t7.quantity_out_stock t7.quantity_out_stock,
0 as 'purchase_type_jit'
from dc_base_stock as t1 from dc_base_stock as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
...@@ -562,7 +575,7 @@ where 1=1 "; ...@@ -562,7 +575,7 @@ where 1=1 ";
if (!string.IsNullOrWhiteSpace(m.supplier_name)) if (!string.IsNullOrWhiteSpace(m.supplier_name))
{ {
sql += " and t3.suppliers_name =@suppliers_name "; sql += " and t3.suppliers_name =@suppliers_name ";
parameters.Add("suppliers_name", m.supplier_name); parameters.Add("suppliers_name", m.supplier_name);
} }
if (!string.IsNullOrWhiteSpace(m.purchase_user)) if (!string.IsNullOrWhiteSpace(m.purchase_user))
...@@ -595,6 +608,11 @@ select * from view_purchase_advise_supplier_price as t_price where t_price.main_ ...@@ -595,6 +608,11 @@ select * from view_purchase_advise_supplier_price as t_price where t_price.main_
parameters.Add("quantity_final_advise_price_min", m.quantity_final_advise_price_min); parameters.Add("quantity_final_advise_price_min", m.quantity_final_advise_price_min);
} }
} }
if (m.purchase_type_jit!=null)
{
sql += " and t1.purchase_type_jit =@purchase_type_jit ";
parameters.Add("purchase_type_jit", m.purchase_type_jit);
}
if (m.is_multiple_warehouse) if (m.is_multiple_warehouse)
{ {
......
...@@ -147,8 +147,20 @@ namespace AutoTurnOver.Models ...@@ -147,8 +147,20 @@ namespace AutoTurnOver.Models
public string push_user_name { get; set; } public string push_user_name { get; set; }
} /// <summary>
/// 0 = 其他
/// 1 = 备安全库存
/// 2 = 补缺货
/// </summary>
public int purchase_type_jit { get; set; }
}
public enum purchase_type_jit_enum
{
其他 = 0,
备安全库存 = 1,
补缺货 = 2
}
public enum purchase_advise_type_enum public enum purchase_advise_type_enum
{ {
预计缺货 = 1, 预计缺货 = 1,
...@@ -211,6 +223,9 @@ namespace AutoTurnOver.Models ...@@ -211,6 +223,9 @@ namespace AutoTurnOver.Models
public decimal? daily_weighted_sales { get; set; } public decimal? daily_weighted_sales { get; set; }
public string suppliers_link { get; set; } public string suppliers_link { get; set; }
public string purchase_type_jit_str { get { return ((purchase_type_jit_enum)purchase_type_jit).ToString(); } }
} }
public class dc_auto_purchase_advise_detailed_time_dto : dc_auto_purchase_advise_detailed public class dc_auto_purchase_advise_detailed_time_dto : dc_auto_purchase_advise_detailed
...@@ -281,6 +296,8 @@ namespace AutoTurnOver.Models ...@@ -281,6 +296,8 @@ namespace AutoTurnOver.Models
public decimal? quantity_final_advise_price_max { get; set; } public decimal? quantity_final_advise_price_max { get; set; }
public int? purchase_type_jit { get; set; }
} }
} }
...@@ -81,7 +81,7 @@ namespace AutoTurnOver.Services ...@@ -81,7 +81,7 @@ namespace AutoTurnOver.Services
int rows = 50000; int rows = 50000;
if (export_count == 1) if (export_count == 1)
{ {
rows = 200000; rows = 250000;
} }
while (true) while (true)
......
...@@ -62,7 +62,7 @@ namespace AutoTurnOver.Controllers ...@@ -62,7 +62,7 @@ namespace AutoTurnOver.Controllers
public string DetailList(int limit, int offset, int main_id, string sort, string sku, string warehousecode, public string DetailList(int limit, int offset, int main_id, string sort, string sku, string warehousecode,
DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea, string order, DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea, string order,
bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool? is_multiple_warehouse = false, bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool? is_multiple_warehouse = false,
decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null) decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null,int? purchase_type_jit = null)
{ {
var m = new dc_auto_purchase_advise_detailed_search_dto var m = new dc_auto_purchase_advise_detailed_search_dto
{ {
...@@ -80,7 +80,8 @@ namespace AutoTurnOver.Controllers ...@@ -80,7 +80,8 @@ namespace AutoTurnOver.Controllers
product_inner_code = product_inner_code, product_inner_code = product_inner_code,
is_multiple_warehouse = is_multiple_warehouse.Value, is_multiple_warehouse = is_multiple_warehouse.Value,
quantity_final_advise_price_max = quantity_final_advise_price_max, quantity_final_advise_price_max = quantity_final_advise_price_max,
quantity_final_advise_price_min = quantity_final_advise_price_min quantity_final_advise_price_min = quantity_final_advise_price_min,
purchase_type_jit = purchase_type_jit
}; };
var total = 0; var total = 0;
...@@ -107,7 +108,7 @@ namespace AutoTurnOver.Controllers ...@@ -107,7 +108,7 @@ namespace AutoTurnOver.Controllers
public JsonResult DetailListSumFooter(int limit, int offset, int main_id, string sort, string sku, string warehousecode, public JsonResult DetailListSumFooter(int limit, int offset, int main_id, string sort, string sku, string warehousecode,
DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea, DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea,
bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool is_multiple_warehouse = false, bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool is_multiple_warehouse = false,
decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null,int? purchase_type_jit = null
) )
{ {
var m = new dc_auto_purchase_advise_detailed_search_dto var m = new dc_auto_purchase_advise_detailed_search_dto
...@@ -127,7 +128,8 @@ namespace AutoTurnOver.Controllers ...@@ -127,7 +128,8 @@ namespace AutoTurnOver.Controllers
isSum = true, isSum = true,
is_multiple_warehouse = is_multiple_warehouse, is_multiple_warehouse = is_multiple_warehouse,
quantity_final_advise_price_max = quantity_final_advise_price_max, quantity_final_advise_price_max = quantity_final_advise_price_max,
quantity_final_advise_price_min = quantity_final_advise_price_min quantity_final_advise_price_min = quantity_final_advise_price_min,
purchase_type_jit = purchase_type_jit
}; };
var total = 0; var total = 0;
...@@ -145,7 +147,7 @@ namespace AutoTurnOver.Controllers ...@@ -145,7 +147,7 @@ namespace AutoTurnOver.Controllers
public FileResult Export(int limit, int offset, int main_id, string sort, string sku, string warehousecode, public FileResult Export(int limit, int offset, int main_id, string sort, string sku, string warehousecode,
DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea, DateTime? end_date, DateTime? start_date, string warehousetype, int? warehousearea,
bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool is_multiple_warehouse = false, bool? ispush = null, int? type = null, string supplier_name = null, string purchase_user = null, string product_inner_code = null, bool is_multiple_warehouse = false,
decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null decimal? quantity_final_advise_price_max = null, decimal? quantity_final_advise_price_min = null,int? purchase_type_jit = null
) )
{ {
var m = new dc_auto_purchase_advise_detailed_search_dto var m = new dc_auto_purchase_advise_detailed_search_dto
...@@ -165,7 +167,8 @@ namespace AutoTurnOver.Controllers ...@@ -165,7 +167,8 @@ namespace AutoTurnOver.Controllers
isSum = false, isSum = false,
is_multiple_warehouse = is_multiple_warehouse, is_multiple_warehouse = is_multiple_warehouse,
quantity_final_advise_price_max = quantity_final_advise_price_max, quantity_final_advise_price_max = quantity_final_advise_price_max,
quantity_final_advise_price_min = quantity_final_advise_price_min quantity_final_advise_price_min = quantity_final_advise_price_min,
purchase_type_jit = purchase_type_jit
}; };
var total = 0; var total = 0;
......
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