Commit 20eaae20 by 泽锋 李

周转表新增筛选字段

parent 74c980c6
......@@ -47,14 +47,14 @@ namespace AutoGeneratePurchaseAdvise
// 要上班才推
if (ApiServices.GetSchedulings())
{
Console.WriteLine($"开始推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(3);
Console.WriteLine($"结束推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(2);
Console.WriteLine($"结束推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(3);
Console.WriteLine($"结束推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始推送 义乌无库仓采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(6);
Console.WriteLine($"结束推送 义乌无库仓采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
......
......@@ -2125,5 +2125,92 @@ where 1 = 1 ";
warehouse_code = input.warehouse_code,
});
}
#region 月度销量配置
public static List<dc_report_sales_trend_year_config_dto> SalesTrendYearConfigPage(dc_auto_return_goods_config_search_dto m, int offset, int limit, ref int total)
{
var list = new List<dc_report_sales_trend_year_config_dto>();
try
{
var sql = @"select t1.*,t2.warehouse_name,t3.area_name as 'warehous_country_name' from dc_report_sales_trend_year_config as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join ( select DISTINCT area_id,area_name from dc_base_warehouse ) as t3 on t1.warehous_country = t3.area_id
where 1 = 1 ";
DynamicParameters parameters = new DynamicParameters();
if (!string.IsNullOrWhiteSpace(m.warehousetype))
{
sql += " and ( t2.hq_type=@warehousetype or t1.warehouse_type =@warehousetype ) ";
parameters.Add("warehousetype", m.warehousetype);
}
if (m.warehousearea > 0)
{
sql += " and ( t2.area_id=@warehousearea or t1.warehous_country = @warehousearea ) ";
parameters.Add("warehousearea", m.warehousearea);
}
if (m.warehouse_code != null)
{
sql += $" and t1.warehouse_code=@warehouse_code ";
parameters.Add("warehouse_code", m.warehouse_code);
}
total = _connection.QuerySingleOrDefault<int>("select count(0) from (" + sql + ") tb1", parameters);
var obj = _connection.Query<dc_report_sales_trend_year_config_dto>(sql + " limit " + offset + "," + limit, parameters);
return obj.AsList();
}
catch (Exception)
{
return list;
}
}
public static string SaveSalesTrendYearConfig(dc_report_sales_trend_year_config m, UserData user)
{
try
{
if (m.id > 0)
{
var old_data = _connection.QueryFirstOrDefault<dc_report_sales_trend_year_config>("select * from dc_auto_return_goods_config where id=@id ", new { id = m.id });
if (old_data == null)
{
throw new Exception("数据不存在");
}
m.create_date = old_data.create_date;
m.create_user = old_data.create_user;
var result = _connection.Update<dc_report_sales_trend_year_config>(m);
return result > 0 ? "" : "保存异常,请重试!";
}
else
{
m.create_date = DateTime.Now;
m.create_user = user.UserName;
var result = _connection.Insert<dc_report_sales_trend_year_config>(m);
return result.HasValue && result.Value > 0 ? "" : "提交异常,请重试!";
}
}
catch (Exception ex)
{
return ex.Message;
}
}
public static dc_report_sales_trend_year_config GetSalesTrendYearConfigById(int id)
{
return _connection.QueryFirstOrDefault<dc_report_sales_trend_year_config>("select * from dc_report_sales_trend_year_config where id=" + id);
}
#endregion
}
}
......@@ -103,11 +103,13 @@ from dc_auto_turnover as dat
";
DynamicParameters parameters = new DynamicParameters();
if (string.IsNullOrWhiteSpace(m.sku_label))
{
sqlCount += " left join dc_auto_config_sku_label as t11 on dat.bailun_sku = t11.bailun_sku ";
}
if (m.warehousearea>0)
if (m.warehousearea > 0)
{
sqlCount += " left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code ";
}
......@@ -118,7 +120,8 @@ from dc_auto_turnover as dat
if (m.monitor_status != null)
{
sqlCount += " left join dc_auto_config_sku_warehouse as t5 on dat.bailun_sku = t5.bailun_sku and dat.warehouse_code = t5.warehouse_code ";
} if (m.returngoodspush_state != null)
}
if (m.returngoodspush_state != null)
{
sqlCount += " left join dc_return_goods_not_push as t12 on dat.bailun_sku = t12.bailun_sku and dat.warehouse_code = t12.warehouse_code ";
}
......@@ -128,6 +131,8 @@ from dc_auto_turnover as dat
}
sqlCount += " where 1=1 ";
if (m.has_tort != null)
{
if (m.has_tort == 0)
......@@ -167,7 +172,7 @@ from dc_auto_turnover as dat
sql += " and ( t5.`status`=0 or t5.`status` is null ) ";
sqlCount += " and ( t5.`status`=0 or t5.`status` is null ) ";
}
if (m.returngoodspush_state == 1)
{
sql += " and t12.`status`=1 ";
......@@ -268,6 +273,82 @@ from dc_auto_turnover as dat
sqlCount += " and dat.suppliers_name = '" + m.supplier_name + "'";
}
if (m.quantity_inventory_min != null)
{
sql += " and dat.quantity_inventory>=@quantity_inventory_min ";
sqlCount += " and dat.quantity_inventory>=@quantity_inventory_min ";
parameters.Add("quantity_inventory_min", m.quantity_inventory_min);
}
if (m.quantity_inventory_max != null)
{
sql += " and dat.quantity_inventory<=@quantity_inventory_max ";
sqlCount += " and dat.quantity_inventory<=@quantity_inventory_max ";
parameters.Add("quantity_inventory_max", m.quantity_inventory_max);
}
if (m.quantity_out_stock_min != null)
{
sql += " and dat.quantity_out_stock>=@quantity_out_stock_min ";
sqlCount += " and dat.quantity_out_stock>=@quantity_out_stock_min ";
parameters.Add("quantity_out_stock_min", m.quantity_out_stock_min);
}
if (m.quantity_out_stock_max != null)
{
sql += " and dat.quantity_out_stock>=@quantity_out_stock_max ";
sqlCount += " and dat.quantity_out_stock>=@quantity_out_stock_max ";
parameters.Add("quantity_out_stock_max", m.quantity_out_stock_max);
}
if (m.oneday_sales_min != null)
{
sql += " and t2.oneday_sales>=@oneday_sales_min ";
sqlCount += " and t2.oneday_sales>=@oneday_sales_min ";
parameters.Add("oneday_sales_min", m.oneday_sales_min);
}
if (m.oneday_sales_max != null)
{
sql += " and t2.oneday_sales<=@oneday_sales_max ";
sqlCount += " and t2.oneday_sales<=@oneday_sales_max ";
parameters.Add("oneday_sales_max", m.oneday_sales_max);
}
if (m.avg_type > 0)
{
var field_str = "";
switch (m.avg_type)
{
case 1: field_str = "dat.history_sevenday_sales"; break;
case 2: field_str = "dat.history_fourteenday_sales"; break;
case 3: field_str = "dat.history_thirtyday_sales"; break;
case 4: field_str = "dat.forecast_sevenday_sales"; break;
case 5: field_str = "dat.forecast_fourteenday_sales"; break;
case 7: field_str = "dat.history_sevenday_sales_ebay"; break;
case 8: field_str = "dat.history_fourteenday_sales_ebay"; break;
case 9: field_str = "dat.history_thirtyday_sales_ebay"; break;
case 10: field_str = "dat.history_sevenday_sales_aliexpress"; break;
case 11: field_str = "dat.history_fourteenday_sales_aliexpress"; break;
case 12: field_str = "dat.history_thirtyday_sales_aliexpress"; break;
case 13: field_str = "dat.history_sevenday_sales_amazon"; break;
case 14: field_str = "dat.history_fourteenday_sales_amazon"; break;
case 15: field_str = "dat.history_thirtyday_sales_amazon"; break;
default: break;
}
if (!string.IsNullOrWhiteSpace(field_str))
{
if (m.avg_sales_min != null)
{
sql += $" and {field_str}>=@avg_sales_min ";
sqlCount += $" and {field_str}>=@avg_sales_min ";
parameters.Add("avg_sales_min", m.avg_sales_min);
}
if (m.avg_sales_max != null)
{
sql += $" and {field_str}<=@avg_sales_max ";
sqlCount += $" and {field_str}<=@avg_sales_max ";
parameters.Add("avg_sales_max", m.avg_sales_max);
}
}
}
if (isSum)
{
total = 0;
......@@ -532,9 +613,10 @@ from dc_auto_turnover as dat
/// 历史库存
/// </summary>
/// <returns></returns>
public static List<dc_daily_stock_dto> GetDailyStock(string bailun_sku,string warehouse_code,DateTime date)
public static List<dc_daily_stock_dto> GetDailyStock(string bailun_sku, string warehouse_code, DateTime date)
{
return _connection.Query<dc_daily_stock_dto>(" select * from dc_daily_stock where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and record_time>=@record_time ", new {
return _connection.Query<dc_daily_stock_dto>(" select * from dc_daily_stock where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and record_time>=@record_time ", new
{
bailun_sku = bailun_sku,
warehouse_code = warehouse_code,
record_time = date
......@@ -833,7 +915,7 @@ select t7_1.warehouse_code,t7_1.bailun_sku,(to_days(t7_1.estimated_arrival_time)
return datas;
}
}
......
......@@ -347,6 +347,15 @@ namespace AutoTurnOver.Models
public string categoryIds { get; set; }
public List<bailun_category_new_dto> categoryModels { get; set; }
public int? quantity_inventory_min { get; set; }
public int? quantity_inventory_max { get; set; }
public int? quantity_out_stock_min { get; set; }
public int? quantity_out_stock_max { get; set; }
public int? oneday_sales_min { get; set; }
public int? oneday_sales_max { get; set; }
public int? avg_type { get; set; }
public int? avg_sales_min { get; set; }
public int? avg_sales_max { get; set; }
}
public class dc_auto_turnover_Extend : dc_auto_turnover
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
/// <summary>
///需要应用月度系数的仓库
/// </summary>
public class dc_report_sales_trend_year_config
{
public int id { get; set; }
/// <summary>
/// 仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 仓库类型
/// </summary>
public string warehouse_type { get; set; }
/// <summary>
/// 国家
/// </summary>
public string warehous_country { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string create_user { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime create_date { get; set; }
}
public class dc_report_sales_trend_year_config_dto: dc_report_sales_trend_year_config
{
public string warehouse_name { get; set; }
public string warehous_country_name { get; set; }
}
}
......@@ -1080,6 +1080,31 @@ namespace AutoTurnOver.Services
#endregion
#region 月度系数配置
public List<dc_report_sales_trend_year_config_dto> SalesTrendYearConfigPage(dc_auto_return_goods_config_search_dto m, int offset, int limit, ref int total)
{
return DB.db_config.SalesTrendYearConfigPage(m, offset, limit, ref total);
}
public string SaveSalesTrendYearConfig(dc_report_sales_trend_year_config m,UserData user)
{
return DB.db_config.SaveSalesTrendYearConfig(m,user);
}
public dc_report_sales_trend_year_config GetSalesTrendYearConfigById(int id)
{
return DB.db_config.GetSalesTrendYearConfigById(id);
}
#endregion
/// <summary>
/// 批量设置默认头程运输方式
/// </summary>
......
......@@ -955,6 +955,45 @@ namespace AutoTurnOver.Controllers
#endregion
#region 月度销量系数配置
[HttpGet]
[BrowseLog("Bailun_aims", "访问【百伦自动周转系统】->【配置】->【月度系数配置】->【搜索】页面", 0)]
public JsonResult SalesTrendYearConfigPage([FromQuery]dc_auto_return_goods_config_search_dto search)
{
var total = 0;
var service = new Services.ConfigServices();
var list = service.SalesTrendYearConfigPage(search, search.offset??0, search.limit??0, ref total);
return new JsonResult(new
{
rows = list,
total = total,
});
}
[HttpPost]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【配置】->【月度系数配置】->【新增】->【保存】操作", 1)]
public JsonResult SaveSalesTrendYearConfig([FromBody]dc_report_sales_trend_year_config m)
{
var result = new Services.ConfigServices().SaveSalesTrendYearConfig(m, AutoUtility.GetUser());
return new JsonResult(result);
}
[HttpGet]
public JsonResult GetSalesTrendYearConfigById(int id)
{
var m = new Services.ConfigServices().GetSalesTrendYearConfigById(id);
return new JsonResult(m);
}
#endregion
[HttpPost]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【周转表】->【设置sku默认头程物流】->操作", 1)]
......
......@@ -30,29 +30,11 @@ namespace AutoTurnOver.Controllers
[HttpGet]
[UseAction]
[BrowseLog("Bailun_aims", "触发【百伦自动周转系统】->【自动下单管理】->【自动周转列表】->【搜索】页面",0)]
public JsonResult List(int limit, int offset, string order, string sort, int? searchType, string key_words, string buyer_name, int? IsRedundant, int? IsStockOut, string warehousecode,string supplier_name, string warehousetype, int? warehousearea, bool? hasDefectConfig, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null, int? returngoodspush_state = null,int? has_tort = null)
public JsonResult List([FromQuery] Condition_AutoTurnOver m, [FromQuery] int offset, [FromQuery] int limit, [FromQuery] string order, [FromQuery] string sort)
{
try
{
var m = new Condition_AutoTurnOver
{
searchType = searchType,
key_words = key_words,
out_of_stock = IsStockOut,
redundancy = IsRedundant,
warehouse_code = warehousecode,
warehousetype = warehousetype,
warehousearea = warehousearea,
hasDefectConfig = hasDefectConfig,
hasAadvise = hasAadvise,
categoryIds = categoryIds,
monitor_status = monitor_status,
returngoodspush_state = returngoodspush_state,
buyer_name = buyer_name,
supplier_name = supplier_name,
has_tort = has_tort
};
var total = 0;
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, offset, limit, ref total, order, sort);
......@@ -80,26 +62,8 @@ namespace AutoTurnOver.Controllers
return new JsonResult(new Services.SkuAutoTurnServices().GetLabelList());
}
public JsonResult ListSumFooter(string supplier_name, int limit, int offset, string order, string sort, int? searchType, string key_words,string buyer_name, string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null, int? returngoodspush_state = null,int? has_tort = null)
public JsonResult ListSumFooter([FromQuery] Condition_AutoTurnOver m, [FromQuery] int offset, [FromQuery] int limit, [FromQuery] string order, [FromQuery] string sort)
{
var m = new Condition_AutoTurnOver
{
searchType = searchType,
key_words = key_words,
out_of_stock = IsStockOut,
redundancy = IsRedundant,
warehouse_code = warehousecode,
warehousetype = warehousetype,
warehousearea = warehousearea,
hasDefectConfig = hasDefectConfig,
hasAadvise = hasAadvise,
categoryIds = categoryIds,
monitor_status = monitor_status,
returngoodspush_state = returngoodspush_state,
buyer_name = buyer_name,
supplier_name = supplier_name,
has_tort = has_tort
};
var total = 0;
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, offset, limit, ref total, order, sort, true);
......@@ -114,30 +78,12 @@ namespace AutoTurnOver.Controllers
/// <param name="warehousecode"></param>
/// <returns></returns>
[UseAction]
public ActionResult Export(string supplier_name, int limit, int offset, string order, string sort, int? searchType, string key_words, string buyer_name, string sku_prefix, int? IsRedundant, int? IsStockOut, string warehousecode, string warehousetype, int? warehousearea, bool? hasDefectConfig, bool? hasAadvise = null, string categoryIds = null, int? monitor_status = null, int? returngoodspush_state = null,int? has_tort = null)
public ActionResult Export([FromQuery] Condition_AutoTurnOver m, [FromQuery] int offset, [FromQuery] int limit, [FromQuery] string order, [FromQuery] string sort)
{
try
{
var user = AutoUtility.GetUser();
if (user == null) throw new Exception("登陆失效,请重新登录");
var m = new Condition_AutoTurnOver
{
searchType = searchType,
key_words = key_words,
out_of_stock = IsStockOut,
redundancy = IsRedundant,
warehouse_code = warehousecode,
warehousetype = warehousetype,
warehousearea = warehousearea,
hasDefectConfig = hasDefectConfig,
hasAadvise = hasAadvise,
categoryIds = categoryIds,
monitor_status = monitor_status,
returngoodspush_state = returngoodspush_state,
buyer_name = buyer_name,
supplier_name = supplier_name,
has_tort = has_tort
};
var memory = new SkuAutoTurnServices().Export(user, m,order,sort);
return File(memory, "text/csv", $"{user.UserAccount}周转表.csv");
}
......
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