Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }