/// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEquAdd_Click(object sender, RoutedEventArgs e)
        {
            if (SelectActivityORG == null)
            {
                MessageBox.Show("请选择新增设备所属单位!", "提示", MessageBoxButton.OK);
                return;
            }
            Equipment newequ = new Equipment();

            newequ.OrgInfo.Guid = SelectActivityORG.Guid;
            newequ.OrgInfo.Name = SelectActivityORG.Name;
            newequ.Key          = System.Guid.NewGuid().ToString();
            newequ.EQUCount     = 1;
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = true;
            addequdialog.DataContext  = newequ;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = this.CurrentActivity.Guid;
                actequ.PlaceGuid    = this.CurrentActivityPlace.Guid;
                actequ.CopyFrom(equ);

                bool result = this.SaveActivityEquipment(actequ);
                if (result)
                {
                    InitQueryCondition(eququerycondition);
                    GetActivityEquipments(eququerycondition);
                    MessageBox.Show("保存成功");
                }
                return(result);
            };
            addequdialog.ShowDialog();
        }
 /// <summary>
 /// 保存设备方法
 /// </summary>
 /// <param name="equ"></param>
 /// <returns></returns>
 private bool SaveActivityEquipment(ActivityEquipment equ)
 {
     return(PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA_FreqStation, bool>(channel =>
     {
         //编号是否重复
         int count = channel.CountEquName(equ);
         if (count == 0)
         {
             try
             {
                 channel.SaveActivityEquipment(equ);
                 return true;
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.GetExceptionMessage(), "保存失败");
                 return false;
             }
         }
         else
         {
             MessageBox.Show("当前单位名称下,存在相同的设备名称+设备编号,请重新输入", "保存失败");
             return false;
         }
     }));
 }
Beispiel #3
0
 internal static void SaveActivityEquipment(ActivityEquipment p_equipment)
 {
     PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(channel =>
     {
         channel.SaveActivityEquipment(p_equipment);
     });
 }
Beispiel #4
0
        private void ImportFromRiasEvent(Organization arg1, List <Equipment> arg2)
        {
            ActivityOrganization importorg = new ActivityOrganization();

            importorg.CopyFrom(arg1);
            importorg.ActivityGuid = SystemLoginService.CurrentActivity.Guid;

            if (arg2 != null && arg2.Count > 0)
            {
                List <ActivityEquipment> actequs = new List <ActivityEquipment>();
                foreach (Equipment item in arg2)
                {
                    ActivityEquipment equ = new ActivityEquipment();
                    equ.CopyFrom(item);
                    equ.ActivityGuid = SystemLoginService.CurrentActivity.Guid;
                    equ.PlaceGuid    = SystemLoginService.CurrentActivityPlace.Guid;
                    equ.OrgInfo.Guid = importorg.Guid;
                    actequs.Add(equ);
                }

                this.ImportActivityEquipmentEvent(importorg, actequs);
            }
            else
            {
                MessageBox.Show("请选择要导入的设备");
            }
        }
Beispiel #5
0
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (sender != null)
            {
                DataGridRow     gridrow   = sender as DataGridRow;
                InterfereObject interfobj = gridrow.Item as InterfereObject;
                if (interfobj != null)
                {
                    if (interfobj.Type == InterfereObjectEnum.设备)
                    {
                        ActivityEquipment equipment =
                            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqStation.I_CO_IA_FreqStation, ActivityEquipment>(channel =>
                        {
                            return(channel.GetActivityEquipment(interfobj.Guid));
                        });

                        EquipmentManageDialog equdialog = new EquipmentManageDialog();
                        equdialog.DataContext = equipment;
                        equdialog.AllowEdit   = false;
                        equdialog.ShowDialog();
                    }
                    else if (interfobj.Type == InterfereObjectEnum.周围台站)
                    {
                        StationDetailDialog dialog = new StationDetailDialog(interfobj.Guid);
                        dialog.ShowDialog(this);
                    }
                }
            }
        }
        bool LoadBaseBindingData(InterferedBindingData bindingData, string freqGuid)
        {
            ActivityEquipment       equip = GetEquipment(freqGuid);
            ActivitySurroundStation stat  = GetSurroundStation(freqGuid);

            if (equip != null)
            {
                bindingData.AssignFreq  = equip.AssignSendFreq.ToString();
                bindingData.BdWith      = equip.Band_kHz.ToString();
                bindingData.EmitPower   = equip.Power_W.ToString();
                bindingData.EquipName   = equip.Name;
                bindingData.StationType = "现场设台";
                bindingData.SetDept     = equip.OrgInfo.Name;
            }
            else if (stat != null)
            {
                StationEmitInfo emitInfo = stat.EmitInfo.Where(p => p.StationGuid == freqGuid).SingleOrDefault();
                if (emitInfo != null)
                {
                    bindingData.AssignFreq = emitInfo.FreqEC == null ? "" : emitInfo.FreqEC.ToString();
                    bindingData.BdWith     = emitInfo.FreqBand == null ? "" : emitInfo.FreqBand.ToString();
                    bindingData.EmitPower  = emitInfo.EquPow.ToString();
                }


                bindingData.EquipName   = "";
                bindingData.StationType = "周围台站";
                bindingData.SetDept     = stat.ORG_NAME;
            }
            if (equip != null || stat != null)
            {
                return(true);
            }
            return(false);
        }
Beispiel #7
0
        public ORGInfoDialog(ActivityOrganization org, ActivityEquipment equ)
        {
            InitializeComponent();

            orgInfo.ORGDataContent      = org;
            orgInfo.IsReadOnly          = true;
            EquipmentDetail.DataContext = equ;

            EquipmentDetail.IsReadOnly = true;
        }
        void LoadEquipFreq(List <ComparableFreq> p_freqList, List <ComparableFreq> p_rcfreqList, string p_freqID)
        {
            ActivityEquipment equip = GetEquipment(p_freqID);

            if (equip != null)
            {
                p_freqList.Add(new ComparableFreq(equip.AssignSendFreq == null ? 0 : (double)equip.AssignSendFreq, equip.AssignSpareFreq == null ? 0 : (double)equip.AssignSpareFreq, equip.Band_kHz == null ? 0 : (double)equip.Band_kHz, equip.Key.ToString()));
                p_rcfreqList.Add(new ComparableFreq(equip.ReceiveFreq == null ? 0 : (double)equip.ReceiveFreq, 0, equip.Band_kHz == null ? 0 : (double)equip.Band_kHz, equip.Key.ToString()));
            }
        }
 private void equInspectiondatagrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (EquipmentInspectionSelected != null && EquipmentInspectionSelected.ActivityEquipment != null)
     {
         ActivityEquipment     equip     = DataOperator.GetEquipmentByID(EquipmentInspectionSelected.ActivityEquipment.Key);
         EquipmentManageDialog equdialog = new EquipmentManageDialog();
         equdialog.AllowEdit   = false;
         equdialog.DataContext = equip;
         equdialog.ShowDialog();
     }
 }
Beispiel #10
0
 private void EquipmentGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Left)
     {
         DataGridRow dgr = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement);
         if (dgr != null)
         {
             ActivityEquipment equipment = dgr.DataContext as ActivityEquipment;
             ShowEquipDetail(equipment);
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// 取设备干扰信息
        /// </summary>
        /// <param name="Interfequ"></param>
        /// <returns></returns>
        private InterfereObject CreateInterfObjectFromEqu(ActivityEquipment Interfequ)
        {
            InterfereObject intobject = new InterfereObject();

            intobject.Guid      = Interfequ.Key;
            intobject.Name      = Interfequ.Name;
            intobject.Type      = InterfereObjectEnum.设备;
            intobject.Freq      = Interfequ.SendFreq;
            intobject.SpareFreq = Interfequ.SpareFreq;
            intobject.Band      = Interfequ.Band_kHz;

            return(intobject);
        }
Beispiel #12
0
        private void AddEquip_Click(object sender, RoutedEventArgs e)
        {
            DataGrid equipDataGrid = (sender as Button).Tag as DataGrid;
            //equipDataGrid.ItemsSource = null;
            //操作xTestDataGrid就行。
            ActivityOrganization org    = xDataGrid.SelectedItem as ActivityOrganization;
            ActivityEquipment    newequ = new ActivityEquipment();

            newequ.OrgInfo.Guid = org.Guid;
            newequ.OrgInfo.Name = org.Name;
            newequ.Key          = System.Guid.NewGuid().ToString();
            newequ.EQUCount     = 1;
            ShowEquipDetail(newequ);
        }
Beispiel #13
0
 public OrgEqu(ActivityOrganization orginfo, ActivityEquipment equinfo)
 {
     InitializeComponent();
     if (orginfo == null || equinfo == null)
     {
         return;
     }
     Orginfo         = orginfo;
     Equinfo         = equinfo;
     txtOrgname.Text = orginfo.Name;
     txtEquname.Text = equinfo.Name;
     this.ToolTip    = orginfo.Name;
     ElementId       = MapGroupTypes.OrgEqu_.ToString() + orginfo.Guid;
 }
Beispiel #14
0
 /// <summary>
 /// 保存设备信息
 /// </summary>
 /// <param name="p_equipment"></param>
 /// <returns></returns>
 private bool SaveEquipment(ActivityEquipment p_equipment)
 {
     try
     {
         DataOperator.SaveActivityEquipment(p_equipment);
         LoadEquipmentsForOrg();
         MessageBox.Show("保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "保存失败!");
         return(false);
     }
 }
Beispiel #15
0
        private void itemInfo_Click(object sender, RoutedEventArgs e)
        {
            MenuItem    item   = sender as MenuItem;
            ContextMenu menu   = item.Parent as ContextMenu;
            var         target = menu.PlacementTarget as OrgEqu;

            if (item != null)
            {
                ActivityOrganization orginfo = target.Orginfo;
                ActivityEquipment    equinfo = target.Equinfo;

                ORGInfoDialog info = new ORGInfoDialog(orginfo, equinfo);
                info.ShowDialog();
            }
        }
 /// <summary>
 /// 保存设备方法
 /// </summary>
 /// <param name="equ"></param>
 /// <returns></returns>
 private bool SaveActivityEquipment(ActivityEquipment equ)
 {
     try
     {
         PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(channel =>
         {
             channel.SaveActivityEquipment(equ);
         });
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetExceptionMessage(), "保存失败");
         return(false);
     }
 }
Beispiel #17
0
        private void buttonLoad_Click(object sender, RoutedEventArgs e)
        {
            var currentPlace = this.listBoxPlace.SelectedItem as TemplatePlace;

            if (currentPlace == null)
            {
                return;
            }
            List <string> ignoreEquipmentGuidList = null;

            if (this.listActivityEquipment.Count > 0)
            {
                ignoreEquipmentGuidList = (from equip in listActivityEquipment select equip.Key).ToList();
            }
            EquipmentSelectWindow wnd = new EquipmentSelectWindow(ignoreEquipmentGuidList);

            if (wnd.ShowDialog(this) == true)
            {
                var listEquipment = wnd.GetSelectedEquipmentList();
                if (listEquipment.Count > 0)
                {
                    ActivityEquipment[] equipments = new ActivityEquipment[listEquipment.Count];
                    for (int i = 0; i < equipments.Length; i++)
                    {
                        equipments[i] = new ActivityEquipment {
                            ActivityGuid = currentPlace.TemplateGuid, PlaceGuid = currentPlace.Key
                        };
                        equipments[i].CopyFrom(listEquipment[i]);
                    }
                    PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PlanDatabase.I_CO_IA_Template>(channel =>
                    {
                        channel.SaveTemplateEquipments(equipments);
                    });
                    this.listActivityEquipment.AddRange(equipments);
                    this.UpdateEquipmentList(currentPlace.Key);
                    //var collectionEquipment=this.planDtatabaseEquipmentList.DataContext as ObservableCollection<ActivityEquipment>;
                    //if (collectionEquipment != null)
                    //{
                    //    foreach (var equipment in equipments)
                    //    {
                    //        collectionEquipment.Add(equipment);
                    //    }
                    //}
                }
            }
        }
        /// <summary>
        /// 取设备的Receiver
        /// </summary>
        /// <param name="equs"></param>
        /// <returns></returns>
        private static Receiver[] GetEquReceivers(List <ActivityEquipment> equs)
        {
            List <Receiver> receiverList = new List <Receiver>();

            if (equs != null && equs.Count > 0)
            {
                ActivityEquipment equ = null;
                for (int i = 0; i < equs.Count; i++)
                {
                    equ = equs[i];
                    if (equ.ReceiveFreq == null)
                    {
                        break;
                    }

                    double recvFreq = 0;
                    if (equ.ReceiveFreq != null)
                    {
                        recvFreq = equ.ReceiveFreq.Value;
                    }
                    double band = 0;
                    if (equ.Band_kHz != null)
                    {
                        band = equ.Band_kHz.Value;
                    }

                    double spareFreq = 0;
                    if (equ.SpareFreq != null)
                    {
                        spareFreq = equ.SpareFreq.Value;
                    }

                    Receiver receiv = new Receiver(equ.Key,
                                                   new ComparableFreq(recvFreq, spareFreq, band, equ.Key),
                                                   new ReceiverParams()
                    {
                        IFBand = new EMCFreqValue(EMCFreqUnitEnum.KHz, (double)(band / 1000))
                    },
                                                   null);

                    receiverList.Add(receiv);
                }
            }
            return(receiverList.ToArray());;
        }
        public object[,] SourceToObject(string activityname, string placename)
        {
            if (EquipmentItemsSource != null && EquipmentItemsSource.Length > 0)
            {
                object[,] obj = null;
                int      rows     = EquipmentItemsSource.Length;
                DataGrid datagrid = new DataGrid();

                ObservableCollection <DataGridColumn> columns = equdatagrid.Columns;
                int cols = columns.Count;
                obj = new object[rows + 3, cols];

                obj[0, 0] = "活动名称:";
                obj[0, 1] = activityname;
                obj[1, 0] = "区域名称:";
                obj[1, 1] = placename;

                //不要全选列
                for (int c = 1; c < cols; c++)
                {
                    DataGridColumn column = columns[c];
                    obj[2, c - 1] = column.Header;
                }
                for (int r = 0; r < rows; r++)
                {
                    ActivityEquipment equ = EquipmentItemsSource[r];

                    obj[r + 3, 0] = equ.OrgInfo.Name;                      //单位
                    obj[r + 3, 1] = equ.Name;                              //设备名称
                    obj[r + 3, 2] = GetEquClassName(equ.EquipmentClassID); //业务类型
                    obj[r + 3, 3] = equ.EQUCount;                          //设备数量
                    obj[r + 3, 4] = equ.SendFreq;                          //发射频率
                    obj[r + 3, 5] = equ.ReceiveFreq;                       //接收频率
                    obj[r + 3, 6] = equ.IsTunable == true ? "是" : "否";     //频率可调
                    obj[r + 3, 7] = equ.Band_kHz;                          //带宽
                    obj[r + 3, 8] = equ.Power_W;                           //最大功率
                }
                return(obj);
            }
            else
            {
                return(null);
            }
        }
Beispiel #20
0
        private void DelEquip_Click(object sender, RoutedEventArgs e)
        {
            ActivityEquipment equip = (sender as Button).Tag as ActivityEquipment;

            if (equip == null)
            {
                return;
            }
            try
            {
                DataOperator.DeleteEquipments(equip.Key);
                LoadEquipmentsForOrg();
                MessageBox.Show("删除成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "删除失败");
            }
        }
Beispiel #21
0
        /// <summary>
        /// 打开设备详细信息
        /// </summary>
        /// <param name="equipment"></param>
        private void ShowEquipDetail(ActivityEquipment equipment)
        {
            if (equipment == null)
            {
                return;
            }
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = !IsReadOnly;
            addequdialog.DataContext  = equipment;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = SystemLoginService.CurrentActivity.Guid;
                actequ.PlaceGuid    = SystemLoginService.CurrentActivityPlace.Guid;
                actequ.CopyFrom(equ);
                return(SaveEquipment(actequ));
            };
            addequdialog.ShowDialog();
        }
        private static List <ActivityEquipment> LoadActivityEquFromTable(DataTable dt, string activityguid, string placeguid, string orgguid, string classId)
        {
            List <ActivityEquipment> equs = new List <ActivityEquipment>();

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    if (string.IsNullOrEmpty(dr[0].ToString()))
                    {
                        continue;
                    }
                    else
                    {
                        ActivityEquipment equ = CreateActivityEquipment(dr, activityguid, placeguid, orgguid, classId);
                        equs.Add(equ);
                    }
                }
            }
            return(equs);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="obj"></param>
        private void equipmentListControl_DoubleClick(ActivityEquipment obj)
        {
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = false;
            addequdialog.DataContext  = obj;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = this.CurrentActivity.Guid;
                actequ.PlaceGuid    = this.CurrentActivityPlaceID;
                actequ.CopyFrom(equ);
                bool result = SaveActivityEquipment(actequ);
                if (result)
                {
                    InitQueryCondition(eququerycondition);
                    GetActivityEquipments(eququerycondition);
                    MessageBox.Show("保存成功");
                }
                return(result);
            };
            addequdialog.ShowDialog();
        }
        /// <summary>
        /// 加载设备信息
        /// </summary>
        /// <param name="tables"></param>
        /// <param name="activityguid"></param>
        /// <param name="placeguid"></param>
        /// <param name="orgguid"></param>
        /// <returns></returns>
        private List <ActivityEquipment> LoadActivityEquipments(DataTable[] tables, string activityguid, string placeguid, string orgguid)
        {
            StringBuilder            errormsg   = new StringBuilder();
            List <ActivityEquipment> equipments = new List <ActivityEquipment>();
            DataTable table = tables.FirstOrDefault(r => r.TableName == "设备信息");

            if (table != null && table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow dr = table.Rows[i];
                    if (string.IsNullOrEmpty(dr["设备名称"].ToString()))
                    {
                        continue;
                    }
                    else
                    {
                        ActivityEquipment equ = CreateActivityEquipment(dr, activityguid, placeguid, orgguid);
                        equipments.Add(equ);
                    }
                }
            }
            return(equipments);
        }
Beispiel #25
0
        /// <summary>
        /// 获取发射机互调
        /// </summary>
        /// <param name="transmResult"></param>
        /// <returns></returns>
        private List <IMInterfereResult> GetTransmitterImResult(IMCompareResult transmResult)
        {
            List <IMInterfereResult> imInterfresultlst = new List <IMInterfereResult>();

            if (transmResult != null)
            {
                #region 获取干扰结果

                IMItemBase imBase = null;
                for (int i = 0; i < transmResult.Values.Length; i++)
                {
                    imBase = transmResult.Values[i];
                    ActivityEquipment equ = new ActivityEquipment();

                    ComparableFreq imfreq = imBase.IMFreqs[0];//发射互调的干扰频率存在IMFreqs中
                    equ = _equipments.FirstOrDefault(r => r.Key == imfreq.FreqID);

                    bool isnewInterfere = true; //新的干扰,不存在dicIMInterfereResult字典中
                    if (equ != null)
                    {
                        if (this.dicIMInterfereResult.TryGetValue(equ, out imInterfresultlst))
                        {
                            isnewInterfere = false;
                        }
                        else
                        {
                            isnewInterfere    = true;
                            imInterfresultlst = new List <IMInterfereResult>();
                        }

                        IMInterfereResult iminterfinfo = new IMInterfereResult();
                        iminterfinfo.InterfType   = InterfereTypeEnum.发射机互调干扰;
                        iminterfinfo.InterfOrder  = GetIMInterfOrder(imBase.Order);
                        iminterfinfo.Formual      = imBase.Formula;
                        iminterfinfo.InterfObject = new List <InterfereObject>();


                        #region  获取干扰台站


                        ComparableFreq disfreq = imBase.DisturbedFreqs[0];

                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipment Interfequ1    = _equipments.FirstOrDefault(r => r.Key == disfreq.FreqID);
                        InterfereObject   interfobject1 = null;
                        if (Interfequ1 != null)
                        {
                            interfobject1 = CreateInterfObjectFromEqu(Interfequ1);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == disfreq.FreqID);
                            if (Interfstation != null)
                            {
                                interfobject1 = CreateInterfObjectFromStation(Interfstation, disfreq);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject1 = CreateInterfObjectFromOther(imBase.DisturbedFreqs[0]);
                            }
                        }
                        iminterfinfo.InterfObject.Add(interfobject1);

                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipment Interfequ2    = _equipments.FirstOrDefault(r => r.Key == imBase.IMFreqs[1].FreqID);
                        InterfereObject   interfobject2 = null;
                        if (Interfequ2 != null)
                        {
                            interfobject2 = CreateInterfObjectFromEqu(Interfequ2);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == imBase.IMFreqs[1].FreqID);
                            if (Interfstation != null)
                            {
                                interfobject2 = CreateInterfObjectFromStation(Interfstation, imBase.IMFreqs[1]);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject2 = CreateInterfObjectFromOther(imBase.IMFreqs[1]);
                            }
                        }
                        iminterfinfo.InterfObject.Add(interfobject2);

                        #endregion

                        imInterfresultlst.Add(iminterfinfo);

                        if (isnewInterfere)
                        {
                            this.dicIMInterfereResult.Add(equ, imInterfresultlst);
                        }
                    }
                }
                #endregion
            }
            return(imInterfresultlst);
        }
        /// <summary>
        /// 创建ActivityEquipment对象
        /// </summary>
        /// <param name="dr"></param>
        /// <param name="activityguid"></param>
        /// <param name="placeguid"></param>
        /// <param name="orgguid"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        private ActivityEquipment CreateActivityEquipment(DataRow dr, string activityguid, string placeguid, string orgguid)
        {
            ActivityEquipment equ = new ActivityEquipment();

            equ.Key              = System.Guid.NewGuid().ToString();
            equ.OrgInfo.Guid     = orgguid;
            equ.ActivityGuid     = activityguid;
            equ.PlaceGuid        = placeguid;
            equ.Name             = dr["设备名称"].ToString();
            equ.EquipmentClassID = ExcelImportHelper.GetEquipmentClassId(dr["业务类型"].ToString());
            equ.EQUCount         = Int32.Parse(dr["数量"].ToString());            //设备数量
            equ.EquModel         = dr["设备型号"].ToString();                       //设备型号
            equ.SeriesNumber     = dr["设备编号"].ToString();                       //设备编号
            equ.IsMobile         = dr["移动设备"].ToString() == "是" ? true : false; //移动设备
            if (!equ.IsMobile)
            {
                equ.Longitude = double.Parse(dr["经度"].ToString());
                equ.Latitude  = double.Parse(dr["纬度"].ToString());
                equ.Address   = dr["地点"].ToString();
            }
            equ.IsStation = dr["已建站"].ToString() == "是" ? true : false;
            if (equ.IsStation)
            {
                equ.StationName = dr["已建站名称"].ToString();
                equ.StationTDI  = dr["台站编号"].ToString();
            }
            else
            {
                equ.StationName = string.Empty;
                equ.StationTDI  = string.Empty;
            }

            equ.SendFreq = double.Parse(dr["发射频率(MHz)"].ToString()); //发射频率
            if (string.IsNullOrWhiteSpace(dr["接收频率(MHz)"].ToString()))
            {
                equ.ReceiveFreq = null;//接收频率
            }
            else
            {
                equ.ReceiveFreq = double.Parse(dr["接收频率(MHz)"].ToString());//接收频率
            }

            if (string.IsNullOrEmpty(dr["备用频率(MHz)"].ToString()))
            {
                equ.SpareFreq = null;//备用频率
            }
            else
            {
                equ.SpareFreq = double.Parse(dr["备用频率(MHz)"].ToString());//接收频率
            }

            equ.IsTunable = dr["频率可调"].ToString() == "是" ? true : false;//频率可调
            if (equ.IsTunable)
            {
                if (string.IsNullOrEmpty(dr["频率范围起始(MHz)"].ToString()))
                {
                    equ.FreqRange.Little = null;//发射频率范围起始
                }
                else
                {
                    equ.FreqRange.Little = double.Parse(dr["频率范围起始(MHz)"].ToString());//发射频率范围起始
                }
                if (string.IsNullOrEmpty(dr["频率范围终止(MHz)"].ToString()))
                {
                    equ.FreqRange.Great = null;//发射频率范围终止
                }
                else
                {
                    equ.FreqRange.Great = double.Parse(dr["频率范围终止(MHz)"].ToString());//发射频率范围终止
                }
            }
            else
            {
                equ.FreqRange = new Range <double?>();
            }

            equ.Band_kHz = double.Parse(dr["波道带宽(kHz)"].ToString()); //必要带宽
            equ.Power_W  = double.Parse(dr["发射功率(W)"].ToString());   //发射功率
            EMCS.Types.EMCModulationEnum modulat;
            if (Enum.TryParse(dr["调制方式"].ToString(), out modulat))
            {
                equ.Modulation = modulat;
            }
            equ.Remark = dr["备注"].ToString();
            return(equ);
        }
        private static ActivityEquipment CreateActivityEquipment(DataRow dr, string activityguid, string placeguid, string orgguid, string classId)
        {
            ActivityEquipment equ = new ActivityEquipment();

            equ.Key              = System.Guid.NewGuid().ToString();
            equ.OrgInfo.Guid     = orgguid;
            equ.ActivityGuid     = activityguid;
            equ.PlaceGuid        = placeguid;
            equ.Name             = dr[0].ToString();
            equ.EquipmentClassID = classId;
            equ.EQUCount         = Int32.Parse(dr[1].ToString());          //设备数量
            equ.EquModel         = dr[2].ToString();                       //设备型号
            equ.SeriesNumber     = dr[3].ToString();                       //设备序列号
            equ.IsMobile         = dr[4].ToString() == "是" ? true : false; //移动设备
            if (!equ.IsMobile)
            {
                equ.Longitude = double.Parse(dr[5].ToString());
                equ.Latitude  = double.Parse(dr[6].ToString());
                equ.Address   = dr[7].ToString();
            }
            equ.IsStation = dr[8].ToString() == "是" ? true : false;
            if (equ.IsStation)
            {
                equ.StationName = dr[9].ToString();
                equ.StationTDI  = dr[10].ToString();
            }
            else
            {
                equ.StationName = string.Empty;
            }
            equ.SendFreq = double.Parse(dr[11].ToString()); //发射频率
            if (string.IsNullOrEmpty(dr[12].ToString()))
            {
                equ.ReceiveFreq = null;//接收频率
            }
            else
            {
                equ.ReceiveFreq = double.Parse(dr[12].ToString());//接收频率
            }

            if (string.IsNullOrEmpty(dr[13].ToString()))
            {
                equ.SpareFreq = null;//备用频率
            }
            else
            {
                equ.SpareFreq = double.Parse(dr[13].ToString());//接收频率
            }

            equ.IsTunable = dr[14].ToString() == "是" ? true : false;//频率可调
            if (equ.IsTunable)
            {
                if (string.IsNullOrEmpty(dr[15].ToString()))
                {
                    equ.FreqRange.Little = null;//发射频率范围起始
                }
                else
                {
                    equ.FreqRange.Little = double.Parse(dr[15].ToString());//发射频率范围起始
                }
                if (string.IsNullOrEmpty(dr[16].ToString()))
                {
                    equ.FreqRange.Great = null;//发射频率范围终止
                }
                else
                {
                    equ.FreqRange.Great = double.Parse(dr[16].ToString());//发射频率范围终止
                }
            }
            else
            {
                equ.FreqRange = new Range <double?>();
            }

            equ.Band_kHz = double.Parse(dr[17].ToString()); //必要带宽
            equ.Power_W  = double.Parse(dr[18].ToString()); //发射功率
            EMCS.Types.EMCModulationEnum modulat;
            if (Enum.TryParse(dr[19].ToString(), out modulat))
            {
                equ.Modulation = modulat;
            }
            equ.Remark = dr[20].ToString();
            return(equ);
        }
Beispiel #28
0
        /// <summary>
        /// 获取接收机互调
        /// </summary>
        /// <param name="receiverResult"></param>
        /// <returns></returns>
        private List <IMInterfereResult> GetReceiverImResult(IMCompareResult receiverResult)
        {
            List <IMInterfereResult> imInterfresultlst = new List <IMInterfereResult>();

            if (receiverResult != null)
            {
                #region 获取干扰结果

                IMItemBase imBase = null;
                for (int i = 0; i < receiverResult.Values.Length; i++)
                {
                    imBase = receiverResult.Values[i];
                    ActivityEquipment equ     = new ActivityEquipment();
                    ComparableFreq    disfreq = imBase.DisturbedFreqs[0];
                    equ = _equipments.FirstOrDefault(r => r.Key == disfreq.FreqID);

                    bool isnewInterfere = true; //新的干扰,不存在dicIMInterfereResult字典中
                    if (equ != null)
                    {
                        if (this.dicIMInterfereResult.TryGetValue(equ, out imInterfresultlst))
                        {
                            isnewInterfere = false;
                        }
                        else
                        {
                            isnewInterfere    = true;
                            imInterfresultlst = new List <IMInterfereResult>();
                        }

                        IMInterfereResult iminterfinfo = new IMInterfereResult();
                        iminterfinfo.InterfType   = InterfereTypeEnum.接收机互调干扰;
                        iminterfinfo.InterfOrder  = GetIMInterfOrder(imBase.Order);
                        iminterfinfo.Formual      = imBase.Formula;
                        iminterfinfo.InterfObject = new List <InterfereObject>();


                        #region  获取干扰台站

                        for (int k = 0; k < imBase.IMFreqs.Length; k++)
                        {
                            ComparableFreq freq = imBase.IMFreqs[k];

                            //先在设备列表中查找,如果有,则认为干扰物为设备
                            ActivityEquipment Interfequ    = _equipments.FirstOrDefault(r => r.Key == freq.FreqID);
                            InterfereObject   interfobject = null;
                            if (Interfequ != null)
                            {
                                interfobject      = CreateInterfObjectFromEqu(Interfequ);
                                interfobject.Freq = freq.Freq; //干扰频率有可能是备用频率
                            }
                            else
                            {
                                //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                                ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == freq.FreqID);
                                if (Interfstation != null)
                                {
                                    interfobject = CreateInterfObjectFromStation(Interfstation, freq);
                                }
                                else
                                {
                                    //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                    interfobject = CreateInterfObjectFromOther(freq);
                                }
                            }
                            iminterfinfo.InterfObject.Add(interfobject);
                        }

                        #endregion

                        imInterfresultlst.Add(iminterfinfo);

                        if (isnewInterfere)
                        {
                            this.dicIMInterfereResult.Add(equ, imInterfresultlst);
                        }
                    }
                }
                #endregion
            }

            return(imInterfresultlst);
        }
Beispiel #29
0
        /// <summary>
        /// 获取邻频干扰结果
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private List <InterfereResult> GetADJFreqInterfResult(AdjFreqCompareResult[] result)
        {
            List <InterfereResult> adjinterfresultlst = new List <InterfereResult>();

            //干扰结果
            foreach (AdjFreqCompareResult item in result)
            {
                ActivityEquipment equ = new ActivityEquipment();
                equ = _equipments.FirstOrDefault(r => r.Key == item.Keys[0].FreqID); //获取干扰设备
                //InterfereResult adjresult = new InterfereResult();

                bool isnewInterfere = true; //新的干扰,不存在dicInterfereResult字典中
                if (this.dicInterfereResult.TryGetValue(equ, out adjinterfresultlst))
                {
                    isnewInterfere = false;
                    //adjresult = adjinterfresultlst[0];
                }
                else
                {
                    isnewInterfere     = true;
                    adjinterfresultlst = new List <InterfereResult>();
                }

                #region  邻频干扰

                if (item.UpperAdjFreqs != null && item.UpperAdjFreqs.Length > 0)
                {
                    InterfereResult uadinterfInfo = new InterfereResult();
                    uadinterfInfo.InterfType   = InterfereTypeEnum.邻频干扰;
                    uadinterfInfo.InterfOrder  = InterfereOrderEnum.邻频;
                    uadinterfInfo.InterfObject = new List <InterfereObject>();
                    foreach (ComparableFreq uadjfreq in item.UpperAdjFreqs)
                    {
                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipment Interfequ    = _equipments.FirstOrDefault(r => r.Key == uadjfreq.FreqID);
                        InterfereObject   interfobject = null;
                        if (Interfequ != null)
                        {
                            interfobject = CreateInterfObjectFromEqu(Interfequ);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == uadjfreq.FreqID);
                            if (Interfstation != null)
                            {
                                interfobject = CreateInterfObjectFromStation(Interfstation, uadjfreq);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject = CreateInterfObjectFromOther(uadjfreq);
                            }
                        }
                        interfobject.InterfFreq = uadjfreq.InterfereResult;
                        uadinterfInfo.InterfObject.Add(interfobject);
                    }
                    adjinterfresultlst.Add(uadinterfInfo);
                }

                #endregion

                #region  邻频干扰

                if (item.LowerAdjFreqs != null && item.LowerAdjFreqs.Length > 0)
                {
                    InterfereResult ladjinterfInfo = new InterfereResult();
                    ladjinterfInfo.InterfType   = InterfereTypeEnum.邻频干扰;
                    ladjinterfInfo.InterfOrder  = InterfereOrderEnum.邻频;
                    ladjinterfInfo.InterfObject = new List <InterfereObject>();

                    foreach (ComparableFreq ladjfreq in item.LowerAdjFreqs)
                    {
                        //先在设备列表中查找,如果有,则认为干扰物为设备
                        ActivityEquipment Interfequ    = _equipments.FirstOrDefault(r => r.Key == ladjfreq.FreqID);
                        InterfereObject   interfobject = null;
                        if (Interfequ != null)
                        {
                            interfobject = CreateInterfObjectFromEqu(Interfequ);
                        }
                        else
                        {
                            //如设备列表中没有,则在周围台站列表中查找,如果有,则认为干扰物为设备
                            ActivitySurroundStation Interfstation = _aroundStation.FirstOrDefault(r => r.STATGUID == ladjfreq.FreqID);
                            if (Interfstation != null)
                            {
                                interfobject = CreateInterfObjectFromStation(Interfstation, ladjfreq);
                            }
                            else
                            {
                                //如设备列表和周围台站列表中都没有此干扰物,则认为干扰物为其他(这种情况应该不会出现??)
                                interfobject = CreateInterfObjectFromOther(ladjfreq);
                            }
                        }
                        interfobject.InterfFreq = ladjfreq.InterfereResult;
                        ladjinterfInfo.InterfObject.Add(interfobject);
                    }
                    adjinterfresultlst.Add(ladjinterfInfo);
                }
                #endregion

                if (isnewInterfere)
                {
                    this.dicInterfereResult.Add(equ, adjinterfresultlst);
                }
            }
            return(adjinterfresultlst);
        }
        /// <summary>
        /// 取设备的Transmitter(包含备用频率发射信息)
        /// </summary>
        /// <param name="equs"></param>
        /// <returns></returns>
        private static Transmitter[] GetEquTransmitters(List <ActivityEquipment> equs)
        {
            List <Transmitter> transList = new List <Transmitter>();

            if (equs != null && equs.Count > 0)
            {
                ActivityEquipment equ = null;
                for (int i = 0; i < equs.Count; i++)
                {
                    equ = equs[i];

                    double freqsend = 0;
                    if (equ.AssignSendFreq != null)
                    {
                        freqsend = equ.AssignSendFreq.Value;
                    }


                    double band = 0;
                    if (equ.Band_kHz != null)
                    {
                        band = equ.Band_kHz.Value;
                    }

                    double sendFreqStart = 0;
                    if (equ.FreqRange.Little != null)
                    {
                        sendFreqStart = equ.FreqRange.Little.Value;
                    }

                    double sendFreqEnd = 0;
                    if (equ.FreqRange.Great != null)
                    {
                        sendFreqEnd = equ.FreqRange.Great.Value;
                    }

                    double maxPower = 0;
                    if (equ.Power_W != null)
                    {
                        maxPower = equ.Power_W.Value;
                    }

                    Transmitter transmitter = new Transmitter(equ.Key,
                                                              new ComparableFreq(freqsend, 0, band / 1000, equ.Key),
                                                              new TransmitterParams()
                    {
                        TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, sendFreqStart),
                        TuningRangeEnd   = new EMCFreqValue(EMCFreqUnitEnum.MHZ, sendFreqEnd),
                        Power            = new EMCPowerValue(EMCPowerUnitEnum.W, maxPower)
                    }, null);
                    transList.Add(transmitter);


                    //备用发射频率也作为一条发射
                    double sparefreq = 0;
                    if (equ.AssignSpareFreq != null)
                    {
                        sparefreq = equ.AssignSpareFreq.Value;
                        Transmitter sparetransmitter = new Transmitter(equ.Key,
                                                                       new ComparableFreq(sparefreq, 0, band / 1000, equ.Key),
                                                                       new TransmitterParams()
                        {
                            TuningRangeStart = new EMCFreqValue(EMCFreqUnitEnum.MHZ, sendFreqStart),
                            TuningRangeEnd   = new EMCFreqValue(EMCFreqUnitEnum.MHZ, sendFreqEnd),
                            Power            = new EMCPowerValue(EMCPowerUnitEnum.W, maxPower)
                        }, null);
                        transList.Add(sparetransmitter);
                    }
                }
            }
            return(transList.ToArray());
        }