Commit c9e73abe by 泽锋 李

新增库存明细查询的接口

parent 5b2cc63e
...@@ -249,14 +249,16 @@ UNION ALL ...@@ -249,14 +249,16 @@ 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, int? product_type = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null, int? product_type = null,bool is_warehouse_sum = false)
{ {
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
var sql = ""; var sql = "";
if (isSum) if (isSum || is_warehouse_sum)
{ {
sql = @" sql = @"
select select
t1.warehouse_code,
(dbw.warehouse_name) as warehouse_name,
sum(t1.quantity_reservation) as 'quantity_reservation', sum(t1.quantity_reservation) as 'quantity_reservation',
sum(t1.quantity_transport) as 'quantity_transport', sum(t1.quantity_transport) as 'quantity_transport',
sum(t1.quantity_transfer) as 'quantity_transfer', sum(t1.quantity_transfer) as 'quantity_transfer',
...@@ -519,14 +521,23 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code ...@@ -519,14 +521,23 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
} }
else else
{ {
if (limit > 1000) if (is_warehouse_sum)
{ {
total = 0; if (limit > 1000)
{
total = 0;
}
else
{
total = _connection.QueryFirst<int>(countSql, parameters, commandTimeout: 0);
}
} }
else else
{ {
total = _connection.QueryFirst<int>(countSql, parameters, commandTimeout: 0); countSql += " group by t1.warehouse_code ";
total = _connection.Query<int>(countSql, parameters, commandTimeout: 0).Count();
} }
if (!string.IsNullOrEmpty(sort) && !string.IsNullOrEmpty(order)) if (!string.IsNullOrEmpty(sort) && !string.IsNullOrEmpty(order))
......
...@@ -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,int? product_type = null) DateTime? start_date = null, DateTime? end_date = null, DateTime? f_start_date = null, DateTime? f_end_date = null,int? product_type = null, bool is_warehouse_sum = false)
{ {
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, product_type: product_type); 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, is_warehouse_sum);
} }
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, string warehousecode, string warehousetype, int? warehousearea) 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, string warehousecode, string warehousetype, int? warehousearea)
......
...@@ -77,6 +77,44 @@ namespace AutoTurnOver.Controllers ...@@ -77,6 +77,44 @@ namespace AutoTurnOver.Controllers
} }
} }
/// <summary>
/// 实时库存
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
[HttpGet("RealtimeStockList")]
public JsonResult RealtimeStockList(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, int? product_type = null, bool is_warehouse_sum = false)
{
try
{
var services = new DailyServices();
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, product_type: product_type, is_warehouse_sum:is_warehouse_sum);
return new JsonResult(new
{
rows = list,
total = total,
});
}
catch (Exception ex)
{
return new JsonResult(new
{
message = ex.Message,
stack_trace = ex.StackTrace
});
}
}
public class GetSkus_dto public class GetSkus_dto
{ {
public string skus { get; set; } public string skus { 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