Commit e0077df1 by lizefeng

新增监控状态查询

parent db26fea8
......@@ -246,7 +246,7 @@ UNION ALL
/// <param name="sku">sku</param>
/// <param name="warehouse_code">仓库编码</param>
/// <returns></returns>
public static List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null,int? has_tort = null, List<bailun_category_new_dto> categoryModels = null,string buyer_name = null)
public static List<dc_base_stock_dto> RealtimeList(int? monitor_status,int? searchType, string key_words, string warehouse_code,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null,int? has_tort = null, List<bailun_category_new_dto> categoryModels = null,string buyer_name = null)
{
var sql = "";
if (isSum)
......@@ -340,6 +340,10 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
{
countSql += " left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku ";
}
if (monitor_status != null)
{
countSql += " left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code ";
}
countSql += "where 1=1 ";
......@@ -359,6 +363,17 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
parameters.Add("buyer_name", buyer_name);
}
if (monitor_status == 1)
{
sql += " and t7.`status`=1 ";
countSql += " and t7.`status`=1 ";
}
if (monitor_status == 0)
{
sql += " and ( t7.`status`=0 or t7.`status` is null ) ";
countSql += " and ( t7.`status`=0 or t7.`status` is null ) ";
}
if (has_tort != null)
{
if (has_tort == 0)
......@@ -386,35 +401,37 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
parameters.Add("area_id", warehousearea);
}
if (!string.IsNullOrWhiteSpace(product_inner_code))
if(searchType>0 && !string.IsNullOrWhiteSpace(key_words))
{
switch(searchType)
{
case 1:
sql += " and t1.bailun_sku in @bailun_skus ";
countSql += " and t1.bailun_sku in @bailun_skus ";
parameters.Add("bailun_skus", key_words.Split(','));
break;
case 2:
sql += " and t1.bailun_sku like @bailun_sku ";
countSql += " and t1.bailun_sku like @bailun_sku ";
parameters.Add("bailun_sku", $"%{key_words}%");
break;
case 3:
sql += " and t1.product_inner_code like @product_inner_code ";
countSql += " and t1.product_inner_code like @product_inner_code ";
parameters.Add("product_inner_code", $"%{product_inner_code}%");
}
if (!string.IsNullOrWhiteSpace(sku_title_cn))
{
parameters.Add("product_inner_code", $"%{key_words}%");
break;
case 4:
sql += " and t1.sku_title_cn like @sku_title_cn ";
countSql += " and t1.sku_title_cn like @sku_title_cn ";
parameters.Add("sku_title_cn", $"%{sku_title_cn}%");
parameters.Add("sku_title_cn", $"%{key_words}%");
break;
}
if (!string.IsNullOrWhiteSpace(sku))
{
sql += " and t1.bailun_sku in @bailun_skus ";
countSql += " and t1.bailun_sku in @bailun_skus ";
parameters.Add("bailun_skus", sku.Split(','));
}
if (!string.IsNullOrWhiteSpace(bailun_sku))
{
sql += " and t1.bailun_sku like @bailun_sku ";
countSql += " and t1.bailun_sku like @bailun_sku ";
parameters.Add("bailun_sku", $"%{bailun_sku}%");
}
if (!string.IsNullOrWhiteSpace(warehouse_code))
{
sql += " and t1.warehouse_code=@warehouse_code ";
......
......@@ -39,14 +39,14 @@ namespace AutoTurnOver.Services
}
public List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea,bool isSum = false,string order = null,string sort = null,int? has_tort = null,string categoryIds = null,string buyer_name = null)
public List<dc_base_stock_dto> RealtimeList(int? monitor_status,int? searchType, string key_words, string warehouse_code,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea,bool isSum = false,string order = null,string sort = null,int? has_tort = null,string categoryIds = null,string buyer_name = null)
{
List<bailun_category_new_dto> categoryModels = null;
if (!string.IsNullOrWhiteSpace(categoryIds))
{
categoryModels = ApiServices.GetNewClientNodesByIds(categoryIds.Split(',').Select(s => int.Parse(s)).ToList());
}
return DB.daily.RealtimeList(sku, bailun_sku, warehouse_code,product_inner_code,sku_title_cn, supplier_name, offset, limit, ref total,warehousetype,warehousearea, isSum, order, sort, has_tort:has_tort, categoryModels: categoryModels, buyer_name:buyer_name);
return DB.daily.RealtimeList(monitor_status, searchType, key_words, warehouse_code, supplier_name, offset, limit, ref total,warehousetype,warehousearea, isSum, order, sort, has_tort:has_tort, categoryModels: categoryModels, buyer_name:buyer_name);
}
......@@ -76,7 +76,7 @@ namespace AutoTurnOver.Services
private static int export_count = 0;
public MemoryStream Export(UserData user, string sku, string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn, string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null, int? has_tort = null,string buyer_name =null)
public MemoryStream Export(UserData user,int? monitor_status, int? searchType, string key_words, string warehousecode, string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null, int? has_tort = null,string buyer_name =null)
{
try
{
......@@ -92,7 +92,7 @@ namespace AutoTurnOver.Services
while (true)
{
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, (page - 1) * rows, rows, ref total, warehousetype, warehousearea, has_tort: has_tort, buyer_name: buyer_name);
var list = services.RealtimeList(monitor_status, searchType, key_words, warehousecode, supplier_name, (page - 1) * rows, rows, ref total, warehousetype, warehousearea, has_tort: has_tort, buyer_name: buyer_name);
if (list == null || list.Count <= 0) break;
......@@ -202,7 +202,7 @@ namespace AutoTurnOver.Services
try
{
var total = 0;
var memory = Export(new UserData { UserAccount = "admin" }, null, null, null, null, null, null, 0, 0, ref total, "国内仓", null);
var memory = Export(new UserData { UserAccount = "admin" },null, null, null, null, null, 0, 0, ref total, "国内仓", null);
var fileData = await QiNiuCloudHelper.UploadAsync(memory, $"stock_{DateTime.Now.ToString("yyyyMMddHmmss")}.csv");
ApiServices.QiYeJiQiRenMsPush(new QiYeJiQiRenMsDto { msgtype = "text", text = new QiYeJiQiRenMsDto.text_dto { content = "国内仓实时库存:" + fileData } });
}
......
......@@ -62,14 +62,14 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
public JsonResult RealtimeList(string sku,string bailun_sku, string warehousecode, string product_inner_code,string buyer_name, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null, string categoryIds = null)
public JsonResult RealtimeList(int? monitor_status, int? searchType, string key_words, string warehousecode, string buyer_name, string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea, int? has_tort = null, string categoryIds = null)
{
try
{
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total, warehousetype, warehousearea, order: order, sort: sort, has_tort: has_tort, categoryIds: categoryIds, buyer_name: buyer_name);
var list = services.RealtimeList(monitor_status,searchType, key_words, warehousecode, supplier_name, offset, limit, ref total, warehousetype, warehousearea, order: order, sort: sort, has_tort: has_tort, categoryIds: categoryIds, buyer_name: buyer_name);
return new JsonResult(new
{
......@@ -88,12 +88,12 @@ namespace AutoTurnOver.Controllers
}
public JsonResult RealtimeListSumFooter(string sku, string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null, string categoryIds = null)
public JsonResult RealtimeListSumFooter(int? monitor_status,int? searchType, string key_words, string warehousecode, string buyer_name,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null, string categoryIds = null)
{
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total, warehousetype, warehousearea,true, has_tort: has_tort, categoryIds: categoryIds);
var list = services.RealtimeList(monitor_status,searchType, key_words, warehousecode, supplier_name, offset, limit, ref total, warehousetype, warehousearea,true, has_tort: has_tort, categoryIds: categoryIds,buyer_name: buyer_name);
return new JsonResult(list == null || list.Count <= 0 ? new dc_base_stock_dto() : list[0]);
}
......@@ -128,11 +128,11 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public FileResult ExportRealtime(string sku, string bailun_sku,string buyer_name, string warehousecode, string product_inner_code, string sku_title_cn, string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea, int? has_tort = null)
public FileResult ExportRealtime(int? monitor_status, int? searchType, string key_words, string warehousecode, string buyer_name, string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea, int? has_tort = null, string categoryIds = null)
{
var user = AutoUtility.GetUser();
int total = 0;
var memory = new DailyServices().Export(user,sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total, warehousetype, warehousearea, has_tort: has_tort, buyer_name: buyer_name);
var memory = new DailyServices().Export(user, monitor_status, searchType, key_words, warehousecode, supplier_name, offset, limit, ref total, warehousetype, warehousearea, has_tort: has_tort, buyer_name: buyer_name);
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