Commit 3df76517 by 泽锋 李

实时库存支持分类查询

parent 09c9715c
...@@ -247,7 +247,7 @@ UNION ALL ...@@ -247,7 +247,7 @@ UNION ALL
/// <param name="warehouse_code">仓库编码</param> /// <param name="warehouse_code">仓库编码</param>
/// <returns></returns> /// <returns></returns>
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, 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,
DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type = null)
{ {
var sql = ""; var sql = "";
if (isSum) if (isSum)
...@@ -397,6 +397,12 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code ...@@ -397,6 +397,12 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
countSql += " and t3.buyer_name = @buyer_name "; countSql += " and t3.buyer_name = @buyer_name ";
parameters.Add("buyer_name", buyer_name); parameters.Add("buyer_name", buyer_name);
} }
if (product_type>0)
{
sql += " and t3.product_type = @product_type ";
countSql += " and t3.product_type = @product_type ";
parameters.Add("product_type", product_type);
}
if (monitor_status == 1) if (monitor_status == 1)
{ {
sql += " and t7.`status`=1 "; sql += " and t7.`status`=1 ";
...@@ -612,5 +618,10 @@ bailun_sku as 'ProductCode' ...@@ -612,5 +618,10 @@ bailun_sku as 'ProductCode'
FROM dc_base_sku FROM dc_base_sku
where bailun_sku in @skus", new { skus = skus.Split(',').ToList() }); where bailun_sku in @skus", new { skus = skus.Split(',').ToList() });
} }
public static List<product_type_dto> GetProductTypeList()
{
return _connection.Query<product_type_dto>(" select DISTINCT product_type as 'id',product_type_desc as 'name' from dc_base_sku ").ToList();
}
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
public class product_type_dto
{
public int id { get; set; }
public string name { get; set; }
}
}
...@@ -40,14 +40,14 @@ namespace AutoTurnOver.Services ...@@ -40,14 +40,14 @@ namespace AutoTurnOver.Services
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, 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,
DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type = null)
{ {
List<bailun_category_new_dto> categoryModels = null; List<bailun_category_new_dto> categoryModels = null;
if (!string.IsNullOrWhiteSpace(categoryIds)) if (!string.IsNullOrWhiteSpace(categoryIds))
{ {
categoryModels = ApiServices.GetNewClientNodesByIds(categoryIds.Split(',').Select(s => int.Parse(s)).ToList()); categoryModels = ApiServices.GetNewClientNodesByIds(categoryIds.Split(',').Select(s => int.Parse(s)).ToList());
} }
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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date); 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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date, product_type: product_type);
} }
public List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date) public List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date)
...@@ -138,7 +138,7 @@ namespace AutoTurnOver.Services ...@@ -138,7 +138,7 @@ namespace AutoTurnOver.Services
private static int export_count = 0; private static int export_count = 0;
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, 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,
DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type = null)
{ {
try try
{ {
...@@ -154,7 +154,7 @@ namespace AutoTurnOver.Services ...@@ -154,7 +154,7 @@ namespace AutoTurnOver.Services
while (true) while (true)
{ {
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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date); 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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date, product_type:product_type);
if (list == null || list.Count <= 0) break; if (list == null || list.Count <= 0) break;
...@@ -293,5 +293,10 @@ namespace AutoTurnOver.Services ...@@ -293,5 +293,10 @@ namespace AutoTurnOver.Services
{ {
return DB.daily.GetSkus(skus); return DB.daily.GetSkus(skus);
} }
public IEnumerable<product_type_dto> GetProductTypeList()
{
return DB.daily.GetProductTypeList();
}
} }
} }
...@@ -84,6 +84,12 @@ namespace AutoTurnOver.Controllers ...@@ -84,6 +84,12 @@ namespace AutoTurnOver.Controllers
var datas = ApiServices.GetCategoryList(); var datas = ApiServices.GetCategoryList();
return new JsonResult(datas); return new JsonResult(datas);
} }
public JsonResult GetProductTypeList()
{
var datas = daily.GetProductTypeList();
return new JsonResult(datas);
}
public JsonResult SearchSupplier(string name) public JsonResult SearchSupplier(string name)
{ {
......
...@@ -62,14 +62,14 @@ namespace AutoTurnOver.Controllers ...@@ -62,14 +62,14 @@ namespace AutoTurnOver.Controllers
/// <returns></returns> /// <returns></returns>
[UseAction] [UseAction]
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, 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,
DateTime? start_date = null,DateTime? end_date =null,DateTime? f_start_date = null, DateTime? f_end_date = null) DateTime? start_date = null,DateTime? end_date =null,DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type)
{ {
try try
{ {
var services = new DailyServices(); var services = new DailyServices();
var total = 0; var total = 0;
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,start_date:start_date,end_date:end_date,f_start_date:f_start_date,f_end_date:f_end_date); 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,start_date:start_date,end_date:end_date,f_start_date:f_start_date,f_end_date:f_end_date, product_type: product_type);
return new JsonResult(new return new JsonResult(new
{ {
...@@ -89,12 +89,12 @@ namespace AutoTurnOver.Controllers ...@@ -89,12 +89,12 @@ namespace AutoTurnOver.Controllers
} }
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, 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,
DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type = null)
{ {
var services = new DailyServices(); var services = new DailyServices();
var total = 0; var total = 0;
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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date); 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, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date, product_type: product_type);
return new JsonResult(list == null || list.Count <= 0 ? new dc_base_stock_dto() : list[0]); return new JsonResult(list == null || list.Count <= 0 ? new dc_base_stock_dto() : list[0]);
} }
...@@ -284,5 +284,7 @@ namespace AutoTurnOver.Controllers ...@@ -284,5 +284,7 @@ namespace AutoTurnOver.Controllers
var memory = new StockMonitorService().Export(user, new dc_auto_stock_monitor_search_dto { type = type, bailun_sku = bailun_sku, page = 1, rows = int.MaxValue, start_date = start_date, end_date = end_date }); var memory = new StockMonitorService().Export(user, new dc_auto_stock_monitor_search_dto { type = type, bailun_sku = bailun_sku, page = 1, rows = int.MaxValue, start_date = start_date, end_date = end_date });
return File(memory, "text/csv", $"{user.UserAccount}库存监控.csv"); return File(memory, "text/csv", $"{user.UserAccount}库存监控.csv");
} }
} }
} }
\ No newline at end of file
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