public string BuildSet(string sid, IList <EDownParamGY> cmds, CDownConfGY down, EChannelType ctype)
 {
     throw new NotImplementedException();
 }
        public string BuildSet(string sid, IList <EDownParamGY> cmds, CDownConfGY down, EChannelType ctype)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("\u0001");                                          //  添加首字符
            sb.Append(String.Format("{0:D10}", Int32.Parse(sid.Trim()))); //  添加遥测站地址
            sb.Append(String.Format("{0:D2}", "00"));                     //  添加中心站地址
            sb.Append(String.Format("{0:D4}", "1234"));                   //  添加密码
            sb.Append("\u0002");                                          //  添加单包起始和结束符
            sb.Append("0000");                                            //  添加下行流水号
            sb.Append(timeToString());                                    // 添加发报时间
            int length = 16;                                              //  指令的长度

            foreach (var cmd in cmds)
            {
                switch (cmd)
                {
                case EDownParamGY.ICconfig:    //  设罝遥测站IC卡状态
                    sb.Insert(17, "4B");
                    sb.Append("ZT");
                    sb.Append(CSpecialChars.BALNK_CHAR);
                    sb.Append(down.ICconfig); length += 11; break;

                case EDownParamGY.pumpCtrl:    //  控制水泵状态
                    sb.Insert(17, "4C");
                    sb.Append(down.PumpCtrl);
                    length += down.PumpCtrl.Length; break;

                case EDownParamGY.valveCtrl:    //  控制阀门状态
                    sb.Insert(17, "4D");
                    sb.Append(down.ValveCtrl);
                    length += down.ValveCtrl.Length; break;

                case EDownParamGY.gateCtrl:    //  控制闸门状态
                    sb.Insert(17, "4E");
                    sb.Append(down.GateCtrl);
                    length += down.GateCtrl.Length; break;

                case EDownParamGY.oldPwd:   //  旧密码
                    sb.Insert(17, "49");    //  添加功能码
                    sb.Append("03");
                    sb.Append(CSpecialChars.BALNK_CHAR);
                    sb.Append(down.OldPwd);
                    sb.Append(CSpecialChars.BALNK_CHAR); length += 8; break;

                case EDownParamGY.newPwd:    //  新密码
                    sb.Append("03");
                    sb.Append(CSpecialChars.BALNK_CHAR);
                    sb.Append(down.NewPwd); length += 7; break;

                case EDownParamGY.basicConfigModify:    //  遥测站基本配置修改
                    sb.Insert(17, "40");

                    /*for (var  in ) {
                     *  sb.Append(cmd);
                     *  sb.Append(CSpecialChars.BALNK_CHAR);
                     *  if (ProtocolMaps.DownParamMap.FindValue(cmd) != null)
                     *  {
                     *      sb.Append(ProtocolMaps.DownParamMap.FindValue(cmd));
                     *      sb.Append(CSpecialChars.BALNK_CHAR);
                     *      length += 4 + Int32.Parse(ProtocolMaps.DownParamLengthMap[cmd]);
                     *  }
                     *  else
                     *      length += 3;
                     * }*/
                    break;

                case EDownParamGY.operatingParaModify:    //  运行参数修改
                    sb.Insert(17, "42");

                    /*for (var  in ){
                     *  sb.Append(cmd);
                     *  sb.Append(CSpecialChars.BALNK_CHAR);
                     *  if (ProtocolMaps.DownParamMap.FindValue(cmd) != null)
                     *  {
                     *      sb.Append(ProtocolMaps.DownParamMap.FindValue(cmd));
                     *      sb.Append(CSpecialChars.BALNK_CHAR);
                     *      length += 4 + Int32.Parse(ProtocolMaps.DownParamLengthMap[cmd]);
                     *  }
                     *  else
                     *      length += 3;
                     * }*/
                    break;

                case EDownParamGY.waterYield: //  水量定值控制
                    sb.Append(down.WaterYield);
                    sb.Insert(17, "4F");      //  插入功能码
                    length += 2; break;

                case EDownParamGY.clockset:    //  设置遥测站时钟
                    sb.Insert(17, "4A");
                    break;

                default:
                    throw new Exception("设置下行指令参数错误");
                }
            }
            sb.Insert(19, String.Format("{0:D1}", 8));      //  添加报文标识
            sb.Insert(20, String.Format("{0:X3}", length)); //  添加报文长度
            sb.Append("\u0003");                            //  添加结束符
            string dataMsg = sb.ToString();
            string crcMsg  = CRC.ToCRC16(dataMsg, false);
            string resut   = dataMsg + crcMsg;

            return(resut);

            throw new NotImplementedException();
        }