服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-08-26 ce47e1a46da2b1191faace70d8d8a64d6f400bf9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using Microsoft.Extensions.DependencyInjection;
using Rhea.Common;
using Sundial;
using Autofac;
using System;
using System.ComponentModel;
using Tiger.IBusiness;
using Tiger.Model;
 
namespace Tiger.Business
{
    /// <summary>
    /// 服务总控
    /// </summary>
    public class ServicesBus : IServicesBus
    {
 
        #region Functions
        public void StartServices(ISchedulerFactory schedulerFactory)
        {
            if (ApiConfig.RunInterface)
            {
                BizContext.InterfaceService = DI.Resolve<IInterfaceService>();
                BizContext.InterfaceService.SetSchedulerFactory(schedulerFactory);
                //启动时从服务器加载所有作业
                BizContext.InterfaceService.AddJobFromDB();
 
 
                //BizContext.InterfaceService.AddJob();
 
                //BizContext.InterfaceService.AddJob<Jobs.QqtSrmToXCSJJob>("XCSJ_QqtRM_Supplier_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("XCSJ_QqtRM_Supplier_Interface");
                //BizContext.InterfaceService.AddJob<Jobs.QqtSrmToDGXCJob>("DGXC_QqtRM_Supplier_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("DGXC_QqtRM_Supplier_Interface");
                //BizContext.InterfaceService.AddJob<Jobs.QqtSrmToAHXCJob>("AHXC_QqtRM_Supplier_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("AHXC_QqtRM_Supplier_Interface");
 
 
                //BizContext.InterfaceService.AddJob<Jobs.ReceiptHToErpXCSJJob>("XCSJ_ReceiptHToErp_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("XCSJ_ReceiptHToErp_Interface");
                //BizContext.InterfaceService.AddJob<Jobs.ReceiptHToErpDGXCJob>("DGXC_ReceiptHToErp_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("DGXC_ReceiptHToErp_Interface");
                //BizContext.InterfaceService.AddJob<Jobs.ReceiptHToErpAHXCJob>("AHXC_ReceiptHToErp_Interface", Triggers.Period(5 * 60 * 1000));
                //BizContext.InterfaceService.StartJob("AHXC_ReceiptHToErp_Interface");
 
                //BizContext.InterfaceService.StartJob();
                ConsoleExt.WriteLine("Start Interface Service..........", ConsoleColor.Yellow);
            }
        }
 
        public void StopServices()
        {
            ////关闭客户端监控
            //if (ApiConfig.RunMesInterface)
            //{
            //    MesInterfaceService.Stop();
            //    ConsoleExt.WriteLine("Stop MES Interface Service..........", ConsoleColor.Yellow);
            //}
            //if (ApiConfig.RunSrmInterface)
            //{
            //    SrmInterfaceService.Stop();
            //    ConsoleExt.WriteLine("Stop SRM Interface Service..........", ConsoleColor.Yellow);
            //}
        }
        #endregion
    }
}