private void LoadStation() { List <Jc_DefInfo> temp = DEFServiceModel.QueryPointByDevpropertIDCache(0).ToList(); GetAllStationItemsRequest getAllStationItemsRequest = new GetAllStationItemsRequest(); var result = stationUpdateService.GetAllStationItems(getAllStationItemsRequest); List <StationUpdateItem> stationUpdateItems = result.Data; dgv.Rows.Clear(); StationUpdateItem item; for (int i = 0; i < temp.Count; i++) { item = stationUpdateItems.FirstOrDefault(a => a.fzh == (int)temp[i].Fzh); if (item != null) { dgv.Rows.Add(item.isUpdate ? 1 : 0, i + 1, temp[i].Fzh, temp[i].Wz, temp[i].DevName, EnumHelper.GetEnumDescription((DeviceRunState)temp[i].State), GetUpdateState(item.stationWorkState.updateState), item.nowNeedSendBuffIndex, EnumHelper.GetEnumDescription(item.updateState), ""); } else { dgv.Rows.Add(0, i + 1, temp[i].Fzh, temp[i].Wz, temp[i].DevName, EnumHelper.GetEnumDescription((DeviceRunState)temp[i].State), "", "", "", ""); } } }
/// <summary> /// 设备选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton4_Click(object sender, EventArgs e) { try { //先获取所有人员设备信息 List <Jc_DefInfo> AllPersonPointInfo = DEFServiceModel.QueryPointByDevpropertIDCache(7); DataTable _dtSelectItem = new DataTable(); _dtSelectItem.Columns.Add("Check"); _dtSelectItem.Columns.Add("Id"); _dtSelectItem.Columns.Add("Text"); foreach (var item in AllPersonPointInfo) { var row = _dtSelectItem.NewRow(); row["Check"] = false; row["Id"] = item.Point; row["Text"] = item.Point + item.Wz; _dtSelectItem.Rows.Add(row); } var selectForm = new ItemSelect("设备选择", "设备名称", _dtSelectItem, pointSelectList.Keys.ToList()); var res = selectForm.ShowDialog(); if (res != DialogResult.OK) { return; } pointSelectList.Clear(); listBoxControl1.Items.Clear(); foreach (string point in selectForm.SelectedIds) { string Wz = AllPersonPointInfo.Find(a => a.Point == point).Wz; pointSelectList.Add(point, Wz); listBoxControl1.Items.Add(point + "(" + Wz + ")"); } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } }
private void CF_Fz_Load(object sender, EventArgs e) { string str = ""; cb_pt1.Properties.Items.Add(""); cb_pt2.Properties.Items.Add(""); cb_pt3.Properties.Items.Add(""); cb_pt4.Properties.Items.Add(""); IList <Jc_DefInfo> list = DEFServiceModel.QueryAllCache(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].DevPropertyID == 2) { str = list[i].Point + "." + list[i].Wz + "[" + list[i].DevName + "]"; cb_pt1.Properties.Items.Add(str); cb_pt2.Properties.Items.Add(str); cb_pt3.Properties.Items.Add(str); cb_pt4.Properties.Items.Add(str); } } if (Str != "") { string[] sz = Str.Split('|'); if (sz.Length > 0) { for (int i = 0; i < cb_pt1.Properties.Items.Count; i++) { if (cb_pt1.Properties.Items[i].ToString().Contains(sz[0])) { cb_pt1.SelectedIndex = i; break; } } } if (sz.Length > 1) { for (int i = 0; i < cb_pt2.Properties.Items.Count; i++) { if (cb_pt2.Properties.Items[i].ToString().Contains(sz[1])) { cb_pt2.SelectedIndex = i; break; } } } if (sz.Length > 2) { for (int i = 0; i < cb_pt3.Properties.Items.Count; i++) { if (cb_pt3.Properties.Items[i].ToString().Contains(sz[2])) { cb_pt3.SelectedIndex = i; break; } } } if (sz.Length > 3) { for (int i = 0; i < cb_pt4.Properties.Items.Count; i++) { if (cb_pt4.Properties.Items[i].ToString().Contains(sz[3])) { cb_pt4.SelectedIndex = i; break; } } } } } }
/// <summary> /// 获取新增运行记录信息 /// </summary> public void getdata() { Jc_RInfo obj = null; long key = 0; #region 获取自动挂接数据 try { automaticArticulatedDeviceInfo = DEFServiceModel.GetAllAutomaticArticulatedDeviceCache(); //测试数据 //AutomaticArticulatedDeviceInfo temp = new AutomaticArticulatedDeviceInfo(); //temp.ID = "1111"; //temp.DeviceOnlyCode = "2018000000"; //temp.AddressNumber = 0; //temp.BranchNumber = 2; //temp.ChanelNumber = 8; //temp.DeviceModel = 34; //temp.ReciveTime = DateTime.Now; //temp.StationNumber = 1; //temp.Value = "10.0"; //automaticArticulatedDeviceInfo.Add(temp); //List<AutomaticArticulatedDeviceInfo> automaticArticulatedDeviceInfo = new List<AutomaticArticulatedDeviceInfo>(); //判断实时运行记录自动挂接记录是否还存在,如果不存在,则删除此自动挂接记录 DataRow[] acrowinfos = showdt.Select("point='未定义'"); if (acrowinfos != null && acrowinfos.Length > 0) { for (int i = 0; i < acrowinfos.Length; i++) { var arid = acrowinfos[i]["id"].ToString(); if (automaticArticulatedDeviceInfo.FirstOrDefault(o => o.DeviceOnlyCode == arid) == null) { //deletelist.Add(long.Parse(arid)); deletelist.Add(arid); } } } if (automaticArticulatedDeviceInfo.Count > 0) { automaticArticulatedDeviceInfo.ForEach(arinfo => { if (arinfo.ChanelNumber <= 16) { //判断实时运行记录是否存在此自动挂接记录,如不存在,则添加一条记录 var rowinfo = showdt.Select("id='" + arinfo.DeviceOnlyCode + "'"); if (rowinfo == null || rowinfo.Length == 0) { #region 新增运行记录 obj = new Jc_RInfo(); obj.ID = arinfo.DeviceOnlyCode; obj.Fzh = arinfo.StationNumber; obj.Kh = arinfo.ChanelNumber; Jc_DevInfo tempdev = devAllList.Find(a => a.Bz4 == arinfo.DeviceModel); if (tempdev != null) { obj.Devid = tempdev.Devid; } else { obj.Devid = ""; } obj.Dzh = arinfo.AddressNumber; obj.Wzid = "-"; obj.Point = "未定义"; obj.Type = -1; obj.State = -1; obj.Val = arinfo.Value; obj.Timer = arinfo.ReciveTime; jc_r.Add(obj.ID, obj); //addlist.Add(long.Parse(obj.ID)); addlist.Add(obj.ID); #endregion } else { rowinfo[0]["ssz"] = arinfo.Value;//刷新实时值 } } }); } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } #endregion }