/// <summary>
        /// 解析任务文件内容,获取任务具体内容
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="tasktype">任务类型</param>
        /// <param name="refundtaskinfo">退购的任务信息</param>
        /// <param name="fileinfo">换表、销户的任务信息</param>
        /// <returns></returns>
        public static Boolean ParseTaskFile(String filename, ref eTaskType tasktype,
                                            ref RefundTaskInfo refundtaskinfo, ref MeterDisassemblyTaskInfo disassemblytaskinfo)
        {
            //首先,初始化解密任务文件的密钥
            InitKey(EncryptKey_TaskFile);

            //取出全部的文件内容
            String  encryptstr = String.Empty;
            Boolean bl         = FileProcessor.ReadFileString(filename, out encryptstr, false);

            if (!bl || String.IsNullOrEmpty(encryptstr))
            {
                return(false);
            }

            //解析

            String filestr = DencryptTaskFileInfo(encryptstr);

            if (String.IsNullOrEmpty(filestr))
            {
                return(false);
            }
            filestr = filestr.Trim();
            //获取任务类型
            bl = GetTaskType(filestr, ref tasktype);
            if (!bl)
            {
                return(false);
            }

            //根据不同的任务类型获取任务信息类数据
            bl = GetTaskInfo(tasktype, ref refundtaskinfo, ref disassemblytaskinfo);
            return(bl);
        }
        /// <summary>
        /// 创建任务文件
        /// </summary>
        /// <param name="tasktype"></param>
        /// <param name="refundtaskinfo"></param>
        /// <param name="disassemblytaskinfo"></param>
        /// <returnes></returns>
        public static Boolean BuildTaskFile(eTaskType tasktype,
                                            RefundTaskInfo refundtaskinfo, MeterDisassemblyTaskInfo resultinfo, ref String filenamestr)
        {
            //首先,初始化解密任务文件的密钥
            InitKey(EncryptKey_TaskFile);

            //根据任务类型,获取任务文件名,带全路径
            String filename = GetFileName(tasktype, refundtaskinfo, resultinfo, false);

            if (String.IsNullOrEmpty(filename))
            {
                return(false);
            }
            filename    = TaskFileFolderPath + filename;
            filenamestr = filename;

            //构建文件具体的内容
            String filecontentstr = GetTaskFileContent(tasktype, refundtaskinfo, resultinfo);

            if (String.IsNullOrEmpty(filecontentstr))
            {
                return(false);
            }

            //加密文件内容
            String encryptresfilestr = EncryptInfo(filecontentstr);

            //创建文件
            Boolean bl = FileProcessor.WriteFileString(filename, encryptresfilestr, false);

            return(true);
        }
        public void CopyFrom(MeterDisassemblyTaskInfo src)
        {
            base.CopyFrom((MeterDisassemblyTaskBase)src);
            MeterAddress = src.MeterAddress;

            AreaCode          = src.AreaCode;
            MeterProtocolType = src.MeterProtocolType;
            DecimalParameter  = src.DecimalParameter;

            CustomerNumber    = src.CustomerNumber;
            CustomerName      = src.CustomerName;
            CustomerTelephone = src.CustomerTelephone;
            CustomerAddress   = src.CustomerAddress;
            ServicemenName    = src.ServicemenName;

            SetMeterKeyParam = src.SetMeterKeyParam;
        }
        /// <summary>
        /// 根据MeterDisassemblyTaskResultInfo组合成任务文件内容
        /// 换表和销户的任务
        /// </summary>
        /// <param name="resultinfo"></param>
        /// <returns></returns>
        private static String GetTaskFileContent_Replase(MeterDisassemblyTaskInfo resultinfo)
        {
            List <String> contentlist = new List <string> {
            };

            /*TaskID=XX(当前的任务ID)
             * TaskType=1(0-退购,1-换表,2-销户)
             * TechnicianID =XX(上门工程师的ID)
             * MeterAddress=012017062001(表通信地址,射频卡表是LAPIS中的meterbasicinfo里面的communicationaddress)
             * AreaCode=m_runparam.CurrentOperator.AreaCode
             * MeterProtocolType=XX (表通信协议类型,eMeterProtocolType)
             * DecimalParameter=脉冲当量小数位数;计量模式;价格精度小数位数;结算精度小数位数;货币符号;是否显示K*/

            String filestr = Const_TaskID + "=" + resultinfo.TaskID.ToString();

            contentlist.Add(filestr);
            filestr = Const_TaskType + "=" + ((Int32)resultinfo.TaskType).ToString();
            contentlist.Add(filestr);
            filestr = Const_TechnicianID + "=" + resultinfo.TechnicianID.ToString();
            contentlist.Add(filestr);

            filestr = Const_MeterAddress + "=" + resultinfo.MeterAddress;
            contentlist.Add(filestr);
            filestr = Const_AreaCode + "=" + resultinfo.AreaCode.ToString();
            contentlist.Add(filestr);

            filestr = Const_MeterProtocolType + "=" + ((Int32)resultinfo.MeterProtocolType).ToString();
            contentlist.Add(filestr);
            filestr = Const_DecimalParameter + "=" + resultinfo.DecimalParameter;
            contentlist.Add(filestr);

            //增加STS设置参数密钥
            filestr = Const_SetMeterKeyParam + "=" + resultinfo.SetMeterKeyParam;
            contentlist.Add(filestr);

            String reslutfile = DataFormatProcessor.ListToString(contentlist, Environment.NewLine);

            return(reslutfile);
        }
        /// <summary>
        /// 获取换表、销户的任务信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="disassemblytaskinfo"></param>
        /// <returns></returns>
        private static Boolean GetTaskInfo_Replace(eTaskType type, ref MeterDisassemblyTaskInfo disassemblytaskinfo)
        {
            if (m_dicFileCon == null)
            {
                return(false);
            }
            //判断任务类型,获取弹出的处理界面
            disassemblytaskinfo = new MeterDisassemblyTaskInfo {
            };
            //TaskID
            if (!m_dicFileCon.Keys.Contains(Const_TaskID))
            {
                return(false);
            }
            disassemblytaskinfo.TaskID = Convert.ToInt32(m_dicFileCon[Const_TaskID]);

            //TaskType
            disassemblytaskinfo.TaskType = (Int32)type;

            //TechnicianID
            if (!m_dicFileCon.Keys.Contains(Const_TechnicianID))
            {
                return(false);
            }
            disassemblytaskinfo.TechnicianID = Convert.ToInt32(m_dicFileCon[Const_TechnicianID]);

            //MeterAddress
            if (!m_dicFileCon.Keys.Contains(Const_MeterAddress))
            {
                return(false);
            }
            disassemblytaskinfo.MeterAddress = m_dicFileCon[Const_MeterAddress];

            //AreaCode
            if (!m_dicFileCon.Keys.Contains(Const_AreaCode))
            {
                return(false);
            }
            disassemblytaskinfo.AreaCode = Convert.ToInt32(m_dicFileCon[Const_AreaCode]);

            //MeterProtocolType
            if (!m_dicFileCon.Keys.Contains(Const_MeterProtocolType))
            {
                return(false);
            }
            disassemblytaskinfo.MeterProtocolType = (eMeterProtocolType)Convert.ToInt32(m_dicFileCon[Const_MeterProtocolType]);

            //DecimalParameter
            if (!m_dicFileCon.Keys.Contains(Const_DecimalParameter))
            {
                return(false);
            }
            disassemblytaskinfo.DecimalParameter = m_dicFileCon[Const_DecimalParameter];

            //SetMeterKeyParam 参数可选
            if (m_dicFileCon.Keys.Contains(Const_DecimalParameter))
            {
                disassemblytaskinfo.SetMeterKeyParam = m_dicFileCon[Const_SetMeterKeyParam];
            }

            return(true);
        }
        /// <summary>
        /// 根据任务类型,获取任务信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="refundtaskinfo"></param>
        /// <param name="disassemblytaskinfo"></param>
        /// <returns></returns>
        private static Boolean GetTaskInfo(eTaskType type, ref RefundTaskInfo refundtaskinfo, ref MeterDisassemblyTaskInfo disassemblytaskinfo)
        {
            refundtaskinfo      = null;
            disassemblytaskinfo = null;
            switch (type)
            {
            case eTaskType.Refund:
                return(GetTaskInfo_Refund(type, ref refundtaskinfo));

            case eTaskType.CloseCustomer:
            case eTaskType.ReplaceMeter:
                return(GetTaskInfo_Replace(type, ref disassemblytaskinfo));

            default:
                return(false);
            }
        }
        /// <summary>
        /// 获取任务文件内容
        /// </summary>
        /// <param name="type"></param>
        /// <param name="refundtaskinfo"></param>
        /// <param name="resultinfo"></param>
        /// <returns></returns>
        private static String GetTaskFileContent(eTaskType type, RefundTaskInfo refundtaskinfo, MeterDisassemblyTaskInfo resultinfo)
        {
            //根据任务类型
            switch (type)
            {
            case eTaskType.CloseCustomer:
            case eTaskType.ReplaceMeter:
                return(GetTaskFileContent_Replase(resultinfo));

            case eTaskType.Refund:
                return(GetTaskFileContent_Refund(refundtaskinfo));

            default:
                return(null);
            }
        }