/// <summary> /// 初始化计量点 /// </summary> private void InitWeightPoints() { //查询计量点信息 _carWeightDatamanage.GetWeightPoints(this.dataTable1); WeighPoint wp = new WeighPoint(this.ob); //按计量点数量生成CoreApp对象数组 if (_measApps == null) { _measApps = new CoreApp[ultraGrid2.Rows.Count]; } int count = 0; for (int i = 0; i < ultraGrid2.Rows.Count; i++) { Infragistics.Win.UltraWinGrid.UltraGridRow uRow = ultraGrid2.Rows[i]; string sign = uRow.Cells["FN_POINTFLAG"].Value.ToString().Trim(); string signIp = uRow.Cells["FS_IP"].Value.ToString().Trim(); if (sign.Equals("1")) { if (signIp.Equals(_carWeightDatamanage.IP4)) { uRow.Appearance.BackColor = Color.Green; //uRow.Cells["XZ"].Value = true; count++; //初始化设备 string pointCode = uRow.Cells["FS_POINTCODE"].Value.ToString().Trim(); _measApps[i] = new CoreApp(); _measApps[i].Params = wp.GetPoint(pointCode); _measApps[i].Init(i); //初始化读卡器 if (_measApps[i].Card != null) { _measApps[i].Card.CardChanged += new CardChangedEventHandler(OnCardChanged1); } // 初始化称重仪 if (_measApps[i].Weight != null) { _measApps[i].Weight.WeightChanged += new YGJZJL.CarSip.Client.Meas.WeightChangedEventHandler(OnWeightChanged1); _measApps[i].Weight.WeightCompleted += new YGJZJL.CarSip.Client.Meas.WeightCompletedEventHandler(OnWeightCompleted1); } //初始化RTU if (_measApps[i].Rtu != null) { _measApps[i].Rtu.DOChanged += new RtuChangedEventHandler(Rtu_DOChanged1); } _measApps[i].Run(); } else { uRow.Appearance.BackColor = Color.Yellow; uRow.Cells["XZ"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; } } else { uRow.Appearance.BackColor = Color.White; } } btnJG.Text = count == 0 ? "接 管" : "取消接管"; if (btnJG.Text.Equals("取消接管")) { MessageBox.Show("接管成功!"); } //设置一次计量图片显示大小 panel17.Width = videoChannel5.Width; panel17.Height = videoChannel5.Height; panel18.Width = videoChannel6.Width; panel18.Height = videoChannel6.Height; panel19.Width = videoChannel7.Width; panel19.Height = videoChannel7.Height; panel20.Width = videoChannel8.Width; panel20.Height = videoChannel8.Height; }
/// <summary> /// 初始化接管计量点 /// </summary> private void InitBandPoints() { WeighPoint wp = new WeighPoint(this.ob); int count = 0; for (int i = 0; i < ultraGrid2.Rows.Count; i++) { Infragistics.Win.UltraWinGrid.UltraGridRow uRow = ultraGrid2.Rows[i]; string sign = uRow.Cells["FN_POINTFLAG"].Value.ToString().Trim(); string signIp = uRow.Cells["FS_IP"].Value.ToString().Trim(); if (sign.Equals("1")) { if (signIp.Equals(_carWeightDatamanage.IP4)) { uRow.Appearance.BackColor = Color.Green; //uRow.Cells["XZ"].Value = true; count++; //初始化设备 bool flag = true; string pointCode = uRow.Cells["FS_POINTCODE"].Value.ToString().Trim(); foreach (CoreApp measApp in _measApps) { if (measApp != null && measApp.Params.FS_POINTCODE.Equals(pointCode)) { flag = false; break; } } if (flag) { _measApps[i] = new CoreApp(); _measApps[i].Params = wp.GetPoint(pointCode); _measApps[i].Init(i); //初始化读卡器 if (_measApps[i].Card != null) { _measApps[i].Card.CardChanged += new CardChangedEventHandler(OnCardChanged1); } // 初始化称重仪 if (_measApps[i].Weight != null) { _measApps[i].Weight.WeightChanged += new YGJZJL.CarSip.Client.Meas.WeightChangedEventHandler(OnWeightChanged1); _measApps[i].Weight.WeightCompleted += new YGJZJL.CarSip.Client.Meas.WeightCompletedEventHandler(OnWeightCompleted1); } //初始化RTU if (_measApps[i].Rtu != null) { _measApps[i].Rtu.DOChanged += new RtuChangedEventHandler(Rtu_DOChanged1); } _measApps[i].Run(); } } else { uRow.Appearance.BackColor = Color.Yellow; uRow.Cells["XZ"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; } } else { uRow.Appearance.BackColor = Color.White; } } btnJG.Text = count == 0 ? "接 管" : "取消接管"; if (btnJG.Text.Equals("取消接管")) { MessageBox.Show("接管成功!"); } }