Example #1
0
        /// <summary>
        /// 启动所有服务。
        /// </summary>
        public void StartServices()
        {
            LocalSettings localSettings = new XmlSerializerWrapper <LocalSettings>().Entity;

            //使用 LocalSettings 里的数据库连接信息覆盖 App.config 里的
            Configuration            configuration            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConnectionStringSettings connectionStringSettings = configuration.ConnectionStrings.ConnectionStrings["GeelyPtlEntities"];

            connectionStringSettings.ProviderName     = localSettings.ConnectionStringProviderName;
            connectionStringSettings.ConnectionString = string.Format(CultureInfo.InvariantCulture, localSettings.ConnectionStringFormat, localSettings.ConnectionStringPassword);
            configuration.Save();
            ConfigurationManager.RefreshSection("connectionStrings");

            //确保基础数据已存在于数据库
            BaseDatasInitializer.EnsureInitialized();

            //启动通讯之前重值所有设备的在线状态
            this.DeviceOnLineStatusReset();

            //承载所有接口服务
            ServiceHosts.Open(localSettings.ServiceIP, localSettings.ServicePort);

            //启动设备通讯
            CartPtlHost.Instance.Start();
            ChannelPtlHost.Instance.Start();

            //启动PickZone通讯
            PickZoneHost.Instance.Start();
            //启动FeedZone通讯(分装工位)
            FeedZoneHost.Instance.Start();
            CacheRegionHost.Instance.Start();
            AssemblySectionHost.Instance.Start();

            //启动MarketZone通讯
            MarketZoneHost.Instance.Start();

            //启动任务加载业务
            AssortingExecutorLoader.Instance.Start();
            CartFindingExecutor.Instance.Start();
            IndicatingExecutorLoader.Instance.Start();

            //启动结果回写业务
            AssortResultWriteBack.Instance.Start(localSettings.PtlToLesServiceUrl);
            CartFindingDeliveryResultWriteBack.Instance.Start(localSettings.PtlToLesServiceUrl);
            AssembleResultWriteBack.Instance.Start(localSettings.PtlToMesServiceUrl);

            //启动历史记录清除器
            Ptl.Device.Log.Logger.HoldingPeriodInDays = localSettings.HistoryHoldingDays;
            HistoryRecordsRemover.Instance.Start(localSettings.HistoryHoldingDays);

            //启动AGV配送任务发送业务
            PickAreaService.Instance.Start(localSettings.PtlToAgvServiceUrl);
            ProductAreaService.Instance.Start(localSettings.PtlToAgvServiceUrl);
            InitService.Instance.Start(localSettings.PtlToAgvServiceUrl);

            //启动状态监控
            this.StartRunningStatusRefreshThread();
        }
Example #2
0
        /// <summary>
        /// 重新启动所有可临时中断的服务。
        /// </summary>
        public void RestartSafelyServices()
        {
            LocalSettings localSettings = new XmlSerializerWrapper <LocalSettings>().Entity;

            //停止所有可临时中断的服务
            this.StopRunningStatusRefreshThread();

            PickAreaService.Instance.Stop();
            ProductAreaService.Instance.Stop();
            InitService.Instance.Stop();

            HistoryRecordsRemover.Instance.Stop();

            AssortResultWriteBack.Instance.Stop();
            CartFindingDeliveryResultWriteBack.Instance.Stop();
            AssembleResultWriteBack.Instance.Stop();

            AssortingExecutorLoader.Instance.Stop();
            CartFindingExecutor.Instance.Stop();
            IndicatingExecutorLoader.Instance.Stop();

            ServiceHosts.Close();

            //启动所有可临时中断的服务
            ServiceHosts.Open(localSettings.ServiceIP, localSettings.ServicePort);

            AssortingExecutorLoader.Instance.Start();
            CartFindingExecutor.Instance.Start();
            IndicatingExecutorLoader.Instance.Start();

            AssortResultWriteBack.Instance.Start(localSettings.PtlToLesServiceUrl);
            CartFindingDeliveryResultWriteBack.Instance.Start(localSettings.PtlToLesServiceUrl);
            AssembleResultWriteBack.Instance.Start(localSettings.PtlToMesServiceUrl);

            HistoryRecordsRemover.Instance.Start(localSettings.HistoryHoldingDays);

            //启动AGV配送任务发送业务
            PickAreaService.Instance.Start(localSettings.PtlToAgvServiceUrl);
            ProductAreaService.Instance.Start(localSettings.PtlToAgvServiceUrl);
            InitService.Instance.Start(localSettings.PtlToAgvServiceUrl);

            this.StartRunningStatusRefreshThread();
        }