Commit e7ccc377 by lizefeng

自动周转的数字展示不清晰

预测曲线算法检查是否有误
parent b7850e55
...@@ -39,7 +39,7 @@ namespace AutoTurnOver.DB ...@@ -39,7 +39,7 @@ namespace AutoTurnOver.DB
return obj.AsList(); return obj.AsList();
} }
catch (Exception ex) catch (Exception)
{ {
return new List<dc_auto_order>(); return new List<dc_auto_order>();
} }
......
...@@ -46,31 +46,51 @@ where t1.count>t2.inboundQuantity and t1.warehouse_code=@warehouse_code and t1.b ...@@ -46,31 +46,51 @@ 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, int offset, int limit, ref int total)
{ {
var sql = @" var sql = @"
select t1.create_time, select
t1.bailun_sku,
t1.sku_name,
t1.purchase_id,
t1.warehouse_code, t1.warehouse_code,
t1.warehouse_name, t1.warehouse_name,
t1.count as 'purchaseQuantity', t1.bailun_sku,
t2.inboundQuantity t2.sku_name,
from dc_base_purchase as t1 t1.quantity_avaliable,
left join ( t1.quantity_occupied,
select t2_1.purchase_id,t2_1.warehouse_code,t2_1.bailun_sku,sum(t2_1.count) as 'inboundQuantity' from dc_base_purchase_inbound as t2_1 t1.quantity_virtual,
where t2_1.warehouse_code=@warehouse_code and t2_1.bailun_sku=@bailun_sku t1.quantity_process,
GROUP BY t2_1.warehouse_code,t2_1.bailun_sku,t2_1.purchase_id t2.quantity as 'purchase_daily_quantity'
) as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code and t1.purchase_id = t2.purchase_id from dc_daily_inventory as t1
where t1.count>t2.inboundQuantity and t1.warehouse_code=@warehouse_code and t1.bailun_sku=@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
where 1=1
";
var countSql = @"
select
count(1)
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
where 1=1
"; ";
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
parameters.Add("bailun_sku", sku); parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
parameters.Add("warehouse_code", warehouse_code);
if (!string.IsNullOrWhiteSpace(sku))
{
sql += " and t1.bailun_sku=@bailun_sku ";
countSql += " and t1.bailun_sku=@bailun_sku ";
parameters.Add("bailun_sku", sku);
}
if (!string.IsNullOrWhiteSpace(warehouse_code))
{
sql += " and t1.warehouse_code=@warehouse_code ";
countSql += " and t1.warehouse_code=@warehouse_code ";
parameters.Add("warehouse_code", warehouse_code);
}
var obj = _connection.Page<dc_realtime_purchase_daily_dto>(offset, limit, sql, ref total, parameters);
var obj = _connection.Query<dc_realtime_purchase_daily_dto>(sql + " limit " + offset + "," + limit, parameters);
total = _connection.QueryFirst<int>(countSql, parameters);
return obj.AsList(); return obj.AsList();
} }
} }
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Text; using System.Text;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using Dapper; using Dapper;
...@@ -69,7 +70,7 @@ where 1=1 "; ...@@ -69,7 +70,7 @@ where 1=1 ";
return obj.AsList(); return obj.AsList();
} }
catch (Exception ex) catch (Exception)
{ {
return new List<Models.dc_auto_turnover_Extend>(); return new List<Models.dc_auto_turnover_Extend>();
} }
...@@ -121,12 +122,28 @@ where 1=1 "; ...@@ -121,12 +122,28 @@ where 1=1 ";
return obj.AsList(); return obj.AsList();
} }
catch (Exception ex) catch (Exception)
{ {
return list; return list;
} }
} }
/// <summary>
/// 查询未来指定时间范围内的特殊销量数据
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <param name="days"></param>
/// <returns></returns>
public static IEnumerable<dc_auto_config_promotion> ListConfigPromotion(string sku, string warehousecode, int days)
{
DynamicParameters parameters = new DynamicParameters();
parameters.Add("bailun_sku", sku);
parameters.Add("warehouse_code", warehousecode);
parameters.Add("b_promotion_time",DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
parameters.Add("e_promotion_time", DateTime.Now.AddDays(days).ToString("yyyy-MM-dd 23:59:59"));
return _connection.Query<Models.dc_auto_config_promotion>(@"select * from dc_auto_config_promotion where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and promotion_time>=@b_promotion_time and promotion_time=@e_promotion_time ", parameters);
}
/// <summary> /// <summary>
/// 保存销售设置 /// 保存销售设置
...@@ -186,6 +203,44 @@ where 1=1 "; ...@@ -186,6 +203,44 @@ where 1=1 ";
} }
/// <summary> /// <summary>
/// 批量追加
/// </summary>
/// <param name="datas"></param>
public static void AddsSaleSetting(List<dc_auto_config_promotion_input> datas)
{
var _con = _connection;
_con.Open();
IDbTransaction transaction = _con.BeginTransaction();
try
{
foreach (var item in datas)
{
var obj = new dc_auto_config_promotion();
obj.bailun_sku = item.sku;
obj.gmt_modified = DateTime.Now;
obj.promotion_time = item.time;
obj.bl_auditor = "";
obj.bl_operator = "";
obj.remark = item.note;
obj.status = 0;
obj.warehouse_code = item.warehousecode;
obj.warehouse_name = item.warehouse_name;
obj.count = item.count;
_con.Insert(obj, transaction);
}
transaction.Commit();
}
catch (Exception)
{
transaction.Rollback();
_con.Close();
throw;
}
}
/// <summary>
/// 获取特殊销售设置详情 /// 获取特殊销售设置详情
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
......
...@@ -107,5 +107,19 @@ namespace AutoTurnOver.Models ...@@ -107,5 +107,19 @@ namespace AutoTurnOver.Models
作废 = 2 作废 = 2
} }
public class dc_auto_config_promotion_input
{
public string sku { get; set; }
public string warehousecode { get; set; }
public string warehouse_name { get; set; }
public DateTime time { get; set; }
public int count { get; set; }
public string note { get; set; }
}
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AutoTurnOver.DB\AutoTurnOver.DB.csproj" /> <ProjectReference Include="..\AutoTurnOver.DB\AutoTurnOver.DB.csproj" />
<ProjectReference Include="..\AutoTurnOver.Models\AutoTurnOver.Models.csproj" /> <ProjectReference Include="..\AutoTurnOver.Models\AutoTurnOver.Models.csproj" />
<ProjectReference Include="..\AutoTurnOver.Utility\AutoTurnOver.Utility.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>
...@@ -3,6 +3,8 @@ using System.Collections.Generic; ...@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.DB; using AutoTurnOver.DB;
using System.Linq;
using AutoTurnOver.Utility;
namespace AutoTurnOver.Services namespace AutoTurnOver.Services
{ {
...@@ -17,7 +19,7 @@ namespace AutoTurnOver.Services ...@@ -17,7 +19,7 @@ namespace AutoTurnOver.Services
public List<string> ForecastSalePutinStockShort(string sku, string warehousecode) public List<string> ForecastSalePutinStockShort(string sku, string warehousecode)
{ {
var list = new List<string>(); var list = new List<string>();
//获取预测销量 //获取预测销量
var sales = DB.SaleVolume.GetBySkuWarehouseCode(sku, warehousecode); var sales = DB.SaleVolume.GetBySkuWarehouseCode(sku, warehousecode);
...@@ -44,6 +46,30 @@ namespace AutoTurnOver.Services ...@@ -44,6 +46,30 @@ namespace AutoTurnOver.Services
list.Add(inventory != null ? inventory.details : "[]"); list.Add(inventory != null ? inventory.details : "[]");
list.Add(shortsupply != null ? shortsupply.details : "[]"); list.Add(shortsupply != null ? shortsupply.details : "[]");
// 计算涉及的总天数
int count = list.Max(s => s.Split(',').Length);
// 查询这些时间范围的 特殊销量情况
var configPromotionList = DB.dc_auto_turnover.ListConfigPromotion(sku, warehousecode, count);
DateTime today = DateTime.Now;
List<int> tempStrList = new List<int>();
for (var i = 0; i < count; i++)
{
var tempDate = today.AddDays(i);
var tempDateHome = DateTime.Parse(tempDate.ToString("yyyy-MM-dd 00:00:00"));
var tempDateEnd = DateTime.Parse(tempDate.ToString("yyyy-MM-dd 23:59:59"));
var tempData = configPromotionList.FirstOrDefault(s => s.promotion_time >= tempDateHome && s.promotion_time <= tempDateEnd);
if (tempData == null)
{
tempStrList.Add(0);
}
else
{
tempStrList.Add(tempData.count);
}
}
list.Add(tempStrList!=null ? tempStrList.ToJson(): "[]");
////添加预测销量 ////添加预测销量
//list.Add(new mforecast { //list.Add(new mforecast {
// typename = "预测销量", // typename = "预测销量",
...@@ -219,6 +245,6 @@ namespace AutoTurnOver.Services ...@@ -219,6 +245,6 @@ namespace AutoTurnOver.Services
return list; return list;
} }
} }
} }
...@@ -39,6 +39,17 @@ namespace AutoTurnOver.Services ...@@ -39,6 +39,17 @@ namespace AutoTurnOver.Services
} }
/// <summary> /// <summary>
/// 查询未来指定时间范围内的特殊销量数据
/// </summary>
/// <param name="days"></param>
/// <returns></returns>
public IEnumerable<dc_auto_config_promotion> List(string sku,string warehousecode,int days)
{
return DB.dc_auto_turnover.ListConfigPromotion(sku, warehousecode, days);
}
/// <summary>
/// 保存销售设置 /// 保存销售设置
/// </summary> /// </summary>
/// <param name="m">销售设置model</param> /// <param name="m">销售设置model</param>
...@@ -77,6 +88,43 @@ namespace AutoTurnOver.Services ...@@ -77,6 +88,43 @@ namespace AutoTurnOver.Services
return DB.dc_auto_turnover.SaveSaleSetting(m, username); return DB.dc_auto_turnover.SaveSaleSetting(m, username);
} }
public void AddsSaleSetting(List<dc_auto_config_promotion_input> datas)
{
foreach (var m in datas)
{
if (string.IsNullOrWhiteSpace(m.sku))
{
throw new Exception("Sku不能为空!");
}
if (string.IsNullOrWhiteSpace(m.warehousecode))
{
throw new Exception("请选择仓库!");
}
if (m.count <= 0)
{
throw new Exception("增量必须大于0!");
}
var objWarehouse = DB.common.GetWareHouseByCode(m.warehousecode);
if (objWarehouse == null)
{
throw new Exception("系统找不到该仓库");
}
m.warehouse_name = objWarehouse.warehouse_name;
if (m.time < DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(1))
{
throw new Exception("销售日期必须大于今天");
}
}
DB.dc_auto_turnover.AddsSaleSetting(datas);
}
/// <summary> /// <summary>
/// 获取特殊销售设置详情 /// 获取特殊销售设置详情
/// </summary> /// </summary>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
</Project>
using Newtonsoft.Json;
using System;
using System.Reflection;
using System.Text.RegularExpressions;
namespace AutoTurnOver.Utility
{
public static class JsonHelper
{
/// <summary>
/// 格式化字符串
/// </summary>
public static string FormateStr
{
get;
set;
}
public static string ToJson(this object obj, bool hasTime = false)
{
//JsonSerializerSettings jss = new JsonSerializerSettings();
string jsonString = JsonConvert.SerializeObject(obj);
string p = @"\\/Date\((\d+)\)\\/";
MatchEvaluator matchEvaluator = null;
if (hasTime)
{
matchEvaluator = new MatchEvaluator(ConvertJsonDateToDateString2);
}
else
{
matchEvaluator = new MatchEvaluator(ConvertJsonDateToDateString);
}
Regex reg = new Regex(p);
jsonString = reg.Replace(jsonString, matchEvaluator);
return jsonString;
}
/// <summary>
/// 将Json序列化的时间由/Date(1294499956278)转为字符串 .
/// </summary>
/// <param name="m">正则匹配</param>
/// <returns>格式化后的字符串</returns>
private static string ConvertJsonDateToDateString(Match m)
{
string result = string.Empty;
DateTime dt = new DateTime(1970, 1, 1);
dt = dt.AddMilliseconds(long.Parse(m.Groups[1].Value));
dt = dt.ToLocalTime();
result = dt.ToString("yyyy-MM-dd");
return result;
}
/// <summary>
/// 将Json序列化的时间由/Date(1294499956278)转为字符串 .
/// </summary>
/// <param name="m">正则匹配</param>
/// <returns>格式化后的字符串</returns>
private static string ConvertJsonDateToDateString2(Match m)
{
string result = string.Empty;
DateTime dt = new DateTime(1970, 1, 1);
dt = dt.AddMilliseconds(long.Parse(m.Groups[1].Value));
dt = dt.ToLocalTime();
result = dt.ToString("yyyy-MM-dd HH:mm:ss");
return result;
}
public static T ToObj<T>(this string objStr)
{
return JsonConvert.DeserializeObject<T>(objStr);
}
/// <summary>
/// 判断对象是否完全相同
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static bool MyEquals(this object obj, object obj2)
{
bool equals = true;
if (obj == null || obj2 == null) return true;
Type ts = obj.GetType();
Type ts2 = obj2.GetType();
if (ts != ts2) return false;
foreach (var item in ts.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
{
//检查对象二是否有该属性
var item2 = ts2.GetProperty(item.Name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
if (item2 == null) return false;
//判断是不是引用类型
var itemValue = item.GetValue(obj);
var item2Value = item2.GetValue(obj2);
if (itemValue == null && item2Value != null) return false;
if (item2Value == null && itemValue != null) return false;
if (itemValue == null && item2Value == null) { continue; }
if (itemValue.GetType() == typeof(DateTime))
{
//值类型,直接判断是否相等
if ((DateTime.Parse(itemValue.ToString()) - DateTime.Parse(item2Value.ToString())).Ticks != 0) return false;
}
else if (itemValue.GetType().IsValueType || itemValue.GetType() == typeof(string))
{
//值类型,直接判断是否相等
if (!itemValue.Equals(item2Value)) return false;
}
else
{
//引用类型
if (!itemValue.MyEquals(item2Value)) return false;
}
}
return equals;
}
}
}
...@@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTurnOver.Models", "Auto ...@@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTurnOver.Models", "Auto
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTurnOver.DB", "AutoTurnOver.DB\AutoTurnOver.DB.csproj", "{DF399520-9D6F-46BE-AB52-2ABD9A783472}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTurnOver.DB", "AutoTurnOver.DB\AutoTurnOver.DB.csproj", "{DF399520-9D6F-46BE-AB52-2ABD9A783472}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoTurnOver.Utility", "AutoTurnOver.Utility\AutoTurnOver.Utility.csproj", "{DDD8D47F-A607-4D28-ADAB-77F21794939A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -33,6 +35,10 @@ Global ...@@ -33,6 +35,10 @@ Global
{DF399520-9D6F-46BE-AB52-2ABD9A783472}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF399520-9D6F-46BE-AB52-2ABD9A783472}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF399520-9D6F-46BE-AB52-2ABD9A783472}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF399520-9D6F-46BE-AB52-2ABD9A783472}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF399520-9D6F-46BE-AB52-2ABD9A783472}.Release|Any CPU.Build.0 = Release|Any CPU {DF399520-9D6F-46BE-AB52-2ABD9A783472}.Release|Any CPU.Build.0 = Release|Any CPU
{DDD8D47F-A607-4D28-ADAB-77F21794939A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDD8D47F-A607-4D28-ADAB-77F21794939A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDD8D47F-A607-4D28-ADAB-77F21794939A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDD8D47F-A607-4D28-ADAB-77F21794939A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AutoTurnOver.Models\AutoTurnOver.Models.csproj" /> <ProjectReference Include="..\AutoTurnOver.Models\AutoTurnOver.Models.csproj" />
<ProjectReference Include="..\AutoTurnOver.Services\AutoTurnOver.Services.csproj" /> <ProjectReference Include="..\AutoTurnOver.Services\AutoTurnOver.Services.csproj" />
<ProjectReference Include="..\AutoTurnOver.Utility\AutoTurnOver.Utility.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace AutoTurnOver.Common
{
public class DataTableHelper
{
/// <summary>
/// 将DataTable中数据写入到CSV文件中
/// </summary>
/// <param name="dt">提供保存数据的DataTable</param>
/// <param name="fileName">CSV的文件路径</param>
public static void SaveCSV(DataTable dt, string fileName)
{
if (!Directory.Exists(Path.GetDirectoryName(fileName)))
{
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
}
FileStream fs = new FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);
string data = "";
//写出列名称
for (int i = 0; i < dt.Columns.Count; i++)
{
data += dt.Columns[i].ColumnName.ToString();
if (i < dt.Columns.Count - 1)
{
data += ",";
}
}
sw.WriteLine(data);
//写出各行数据
for (int i = 0; i < dt.Rows.Count; i++)
{
data = "";
for (int j = 0; j < dt.Columns.Count; j++)
{
data += ToStr(dt.Rows[i][j]);
if (j < dt.Columns.Count - 1)
{
data += ",";
}
}
sw.WriteLine(data);
}
sw.Close();
fs.Close();
}
private static string ToStr(object obj)
{
if (obj == null) return "";
return obj.ToString().Replace(",", "").Replace("\n", "");
}
}
}
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoTurnOver.Common;
using AutoTurnOver.Services; using AutoTurnOver.Services;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
...@@ -28,7 +31,7 @@ namespace AutoTurnOver.Controllers ...@@ -28,7 +31,7 @@ namespace AutoTurnOver.Controllers
} }
/// <summary> /// <summary>
/// 下单记录分页 /// 实时库存
/// </summary> /// </summary>
/// <param name="sku"></param> /// <param name="sku"></param>
/// <param name="warehousecode"></param> /// <param name="warehousecode"></param>
...@@ -48,5 +51,53 @@ namespace AutoTurnOver.Controllers ...@@ -48,5 +51,53 @@ namespace AutoTurnOver.Controllers
total = total, total = total,
}); });
} }
/// <summary>
/// 导出实时库存
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public FileResult ExportRealtime(string sku, string warehousecode)
{
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, warehousecode, 0, int.MaxValue, ref total);
DataTable table = new DataTable();
string[] cols = new string[] { "Sku", "仓库编码", "仓库名称", "可用库存", "占用库存", "预分配库存", "在途库存" };
foreach (var item in cols)
{
table.Columns.Add(item);
}
foreach (var itemData in list)
{
DataRow row = table.NewRow();
row["Sku"] = itemData.bailun_sku;
row["仓库编码"] = itemData.warehouse_code;
row["仓库名称"] = itemData.warehouse_name;
row["可用库存"] = itemData.quantity_avaliable;
row["占用库存"] = itemData.quantity_occupied;
row["预分配库存"] = itemData.quantity_virtual;
row["在途库存"] = itemData.purchase_daily_quantity;
table.Rows.Add(row);
}
var vName = @"Result/RealtimeStock/实时库存.csv";
var fileName = AppContext.BaseDirectory+ @"Result\RealtimeStock\实时库存.csv";
DataTableHelper.SaveCSV(table, fileName);
var memory = new MemoryStream();
using (var stream = new FileStream(fileName, FileMode.Open))
{
stream.CopyTo(memory);
}
memory.Position = 0;
return File(memory, "text/csv", "实时库存.csv");
}
} }
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ namespace AutoTurnOver.Controllers ...@@ -11,7 +11,7 @@ namespace AutoTurnOver.Controllers
[ApiController] [ApiController]
public class ReportsController : ControllerBase public class ReportsController : ControllerBase
{ {
/// <summary> /// <summary>ForecastSalePutinStockShort
/// 获取预测销售+入库+库存+缺货数 /// 获取预测销售+入库+库存+缺货数
/// </summary> /// </summary>
/// <param name="sku">sku编码</param> /// <param name="sku">sku编码</param>
...@@ -42,7 +42,7 @@ namespace AutoTurnOver.Controllers ...@@ -42,7 +42,7 @@ namespace AutoTurnOver.Controllers
date.Add(today.AddDays(i).ToString("MM/dd")); date.Add(today.AddDays(i).ToString("MM/dd"));
} }
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);
return new JsonResult(new { data = result, turnoverData, saleVolumeData, days = date, names }); return new JsonResult(new { data = result, turnoverData, saleVolumeData, days = date, names });
......
...@@ -8,6 +8,7 @@ using Newtonsoft.Json.Serialization; ...@@ -8,6 +8,7 @@ using Newtonsoft.Json.Serialization;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using Newtonsoft.Json; using Newtonsoft.Json;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using AutoTurnOver.Utility;
namespace AutoTurnOver.Controllers namespace AutoTurnOver.Controllers
{ {
...@@ -140,6 +141,28 @@ namespace AutoTurnOver.Controllers ...@@ -140,6 +141,28 @@ namespace AutoTurnOver.Controllers
return new JsonResult(result); return new JsonResult(result);
} }
[HttpPost]
public JsonResult AddsSaleSetting([FromForm]string datasStr)
{
var datasObj = datasStr.ToObj<List<dc_auto_config_promotion_input>>();
try
{
new Services.SkuAutoTurnServices().AddsSaleSetting(datasObj);
return new JsonResult(new
{
success = true
});
}
catch (Exception ex)
{
return new JsonResult(new {
success = false,
message = ex.Message
});
}
}
/// <summary> /// <summary>
/// 获取特殊销售设置详情 /// 获取特殊销售设置详情
/// </summary> /// </summary>
......
...@@ -55,7 +55,7 @@ namespace AutoTurnOver ...@@ -55,7 +55,7 @@ namespace AutoTurnOver
{ {
app.UseHsts(); app.UseHsts();
} }
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
// 跨域配置 // 跨域配置
......
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