private void ImportEquipmentEvent(ActivityORGInfo orginfo, List <ActivityEquipmentInfo> lstequ)
        {
            try
            {
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                {
                    channel.SaveORGInfo(orginfo);
                });
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                {
                    channel.SaveEquipmentList(lstequ);
                });

                condition = new EquipmentQueryCondition();

                if (activityPlaceInfo != null && string.IsNullOrEmpty(activityPlaceInfo.Guid) == false)
                {
                    condition.PlaceGuid = activityPlaceInfo.Guid;
                }
                condition.ActivityGuid = Client.RiasPortal.ModuleContainer.Activity.Guid;


                //重新查询设备
                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                {
                    EquipmentItemsSource = channel.GetEquipmentInfos(condition);
                });

                MessageBox.Show("导入成功!", "提示", MessageBoxButton.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetExceptionMessage());
            }
        }
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Import_Click(object sender, RoutedEventArgs e)
        {
            if (activityPlaceInfo == null || string.IsNullOrEmpty(activityPlaceInfo.Guid) == true)
            {
                MessageBox.Show("请选择设备使用地点!", "提示", MessageBoxButton.OK);
                return;
            }
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter     = "Excel文件(*.xls)|*.xls";
            dialog.DefaultExt = "xls";

            dialog.CheckFileExists = true;
            if (dialog.ShowDialog() == true)
            {
                DataTable[] tables = LoadDataFromExcel(dialog.FileName);
                if (tables != null && tables.Length > 0)
                {
                    //单位信息
                    ActivityORGInfo orginfo  = null;
                    DataTable       orgtable = tables.FirstOrDefault(r => r.TableName == "单位信息");
                    if (orgtable != null && ValidateORG(orgtable))
                    {
                        orginfo = LoadORGFromTable(orgtable);


                        ActivityORGInfo tempOrginfo = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, ActivityORGInfo>(channel =>
                        {
                            return(channel.GetORGInfoByActivityORGInfo(orginfo));
                        });


                        if (tempOrginfo != null && string.IsNullOrEmpty(tempOrginfo.Activity_Guid) == false)
                        {
                            orginfo = tempOrginfo;
                        }
                    }
                    if (orginfo != null)
                    {
                        List <ActivityEquipmentInfo> lstequ = LoadActivityEquipmentFromTable(tables, orginfo);

                        if (lstequ != null)
                        {
                            if (lstequ.Count == 0)
                            {
                                MessageBox.Show("请输入要导入的设备", "提示", MessageBoxButton.OK);
                                return;
                            }
                            else
                            {
                                ImportEquipmentEvent(orginfo, lstequ);
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentEquipment != null && Validate(CurrentEquipment))
            {
                //ActivityORGInfo orginfo = new ActivityORGInfo();
                //if (cb_AddNewUnit.IsChecked == true)
                //{
                //    orginfo.Guid =CO_IA.Client.Utility.NewGuid();
                //    orginfo.Activity_Guid = CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid;
                //    orginfo.Address = this.txtAddress.Text.Trim();
                //    orginfo.Contact = this.txtContact.Text.Trim();
                //    orginfo.Name = this.txt_UnitName.Text.Trim();
                //    orginfo.Phone = this.txtUnitPhone.Text.Trim();
                //    orginfo.Securityclass.Guid = this.combClass.SelectedValue as string;
                //    orginfo.Securityclass.Value = this.combClass.SelectedValue as string;
                //    orginfo.ShortName = this.txtShortName.Text.Trim();
                //}
                //else
                //{
                //    orginfo = CurrentEquipment.OrgInfo;
                //}

                ActivityORGInfo tempOrginfo = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, ActivityORGInfo>(channel =>
                {
                    return(channel.GetORGInfoByActivityORGInfo(CurrentEquipment.OrgInfo));
                });


                if (tempOrginfo != null && string.IsNullOrEmpty(tempOrginfo.Activity_Guid) == false)
                {
                    CurrentEquipment.OrgInfo = tempOrginfo;
                }


                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                {
                    channel.SaveORGInfo(CurrentEquipment.OrgInfo);
                });

                //CurrentEquipment.OrgInfo = orginfo;
                //CurrentEquipment.OrgInfo.Activity_Guid = CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid;
                CurrentEquipment.ORGGuid = CurrentEquipment.OrgInfo.Guid;

                PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                {
                    channel.SaveEquipment(CurrentEquipment);
                    MessageBox.Show("保存成功!", "提示", MessageBoxButton.OK);
                    this.Close();
                    if (RefreshEquipmentSource != null)
                    {
                        RefreshEquipmentSource();
                    }
                });
            }
        }
예제 #4
0
        /// <summary>
        /// 选择单位改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmb_OrgList_SelectedIndexChanged(object sender, RoutedEventArgs e)
        {
            if (cmb_OrgList.SelectedItem != null)
            {
                ActivityORGInfo orginfo = cmb_OrgList.SelectedItem as ActivityORGInfo;

                if (CurrentEquipment != null && CurrentEquipment.OrgInfo != null)
                {
                    CurrentEquipment.OrgInfo = orginfo;
                    CurrentEquipment.OrgInfo.Activity_Guid = CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid;
                    CurrentEquipment.ORGGuid = orginfo.Guid;
                }
            }
        }
        private ActivityORGInfo LoadORGFromTable(DataTable dt)
        {
            ActivityORGInfo org = new ActivityORGInfo();

            if (dt.Rows != null && dt.Rows.Count > 0)
            {
                org.Activity_Guid = Client.RiasPortal.ModuleContainer.Activity.Guid;
                org.Name          = dt.Rows[0][1].ToString().Trim();
                org.ShortName     = dt.Rows[1][1].ToString().Trim();
                org.Address       = dt.Rows[3][1].ToString().Trim();
                org.Contact       = dt.Rows[4][1].ToString().Trim();
                org.Phone         = dt.Rows[5][1].ToString().Trim();
            }
            return(org);
        }
        /// <summary>
        /// 对组织信息进行转换
        /// </summary>
        /// <param name="orginfo"></param>
        /// <returns></returns>
        private ActivityORGInfo ConvertToActivityORGInfo(ORGInfo orginfo)
        {
            ActivityORGInfo activityOrginfo = new ActivityORGInfo();

            activityOrginfo.Guid               = orginfo.Guid;
            activityOrginfo.Activity_Guid      = Client.RiasPortal.ModuleContainer.Activity.Guid;
            activityOrginfo.Address            = orginfo.Address.Trim();
            activityOrginfo.Contact            = orginfo.Contact.Trim();
            activityOrginfo.Name               = orginfo.Name.Trim();
            activityOrginfo.Phone              = orginfo.Phone.Trim();
            activityOrginfo.Securityclass.Guid = orginfo.Securityclass.Guid.Trim();
            activityOrginfo.Securityclass.Name = orginfo.Securityclass.Name.Trim();
            activityOrginfo.ShortName          = orginfo.ShortName.Trim();


            return(activityOrginfo);
        }
예제 #7
0
        /// <summary>
        /// 单位信息保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cb_AddNewUnit_Click(object sender, RoutedEventArgs e)
        {
            if (cb_AddNewUnit.IsChecked == true)
            {
                cmb_OrgList.Visibility       = System.Windows.Visibility.Hidden;
                this.txt_UnitName.Visibility = System.Windows.Visibility.Visible;

                ActivityORGInfo orginfo = new ActivityORGInfo();
                orginfo.Activity_Guid    = CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid;
                CurrentEquipment.OrgInfo = orginfo;
                CurrentEquipment.ORGGuid = orginfo.Guid;
            }
            else
            {
                cmb_OrgList.Visibility       = System.Windows.Visibility.Visible;
                this.txt_UnitName.Visibility = System.Windows.Visibility.Hidden;

                ActivityORGInfo orginfo = cmb_OrgList.SelectedItem as ActivityORGInfo;

                CurrentEquipment.OrgInfo = orginfo;
                CurrentEquipment.ORGGuid = orginfo.Guid;
            }
        }
        /// <summary>
        /// 创建ActivityEquipmentInfo对象
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="orginfo"></param>
        /// <param name="businesscode"></param>
        /// <returns></returns>
        private List <ActivityEquipmentInfo> CreateActivityEquipments(DataTable dt, ActivityORGInfo orginfo, string businesscode)
        {
            List <ActivityEquipmentInfo> equs = new List <ActivityEquipmentInfo>();

            if (dt != null && dt.Rows.Count > 0)
            {
                StringBuilder errorMsg = new StringBuilder();

                #region

                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    if (string.IsNullOrEmpty(dr[0].ToString()))
                    {
                        continue;
                    }

                    ActivityEquipmentInfo equ = new ActivityEquipmentInfo();
                    equ.GUID         = System.Guid.NewGuid().ToString();
                    equ.ActivityGuid = Client.RiasPortal.ModuleContainer.Activity.Guid;
                    equ.PlaceGuid    = activityPlaceInfo.Guid;;
                    equ.ORGGuid      = orginfo.Guid;
                    equ.Origin       = 3;
                    IdentifiableData <string> org = new IdentifiableData <string>();
                    org.Guid         = orginfo.Guid;
                    org.Name         = orginfo.Name;
                    equ.ORG          = org;
                    equ.Name         = dr[0].ToString();
                    equ.BusinessCode = businesscode;
                    equ.EQUCount     = Int32.Parse(dr[1].ToString()); //设备数量
                    equ.EquModel     = dr[2].ToString();              //设备型号
                    equ.EquNo        = dr[3].ToString();              //设备编号
                    equ.Remark       = dr[4].ToString();              //备注
                    equ.IsStation    = false;
                    equ.StationName  = string.Empty;
                    equ.IsMobile     = false;

                    equ.SendFreq      = string.IsNullOrEmpty(dr[5].ToString()) ? double.NaN : double.Parse(dr[5].ToString());
                    equ.ReceiveFreq   = string.IsNullOrEmpty(dr[6].ToString()) ? double.NaN : double.Parse(dr[6].ToString());   //接收频率
                    equ.IsTunAble     = dr[7].ToString() == "是" ? true : false;                                                 //频率可调
                    equ.SendFreqStart = string.IsNullOrEmpty(dr[8].ToString()) ? double.NaN : double.Parse(dr[8].ToString());   //发射频率范围起始
                    equ.SendFreqEnd   = string.IsNullOrEmpty(dr[9].ToString()) ? double.NaN : double.Parse(dr[9].ToString());   //发射频率范围终止
                    equ.Band          = string.IsNullOrEmpty(dr[10].ToString()) ? double.NaN : double.Parse(dr[10].ToString()); //带宽
                    equ.MaxPower      = string.IsNullOrEmpty(dr[11].ToString()) ? double.NaN : double.Parse(dr[11].ToString()); //发射功率

                    EMCS.Types.EMCModulationEnum modulat;
                    if (Enum.TryParse(dr[12].ToString(), out modulat))
                    {
                        equ.ModulateMode = modulat;
                    }

                    //发射天线
                    //equ.SendPara.Ant.Guid = System.Guid.NewGuid().ToString();

                    //equ.SendPara.Ant.AntType = dr[13].ToString();//天线类型
                    equ.SendAntModel = dr[14].ToString();                                                                      //天线型号
                    equ.SendAntGain  = string.IsNullOrEmpty(dr[15].ToString()) ? double.NaN : double.Parse(dr[15].ToString()); //天线增益
                    EMCS.Types.EMCPolarisationEnum sendpolar;
                    if (Enum.TryParse(dr[16].ToString(), out sendpolar))                                                       //极化方式
                    {
                        equ.SendAntPolar = sendpolar;
                    }
                    equ.SendAntHeight   = double.Parse(dr[17].ToString()); //天线高度
                    equ.SendAntFeedLoss = double.Parse(dr[18].ToString()); //馈线损耗


                    //接收
                    equ.RecvFreqStart = string.IsNullOrEmpty(dr[19].ToString()) ? double.NaN : double.Parse(dr[19].ToString()); //接收频率范围起始
                    equ.RecvFreqEnd   = string.IsNullOrEmpty(dr[20].ToString()) ? double.NaN : double.Parse(dr[20].ToString()); //接收频率范围终止
                    //equ.RecivePara.Ant.Guid = System.Guid.NewGuid().ToString();
                    //equ.RecivePara.Ant.AntType = dr[21].ToString();//天线类型
                    equ.RecvAntModel = dr[22].ToString();                                                                      //天线型号
                    equ.RecvAntGain  = string.IsNullOrEmpty(dr[23].ToString()) ? double.NaN : double.Parse(dr[23].ToString()); //天线增益
                    EMCS.Types.EMCPolarisationEnum recpolar;
                    if (Enum.TryParse(dr[24].ToString(), out recpolar))                                                        //极化方式
                    {
                        equ.RecvAntPolar = recpolar;
                    }
                    equ.RecvAntHeight   = string.IsNullOrEmpty(dr[25].ToString()) ? double.NaN : double.Parse(dr[25].ToString()); //天线高度
                    equ.RecvAntFeedLoss = string.IsNullOrEmpty(dr[26].ToString()) ? double.NaN : double.Parse(dr[26].ToString()); //馈线损耗

                    equs.Add(equ);
                }

                #endregion
            }
            return(equs);
        }
        /// <summary>
        /// 从DataTable中加载EquipmentInfo
        /// </summary>
        /// <param name="tables"></param>
        /// <param name="orginfo"></param>
        /// <returns></returns>
        private List <ActivityEquipmentInfo> LoadActivityEquipmentFromTable(DataTable[] tables, ActivityORGInfo orginfo)
        {
            StringBuilder errormsg = new StringBuilder();

            List <ActivityEquipmentInfo> equipments = new List <ActivityEquipmentInfo>();

            //0:参数信息
            //1:单位信息
            //2:业务类型
            for (int i = 0; i < tables.Length; i++)
            {
                DataTable table     = tables[i];
                string    tablename = table.TableName;
                if (tablename == "参数设置" || tablename == "单位信息" || tablename == "业务类型")
                {
                    continue;
                }

                string tabname      = SettingHelper.TableNameConvert(table.TableName);
                string businesscode = SettingHelper.GetBusinessCode(tabname);
                if (!string.IsNullOrEmpty(businesscode))
                {
                    StringBuilder error = ValidateEquipments(table);
                    if (!string.IsNullOrEmpty(error.ToString()))
                    {
                        errormsg.AppendFormat("{0}错误信息:\r", tabname);
                        errormsg.Append(error);
                        errormsg.Append("\r");
                    }
                    else
                    {
                        List <ActivityEquipmentInfo> equs = CreateActivityEquipments(table, orginfo, businesscode);
                        equipments.AddRange(equs);
                    }
                }
            }
            if (string.IsNullOrEmpty(errormsg.ToString()))
            {
                return(equipments);
            }
            else
            {
                ShowErrorDialog(errormsg.ToString());
                return(null);
            }
        }
        /// <summary>
        /// 转换相关设备类
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private ActivityEquipmentInfo ConvertToActivityEquipmentInfo(EquipmentInfo tempInfo)
        {
            #region  保存组织信息
            ORGInfo orginfo = new ORGInfo();
            //PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke<I_CO_IA.Setting.I_CO_IA_Setting>(channel =>
            //{
            //    orginfo = channel.GetORGInfoByGuid(tempInfo.ORG.Guid);
            //});

            ActivityORGInfo activityOrginfo = ConvertToActivityORGInfo(orginfo);


            ActivityORGInfo tempOrginfo = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, ActivityORGInfo>(channel =>
            {
                return(channel.GetORGInfoByActivityORGInfo(activityOrginfo));
            });


            if (tempOrginfo != null && string.IsNullOrEmpty(tempOrginfo.Activity_Guid) == false)
            {
                activityOrginfo = tempOrginfo;
            }

            bool result = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, bool>(channel =>
            {
                return(channel.SaveORGInfo(activityOrginfo));
            });
            #endregion


            ActivityEquipmentInfo aeuip = new ActivityEquipmentInfo();
            aeuip.GUID         = CO_IA.Client.Utility.NewGuid();
            aeuip.ActivityGuid = Client.RiasPortal.ModuleContainer.Activity.Guid;
            aeuip.PlaceGuid    = activityPlaceInfo.Guid;
            aeuip.ORGGuid      = tempInfo.ORG.Guid;


            aeuip.ADJChannelInh = tempInfo.RecivePara.ADJChannelInh;
            //aeuip.AssignFreq = tempInfo.RecivePara.Ant.AssignFreq;
            aeuip.Band        = tempInfo.SendPara.Band;
            aeuip.ChannelBand = tempInfo.SendPara.ChannelBand;
            aeuip.CoChnPro    = tempInfo.RecivePara.CoChnPro;
            aeuip.EQUCount    = tempInfo.EQUCount;
            aeuip.EquModel    = tempInfo.EquModel;
            aeuip.EquNo       = tempInfo.EquNo;
            //aeuip.IsChecked = tempInfo.RecivePara.ADJChannelInh;
            aeuip.IsMobile  = tempInfo.IsMobile;
            aeuip.IsStation = tempInfo.IsStation;
            aeuip.IsTunAble = tempInfo.SendPara.IsTunAble;
            aeuip.Leakage   = tempInfo.RecivePara.ADJChannelInh;
            aeuip.MaxPower  = tempInfo.SendPara.MaxPower;

#warning 需要处理调制方式为空情况
            if (tempInfo.SendPara.ModulateMode.HasValue)
            {
                aeuip.ModulateMode = tempInfo.SendPara.ModulateMode.Value;
            }
            aeuip.Name              = tempInfo.Name;
            aeuip.Origin            = 1;//设备库录入
            aeuip.ReceiveFreq       = tempInfo.RecivePara.ReceiveFreq;
            aeuip.RecvAntAzimuth    = tempInfo.RecivePara.Ant.AntAzimuth;
            aeuip.RecvAntElevation  = tempInfo.RecivePara.Ant.AntElevation;
            aeuip.RecvAntFeedLength = tempInfo.RecivePara.Ant.FeedLength;
            aeuip.RecvAntFeedLoss   = tempInfo.RecivePara.Ant.FeedLose;
            aeuip.RecvAntGain       = tempInfo.RecivePara.Ant.AntGain;
            aeuip.RecvAntHeight     = tempInfo.RecivePara.Ant.AntHight;
            aeuip.RecvAntModel      = tempInfo.RecivePara.Ant.AntModel;
            aeuip.RecvAntPolar      = tempInfo.RecivePara.Ant.AntPolar;
            aeuip.RecvFreqEnd       = tempInfo.RecivePara.FreqEnd;
            aeuip.RecvFreqStart     = tempInfo.RecivePara.FreqStart;
            aeuip.Remark            = tempInfo.Remark;
            //aeuip.RunningFrom = tempInfo.RecivePara.ADJChannelInh;
            //aeuip.RunningTo = tempInfo.RecivePara.ADJChannelInh;
            aeuip.SendAntAzimuth    = tempInfo.SendPara.Ant.AntAzimuth;
            aeuip.SendAntElevation  = tempInfo.SendPara.Ant.AntElevation;
            aeuip.SendAntFeedLength = tempInfo.SendPara.Ant.FeedLength;
            aeuip.SendAntFeedLoss   = tempInfo.SendPara.Ant.FeedLose;
            aeuip.SendAntGain       = tempInfo.SendPara.Ant.AntGain;
            aeuip.SendAntHeight     = tempInfo.SendPara.Ant.AntHight;
            aeuip.SendAntModel      = tempInfo.SendPara.Ant.AntModel;
            aeuip.SendAntPolar      = tempInfo.SendPara.Ant.AntPolar;
            aeuip.SendFreq          = tempInfo.SendPara.SendFreq;
            aeuip.SendFreqEnd       = tempInfo.SendPara.FreqEnd;
            aeuip.SendFreqStart     = tempInfo.SendPara.FreqStart;
            aeuip.Sensitivity       = tempInfo.RecivePara.Sensitivity.GetNullableDouble();
            aeuip.SensitivityUnit   = tempInfo.RecivePara.SensitivityUnit.GetNullableInt();
            aeuip.SignalNoise       = tempInfo.RecivePara.SignalNoise;
            aeuip.StationName       = tempInfo.StationName;
            aeuip.BusinessCode      = tempInfo.StClassCode;


            return(aeuip);
        }
예제 #11
0
        private void ShowDetail(DataSet ds)
        {
            if (ds == null)
            {
                MessageBox.Show("获取不到台站概要信息,请确认数据源是否改变!");
                return;
            }
            else
            {
                #region 弹出对话框
                if (ds.Tables.Count > 0)
                {
                    //申请表
                    //ApplyControl = new ApplyInfoControl(ds);
                    //this.lg_Apply.Children.Add(ApplyControl);

                    ActivityORGInfo orginfo = new ActivityORGInfo();
                    #region  单位信息

                    orginfo.Activity_Guid = Client.RiasPortal.ModuleContainer.Activity.Guid;
                    if (ds.Tables["RSBT_ORG"] != null && ds.Tables["RSBT_ORG"].Rows.Count > 0)
                    {
                        DataTable orgTable = ds.Tables["RSBT_ORG"];
                        if (orgTable.Columns.Contains("ORG_NAME"))
                        {
                            orginfo.Name = orgTable.Rows[0]["ORG_NAME"].ToString();//单位名称
                        }
                        else
                        {
                            orginfo.Name = "";
                        }
                        //if (orgTable.Columns.Contains("ORG_CODE"))
                        //{
                        //    this.tb_UnitCode.Text = orgTable.Rows[0]["ORG_CODE"].ToString();//组织机构代码
                        //}
                        //else
                        //{
                        //    this.tb_UnitCode.Text = "";
                        //}
                        if (orgTable.Columns.Contains("ORG_ADDR"))
                        {
                            orginfo.Address = orgTable.Rows[0]["ORG_ADDR"].ToString();//单位地址
                        }
                        if (orgTable.Columns.Contains("ORG_LINK_PERSON"))
                        {
                            orginfo.Contact = orgTable.Rows[0]["ORG_LINK_PERSON"].ToString();//单位联系人
                        }

                        if (orgTable.Columns.Contains("ORG_PHONE"))
                        {
                            orginfo.Phone = orgTable.Rows[0]["ORG_PHONE"].ToString();//联系电话
                        }
                    }


                    #endregion

                    List <CO_IA.UI.StationManage.EquInfo> equList = new List <CO_IA.UI.StationManage.EquInfo>();

                    List <CO_IA.UI.StationManage.FreqInfo> freqList = new List <CO_IA.UI.StationManage.FreqInfo>();
                    string STAT_NAME = string.Empty;
                    string NET_TS    = string.Empty;


                    #region  详细信息

                    List <ActivityEquipmentInfo> equipList = new List <ActivityEquipmentInfo>();


                    //网表
                    if (ds.Tables["RSBT_NET"] != null && ds.Tables["RSBT_NET"].Rows.Count > 0)
                    {
                        if (ds.Tables["RSBT_NET"].Columns.Contains("NET_TS"))
                        {
                            NET_TS = ds.Tables["RSBT_NET"].Rows[0]["NET_TS"].ToString();//技术体制
                        }
                    }



                    //台站资料表
                    if (ds.Tables["RSBT_STATION"] != null && ds.Tables["RSBT_STATION"].Rows.Count > 0)
                    {
                        if (ds.Tables["RSBT_STATION"].Columns.Contains("STAT_NAME"))
                        {
                            STAT_NAME = ds.Tables["RSBT_STATION"].Rows[0]["STAT_NAME"].ToString();//台站名称
                        }
                    }

                    //设备表
                    if (ds.Tables["RSBT_EQU"] != null && ds.Tables["RSBT_EQU"].Rows.Count > 0)
                    {
                        //EquControl = new EquInfoControl(ds.Tables["RSBT_EQU"], ds.Tables["RSBT_EQU_T"]);
                        //this.lg_Equinfo.Children.Add(EquControl);

                        DataTable dataTable = ds.Tables["RSBT_EQU"];
                        DataTable eDT       = ds.Tables["RSBT_EQU_T"];

                        #region  设备表

                        foreach (DataRow dr in dataTable.Rows)
                        {
                            try
                            {
                                CO_IA.UI.StationManage.EquInfo equInfo = new CO_IA.UI.StationManage.EquInfo();
                                if (dataTable.Columns.Contains("EQU_MODEL"))
                                {
                                    equInfo.EQU_MODEL = dr["EQU_MODEL"].ToString();
                                }
                                else
                                {
                                    equInfo.EQU_MODEL = "";
                                }
                                if (dataTable.Columns.Contains("EQU_AUTH"))
                                {
                                    equInfo.EQU_AUTH = dr["EQU_AUTH"].ToString();
                                }
                                else
                                {
                                    equInfo.EQU_AUTH = "";
                                }
                                if (dataTable.Columns.Contains("EQU_CODE"))
                                {
                                    equInfo.EQU_CODE = dr["EQU_CODE"].ToString();
                                }
                                else
                                {
                                    equInfo.EQU_CODE = "";
                                }
                                if (dataTable.Columns.Contains("EQU_MENU"))
                                {
                                    equInfo.EQU_MENU = dr["EQU_MENU"].ToString();
                                }
                                else
                                {
                                    equInfo.EQU_MENU = "";
                                }
                                if (dataTable.Columns.Contains("EQU_POW"))
                                {
                                    equInfo.EQU_POW = dr["EQU_POW"].ToString();
                                }
                                else
                                {
                                    equInfo.EQU_POW = "";
                                }

                                try
                                {
                                    if (string.IsNullOrEmpty(dr["EQU_POW"].ToString()) == true && dr["GUID"].ToString() != null)
                                    {
                                        foreach (DataRow edr in eDT.Rows)
                                        {
                                            if (edr["GUID"] == dr["GUID"])
                                            {
                                                if (dataTable.Columns.Contains("ET_EQU_SENU"))
                                                {
                                                    equInfo.ET_EQU_SENU = dr["ET_EQU_SENU"].ToString();
                                                }
                                                else
                                                {
                                                    equInfo.ET_EQU_SENU = "";
                                                }
                                                if (dataTable.Columns.Contains("ET_EQU_SEN"))
                                                {
                                                    equInfo.ET_EQU_SEN = dr["ET_EQU_SEN"].ToString();
                                                }
                                                else
                                                {
                                                    equInfo.ET_EQU_SEN = "";
                                                }

                                                break;
                                            }
                                        }
                                    }
                                }
                                catch
                                {
                                }
                                equList.Add(equInfo);
                            }
                            catch
                            {
                            }
                        }

                        #endregion
                    }

                    //频率表
                    if (ds.Tables["RSBT_FREQ"] != null && ds.Tables["RSBT_FREQ"].Rows.Count > 0)
                    {
                        //FreqControl = new FreqInfoControl(ds.Tables["RSBT_FREQ"]);
                        //this.lg_Freq.Children.Add(FreqControl);

                        DataTable dataTable = ds.Tables["RSBT_FREQ"];
                        #region 频率表
                        foreach (DataRow dr in dataTable.Rows)
                        {
                            try
                            {
                                CO_IA.UI.StationManage.FreqInfo freqInfo = new CO_IA.UI.StationManage.FreqInfo();


                                //freqInfo.FREQ_EFB = dr["FREQ_EFB"];
                                //freqInfo.FREQ_EFE = dr["FREQ_EFE"];
                                //freqInfo.FREQ_RFB = dr["FREQ_RFB"];
                                //freqInfo.FREQ_RFE = dr["FREQ_RFE"];
                                //freqInfo.FREQ_UC = dr["FREQ_UC"];

                                if (dataTable.Columns.Contains("GUID"))
                                {
                                    freqInfo.GUID = dr["GUID"].ToString();
                                }
                                else
                                {
                                    freqInfo.GUID = Guid.NewGuid().ToString();
                                }

                                if (dataTable.Columns.Contains("FREQ_TYPE"))
                                {
                                    freqInfo.FREQ_TYPE = dr["FREQ_TYPE"].ToString();
                                }
                                else
                                {
                                    freqInfo.FREQ_TYPE = "";
                                }
                                double dbUC = 0;
                                if (dataTable.Columns.Contains("FREQ_UC"))
                                {
                                    if (dr["FREQ_UC"].ToString() != null && dr["FREQ_UC"].ToString() != string.Empty && double.TryParse(dr["FREQ_UC"].ToString(), out dbUC) == true)
                                    {
                                        freqInfo.FREQ_UC = dbUC.ToString();

                                        //if (dbUC >= 3)
                                        //{
                                        //    freqInfo.FREQ_UC = dbUC + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_UC = dbUC * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_UC = dr["FREQ_UC"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_UC = "";
                                }


                                double dbLC = 0;
                                if (dataTable.Columns.Contains("FREQ_LC"))
                                {
                                    if (dr["FREQ_LC"].ToString() != null && dr["FREQ_LC"].ToString() != string.Empty && double.TryParse(dr["FREQ_LC"].ToString(), out dbLC) == true)
                                    {
                                        freqInfo.FREQ_LC = dbLC.ToString();

                                        //if (dbUC >= 3)
                                        //{
                                        //    freqInfo.FREQ_UC = dbUC + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_UC = dbUC * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_LC = dr["FREQ_LC"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_LC = "";
                                }



                                double dbEFB = 0;
                                if (dataTable.Columns.Contains("FREQ_EFB"))
                                {
                                    if (dr["FREQ_EFB"].ToString() != null && dr["FREQ_EFB"].ToString() != string.Empty && double.TryParse(dr["FREQ_EFB"].ToString(), out dbEFB) == true)
                                    {
                                        freqInfo.FREQ_EFB = dbEFB.ToString();
                                        //if (dbEFB >= 3)
                                        //{
                                        //    freqInfo.FREQ_EFB = dbEFB + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_EFB = dbEFB * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_EFB = dr["FREQ_EFB"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_EFB = "";
                                }



                                double dbEFE = 0;
                                if (dataTable.Columns.Contains("FREQ_EFE"))
                                {
                                    if (dr["FREQ_EFE"].ToString() != null && dr["FREQ_EFE"].ToString() != string.Empty && double.TryParse(dr["FREQ_EFE"].ToString(), out dbEFE) == true)
                                    {
                                        freqInfo.FREQ_EFE = dbEFE.ToString();
                                        //if (dbEFE >= 3)
                                        //{
                                        //    freqInfo.FREQ_EFE = dbEFE + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_EFE = dbEFE * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_EFE = dr["FREQ_EFE"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_EFE = "";
                                }

                                double dbRFB = 0;
                                if (dataTable.Columns.Contains("FREQ_RFB"))
                                {
                                    if (dr["FREQ_RFB"].ToString() != null && dr["FREQ_RFB"].ToString() != string.Empty && double.TryParse(dr["FREQ_RFB"].ToString(), out dbRFB) == true)
                                    {
                                        freqInfo.FREQ_RFB = dbRFB.ToString();
                                        //if (dbRFB >= 3)
                                        //{
                                        //    freqInfo.FREQ_RFB = dbRFB + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_RFB = dbRFB * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_RFB = dr["FREQ_RFB"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_RFB = "";
                                }

                                double dbRFE = 0;
                                if (dataTable.Columns.Contains("FREQ_RFE"))
                                {
                                    if (dr["FREQ_RFE"].ToString() != null && dr["FREQ_RFE"].ToString() != string.Empty && double.TryParse(dr["FREQ_RFE"].ToString(), out dbRFE) == true)
                                    {
                                        freqInfo.FREQ_RFE = dbRFE.ToString();
                                        //if (dbRFE >= 3)
                                        //{
                                        //    freqInfo.FREQ_RFE = dbRFE + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_RFE = dbRFE * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_RFE = dr["FREQ_RFE"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_RFE = "";
                                }
                                //freqInfo.FREQ_E_BAND = dr["FREQ_E_BAND"];
                                //freqInfo.FREQ_R_BAND = dr["FREQ_R_BAND"];

                                double db_E_BAND = 0;
                                if (dataTable.Columns.Contains("FREQ_E_BAND"))
                                {
                                    if (dr["FREQ_E_BAND"].ToString() != null && dr["FREQ_E_BAND"].ToString() != string.Empty && double.TryParse(dr["FREQ_E_BAND"].ToString(), out db_E_BAND) == true)
                                    {
                                        freqInfo.FREQ_E_BAND = db_E_BAND.ToString();

                                        //if (db_E_BAND >= 3)
                                        //{
                                        //    freqInfo.FREQ_E_BAND = db_E_BAND + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_E_BAND = db_E_BAND * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_E_BAND = dr["FREQ_E_BAND"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_E_BAND = "";
                                }


                                double db_R_BAND = 0;
                                if (dataTable.Columns.Contains("FREQ_R_BAND"))
                                {
                                    if (dr["FREQ_R_BAND"].ToString() != null && dr["FREQ_R_BAND"].ToString() != string.Empty && double.TryParse(dr["FREQ_R_BAND"].ToString(), out db_R_BAND) == true)
                                    {
                                        freqInfo.FREQ_R_BAND = db_R_BAND.ToString();


                                        //if (db_R_BAND >= 3)
                                        //{
                                        //    freqInfo.FREQ_R_BAND = db_R_BAND + " M";
                                        //}
                                        //else
                                        //{
                                        //    freqInfo.FREQ_R_BAND = db_R_BAND * 1000 + " kHz";

                                        //}
                                    }
                                    else
                                    {
                                        freqInfo.FREQ_R_BAND = dr["FREQ_R_BAND"].ToString();
                                    }
                                }
                                else
                                {
                                    freqInfo.FREQ_R_BAND = "";
                                }
                                //freqInfo.FT_FREQ_TimeB = dr["FT_FREQ_TimeB"];
                                //freqInfo.FT_FREQ_TimeE = dr["FT_FREQ_TimeE"];

                                //freqInfo.FT_FREQ_INFO_Type = dr["FT_FREQ_INFO_Type"];
                                if (dataTable.Columns.Contains("FREQ_MOD"))
                                {
                                    freqInfo.FREQ_MOD = dr["FREQ_MOD"].ToString();
                                }
                                else
                                {
                                    freqInfo.FREQ_MOD = "";
                                }
                                //freqInfo.FT_FREQ_HCL = dr["FT_FREQ_HCL"];

                                #region  频率冗余表


                                if (dr["GUID"].ToString() != null && ds.Tables["RSBT_FREQ_T"] != null && ds.Tables["RSBT_FREQ_T"].Rows.Count > 0)
                                {
                                    DataTable eDT = ds.Tables["RSBT_FREQ_T"];

                                    foreach (DataRow edr in eDT.Rows)
                                    {
                                        if (edr["GUID"] == dr["GUID"])
                                        {
                                            if (dataTable.Columns.Contains("FT_FREQ_POW_MAX"))
                                            {
                                                freqInfo.FT_FREQ_POW_MAX = dr["FT_FREQ_POW_MAX"].ToString();
                                            }
                                            else
                                            {
                                                freqInfo.FT_FREQ_POW_MAX = "";
                                            }

                                            break;
                                        }
                                    }
                                    #endregion
                                }
                                freqList.Add(freqInfo);
                                //break;
                            }
                            catch
                            {
                            }
                        }
                        #endregion
                    }

                    #endregion 细节

                    #region  保存组织信息
                    if (freqList.Count == 0)
                    {
                        return;
                    }


                    ActivityORGInfo tempOrginfo = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, ActivityORGInfo>(channel =>
                    {
                        return(channel.GetORGInfoByActivityORGInfo(orginfo));
                    });


                    if (tempOrginfo != null && string.IsNullOrEmpty(tempOrginfo.Activity_Guid) == false)
                    {
                        orginfo = tempOrginfo;
                    }

                    PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel =>
                    {
                        channel.SaveORGInfo(orginfo);
                    });
                    #endregion


                    foreach (CO_IA.UI.StationManage.FreqInfo freqInfo in freqList)
                    {
                        ActivityEquipmentInfo equipinfo = new ActivityEquipmentInfo();
                        equipinfo.GUID    = freqInfo.GUID;
                        equipinfo.OrgInfo = orginfo;
                        equipinfo.ORGGuid = orginfo.Guid;
                        //equipinfo.ORG.Guid = orginfo.Guid;
                        //equipinfo.ORG.Value = orginfo.Name;
                        equipinfo.ActivityGuid = orginfo.Activity_Guid;
                        equipinfo.PlaceGuid    = activityPlaceInfo.Guid;
                        equipinfo.StationName  = STAT_NAME;
                        equipinfo.EQUCount     = equList.Count;
                        equipinfo.IsStation    = true;
                        equipinfo.BusinessCode = NET_TS;
                        equipinfo.Origin       = 1;


                        if (equList.Count > 0)
                        {
                            CO_IA.UI.StationManage.EquInfo tempInfo = equList[0];
                            equipinfo.IsMobile        = false;
                            equipinfo.Name            = tempInfo.EQU_MODEL;
                            equipinfo.EquModel        = tempInfo.EQU_MODEL;
                            equipinfo.EquNo           = tempInfo.EQU_CODE;
                            equipinfo.Sensitivity     = tempInfo.ET_EQU_SEN.GetNullableDouble();
                            equipinfo.SensitivityUnit = tempInfo.ET_EQU_SEN.GetNullableInt();
                        }

                        //equipinfo.ADJChannelInh = 1;

                        equipinfo.RecvFreqEnd   = freqInfo.FREQ_RFB.GetNullableDouble();
                        equipinfo.RecvFreqStart = freqInfo.FREQ_RFE.GetNullableDouble();
                        equipinfo.SendFreqEnd   = freqInfo.FREQ_EFB.GetNullableDouble();
                        equipinfo.SendFreqStart = freqInfo.FREQ_EFB.GetNullableDouble();
                        equipinfo.MaxPower      = freqInfo.FT_FREQ_POW_MAX.GetNullableDouble();

                        equipinfo.ReceiveFreq = freqInfo.FREQ_UC.GetNullableDouble();  //接收频率
                        equipinfo.SendFreq    = freqInfo.FREQ_LC.GetNullableDouble();  //发射频率

                        //equipinfo.Band = 1;
                        //equipinfo.ChannelBand = 1;

                        //equipinfo.SignalNoise = 1;
                        //equipinfo.Remark = "1";
                        //equipinfo.RunningFrom = DateTime.Now;
                        //equipinfo.RunningTo = DateTime.Now;

                        equipinfo.IsTunAble = true;
                        //equipinfo.Leakage = 1;


                        try
                        {
                            EMCS.Types.EMCModulationEnum ModulateModeEnum = (EMCS.Types.EMCModulationEnum)freqInfo.FREQ_MOD.GetNullableInt();

                            if (Enum.IsDefined(typeof(EMCS.Types.EMCModulationEnum), ModulateModeEnum))
                            {
                                equipinfo.ModulateMode = ModulateModeEnum;
                            }
                        }
                        catch
                        { }
                        //天线表
                        if (ds.Tables["RSBT_ANTFEED"] != null && ds.Tables["RSBT_ANTFEED"].Rows.Count > 0)
                        {
                            DataTable dataTable = ds.Tables["RSBT_ANTFEED"];
                            #region  天线表

                            try
                            {
                                if (dataTable.Columns.Contains("ANT_MODEL"))
                                {
                                    equipinfo.SendAntModel = equipinfo.RecvAntModel = dataTable.Rows[0]["ANT_MODEL"].ToString();
                                }


                                if (dataTable.Columns.Contains("ANT_GAIN"))
                                {
                                    equipinfo.SendAntGain = equipinfo.RecvAntGain = dataTable.Rows[0]["ANT_GAIN"].ToString().GetNullableDouble();
                                }

                                if (dataTable.Columns.Contains("FEED_LENGTH"))
                                {
                                    equipinfo.RecvAntFeedLength = equipinfo.SendAntFeedLength = dataTable.Rows[0]["FEED_LENGTH"].ToString().GetNullableDouble();    //馈线长度
                                }
                                if (dataTable.Columns.Contains("FEED_LOSE"))
                                {
                                    equipinfo.RecvAntFeedLoss = equipinfo.SendAntFeedLoss = dataTable.Rows[0]["FEED_LOSE"].ToString().GetNullableDouble();    //馈线系统总损耗
                                }


                                if (dataTable.Columns.Contains("ANT_HIGHT"))
                                {
                                    equipinfo.RecvAntHeight = equipinfo.SendAntHeight = dataTable.Rows[0]["ANT_HIGHT"].ToString().GetNullableDouble();    //馈线系统总损耗
                                }
                            }
                            catch
                            { }

                            #endregion
                        }
                        //天线表冗余表
                        if (ds.Tables["RSBT_ANTFEED_T"] != null && ds.Tables["RSBT_ANTFEED_T"].Rows.Count > 0)
                        {
                            DataTable dataTable = ds.Tables["RSBT_ANTFEED_T"];
                            #region  天线冗余表

                            try
                            {
                                if (dataTable.Columns.Contains("AT_ANT_UPANG"))
                                {
                                    equipinfo.RecvAntElevation = equipinfo.SendAntElevation = dataTable.Rows[0]["AT_ANT_UPANG"].ToString().GetNullableDouble();
                                }


                                if (dataTable.Columns.Contains("ANT_POLE"))
                                {
                                    //ANT_POLE = dataTable.Rows[0]["ANT_POLE"].ToString();//极化方式

                                    try
                                    {
                                        EMCS.Types.EMCPolarisationEnum EMCPolarisationEnum = (EMCS.Types.EMCPolarisationEnum)freqInfo.FREQ_MOD.GetIntOrDefault();

                                        if (Enum.IsDefined(typeof(EMCS.Types.EMCPolarisationEnum), EMCPolarisationEnum))
                                        {
                                            equipinfo.RecvAntPolar = equipinfo.SendAntPolar = EMCPolarisationEnum;
                                        }
                                    }
                                    catch
                                    { }
                                }


                                if (dataTable.Columns.Contains("ANT_ANGLE"))
                                {
                                    equipinfo.RecvAntAzimuth = equipinfo.SendAntAzimuth = dataTable.Rows[0]["ANT_ANGLE"].ToString().GetNullableDouble();    //最大辐射方位角
                                }

                                if (dataTable.Columns.Contains("FEED_LENGTH"))
                                {
                                    equipinfo.RecvAntFeedLength = equipinfo.SendAntFeedLength = dataTable.Rows[0]["FEED_LENGTH"].ToString().GetNullableDouble();   //馈线长度
                                }
                                if (dataTable.Columns.Contains("FEED_LOSE"))
                                {
                                    equipinfo.RecvAntFeedLoss = equipinfo.SendAntFeedLoss = dataTable.Rows[0]["FEED_LOSE"].ToString().GetNullableDouble();    //馈线系统总损耗
                                }


                                if (dataTable.Columns.Contains("ANT_HIGHT"))
                                {
                                    equipinfo.RecvAntHeight = equipinfo.SendAntHeight = dataTable.Rows[0]["ANT_HIGHT"].ToString().GetNullableDouble();    //馈线系统总损耗
                                }
                            }
                            catch
                            { }

                            #endregion
                        }


                        equipList.Add(equipinfo);
                    }



                    PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqPlan.I_CO_IA_FreqPlan, bool>(channel =>
                    {
                        return(channel.SaveEquipmentList(equipList));
                    });
                }
                #endregion
            }
        }