コード例 #1
0
 /// <summary>
 /// 分站取消放电
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void substationCancelDischarge_Click(object sender, EventArgs e)
 {
     try
     {
         var node = treeViewSubstation.SelectedNode;
         if (node == null)
         {
             XtraMessageBox.Show("请先选择需操作的项。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         var point = node.Name;
         ChargeMrg.SendStationDControl(Convert.ToUInt16(point), 1);
         XtraMessageBox.Show("操作成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (Exception exc)
     {
         XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #2
0
        /// <summary>
        /// 分站电源箱放电
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void substationExecuteDischarge_Click(object sender, EventArgs e)
        {
            try
            {
                var node = treeViewSubstation.SelectedNode;
                if (node == null)
                {
                    XtraMessageBox.Show("请先选择需操作的项。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                var point = node.Name;
                ChargeMrg.SendStationDControl(Convert.ToUInt16(point), 2);

                //写放电记录  20180124
                ChargeMrg.AddPowerboxchargehistory(Convert.ToUInt16(point), "");

                //var tempControls = ChargeMrg.QueryJCSDKZbyInf(10, point);
                //if (tempControls.Count > 0) //处于放电状态
                //{
                //    if (substationExecuteDischarge.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());
                //        substationExecuteDischarge.Text = "执行放电";
                //        substationExecuteDischarge.ForeColor = Color.Green;
                //    }
                //    else if (substationExecuteDischarge.Text == "执行放电")
                //    {
                //        substationExecuteDischarge.Text = "取消放电";
                //        substationExecuteDischarge.ForeColor = Color.Red;
                //    }
                //}
                //else //处于未放电状态
                //{
                //    if (substationExecuteDischarge.Text == "执行放电")
                //    {
                //        var tempControlAdd = new Jc_JcsdkzInfo
                //        {
                //            ID = IdHelper.CreateLongId().ToString(),
                //            Type = 10,
                //            ZkPoint = "0000000",
                //            Bkpoint = point,
                //            InfoState = InfoState.AddNew
                //        };
                //        ChargeMrg.AddJC_JCSDKZCache(tempControlAdd);
                //        OperateLogHelper.InsertOperateLog(4,
                //            "执行放电:主控【" + tempControlAdd.ZkPoint + "】-【" + tempControlAdd.Bkpoint + "】-【" +
                //            DateTime.Now + "】", "");
                //        substationExecuteDischarge.Text = "取消放电";
                //        substationExecuteDischarge.ForeColor = Color.Red;
                //    }
                //    else if (substationExecuteDischarge.Text == "取消放电")
                //    {
                //        substationExecuteDischarge.Text = "执行放电";
                //        substationExecuteDischarge.ForeColor = Color.Green;
                //    }
                //}
                XtraMessageBox.Show("操作成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception exc)
            {
                XtraMessageBox.Show(exc.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }