private void Start_HJStorage2() { List <ErrorDates> Errors = new List <ErrorDates>(); List <ErrorInfo> info; try { AllSystemStart ass = new AllSystemStart(); info = ass.ReadDBinfo_Storage(2); } catch (Exception) { updateListBox("第二组重力式货架PLC连接失败", listBox1); return; } if (info.Where(x => x.Value != "0").Count() != 0 ? true : false) { updateListBox("第二组重力式货架存在故障", listBox1); b5_2.BackColor = Color.Red; foreach (var item in info) { if (item.Value != "0") { ErrorDates ed = new ErrorDates(); ed.Value = item.Value; ed.ErrorMsg = item.ErrorMsg; Errors.Add(ed); } } HJStorage.HJStorageList2 = Errors; } else { b5_2.BackColor = Color.Green; } }
/// <summary> /// 一组重力式货架 /// </summary> private void GetListBoxItems1() { updateListBox(System.DateTime.Now.ToString() + "开始自检", listBox1); updateListBox("自检中,请等待......", listBox1); AllSystemStart ass1 = new AllSystemStart(); try { List <ErrorInfo> li = ass1.ReadDBinfo_Storage(1); foreach (var item in li) { if (item.Value != "0") { updateListBox(item.ErrorMsg, listBox1); } } updateListBox("本次自检结束......", listBox1); } catch (Exception) { updateListBox("未能成功连接PLC......", listBox2); } }