Example #1
0
File: main.cs Project: hkiaipc/guye
        //xd100n数据处理
        private void rz_deal(byte[] rs ,int listid)
        {
            Tool.XD100n x = new Tool.XD100n(rs[0]);

            //实时数据模拟量 功能码0x04
            if (rs[1] == 0x04 && rs[2] == 0x64)
            {
                try
                {
                    Tool.XD100nData d = new Tool.XD100nData();
                    d = x.Read_nowdata(rs);
                    _XDRZInfoList[listid]._nowDatas = d;
                    _XDRZInfoList[listid]._command[0]._retrytimesnow = 0;
                    _XDRZInfoList[listid]._command[0]._sendover = false;
                }
                catch
                { }
            }
            //实时数据数字量 功能码0x02
            if (rs[1] == 0x02 && rs[2] == 0x04)
            {
                try
                {
                    Tool.GRPumpState ps = x.getpumpstate(rs);
                    Tool.GRAlarmData ad = x.getalarmstate(rs);
                    _XDRZInfoList[listid]._nowDatas._alarm = ad;
                    _XDRZInfoList[listid]._nowDatas._pump = ps;
                    _XDRZInfoList[listid]._saveDatas = true;
                    _XDRZInfoList[listid]._refDisplay = true;
                    _XDRZInfoList[listid]._command[1]._retrytimesnow = 0;
                    _XDRZInfoList[listid]._command[1]._sendover = false;
                }
                catch
                { }
            }

            //03可读返回
            if (rs[1] == 0x03)
            {
                //控制方法114
                if (_XDRZInfoList[listid].lastaddr == 114 - 1)
                {
                    _XDRZInfoList[listid]._Set._controltype = x.Read_controltype(rs);
                    _XDRZInfoList[listid]._commandonce[0]._back = true;
                    _XDRZInfoList[listid]._commandonce[0]._sendover = false;
                }
                //设定值116
                if (_XDRZInfoList[listid].lastaddr == 116 - 1)
                {
                    _XDRZInfoList[listid]._Set._setvalue = x.Read_setvalue(rs);
                    _XDRZInfoList[listid]._commandonce[1]._back = true;
                    _XDRZInfoList[listid]._commandonce[1]._sendover = false;
                }
                //曲线117
                if (_XDRZInfoList[listid].lastaddr == 117 - 1)
                {
                    _XDRZInfoList[listid]._Set._line = x.Read_line(rs);
                    _XDRZInfoList[listid]._commandonce[2]._back = true;
                    _XDRZInfoList[listid]._commandonce[2]._sendover = false;
                }
                //分时调整133
                if (_XDRZInfoList[listid].lastaddr == 133 - 1)
                {
                    _XDRZInfoList[listid]._Set._timepace = x.Read_timepace(rs);
                    _XDRZInfoList[listid]._commandonce[3]._back = true;
                    _XDRZInfoList[listid]._commandonce[3]._sendover = false;
                }
                //开度最大最小值145
                if (_XDRZInfoList[listid].lastaddr == 145 - 1)
                {
                    _XDRZInfoList[listid]._Set._valvemm = x.Read_valvemm(rs);
                    _XDRZInfoList[listid]._commandonce[4]._back = true;
                    _XDRZInfoList[listid]._commandonce[4]._sendover = false;
                }
                //流量限定153
                if (_XDRZInfoList[listid].lastaddr == 153 - 1)
                {
                    _XDRZInfoList[listid]._Set._valvelimit = x.Read_valvelimit(rs);
                    _XDRZInfoList[listid]._commandonce[5]._back = true;
                    _XDRZInfoList[listid]._commandonce[5]._sendover = false;
                }
                //报警198
                if (_XDRZInfoList[listid].lastaddr == 198 - 1)
                {
                    _XDRZInfoList[listid]._Set._alarm = x.Read_alarm(rs);
                    _XDRZInfoList[listid]._commandonce[6]._back = true;
                    _XDRZInfoList[listid]._commandonce[6]._sendover = false;
                }
                //室外温度206
                if (_XDRZInfoList[listid].lastaddr == 206 - 1)
                {
                    _XDRZInfoList[listid]._Set._outtemp = x.Read_outtemp(rs);
                    _XDRZInfoList[listid]._commandonce[7]._back = true;
                    _XDRZInfoList[listid]._commandonce[7]._sendover = false;
                }
                //刷新设置
                rz.rz_flowchart.refsetdisplay = 1;

            }
            //10写返回
            if (rs[1] == 0x10)
            {
                //控制方法114
                if (_XDRZInfoList[listid].lastaddr == 114 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[8]._back = true;
                    _XDRZInfoList[listid]._commandonce[8]._sendover = false;

                }
                //设定值116
                if (_XDRZInfoList[listid].lastaddr == 116 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[9]._back = true;
                    _XDRZInfoList[listid]._commandonce[9]._sendover = false;
                }
                //曲线117
                if (_XDRZInfoList[listid].lastaddr == 117 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[10]._back = true;
                    _XDRZInfoList[listid]._commandonce[10]._sendover = false;
                }
                //分时调整133
                if (_XDRZInfoList[listid].lastaddr == 133 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[11]._back = true;
                    _XDRZInfoList[listid]._commandonce[11]._sendover = false;
                }
                //开度最大最小值145
                if (_XDRZInfoList[listid].lastaddr == 145 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[12]._back = true;
                    _XDRZInfoList[listid]._commandonce[12]._sendover = false;
                }
                //流量限定153
                if (_XDRZInfoList[listid].lastaddr == 153 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[13]._back = true;
                    _XDRZInfoList[listid]._commandonce[13]._sendover = false;
                }
                //报警198
                if (_XDRZInfoList[listid].lastaddr == 198 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[14]._back = true;
                    _XDRZInfoList[listid]._commandonce[14]._sendover = false;
                }
                //室外温度206
                if (_XDRZInfoList[listid].lastaddr == 206 - 1)
                {
                    _XDRZInfoList[listid]._commandonce[15]._back = true;
                    _XDRZInfoList[listid]._commandonce[15]._sendover = false;
                }
                //刷新设置
                rz.rz_flowchart.refsetdisplay = 1;

            }
            //急停返回
            if (rs[1] == 0x0F)
            {
                //循环泵启动返回
                if (rs[3] == 0x04)
                {
                    //古冶特定版本 2010-3-22验收
                    _XDRZInfoList[listid]._commandonce[17]._cmd = x.Set_xunhuan_stop();
                    _XDRZInfoList[listid]._commandonce[17]._onoff = true;

                    _XDRZInfoList[listid]._commandonce[19]._back = true;
                    _XDRZInfoList[listid]._commandonce[19]._sendover = false;
                }
                //补水泵启动返回
                if (rs[3] == 0x06)
                {
                    _XDRZInfoList[listid]._commandonce[18]._cmd = x.Set_bushui_stop();
                    _XDRZInfoList[listid]._commandonce[18]._onoff = true;
                    _XDRZInfoList[listid]._commandonce[20]._back = true;
                    _XDRZInfoList[listid]._commandonce[20]._sendover = false;
                }

                //循环泵急停返回
                if (rs[3] == 0x05)
                {
                    _XDRZInfoList[listid]._commandonce[17]._back = true;
                    _XDRZInfoList[listid]._commandonce[17]._sendover = false;
                }
                //补水泵急停返回
                if (rs[3] == 0x07)
                {
                    _XDRZInfoList[listid]._commandonce[18]._back = true;
                    _XDRZInfoList[listid]._commandonce[18]._sendover = false;
                }

                //刷新设置
                rz.rz_flowchart.refsetdisplay = 1;
            }
            _XDRZInfoList[listid].state = true;
            //解除ISocketRS占用
            On_ISocketRS(_XDRZInfoList[listid]._station._IPAddress, false);
        }