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("刷新缺货数据任务启动...");
            try
            {
                
                var now = DateTime.Now;
                //dc_auto_turnover.CopyForecast();
                //report.GenerateWeekTagStockDatas();
                //dc_base_transfer_extend_dao.SynchroLmsTransferOrder();
                //dc_base_supplier_dao.SynchroBailunLmsChannel();
                //dc_base_trans_temp_schedule_dao.SynchroTransTempScheduleData(true);
                //dc_auto_turnover.CalculationProfitAnalysis("LM-EO-007", "MMDUSFBA");
                //dc_auto_turnover.SynchroCalculationProfitAnalysis();
                //dc_auto_turnover.SynchroCalculationProfitAnalysis();

                //dc_base_transfer_freight_dao.CalculationSingle("946549801", "GB4PXBL");
                //dc_base_transfer_freight_dao.Init();

                //daily.ResetFbaExtendSales(DateTime.Now);
                //dc_base_transfer_extend_dao.SynchroLmsTransferOrder();
                //dc_base_full_link_wait_order_dao.ResetDatas();
                //dc_auto_turnover.set_full_stock_use_days_turnover_sales(dc_auto_turnover.GetModel("250924601", "USFBABLXJ"));
                //dc_base_trans_temp_schedule_dao.SynchroTransTempScheduleData(true);
                //daily.ResetGmvExtendSales(now);
                //report.ResetTransExpectArrivaltime();
                //base_sku_dao.SynchroSkuCharacter();
                //report.ClearShopifyJitInventory();
                //report.ShopifyJitInventory();
                //daily.ResetOrders7();

            }
            catch (Exception ex)
            {
                throw;
            }
           

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

            await builder.RunConsoleAsync();
        }
    }
}
