Commit d40da508 by lizefeng

实时库存界面新增 sku中文名称,英文名称,内部产品编码,采购员名称字段

parent 4327f6bb
...@@ -24,15 +24,16 @@ namespace AutoTurnOver.DB ...@@ -24,15 +24,16 @@ namespace AutoTurnOver.DB
{ {
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00")); parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00"));
return _connection.Query<temp_sku_dto>("select t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1 where t1.update_time>=@time group by t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", parameters); return _connection.Query<temp_sku_dto>("select t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1 where t1.supplier_id>0 ");
//return _connection.Query<temp_sku_dto>("select t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1 where t1.update_time>=@time group by t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", parameters);
} }
public static dc_average_purchase GetModel(string sku, string warehousecode) public static IEnumerable<dc_average_purchase> GetList(string sku, string warehousecode)
{ {
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
parameters.Add("bailun_sku", sku); parameters.Add("bailun_sku", sku);
parameters.Add("warehouse_code", warehousecode); parameters.Add("warehouse_code", warehousecode);
return _connection.QueryFirstOrDefault<dc_average_purchase>("select * from dc_average_purchase where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku ", parameters); return _connection.Query<dc_average_purchase>("select * from dc_average_purchase where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku ", parameters);
} }
......
...@@ -40,7 +40,8 @@ namespace AutoTurnOver.DB ...@@ -40,7 +40,8 @@ namespace AutoTurnOver.DB
{ {
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json"); var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
var configurationRoot = builder.Build(); var configurationRoot = builder.Build();
return configurationRoot.GetSection("cnstr").Value; _connStr = configurationRoot.GetSection("cnstr").Value;
return _connStr;
} }
} }
} }
......
...@@ -46,7 +46,7 @@ where t1.count>t2.inboundQuantity and t1.warehouse_code=@warehouse_code and t1.b ...@@ -46,7 +46,7 @@ where t1.count>t2.inboundQuantity and t1.warehouse_code=@warehouse_code and t1.b
/// <param name="sku">sku</param> /// <param name="sku">sku</param>
/// <param name="warehouse_code">仓库编码</param> /// <param name="warehouse_code">仓库编码</param>
/// <returns></returns> /// <returns></returns>
public static IEnumerable<dc_realtime_purchase_daily_dto> RealtimeList(string sku, string warehouse_code, int offset, int limit, ref int total) public static IEnumerable<dc_realtime_purchase_daily_dto> RealtimeList(string sku, string warehouse_code,string product_inner_code,string sku_title_cn, int offset, int limit, ref int total)
{ {
var sql = @" var sql = @"
select select
...@@ -58,9 +58,11 @@ t1.quantity_avaliable, ...@@ -58,9 +58,11 @@ t1.quantity_avaliable,
t1.quantity_occupied, t1.quantity_occupied,
t1.quantity_virtual, t1.quantity_virtual,
t1.quantity_process, t1.quantity_process,
t2.quantity as 'purchase_daily_quantity' t2.quantity as 'purchase_daily_quantity',
t3.buyer_name,t3.sku_title_cn,t3.sku_title_en,t3.product_inner_code
from dc_daily_inventory as t1 from dc_daily_inventory as t1
left join ( select * from dc_daily_purchase where record_time>=@time and type=1) as t2 on t1.warehouse_code = t2.warehouse_code and t1.bailun_sku = t2.bailun_sku left join ( select * from dc_daily_purchase where record_time>=@time and type=1) as t2 on t1.warehouse_code = t2.warehouse_code and t1.bailun_sku = t2.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
where 1=1 where 1=1
"; ";
...@@ -69,11 +71,25 @@ select ...@@ -69,11 +71,25 @@ select
count(1) count(1)
from dc_daily_inventory as t1 from dc_daily_inventory as t1
left join ( select * from dc_daily_purchase where record_time>=@time and type=1) as t2 on t1.warehouse_code = t2.warehouse_code and t1.bailun_sku = t2.bailun_sku left join ( select * from dc_daily_purchase where record_time>=@time and type=1) as t2 on t1.warehouse_code = t2.warehouse_code and t1.bailun_sku = t2.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
where 1=1 where 1=1
"; ";
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
if (!string.IsNullOrWhiteSpace(product_inner_code))
{
sql += " and t3.product_inner_code like @product_inner_code ";
countSql += " and t3.product_inner_code like @product_inner_code ";
parameters.Add("product_inner_code", $"%{product_inner_code}%");
}
if (!string.IsNullOrWhiteSpace(sku_title_cn))
{
sql += " and t3.sku_title_cn like @sku_title_cn ";
countSql += " and t3.sku_title_cn like @sku_title_cn ";
parameters.Add("sku_title_cn", $"%{sku_title_cn}%");
}
if (!string.IsNullOrWhiteSpace(sku)) if (!string.IsNullOrWhiteSpace(sku))
{ {
sql += " and t1.bailun_sku=@bailun_sku "; sql += " and t1.bailun_sku=@bailun_sku ";
......
...@@ -183,5 +183,7 @@ namespace AutoTurnOver.Models ...@@ -183,5 +183,7 @@ namespace AutoTurnOver.Models
/// 预测明日销量 /// 预测明日销量
/// </summary> /// </summary>
public int forecast_oneday_sales2 { get; set; } public int forecast_oneday_sales2 { get; set; }
} }
} }
...@@ -40,5 +40,25 @@ namespace AutoTurnOver.Models ...@@ -40,5 +40,25 @@ namespace AutoTurnOver.Models
/// 内部系统采购在途 /// 内部系统采购在途
/// </summary> /// </summary>
public int purchase_daily_quantity { get; set; } public int purchase_daily_quantity { get; set; }
/// <summary>
/// 采购员名称
/// </summary>
public string buyer_name { get; set; }
/// <summary>
/// 产品中文名
/// </summary>
public string sku_title_cn { get; set; }
/// <summary>
/// 产品英文名
/// </summary>
public string sku_title_en { get; set; }
/// <summary>
/// 产品内部编码
/// </summary>
public string product_inner_code { get; set; }
} }
} }
...@@ -5,12 +5,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ...@@ -5,12 +5,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration> <Configuration>Debug</Configuration>
<Platform>Any CPU</Platform> <Platform>Any CPU</Platform>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.1</TargetFramework>
<PublishDir>bin\Release\netcoreapp2.1\publish\</PublishDir> <PublishDir>bin\Release\netcoreapp2.1\publish\</PublishDir>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<_IsPortable>false</_IsPortable> <_IsPortable>false</_IsPortable>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
\ No newline at end of file
...@@ -21,9 +21,9 @@ namespace AutoTurnOver.Services ...@@ -21,9 +21,9 @@ namespace AutoTurnOver.Services
return DB.daily.List(sku, warehouse_code); return DB.daily.List(sku, warehouse_code);
} }
public IEnumerable<dc_realtime_purchase_daily_dto> RealtimeList(string sku, string warehouse_code, int offset, int limit, ref int total) public IEnumerable<dc_realtime_purchase_daily_dto> RealtimeList(string sku, string warehouse_code, string product_inner_code, string sku_title_cn, int offset, int limit, ref int total)
{ {
return DB.daily.RealtimeList(sku, warehouse_code,offset, limit, ref total); return DB.daily.RealtimeList(sku, warehouse_code,product_inner_code,sku_title_cn,offset, limit, ref total);
} }
......
...@@ -122,9 +122,9 @@ namespace AutoTurnOver.Services ...@@ -122,9 +122,9 @@ namespace AutoTurnOver.Services
conn.Update(task_log); conn.Update(task_log);
} }
public static dc_average_purchase GetModel(string sku, string warehouse_code) public static IEnumerable<dc_average_purchase> GetList(string sku, string warehouse_code)
{ {
return AveragePurchase.GetModel(sku, warehouse_code); return AveragePurchase.GetList(sku, warehouse_code);
} }
......
...@@ -38,12 +38,12 @@ namespace AutoTurnOver.Controllers ...@@ -38,12 +38,12 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param> /// <param name="offset"></param>
/// <param name="limit"></param> /// <param name="limit"></param>
/// <returns></returns> /// <returns></returns>
public JsonResult RealtimeList(string sku, string warehousecode, int offset, int limit, string order, string sort) public JsonResult RealtimeList(string sku, string warehousecode, string product_inner_code, string sku_title_cn, int offset, int limit, string order, string sort)
{ {
var services = new DailyServices(); var services = new DailyServices();
var total = 0; var total = 0;
var list = services.RealtimeList(sku, warehousecode, offset, limit, ref total); var list = services.RealtimeList(sku, warehousecode,product_inner_code, sku_title_cn, offset, limit, ref total);
return new JsonResult(new return new JsonResult(new
{ {
...@@ -58,11 +58,11 @@ namespace AutoTurnOver.Controllers ...@@ -58,11 +58,11 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param> /// <param name="sku"></param>
/// <param name="warehousecode"></param> /// <param name="warehousecode"></param>
/// <returns></returns> /// <returns></returns>
public FileResult ExportRealtime(string sku, string warehousecode) public FileResult ExportRealtime(string sku, string warehousecode, string product_inner_code, string sku_title_cn)
{ {
var services = new DailyServices(); var services = new DailyServices();
var total = 0; var total = 0;
var list = services.RealtimeList(sku, warehousecode, 0, int.MaxValue, ref total); var list = services.RealtimeList(sku, warehousecode, product_inner_code, sku_title_cn, 0, int.MaxValue, ref total);
DataTable table = new DataTable(); DataTable table = new DataTable();
string[] cols = new string[] { "Sku", "仓库编码", "仓库名称", "可用库存", "占用库存", "预分配库存", "在途库存" }; string[] cols = new string[] { "Sku", "仓库编码", "仓库名称", "可用库存", "占用库存", "预分配库存", "在途库存" };
......
...@@ -46,8 +46,8 @@ namespace AutoTurnOver.Controllers ...@@ -46,8 +46,8 @@ namespace AutoTurnOver.Controllers
var names = new List<string>() { "销量", "预计入库", "可用库存", "预计缺货数量", "特殊销量" }; var names = new List<string>() { "销量", "预计入库", "可用库存", "预计缺货数量", "特殊销量" };
var turnoverData = new Services.SkuAutoTurnServices().GetModel(sku, warehousecode); var turnoverData = new Services.SkuAutoTurnServices().GetModel(sku, warehousecode);
var saleVolumeData = new Services.SaleVolumeServices().GetBySkuWarehouseCode(sku, warehousecode); var saleVolumeData = new Services.SaleVolumeServices().GetBySkuWarehouseCode(sku, warehousecode);
var averageTarget = PurchaseAverageTargetServices.GetModel(sku, warehousecode); var averageTargets = PurchaseAverageTargetServices.GetList(sku, warehousecode);
return new JsonResult(new { data = result, turnoverData, saleVolumeData, days = date, names, averageTarget }); return new JsonResult(new { data = result, turnoverData, saleVolumeData, days = date, names, averageTargets });
} }
} }
......
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