Exemplo n.º 1
0
        public EditableDeviceInfo8001(DeviceInfo8001 deviceInfo8001)
        {
            this.Loop   = deviceInfo8001.Loop;
            this.LoopID = deviceInfo8001.LoopID;
            //this.MachineNo = deviceInfo8001.MachineNo;//临时应用
            this.ID   = deviceInfo8001.ID;
            this.Code = deviceInfo8001.Code;
            //this.SimpleCode = deviceInfo8001.SimpleCode;
            this.TypeCode = deviceInfo8001.TypeCode;

            this.LinkageGroup1 = deviceInfo8001.LinkageGroup1;
            this.LinkageGroup2 = deviceInfo8001.LinkageGroup2;
            this.LinkageGroup3 = deviceInfo8001.LinkageGroup3;

            this.BoardNo       = deviceInfo8001.BoardNo;
            this.SubBoardNo    = deviceInfo8001.SubBoardNo;
            this.KeyNo         = deviceInfo8001.KeyNo;
            this.BroadcastZone = deviceInfo8001.BroadcastZone;

            this.DelayValue     = deviceInfo8001.DelayValue;
            this.SensitiveLevel = deviceInfo8001.SensitiveLevel;
            this.Feature        = deviceInfo8001.Feature;
            this.Disable        = deviceInfo8001.Disable;


            this.BuildingNo = deviceInfo8001.BuildingNo;
            this.ZoneNo     = deviceInfo8001.ZoneNo;
            this.FloorNo    = deviceInfo8001.FloorNo;
            this.RoomNo     = deviceInfo8001.RoomNo;
            this.Location   = deviceInfo8001.Location;
            this.sdpKey     = deviceInfo8001.sdpKey;
            this.MCBCode    = deviceInfo8001.MCBCode;
        }
Exemplo n.º 2
0
        public DeviceInfo8001 ToDeviceInfo8001()
        {
            DeviceInfo8001 deviceInfo8001 = new DeviceInfo8001();

            deviceInfo8001.Loop   = this.Loop;
            deviceInfo8001.LoopID = this.LoopID;
            //this.MachineNo = deviceInfo8001.MachineNo;//临时应用
            deviceInfo8001.ID   = this.ID;
            deviceInfo8001.Code = this.Code;
            //deviceInfo8001.SimpleCode = this.SimpleCode;
            deviceInfo8001.TypeCode       = this.TypeCode;
            deviceInfo8001.LinkageGroup1  = this.LinkageGroup1;
            deviceInfo8001.LinkageGroup2  = this.LinkageGroup2;
            deviceInfo8001.LinkageGroup3  = this.LinkageGroup3;
            deviceInfo8001.BoardNo        = this.BoardNo;
            deviceInfo8001.SubBoardNo     = this.SubBoardNo;
            deviceInfo8001.KeyNo          = this.KeyNo;
            deviceInfo8001.BroadcastZone  = this.BroadcastZone;
            deviceInfo8001.DelayValue     = this.DelayValue;
            deviceInfo8001.SensitiveLevel = this.SensitiveLevel;
            deviceInfo8001.Feature        = this.Feature;
            deviceInfo8001.Disable        = this.Disable;
            deviceInfo8001.BuildingNo     = this.BuildingNo;
            deviceInfo8001.ZoneNo         = this.ZoneNo;
            deviceInfo8001.FloorNo        = this.FloorNo;
            deviceInfo8001.RoomNo         = this.RoomNo;
            deviceInfo8001.Location       = this.Location;
            deviceInfo8001.sdpKey         = this.sdpKey;
            deviceInfo8001.MCBCode        = this.MCBCode;
            return(deviceInfo8001);
        }
Exemplo n.º 3
0
        public static Dictionary <DeviceInfo8001, LinkageSimulatorDeviceStatus> EmulateLinkageStandardInfo(List <Model.DeviceInfo8001> lstSourceDevices, ControllerModel controller)
        {
            dictStandardLinkageCount.Clear();
            Dictionary <DeviceInfo8001, LinkageSimulatorDeviceStatus> linkageResult = new Dictionary <DeviceInfo8001, LinkageSimulatorDeviceStatus>();

            StandardLinkageTriggerForDevice(lstSourceDevices);         //初始化输出组信息并计数
            StandardLinkageTriggerForGroup(controller.StandardConfig); //记录处于激活的输出组信息
            List <DeviceInfo8001> lstAllDevices = GetControllerDevices(controller);

            foreach (var code in lstDeviceCode)
            {
                if (code.Substring(0, controller.DeviceAddressLength - 5) != controller.MachineNumber)
                {
                    linkageResult.Add(new DeviceInfo8001 {
                        Code = code
                    }, LinkageSimulatorDeviceStatus.OtherMachine);
                }
                else
                {
                    DeviceInfo8001 dev = lstAllDevices.Find(x => x.Code == code);
                    if (dev != null)
                    {
                        linkageResult.Add(dev, LinkageSimulatorDeviceStatus.Actived);
                    }
                    else
                    {
                        linkageResult.Add(new DeviceInfo8001 {
                            Code = code
                        }, LinkageSimulatorDeviceStatus.NotDefined);
                    }
                }
            }
            return(linkageResult);
        }
Exemplo n.º 4
0
        public bool GetDevicesByLoopForControllerType8001(ref LoopModel loop, Dictionary <string, string> dictDeviceMappingManualControlBoard)
        {
            List <DeviceInfo8001> lstDeviceInfo8001 = new List <DeviceInfo8001>();

            string strDeviceQuerySQL = "select bianhao,leixing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,panhao,jianhao,cleixing,GbZone,didian,louhao,quhao,cenghao,fangjianhao,sdpkey from ";

            //if (Version == 6) //8001控制器的版本6中增加了texing字段
            //{
            //    strDeviceQuerySQL = "select bianhao,leixing,texing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,panhao,jianhao,cleixing,GbZone,didian,louhao,quhao,cenghao,fangjianhao,sdpkey from ";
            //}
            strDeviceQuerySQL += loop.Code;
            DataTable dtDevices          = _databaseService.GetDataTableBySQL(new StringBuilder(strDeviceQuerySQL));
            int       dtDevicesRowsCount = dtDevices.Rows.Count;

            for (int j = 0; j < dtDevicesRowsCount; j++) //器件信息
            {
                DeviceInfo8001 device = new DeviceInfo8001();
                device.Code           = dtDevices.Rows[j]["bianhao"].ToString();
                device.Disable        = dtDevices.Rows[j]["geli"].ToString().ToNullable <bool>();
                device.SensitiveLevel = dtDevices.Rows[j]["lingmd"].ToString().ToNullable <Int16>();
                device.LinkageGroup1  = dtDevices.Rows[j]["shuchu1"].ToString();
                device.LinkageGroup2  = dtDevices.Rows[j]["shuchu2"].ToString();
                device.LinkageGroup3  = dtDevices.Rows[j]["shuchu3"].ToString();
                device.DelayValue     = dtDevices.Rows[j]["yanshi"].ToString().ToNullable <Int16>();
                device.BoardNo        = dtDevices.Rows[j]["xianggh"].ToString().ToNullable <Int16>();
                device.SubBoardNo     = dtDevices.Rows[j]["panhao"].ToString().ToNullable <Int16>();
                device.KeyNo          = dtDevices.Rows[j]["jianhao"].ToString().ToNullable <Int16>();
                Int16?intTypeCode = dtDevices.Rows[j]["leixing"].ToString().Substring(0, 3).ToNullable <Int16>();
                device.TypeCode      = (short)intTypeCode;
                device.BroadcastZone = dtDevices.Rows[j]["GbZone"].ToString();
                device.Location      = dtDevices.Rows[j]["didian"].ToString();
                device.BuildingNo    = dtDevices.Rows[j]["louhao"].ToString().ToNullable <Int16>();
                device.ZoneNo        = dtDevices.Rows[j]["quhao"].ToString().ToNullable <Int16>();
                device.FloorNo       = dtDevices.Rows[j]["cenghao"].ToString().ToNullable <Int16>();
                device.RoomNo        = dtDevices.Rows[j]["fangjianhao"].ToString().ToNullable <Int16>();
                device.sdpKey        = dtDevices.Rows[j]["sdpkey"].ToString();
                device.Loop          = loop;
                if (dictDeviceMappingManualControlBoard != null)
                {
                    if (dictDeviceMappingManualControlBoard.ContainsKey(device.Code))//如果存在网络手动盘的信息定义,则设置MCBCode的值,建立与手动盘的关系
                    {
                        device.MCBCode = dictDeviceMappingManualControlBoard[device.Code];
                    }
                }
                //if(lstDeviceInfo8001.Count>0)
                //{
                //    _deviceAddressLength = lstDeviceInfo8001[0].Code.Length;
                //}
                loop.SetDevice <DeviceInfo8001>(device);
                lstDeviceInfo8001.Add(device);
            }
            return(true);
        }
Exemplo n.º 5
0
        public DeviceInfo8001 Builder()
        {
            DeviceInfo8001 device = new DeviceInfo8001
            {
                ID = _id,
                //SimpleCode = _simpleCode,
                TypeCode      = _type,
                Disable       = _disable,
                LoopID        = _loopID,
                LinkageGroup1 = _linkageGroup1,
                LinkageGroup2 = _linkageGroup2,
                LinkageGroup3 = _linkageGroup3,
                Code          = _code
            };

            return(device);
        }
Exemplo n.º 6
0
        public bool  GetDevicesInLoop(ref LoopModel loop, Dictionary <string, string> dictDeviceMappingManualControlBoard)
        {
            List <DeviceInfo8001> lstDeviceInfo8001 = new List <DeviceInfo8001>();

            try
            {
                string strDeviceQuerySQL = "select bianhao,leixing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,panhao,jianhao,cleixing,GbZone,didian,louhao,quhao,cenghao,fangjianhao,sdpkey from ";
                if (Version == 6) //8001控制器的版本6中增加了texing字段
                {
                    strDeviceQuerySQL = "select bianhao,leixing,texing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,panhao,jianhao,cleixing,GbZone,didian,louhao,quhao,cenghao,fangjianhao,sdpkey from ";
                }
                strDeviceQuerySQL += loop.Code;
                DataTable dtDevices          = _databaseService.GetDataTableBySQL(new StringBuilder(strDeviceQuerySQL));
                int       dtDevicesRowsCount = dtDevices.Rows.Count;

                for (int j = 0; j < dtDevicesRowsCount; j++) //器件信息
                {
                    DeviceInfo8001 device = new DeviceInfo8001();
                    device.Code           = dtDevices.Rows[j]["bianhao"].ToString();
                    device.Disable        = dtDevices.Rows[j]["geli"].ToString().ToNullable <bool>();
                    device.SensitiveLevel = dtDevices.Rows[j]["lingmd"].ToString().ToNullable <Int16>();
                    device.LinkageGroup1  = dtDevices.Rows[j]["shuchu1"].ToString();
                    device.LinkageGroup2  = dtDevices.Rows[j]["shuchu2"].ToString();
                    device.LinkageGroup3  = dtDevices.Rows[j]["shuchu3"].ToString();
                    device.DelayValue     = dtDevices.Rows[j]["yanshi"].ToString().ToNullable <Int16>();
                    device.BoardNo        = dtDevices.Rows[j]["xianggh"].ToString().ToNullable <Int16>();
                    device.SubBoardNo     = dtDevices.Rows[j]["panhao"].ToString().ToNullable <Int16>();
                    device.KeyNo          = dtDevices.Rows[j]["jianhao"].ToString().ToNullable <Int16>();
                    Int16?intTypeCode = dtDevices.Rows[j]["leixing"].ToString().Substring(0, 3).ToNullable <Int16>();
                    //不存储cleixing
                    if (Version > 5) //从第6版开始增加了"特性"列
                    {
                        device.Feature  = dtDevices.Rows[j]["texing"].ToString().ToNullable <Int16>();
                        device.TypeCode = (short)intTypeCode;
                    }
                    else
                    {
                        // 特性字段值 更新依据:
                        // 1>"器件类型编号">36且<66-->特性字段为0
                        // 2>"器件类型编号">=101且<=129-->特性字段为1
                        // 器件编码更新依据:
                        // 1> "器件类型编号">=101且<=129 --> 更新为"器件类型编号"-64
                        // 2> cleixing字段为中文名称,需要去掉“自锁”及“点动”前缀(由于本软件中不存储中文名称,故不需更新)
                        if (intTypeCode > 36 && intTypeCode < 66)
                        {
                            device.Feature  = 0;
                            device.TypeCode = (short)intTypeCode;
                        }
                        else if (intTypeCode >= 101 && intTypeCode <= 129)
                        {
                            device.TypeCode = Convert.ToInt16(intTypeCode - 64);
                            device.Feature  = 1;
                        }
                        else
                        {
                            device.TypeCode = (short)intTypeCode;
                        }
                    }
                    device.BroadcastZone = dtDevices.Rows[j]["GbZone"].ToString();
                    device.Location      = dtDevices.Rows[j]["didian"].ToString();

                    device.BuildingNo = dtDevices.Rows[j]["louhao"].ToString().ToNullable <Int16>();
                    device.ZoneNo     = dtDevices.Rows[j]["quhao"].ToString().ToNullable <Int16>();
                    device.FloorNo    = dtDevices.Rows[j]["cenghao"].ToString().ToNullable <Int16>();
                    device.RoomNo     = dtDevices.Rows[j]["fangjianhao"].ToString().ToNullable <Int16>();
                    device.sdpKey     = dtDevices.Rows[j]["sdpkey"].ToString();
                    device.Loop       = loop;
                    if (dictDeviceMappingManualControlBoard != null)
                    {
                        if (dictDeviceMappingManualControlBoard.ContainsKey(device.Code))//如果存在网络手动盘的信息定义,则设置MCBCode的值,建立与手动盘的关系
                        {
                            device.MCBCode = dictDeviceMappingManualControlBoard[device.Code];
                        }
                    }
                    if (lstDeviceInfo8001.Count > 0)
                    {
                        _deviceAddressLength = lstDeviceInfo8001[0].Code.Length;
                    }
                    loop.SetDevice <DeviceInfo8001>(device);
                    lstDeviceInfo8001.Add(device);
                }
            }
            catch
            {
                return(false);
            }
            return(true);
            //return (List<T>)lstDeviceInfo8001;
        }
Exemplo n.º 7
0
 public int AddDeviceForControllerType8001(DeviceInfo8001 deviceInfo)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
        private bool GenerateDeviceID(ControllerType controllerType, ref LoopModel loop)
        {
            bool resultFlag = false;

            try
            {
                switch (controllerType)
                {
                case ControllerType.NT8001:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8001;
                    List <DeviceInfo8001> lstDeviceInfo = loop.GetDevices <DeviceInfo8001>();
                    for (int i = 0; i < lstDeviceInfo.Count; i++)
                    {
                        maxDeviceID++;
                        DeviceInfo8001 deviceInfo = lstDeviceInfo[i];
                        deviceInfo.ID    = maxDeviceID;
                        lstDeviceInfo[i] = deviceInfo;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8001 = maxDeviceID;
                }
                break;

                case ControllerType.NT8007:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8007;
                    List <DeviceInfo8007> lstDeviceInfo = loop.GetDevices <DeviceInfo8007>();
                    foreach (var device in lstDeviceInfo)
                    {
                        maxDeviceID++;
                        device.ID = maxDeviceID;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8007 = maxDeviceID;
                }
                break;

                case ControllerType.NT8021:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8021;
                    List <DeviceInfo8021> lstDeviceInfo = loop.GetDevices <DeviceInfo8021>();
                    for (int i = 0; i < lstDeviceInfo.Count; i++)
                    {
                        maxDeviceID++;
                        DeviceInfo8021 deviceInfo = lstDeviceInfo[i];
                        deviceInfo.ID    = maxDeviceID;
                        lstDeviceInfo[i] = deviceInfo;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8021 = maxDeviceID;
                }
                break;

                case ControllerType.NT8036:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8036;
                    List <DeviceInfo8036> lstDeviceInfo = loop.GetDevices <DeviceInfo8036>();
                    for (int i = 0; i < lstDeviceInfo.Count; i++)
                    {
                        maxDeviceID++;
                        DeviceInfo8036 deviceInfo = lstDeviceInfo[i];
                        deviceInfo.ID    = maxDeviceID;
                        lstDeviceInfo[i] = deviceInfo;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8036 = maxDeviceID;
                }
                break;

                case ControllerType.FT8000:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8000;
                    List <DeviceInfo8000> lstDeviceInfo = loop.GetDevices <DeviceInfo8000>();
                    for (int i = 0; i < lstDeviceInfo.Count; i++)
                    {
                        maxDeviceID++;
                        DeviceInfo8000 deviceInfo = lstDeviceInfo[i];
                        deviceInfo.ID    = maxDeviceID;
                        lstDeviceInfo[i] = deviceInfo;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8000 = maxDeviceID;
                }
                break;

                case ControllerType.FT8003:
                {
                    int maxDeviceID = ProjectManager.GetInstance.MaxDeviceIDInController8003;
                    List <DeviceInfo8003> lstDeviceInfo = loop.GetDevices <DeviceInfo8003>();
                    for (int i = 0; i < lstDeviceInfo.Count; i++)
                    {
                        maxDeviceID++;
                        DeviceInfo8003 deviceInfo = lstDeviceInfo[i];
                        deviceInfo.ID    = maxDeviceID;
                        lstDeviceInfo[i] = deviceInfo;
                    }
                    ProjectManager.GetInstance.MaxDeviceIDInController8003 = maxDeviceID;
                }
                break;
                }
                resultFlag = true;
            }
            catch
            {
            }
            return(resultFlag);
        }