public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += RType.ToString("X").PadLeft(2, '0');
            UserDataAll += IsSend.ToString("X").PadLeft(2, '0');
            //kqz 2016-12-31 增加
            UserDataAll += NumAuthenType.ToString("X").PadLeft(2, '0');
            //kqz 2016-12-31 增加
            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            if (List_Identifier != null && List_Identifier.Count > 0)
            {
                foreach (Identifier iden in List_Identifier)
                {
                    UserDataAll += iden.GetHexStr();
                }
            }

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 3
0
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += Iden_F1.GetHexStr();
            for (int i = 0; i < stateDec.Length; i++)
            {
                if (States.Count > i)
                {
                    UserDataAll += States[i].ToString("X").PadLeft(4, '0');
                }
                else
                {
                    UserDataAll += "0000";
                }
            }

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 4
0
        public string WriteMsg()
        {
            if (Phone.Trim().Length > 11)
            {
                return("预警责任人号码读取非法!");
            }

            if (Phone.Trim() != "" && Tools.GetTest(Phone.Trim()) != "数字")
            {
                return("预警责任人号码读取非法!");
            }

            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += OrderNum.ToString("X").PadLeft(2, '0');
            UserDataAll += HexStringUtility.StrToHexString(Phone.Trim());

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 5
0
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += Iden_F1.GetHexStr();
            Identifier_45 iden = new Identifier_45();

            iden.AlarmStateV = "0".PadLeft(32, '0');
            iden.AlarmStateV = (isUsed ? "1" : "0").PadRight(10, '0').PadLeft(32, '0');
            UserData        += iden.GetHexStr();

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 6
0
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += Iden_F1.GetHexStr();
            VersionL     = (byte)HexStringUtility.StrToByteArray(VersionC).Length;
            UserDataAll += VersionL.ToString("X").PadLeft(2, '0');
            UserDataAll += HexStringUtility.StrToHexString(VersionC);

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 7
0
        public string WriteMsg()
        {
            /*UserData = "";
             * UserData += SerialNumber.ToString("X").PadLeft(4, '0');
             * UserData += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
             *
             * UserData += YellowLevel.ToString("X").PadLeft(4, '0');
             * UserData += OrangeLevel.ToString("X").PadLeft(4, '0');
             * UserData += RedLevel.ToString("X").PadLeft(4, '0');
             *
             * UserDataBytes = HexStringUtility.HexStringToByteArray(UserData);
             * return WriteMsgBase();*/
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += YellowLevel.ToString("X").PadLeft(4, '0');
            UserDataAll += OrangeLevel.ToString("X").PadLeft(4, '0');
            UserDataAll += RedLevel.ToString("X").PadLeft(4, '0');
            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 8
0
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += Iden_F1.GetHexStr();
            UserDataAll += newPW.GetHexStr();

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 9
0
        public string WriteMsg()
        {
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += Iden_F1.GetHexStr();

            int count = Ps.Length < PsOpen.Length ? Ps.Length : PsOpen.Length;

            UserData += count.ToString("X").PadLeft(2, '0');
            string s = "";

            for (int i = 0; i < count; i++)
            {
                if (Ps[i])
                {
                    s = "1" + s;
                }
                else
                {
                    s = "0" + s;
                }
            }
            s         = s.PadLeft(8 * ((count - 1) / 8 + 1), '0');
            UserData += HexStringUtility.BinStringToHexString(s);

            for (int i = 0; i < count; i++)
            {
                if (PsOpen[i] <= 9999)
                {
                    UserData += PsOpen[i].ToString().PadLeft(4, '0');
                }
                else if (PsOpen[i] > 9999)
                {
                    UserData += PsOpen[i].ToString().Substring(PsOpen[i].ToString().Length - 4);
                }
            }

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
        public string WriteMsg()
        {
            if (Values == null || Values.Length != 12)
            {
                return("雨量预警阈值读取非法!");
            }

            UserDataAll  = "";
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');
            UserDataAll += "01";
            UserDataAll += Values[0].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[1].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[2].ToString("X").PadLeft(2, '0');
            UserDataAll += "03";
            UserDataAll += Values[3].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[4].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[5].ToString("X").PadLeft(2, '0');
            UserDataAll += "06";
            UserDataAll += Values[6].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[7].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[8].ToString("X").PadLeft(2, '0');
            UserDataAll += "12";
            UserDataAll += Values[9].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[10].ToString("X").PadLeft(2, '0');
            UserDataAll += Values[11].ToString("X").PadLeft(2, '0');

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }
Ejemplo n.º 11
0
        public string WriteMsg()
        {
            if (Iden_04 == null)
            {
                return("时间步长码出错");
            }
            UserDataAll  = "";
            UserDataAll += SerialNumber.ToString("X").PadLeft(4, '0');
            UserDataAll += SendTime.ToString("yyMMddHHmmss").PadLeft(12, '0');

            /*
             * UserDataAll += HexStringUtility.ByteArrayToHexString(new byte[] { 0xF1, 0xF1 });
             * UserDataAll += RemoteStation.PadLeft(10, '0');
             * UserDataAll += StationType.ToString("X").PadLeft(2, '0');
             * */
            UserDataAll += Iden_F1.GetHexStr();

            /*
             * UserDataAll += HexStringUtility.ByteArrayToHexString(new byte[] { 0xF0, 0xF0 });
             * UserDataAll += ObsTime.ToString("yyMMddHHmm").PadLeft(10, '0');
             * */
            UserDataAll += Iden_F0.GetHexStr();
            UserDataAll += Iden_04.GetHexStr();
            if (Idens != null && Idens.Count > 0)
            {
                UserDataAll += Idens[0].GetHexStrHead();
                if (Idens[0].GetKey() != (byte)Identifier_Standard._FF)
                {
                    foreach (Identifier obj in Idens)
                    {
                        UserDataAll += obj.GetHexStr().Substring(4);
                    }
                }
                else
                {
                    foreach (Identifier obj in Idens)
                    {
                        UserDataAll += obj.GetHexStr().Substring(6);
                    }
                }
            }
            else
            {
                return("无有效数据");
            }

            byte[]             UserDataBytesAllTmp;
            WaterBaseMessage[] MsgListTmp;
            string             msg = WaterBaseMessageService.GetMsgList_WriteMsg(this, UserDataAll, out UserDataBytesAllTmp, out MsgListTmp);

            if (msg == "")
            {
                UserDataBytesAll = UserDataBytesAllTmp;
                MsgList          = MsgListTmp;
            }
            else
            {
                if (ShowLog)
                {
                    logHelper.Error(msg);
                }
            }
            return(msg);
        }