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

namespace AutoGeneratePurchaseAdvise
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("采购建议计算任务启动...");
            
            try
            {

                //purchase_advise.ReplaceLogistics(DateTime.Now);
                //purchase_advise.WaitReplaceLogisticsTask();
                //PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("2020-11-27 19:40:00")));
                //PurchaseAdviseServices.AutoPushBuySys(6);
                //PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 12:00:00")));
            }
            catch (Exception ex)
            {
                throw;
            }
          
            var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
                {
                    services.AddHostedService<GeneratePurchaseAdviseBackgroundService>();
                    services.AddHostedService<FirstBackgroundService>();
                });

            await builder.RunConsoleAsync();
        }
    }
}
