Example #1
0
        public string[] GetCommand(string[] Stcds, string NFOINDEX, out string CommandCode)
        {
            YYPack.Pack pack     = new YYPack.Pack();
            string[]    commands = null;

            CommandCode = "0067";
            commands    = new string[Stcds.Length];
            for (int i = 0; i < Stcds.Length; i++)
            {
                if (NFOINDEX.ToLower() != "短信") //短信
                {
                    //打召测包
                    commands[i] = pack.GetAnswer("0001", CommandCode, GetAuto(Stcds[i]), GetWaterLevelOrder(Stcds[i]), GetRainfallOrder(Stcds[i]), GetPowerMode(Stcds[i]), GetCenterAddress(Stcds[i]), "FFFF", "FFFF", "FFFF");
                }
                else
                {
                    if (radTX_A.Checked)
                    {
                        commands[i] = pack.GetAnswer("0001", CommandCode, GetAuto(Stcds[i]), GetWaterLevelOrder(Stcds[i]), GetRainfallOrder(Stcds[i]), GetPowerMode(Stcds[i]), GetCenterAddress(Stcds[i]), "FFFF", "FFFF", "FFFF", "gsm");
                    }
                    else
                    {
                        commands[i] = pack.GetAnswer("0001", CommandCode, GetAuto(Stcds[i]), GetWaterLevelOrder(Stcds[i]), GetRainfallOrder(Stcds[i]), GetPowerMode(Stcds[i]), GetCenterAddress(Stcds[i]), "FFFF", "FFFF", "FFFF", "gprs");
                    }
                }
            }

            return(commands);
        }
Example #2
0
        public string[] GetCommand(string[] Stcds, string NFOINDEX, out string CommandCode)
        {
            YYPack.Pack pack     = new YYPack.Pack();
            string[]    commands = null;
            CommandCode = "0069";

            if (radioButton1.Checked)
            {
                string sjy = Validate();
                if (sjy == null)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("输入开始或结束时间有误!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(null);
                }


                commands = new string[Stcds.Length];
                for (int i = 0; i < Stcds.Length; i++)
                {
                    string Auto            = Convert.ToInt32(GetAuto(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string CenterAddress   = Convert.ToInt32(GetCenterAddress(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string RainfallOrder   = Convert.ToInt32(GetRainfallOrder(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string WaterLevelOrder = Convert.ToInt32(GetWaterLevelOrder(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string PowerMode       = Convert.ToInt32(GetPowerMode(Stcds[i]), 16).ToString().ToString().PadLeft(4, '0');
                    if (NFOINDEX.ToLower() != "短信") //短信
                    {
                        //打召测包
                        commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, CenterAddress, sjy, pack.GetBeginOrEndTime(dateTimePicker1.Value), pack.GetBeginOrEndTime(dateTimePicker2.Value));
                    }
                    else
                    {
                        if (radTX_A.Checked)
                        {
                            commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, CenterAddress, sjy, pack.GetBeginOrEndTime(dateTimePicker1.Value), pack.GetBeginOrEndTime(dateTimePicker2.Value), "gsm");
                        }
                        else
                        {
                            commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, CenterAddress, sjy, pack.GetBeginOrEndTime(dateTimePicker1.Value), pack.GetBeginOrEndTime(dateTimePicker2.Value), "gprs");
                        }
                    }
                }

                return(commands);
            }
            else
            {
                commands = new string[Stcds.Length];
                for (int i = 0; i < Stcds.Length; i++)
                {
                    string Auto            = Convert.ToInt32(GetAuto(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string CenterAddress   = Convert.ToInt32(GetCenterAddress(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string RainfallOrder   = Convert.ToInt32(GetRainfallOrder(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string WaterLevelOrder = Convert.ToInt32(GetWaterLevelOrder(Stcds[i]), 16).ToString().PadLeft(4, '0');;
                    string PowerMode       = Convert.ToInt32(GetPowerMode(Stcds[i]), 16).ToString().ToString().PadLeft(4, '0');
                    if (NFOINDEX.ToLower() != "短信") //短信
                    {
                        //打召测包
                        commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, "0000", "FFFF", "FFFF", "FFFF");
                    }
                    else
                    {
                        if (radTX_C.Checked)
                        {
                            commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, "0000", "FFFF", "FFFF", "FFFF", "gsm");
                        }
                        else
                        {
                            commands[i] = pack.GetAnswer("0001", CommandCode, Auto, WaterLevelOrder, RainfallOrder, PowerMode, "0000", "FFFF", "FFFF", "FFFF", "gprs");
                        }
                    }
                }

                return(commands);
            }
        }