using AutoTurnOver.DB;
using AutoTurnOver.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace AutoTurnOver.Purchase.AverageTarget
{
    /// <summary>
    /// 计算采购历史平均指标
    /// 最近5次平均交期
    /// 最近5次平均入库天数
    /// 最近5次平均（空运）调拨天数
    /// 最近5次平均（海运）调拨天数
    /// 最近5次平均采购价
    /// </summary>
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("采购平均值计算任务启动...");
            // 创建采购计划
            //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")}");
            //daily.SynchroPPSSkuStatus();
            var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
            {
                services.AddHostedService<AverageTargetBackgrounService>();
            });

            await builder.RunConsoleAsync();
        }
    }
}
