/// <summary> /// 其他管理分站列表选择函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewInterlockedCircuitBreaker_AfterSelect(object sender, TreeViewEventArgs e) { try { var node = treeViewInterlockedCircuitBreaker.SelectedNode; if (node == null) { return; } _lastBasicInfoRefTime = new DateTime(); //刷新解锁按钮状态 var point = node.Name.PadLeft(3, '0') + "0000"; var tempControls = ChargeMrg.QueryJCSDKZbyInf((int)ControlType.GasThreeUnlockControl, point); if (tempControls.Count > 0) { icbUnlock.Text = "取消三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Red; } else { icbUnlock.Text = "三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Green; } //刷新解锁按钮状态 var point1 = node.Name.PadLeft(3, '0') + "0000"; var tempControls1 = ChargeMrg.QueryJCSDKZbyInf((int)ControlType.StationHisDataClear, point1); if (tempControls1.Count > 0) { simpleButton1.Text = "取消清除分站历史数据"; simpleButton1.ForeColor = Color.Red; } else { simpleButton1.Text = "清除分站历史数据"; simpleButton1.ForeColor = Color.Green; } RefBasicInfo(node.Name); } catch (Exception exc) { XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 风电闭锁解锁 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void icbUnlock_Click(object sender, EventArgs e) { try { var node = treeViewInterlockedCircuitBreaker.SelectedNode; if (node == null) { XtraMessageBox.Show("请先选择需操作的项。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (icbUnlock.Text == "三分风电闭锁解锁") { if (XtraMessageBox.Show("点击三分强制解锁后,需要手动取消,否则设备一直处于强制解锁状态,是否继续?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } var point = node.Name.PadLeft(3, '0') + "0000"; var tempControls = ChargeMrg.QueryJCSDKZbyInf((int)ControlType.GasThreeUnlockControl, point); if (tempControls.Count > 0) //处于解锁状态 { if (icbUnlock.Text == "取消三分风电闭锁解锁") { for (var i = 0; i < tempControls.Count; i++) { tempControls[i].InfoState = InfoState.Delete; OperateLogHelper.InsertOperateLog(4, "取消三分风电闭锁解锁:主控【" + tempControls[i].ZkPoint + "】-【" + tempControls[i].Bkpoint + "】-【" + DateTime.Now + "】", ""); } ChargeMrg.DelJC_JCSDKZCache(tempControls.ToList()); icbUnlock.Text = "三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Green; } else if (icbUnlock.Text == "三分风电闭锁解锁") { icbUnlock.Text = "取消三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Red; } } else //未处于解锁状态 { if (icbUnlock.Text == "三分风电闭锁解锁") { var tempControlAdd = new Jc_JcsdkzInfo { ID = IdHelper.CreateLongId().ToString(), Type = (int)ControlType.GasThreeUnlockControl, ZkPoint = "0000000", Bkpoint = point, InfoState = InfoState.AddNew }; ChargeMrg.AddJC_JCSDKZCache(tempControlAdd); OperateLogHelper.InsertOperateLog(4, "三分风电闭锁解锁:主控【" + tempControlAdd.ZkPoint + "】-【" + tempControlAdd.Bkpoint + "】-【" + DateTime.Now + "】", ""); icbUnlock.Text = "取消三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Red; } else if (icbUnlock.Text == "取消三分风电闭锁解锁") { icbUnlock.Text = "三分风电闭锁解锁"; icbUnlock.ForeColor = Color.Green; } } } catch (Exception exc) { XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void simpleButton1_Click(object sender, EventArgs e) { try { var node = treeViewInterlockedCircuitBreaker.SelectedNode; if (node == null) { XtraMessageBox.Show("请先选择需操作的项。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var point = node.Name.PadLeft(3, '0') + "0000"; var tempControls = ChargeMrg.QueryJCSDKZbyInf((int)ControlType.StationHisDataClear, point); if (tempControls.Count > 0) //处于解锁状态 { if (simpleButton1.Text == "取消清除分站历史数据") { for (var i = 0; i < tempControls.Count; i++) { tempControls[i].InfoState = InfoState.Delete; OperateLogHelper.InsertOperateLog(4, "取消清除分站历史数据:主控【" + tempControls[i].ZkPoint + "】-【" + tempControls[i].Bkpoint + "】-【" + DateTime.Now + "】", ""); } ChargeMrg.DelJC_JCSDKZCache(tempControls.ToList()); simpleButton1.Text = "清除分站历史数据"; simpleButton1.ForeColor = Color.Green; } else if (simpleButton1.Text == "清除分站历史数据") { simpleButton1.Text = "取消清除分站历史数据"; simpleButton1.ForeColor = Color.Red; } } else //未处于解锁状态 { if (simpleButton1.Text == "清除分站历史数据") { var tempControlAdd = new Jc_JcsdkzInfo { ID = IdHelper.CreateLongId().ToString(), Type = (int)ControlType.StationHisDataClear, ZkPoint = "0000000", Bkpoint = point, InfoState = InfoState.AddNew }; ChargeMrg.AddJC_JCSDKZCache(tempControlAdd); OperateLogHelper.InsertOperateLog(4, "清除分站历史数据:主控【" + tempControlAdd.ZkPoint + "】-【" + tempControlAdd.Bkpoint + "】-【" + DateTime.Now + "】", ""); simpleButton1.Text = "取消清除分站历史数据"; simpleButton1.ForeColor = Color.Red; } else if (simpleButton1.Text == "取消清除分站历史数据") { simpleButton1.Text = "清除分站历史数据"; simpleButton1.ForeColor = Color.Green; } } } catch (Exception exc) { XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }