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

namespace ResetOutofstock
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("刷新缺货数据任务启动...");
            //report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
            //try
            //{
            //    var now = DateTime.Now;
            //    report_cash_flow_dao.CalculationOrder(now.AddMonths(-3), DateTime.Parse(now.ToString("yyyy-MM-dd 23:59:59")));
            //}
            //catch (Exception ex)
            //{

            //    throw;
            //}

            

            var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
            {
                services.AddHostedService<ResetOutofstockBackgrounService>();
                services.AddHostedService<CaseFlowBackgrounService>();
            });

            await builder.RunConsoleAsync();
        }
    }
}
