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),
                                 "",
                                 "",
                                 "",
                                 "");
                }
            }
        }
Exemple #2
0
        /// <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);
            }
        }