Commit 8864702f by 泽锋 李

记录每天的周转关键时间节点

parent a3f86074
......@@ -1460,6 +1460,12 @@ left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
countSql += " and t3.buyer_name = @buyer_name ";
parameters.Add("buyer_name", search_data.buyer_name);
}
if (!string.IsNullOrWhiteSpace(search_data.order_no))
{
sql += " and t1.purchase_id = @order_no ";
countSql += " and t1.purchase_id= @order_no ";
parameters.Add("order_no", search_data.order_no);
}
if (search_data.product_type > 0)
{
sql += " and t3.product_type = @product_type ";
......@@ -1764,6 +1770,12 @@ left join dc_base_stock as t5 on t2.sku = t5.bailun_sku and t1.targetwareno = t5
countSql += " and t4.product_type = @product_type ";
parameters.Add("product_type", search_data.product_type);
}
if (!string.IsNullOrWhiteSpace(search_data.order_no))
{
sql += " and t1.`code` = @order_no ";
countSql += " and t1.`code` = @order_no ";
parameters.Add("order_no", search_data.order_no);
}
if (search_data.monitor_status == 1)
{
sql += " and t10.`status`=1 ";
......
......@@ -112,7 +112,7 @@ from dc_auto_turnover as dat
";
DynamicParameters parameters = new DynamicParameters();
if (string.IsNullOrWhiteSpace(m.sku_label))
{
......@@ -138,17 +138,17 @@ from dc_auto_turnover as dat
{
sqlCount += " left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku ";
}
if(m.oneday_sales_min>0 || m.oneday_sales_max > 0)
if (m.oneday_sales_min > 0 || m.oneday_sales_max > 0)
{
sqlCount += " left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code ";
}
if(m.not_trans_count_max>0 || m.not_trans_count_min > 0)
if (m.not_trans_count_max > 0 || m.not_trans_count_min > 0)
{
sqlCount += " left join not_trans_view as t15 on dat.bailun_sku = t15.bailun_sku and dat.warehouse_code = t15.warehouse_code ";
}
sqlCount += " where 1=1 ";
if (m.has_tort != null)
{
......@@ -306,7 +306,7 @@ from dc_auto_turnover as dat
sql += " and dat.quantity_inventory<=@quantity_inventory_max ";
sqlCount += " and dat.quantity_inventory<=@quantity_inventory_max ";
parameters.Add("quantity_inventory_max", m.quantity_inventory_max);
}
}
if (m.not_trans_count_min != null)
{
sql += " and t15.count>=@not_trans_count_min ";
......@@ -429,6 +429,59 @@ from dc_auto_turnover as dat
}
/// <summary>
/// 查询历史节点趋势图
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public static charts_line_dto GetHistoryDataNodes(string sku, string warehousecode)
{
var btime = DateTime.Now.AddDays(-30).ToDayHome();
var base_datas = _connection.Query<dc_base_forecast_history>(" select * from dc_base_forecast_history where `date`>=@btime and bailun_sku_warehouse_code=@bailun_sku_warehouse_code ", new
{
bailun_sku_warehouse_code = $"{sku}{warehousecode}",
btime = btime
}).ToList();
List<string> date_list = new List<string>();
List<charts_line_dto.data_dto> datas = new List<charts_line_dto.data_dto>();
var names = new List<string> { "供应链长度", "供应商交期", "质检入库天数", "调拨头程天数", "调拨打包天数", "海外仓入库天数" };
foreach (var itemName in names)
{
datas.Add(new charts_line_dto.data_dto
{
name = itemName,
type = "line",
data = new List<decimal> { }
});
}
var nowDate = DateTime.Now;
var this_date = btime;
while (this_date.Date.ToDayHome() <= nowDate)
{
date_list.Add(this_date.ToString("yyyy-MM-dd"));
var this_date_item = (base_datas.FirstOrDefault(s => s.date_str == this_date.ToString("yyyy-MM-dd")) ?? new dc_base_forecast_history());
datas.FirstOrDefault(s => s.name == "供应链长度").data.Add(this_date_item.turnover_days);
datas.FirstOrDefault(s => s.name == "供应商交期").data.Add(this_date_item.supplier_delivery);
datas.FirstOrDefault(s => s.name == "质检入库天数").data.Add(this_date_item.inspection_delivery);
datas.FirstOrDefault(s => s.name == "调拨头程天数").data.Add(this_date_item.transfer_delivery);
datas.FirstOrDefault(s => s.name == "调拨打包天数").data.Add(this_date_item.transfer_bale_delivery);
datas.FirstOrDefault(s => s.name == "海外仓入库天数").data.Add(this_date_item.abroad_inbound_delivery);
this_date = this_date.AddDays(1);
}
return new charts_line_dto
{
y = datas,
x = date_list
};
}
public static IEnumerable<string> GetLabelList()
{
return _connection.Query<string>(" select DISTINCT label from dc_auto_config_sku_label ");
......@@ -943,7 +996,7 @@ select t7_1.warehouse_code,t7_1.bailun_sku,(to_days(t7_1.estimated_arrival_time)
/// </summary>
public static void CopyForecast()
{
_connection.Execute(@"REPLACE INTO dc_base_forecast_history(`bailun_sku`,`warehouse_code`,`bailun_sku_warehouse_code`,`date`,`date_str`,`create_date`,`sales`)
_connection.Execute(@"REPLACE INTO dc_base_forecast_history(`bailun_sku`,`warehouse_code`,`bailun_sku_warehouse_code`,`date`,`date_str`,`create_date`,`sales`,`turnover_days`,`quantity_safe_inventory`,`supplier_delivery`,`transfer_config_delivery`,`transfer_bale_config_delivery`,`abroad_inbound_config_delivery`,`inspection_config_delivery`,`inspection_delivery`,`transfer_delivery`,`daily_weighted_sales`,`transfer_bale_delivery`,`abroad_inbound_delivery`)
(
select
bailun_sku,
......@@ -952,7 +1005,19 @@ CONCAT(bailun_sku,warehouse_code) as 'bailun_sku_warehouse_code',
gmt_modified as 'date',
DATE_FORMAT(gmt_modified,'%Y-%m-%d') as 'date_str',
now() as 'create_date',
forecast_oneday_sales as 'sales'
forecast_oneday_sales as 'sales',
turnover_days as 'turnover_days',
quantity_safe_inventory as 'quantity_safe_inventory',
supplier_delivery as 'supplier_delivery',
transfer_config_delivery as 'transfer_config_delivery',
transfer_bale_config_delivery as 'transfer_bale_config_delivery',
abroad_inbound_config_delivery as 'abroad_inbound_config_delivery',
inspection_config_delivery as 'inspection_config_delivery',
inspection_delivery as 'inspection_delivery',
transfer_delivery as 'transfer_delivery',
daily_weighted_sales as 'daily_weighted_sales',
transfer_bale_delivery as 'transfer_bale_delivery',
abroad_inbound_delivery as 'abroad_inbound_delivery'
from dc_auto_turnover where gmt_modified>=@btime and gmt_modified<=@etime
)
", new { btime = DateTime.Now.ToDayHome(), etime = DateTime.Now.ToDayEnd() });
......
......@@ -17,5 +17,17 @@ namespace AutoTurnOver.DB
public string date_str { get; set; }
public DateTime create_date { get; set; }
public decimal sales { get; set; }
public int turnover_days { get; set; }
public int quantity_safe_inventory { get; set; }
public int supplier_delivery { get; set; }
public int transfer_config_delivery { get; set; }
public int transfer_bale_config_delivery { get; set; }
public int abroad_inbound_config_delivery { get; set; }
public int inspection_config_delivery { get; set; }
public int inspection_delivery { get; set; }
public decimal daily_weighted_sales { get; set; }
public int transfer_delivery { get; set; }
public int transfer_bale_delivery { get; set; }
public int abroad_inbound_delivery { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoTurnOver.Models
{
public class charts_line_dto
{
public List<string> x { get; set; }
public List<data_dto> y { get; set; }
public List<string> y_name { get {
if (y == null || y.Count<1)
{
return new List<string>();
}
else
{
return y.Select(s=>s.name).ToList();
}
} }
public class data_dto
{
public string name { get; set; }
public string type { get; set; }
public List<decimal> data { get; set; }
}
}
}
......@@ -468,6 +468,8 @@ namespace AutoTurnOver.Models
{
[Description("监控状态")]
public int? monitor_status { get; set; }
[Description("单号")]
public string order_no { get; set; }
[Description("Asin")]
public string asin { get; set; }
public bool isSum { get; set; }
......
......@@ -439,6 +439,15 @@ namespace AutoTurnOver.Services
}
/// <summary>
/// 获取历史节点趋势图
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public charts_line_dto GetHistoryDataNodes(string sku, string warehousecode)
{
return DB.dc_auto_turnover.GetHistoryDataNodes(sku, warehousecode);
}
}
}
......@@ -538,6 +538,16 @@ namespace AutoTurnOver.Controllers
return File(memory, "text/csv", "最新预计交期.csv");
}
/// <summary>
/// 获取历史节点趋势图
/// </summary>
/// <returns></returns>
public JsonResult GetHistoryDataNodes(string sku, string warehousecode)
{
var result = new Services.SkuAutoTurnServices().GetHistoryDataNodes(sku, warehousecode);
return new JsonResult(new { success = true, data = result });
}
}
}
\ No newline at end of file
......@@ -112,9 +112,6 @@ namespace ResetOutofstock
Console.WriteLine($"结束拷贝 周转预测值 报表 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
public override void Dispose()
......
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