Commit 5cf255a7 by 泽锋 李

fix

parent d08eb7ff
...@@ -357,7 +357,7 @@ namespace AutoTurnOver.DB ...@@ -357,7 +357,7 @@ namespace AutoTurnOver.DB
turnover_list.Add(new invented_turnover_model { val = final_purchase_quantity, type = (int)invented_turnover_model.type_enum.可用库存, date = min_date_sale.date.AddDays(-1) }); turnover_list.Add(new invented_turnover_model { val = final_purchase_quantity, type = (int)invented_turnover_model.type_enum.可用库存, date = min_date_sale.date.AddDays(-1) });
var max_forecast_date = sale_list.Max(s => s.date).AddDays(delivery); var max_forecast_date = sale_list.Max(s => s.date).AddDays(-delivery);
var this_time = min_date_sale.date; var this_time = min_date_sale.date;
while (this_time.ToDayHome() <= max_forecast_date.ToDayHome()) while (this_time.ToDayHome() <= max_forecast_date.ToDayHome())
...@@ -372,12 +372,18 @@ namespace AutoTurnOver.DB ...@@ -372,12 +372,18 @@ namespace AutoTurnOver.DB
var today_sale = (turnover_list.Where(s => s.date_str == today_data_str && s.type == (int)invented_turnover_model.type_enum.销量).FirstOrDefault() ?? new invented_turnover_model()).val; var today_sale = (turnover_list.Where(s => s.date_str == today_data_str && s.type == (int)invented_turnover_model.type_enum.销量).FirstOrDefault() ?? new invented_turnover_model()).val;
var today_stock = yesterday_stock - today_sale; var today_stock = yesterday_stock - today_sale;
turnover_list.Add(new invented_turnover_model { val = today_stock, type = (int)invented_turnover_model.type_enum.可用库存, date = this_time }); turnover_list.Add(new invented_turnover_model { val = today_stock, type = (int)invented_turnover_model.type_enum.可用库存, date = this_time });
// 供应链长度的累积销量 - 累积入库
var date_sum_day = this_time.AddDays(delivery).ToDayEnd();
var sales_sum = turnover_list.Where(s=>s.date>=this_time && s.date<= date_sum_day && s.type== (int)invented_turnover_model.type_enum.销量).Sum(s=>s.val)
- turnover_list.Where(s => s.date >= this_time && s.date <= date_sum_day && s.type == (int)invented_turnover_model.type_enum.入库数量).Sum(s => s.val);
// 计算跟安全库存的差值 // 计算跟安全库存的差值
if (inventory_stock - today_stock > 0) var init_p = inventory_stock + sales_sum - today_stock;
if (init_p > 0)
{ {
//准备采购 //准备采购
// 1. 补齐安全库存 // 1. 补齐安全库存
var init_p = inventory_stock - today_stock;
// 2. 考虑备货天数 // 2. 考虑备货天数
var this_stock_up_day_date = this_time.AddDays(stock_up_days.stock_up_days - 1); var this_stock_up_day_date = this_time.AddDays(stock_up_days.stock_up_days - 1);
if (this_stock_up_day_date.ToDayHome() > this_time.ToDayHome()) if (this_stock_up_day_date.ToDayHome() > this_time.ToDayHome())
...@@ -603,7 +609,7 @@ namespace AutoTurnOver.DB ...@@ -603,7 +609,7 @@ namespace AutoTurnOver.DB
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 13 }, date_type_str = "新增采购费用_首单", remarks = " 采购首单费用,下单一个月之后如果有出单,讲转移到【新增采购费用】字段", dates = new List<report_cash_flow_view_dto.date_dto>() }); info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 13 }, date_type_str = "新增采购费用_首单", remarks = " 采购首单费用,下单一个月之后如果有出单,讲转移到【新增采购费用】字段", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 10 }, date_type_str = "新增头程费用", remarks = " 调拨单的数据,支付时间 已 读取对应物流商的账期,注:调拨单需要付款之后才能获取到金额 ", dates = new List<report_cash_flow_view_dto.date_dto>() }); info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 10 }, date_type_str = "新增头程费用", remarks = " 调拨单的数据,支付时间 已 读取对应物流商的账期,注:调拨单需要付款之后才能获取到金额 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 14 }, date_type_str = "新增头程费用_首单", remarks = " 调拨首单费用,下单一个月之后如果有出单,讲转移到【新增头程费用】字段 ", dates = new List<report_cash_flow_view_dto.date_dto>() }); info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 14 }, date_type_str = "新增头程费用_首单", remarks = " 调拨首单费用,下单一个月之后如果有出单,讲转移到【新增头程费用】字段 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 4, 3 }, date_type_str = "汇总利润", remarks = " oms 中的订单,销售额 - 销售成本 - 尾程费 - 头程费 - 退款 (", dates = new List<report_cash_flow_view_dto.date_dto>() }); info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> {2, 4, 3 }, date_type_str = "汇总利润", remarks = " oms 中的订单,销售额 - 销售成本 (", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2, 3, 5, 8, 9, 10, 11, 12, 13, 14 }, date_type_str = "现金流结余", remarks = " 销售金额 - 新增采购费用 - 新增头程费用 - 平台费用 - 尾程费用 ", dates = new List<report_cash_flow_view_dto.date_dto>() }); info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2, 3, 5, 8, 9, 10, 11, 12, 13, 14 }, date_type_str = "现金流结余", remarks = " 销售金额 - 新增采购费用 - 新增头程费用 - 平台费用 - 尾程费用 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> {(int)invented_turnover_model.type_enum.销量 }, item_title = "销量",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } }); info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> {(int)invented_turnover_model.type_enum.销量 }, item_title = "销量",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
......
...@@ -23,13 +23,13 @@ namespace AutoTurnOver.Purchase.AverageTarget ...@@ -23,13 +23,13 @@ namespace AutoTurnOver.Purchase.AverageTarget
{ {
try try
{ {
Console.WriteLine($"开始 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"开始 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_forecast_dao.Calculation(); report_cash_flow_forecast_dao.Calculation();
Console.WriteLine($"结束 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"结束 计算预测现金流,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine("计算预测现金流"+ ex.Message);
} }
......
...@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget ...@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
Console.WriteLine("采购平均值计算任务启动..."); Console.WriteLine("采购平均值计算任务启动...");
// 创建采购计划 // 创建采购计划
//Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//report_cash_flow_forecast_dao.Calculation();
//Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); //Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
......
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