예제 #1
0
        /// <summary>
        /// 初始化区域二待命点成员
        /// </summary>
        private void InitWaitPointAreaTwoMember()
        {
            string section = "AreaTwoConfig";

            string keyPre = string.Format("待名点个数");

            string read = ConfigHelper.IniReadValue(section, keyPre, 100);

            if (string.IsNullOrEmpty(read))
            {
                read = "3";

                ConfigHelper.IniWriteValue(section, keyPre, read);
            }

            if (!Int32.TryParse(read, out _waitCountAreaTwo))
            {
                _waitCountAreaTwo = 3;
            }

            _waitAreaTwoList.Clear();

            for (int i = 1; i <= _waitCountAreaTwo; i++)
            {
                AreaTwoWaitPointMember member = GetConfigArea2Member(i);

                _waitAreaTwoList.Add(member);

                _waitAreaTwoList = _waitAreaTwoList.OrderBy(c => c.OrderIndex).ToList();
            }
        }
예제 #2
0
        /// <summary>
        /// 返回区域二附近的待命点
        /// </summary>
        private void BackToPointAround()
        {
            if (_devArea2 == null)
            {
                return;
            }

            if (_devTarWait == null)
            {
                WcfMainHelper.InitPara(_severIp, "", "");

                List <DispatchBackMember> diss = WcfMainHelper.GetDispatchList();

                List <DeviceBackImf> devs = WcfMainHelper.GetDevList();

                foreach (var item in _waitAreaTwoList)
                {
                    if ((!IsDispatchContainPath(diss, item.StaTarget)) && (!IsDevOnSite(devs, item.StaSite)))
                    {
                        _devTarWait = item;

                        break;
                    }
                }
            }

            if (_devTarWait != null)
            {
                WcfMainHelper.InitPara(_severIp, "", "");

                DeviceBackImf result = WcfMainHelper.GetDev(_devArea2.DevId);

                if (result != null)
                {
                    if (result.SensorList.Find(c => { return(c.SenId == string.Format("{0}0003", _devArea2.DevId)); }).RValue == _devTarWait.StaTarget.ToString())
                    {
                        _devTarWait = null;

                        _devArea2 = null;
                    }
                    else
                    {
                        WcfMainHelper.SendOrder(_devArea2.DevId, new CommonDeviceOrderObj(DeviceOrderTypeEnum.OrderIndexThree, _devTarWait.StaTarget));
                    }
                }
            }
        }