Commit b644c10d by lizefeng

平均入库天数,向下取整

parent 2aac719c
...@@ -12,7 +12,7 @@ namespace AutoGeneratePurchaseAdvise ...@@ -12,7 +12,7 @@ namespace AutoGeneratePurchaseAdvise
{ {
Console.WriteLine("采购建议计算任务启动..."); Console.WriteLine("采购建议计算任务启动...");
// 创建采购计划 // 创建采购计划
//PurchaseAdviseServices.Generate(); PurchaseAdviseServices.Generate();
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{ {
services.AddHostedService<GeneratePurchaseAdviseBackgroundService>(); services.AddHostedService<GeneratePurchaseAdviseBackgroundService>();
......
...@@ -52,7 +52,7 @@ where 1=1 "; ...@@ -52,7 +52,7 @@ where 1=1 ";
else else
{ {
sql = @"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2', sql = @"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2',
t4.product_inner_code,t4.product_code,t4.bailun_category_name, t4.product_inner_code,t4.product_code,t4.bailun_category_name,t4.buyer_name,
( case when t5.`status`=0 or t5.`status` is null then 0 else 1 end ) as 'monitor_status',t4.suppliers_name ( case when t5.`status`=0 or t5.`status` is null then 0 else 1 end ) as 'monitor_status',t4.suppliers_name
from dc_auto_turnover as dat from dc_auto_turnover as dat
left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code
......
...@@ -356,6 +356,8 @@ namespace AutoTurnOver.Models ...@@ -356,6 +356,8 @@ namespace AutoTurnOver.Models
public string supplier_name { get; set; } public string supplier_name { get; set; }
public string buyer_name { get; set; }
} }
} }
...@@ -106,7 +106,7 @@ namespace AutoTurnOver.Services ...@@ -106,7 +106,7 @@ namespace AutoTurnOver.Services
var inboundList = AveragePurchase.GetInboundList(purchaseWList.Select(s => s.purchase_id), skuItem.bailun_sku); var inboundList = AveragePurchase.GetInboundList(purchaseWList.Select(s => s.purchase_id), skuItem.bailun_sku);
if (inboundList != null && inboundList.Count() >= 1) if (inboundList != null && inboundList.Count() >= 1)
{ {
dataWarehouse.inbound_days = (int)inboundList.Sum(s => (s.update_time - s.arrival_time).TotalDays) / inboundList.Count(); dataWarehouse.inbound_days = (int)inboundList.Sum(s => Math.Ceiling((s.update_time - s.arrival_time).TotalHours / 24)) / inboundList.Count();
} }
else else
{ {
......
...@@ -171,13 +171,14 @@ namespace AutoTurnOver.Controllers ...@@ -171,13 +171,14 @@ namespace AutoTurnOver.Controllers
p.product_code, p.product_code,
p.bailun_category_name, p.bailun_category_name,
p.monitor_status, p.monitor_status,
p.supplier_name p.supplier_name,
p.buyer_name
}); });
DataTable table = new DataTable(); DataTable table = new DataTable();
string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ", string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ",
"采购在途", "调拨在途", "昨日销量", "明日销量", "未来7天日均", "未来14天日均", "建议采购数", "活动促销数量", "采购在途", "调拨在途", "昨日销量", "明日销量", "未来7天日均", "未来14天日均", "建议采购数", "活动促销数量",
"实际库存", "安全库存", "周转天数", "供应商交期", "质检入库天数", "调拨头程天数", "预测是否断货", "缺货数量","监控状态","供应商" "实际库存", "安全库存", "周转天数", "供应商交期", "质检入库天数", "调拨头程天数", "预测是否断货", "缺货数量","监控状态","供应商","采购员"
}; };
foreach (var item in cols) foreach (var item in cols)
{ {
...@@ -213,6 +214,7 @@ namespace AutoTurnOver.Controllers ...@@ -213,6 +214,7 @@ namespace AutoTurnOver.Controllers
row["缺货数量"] = itemData.quantity_out_stock; row["缺货数量"] = itemData.quantity_out_stock;
row["监控状态"] = itemData.monitor_status == 1 ? "停止监控" : "监控中"; row["监控状态"] = itemData.monitor_status == 1 ? "停止监控" : "监控中";
row["供应商"] = itemData.supplier_name; row["供应商"] = itemData.supplier_name;
row["采购员"] = itemData.buyer_name;
table.Rows.Add(row); table.Rows.Add(row);
} }
......
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