using RGD.Common;
using RGD.DataService;
using RGD.DBUtility;
using RGD.MdsAPI.WMS;
using RGD.OPCClient;
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace RGD.WCS
{
public partial class FrmModifyMonitor : Form
{
private string _monstatus = " F_Status<>-1 ";
private static FrmModifyMonitor _formInstance;
public static FrmModifyMonitor FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmModifyMonitor();
}
return _formInstance;
}
set { _formInstance = value; }
}
public FrmModifyMonitor()
{
InitializeComponent();
_formInstance = this;
}
private CGetState gs = new CGetState();
private CCommonFunction ccf = new CCommonFunction();
private void FrmModifyMonitor_Load(object sender, EventArgs e)
{
rbmonRun_CheckedChanged(sender, e);
}
///
/// 运行队列
///
///
///
private void rbmonRun_CheckedChanged(object sender, EventArgs e)
{
if (rbmonRun.Checked == true)
{
_monstatus = " (F_Status>=1) ";
}
TSMMonitorRefresh_Click(sender, e);
}
///
/// 全部队列
///
///
///
private void rbmonAll_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
if (rb.Checked == true)
{
_monstatus = " F_Status<>-1 ";
}
TSMMonitorRefresh_Click(sender, e);
}
///
/// 等待队列
///
///
///
private void rbmonWait_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb = (RadioButton)sender;
if (rb.Checked == true)
{
_monstatus = " F_Status=0 ";
}
TSMMonitorRefresh_Click(sender, e);
}
//刷新列表
private void TSMMonitorRefresh_Click(object sender, EventArgs e)
{
CStaticClass.RealRefresh = true;
this.dgvMonitor.DataSource = DbHelperSQL.Query("select * from V_Monitor_Task where " + _monstatus + " order by 设备指令索引 asc ").Tables[0].DefaultView;
}
///
/// 开始查询
///
///
///
private void button1_Click(object sender, EventArgs e)
{
if (this.textBox1.Text.Trim().Length == 0) return;
int index = 0;
bool isint = int.TryParse(this.textBox1.Text.Trim(), out index);
if (this.comboBox1.Text == "表箱条码")
{
_monstatus = " 表箱条码 like'%" + this.textBox1.Text.Trim() + "%' ";
}
if (this.comboBox1.Text == "设备指令索引")
{
if (isint == false)
{
//MessageBox.Show("请输入数字!", "误操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox1.Text = string.Empty;
return;
}
_monstatus = " 设备指令索引='" + this.textBox1.Text.Trim() + "' ";
}
if (this.comboBox1.Text == "调度任务索引")
{
if (isint == false)
{
//MessageBox.Show("请输入数字!", "误操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox1.Text = string.Empty;
return;
}
_monstatus = " 调度任务索引='" + this.textBox1.Text.Trim() + "' ";
}
TSMMonitorRefresh_Click(sender, e);
}
///
/// 显示全部
///
///
///
private void button2_Click(object sender, EventArgs e)
{
_monstatus = " F_Status<>-1 ";
TSMMonitorRefresh_Click(sender, e);
}
private void dgvMonitor_DataSourceChanged(object sender, EventArgs e)
{
dgvMonitor.Columns["F_Status"].Visible = false;
}
///
/// 指令完成
///
///
///
private void TSMmonitorOK_Click(object sender, EventArgs e)
{
char[] cc = new char[1] { ':' };
string[] split = TSMonitor.Text.Split(cc);
if (split[1] == "") return;
DataView dv = DbHelperSQL.Query("SELECT * FROM T_Monitor_Task Where F_MonitorIndex=" +
Convert.ToInt32(split[1])).Tables[0].DefaultView;
if (dv.Count > 0)
{
//20100108中间指令被报告完成时给与提示和警告
DataView dv0 = DbHelperSQL.Query("SELECT MIN(F_MonitorIndex) AS mmi FROM dbo.T_Monitor_Task WHERE (F_ManageTaskIndex = " + dv[0]["F_ManageTaskIndex"] + ") AND (F_ManageTASKKINDINDEX = " + dv[0]["F_ManageTASKKINDINDEX"] + ")").Tables[0].DefaultView;
if (dv0.Count > 0)
{
if ((dv0[0]["mmi"] != DBNull.Value) && (dv0[0]["mmi"].ToString() != split[1]))
{
if (MessageBox.Show("表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”之前还有没执行完成的调度任务,提前【动作完成】会造成调度任务混乱,您确认要继续操作吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
{
return;
}
}
}
dv0 = null;
//20100108操作黑匣子增加托盘条码
if (MessageBox.Show("您确认表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”已经操作完成了吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{
return;
}
if (dv[0]["F_DeviceIndex"].ToString() == "11001")
{
if (MessageBox.Show("Agv无法手动完成任务,请问是否只调接口", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
string sResult;
//DataView dv_task = DbHelperSQL.Query("select * from t_WareHouse").Tables[0].DefaultView;
DataView ds = DbHelperSQL.Query("SELECT * FROM T_Manage_Task =" + dv[0]["F_ManageTaskIndex"]).Tables[0].DefaultView;
bool bResult = (new uploadStackIODet()).Notify(ds[0]["fmanageid"].ToString(), ds[0]["FSTARTCELL"].ToString() == "-" ? "02" : "01", ds[0]["FSTARTCELL"].ToString() == "-" ? ds[0]["FENDCELL"].ToString() : ds[0]["FSTARTCELL"].ToString(), out sResult);
MessageBox.Show("调用接口" + (bResult ? "成功" : "失败"));
}
}
string sss = "设备索引:" + dv[0]["F_DeviceIndex"].ToString() + ";设备指令索引:" + dv[0]["F_MonitorIndex"].ToString();
//20100108操作黑匣子增加托盘条码
CCarryConvert.WriteDarkCasket("设备指令管理", "手工报告完成", "表箱条码:" + dv[0]["F_TxtParam"].ToString(), sss);
AssociateComplete(Convert.ToInt32(dv[0]["F_DeviceIndex"]), Convert.ToInt32(dv[0]["F_MonitorIndex"]), Convert.ToInt32(dv[0]["F_Status"]));
this.dgvMonitor.DataSource = DbHelperSQL.Query("select * from V_Monitor_Task where " + _monstatus + " order by 设备指令索引 asc ").Tables[0].DefaultView;
}
}
public void AssociateComplete(int deviceIdx, int mindex, int status)
{
int ClearZero = 0;
if (status >= 1)
{
ClearZero = 1;
}
else
{
ClearZero = CGeneralFunction.TASKFINISH;
}
int DeviceIdx = deviceIdx;
int devKind;
DataView dv = DbHelperSQL.Query("select F_MonitorIndex,F_DeviceIndex,F_DeviceCommandIndex,F_NumParam4 from T_Monitor_Task where F_MonitorIndex=" + mindex).Tables[0].DefaultView;
if (dv.Count > 0)
{
//检查关联命令一起报告完成
//如果mindex是主动任务(f_associatemonitor有数据),先报告完成被动的任务;如果mindex是被动任务,先报告完成自己,再报告完成主动任务;
DataView dv1 = DbHelperSQL.Query("select F_DeviceIndex,F_Associate from T_Monitor_Task where F_Associate IS NOT NULL and F_MonitorIndex=" + mindex).Tables[0].DefaultView;
if (dv1.Count > 0)
{
DataView dv2 = DbHelperSQL.Query("select F_DeviceIndex,F_MonitorIndex from T_Monitor_Task where F_MonitorIndex=" + Convert.ToInt32(dv1[0]["F_Associate"])).Tables[0].DefaultView;
if (dv2.Count > 0)//有关联命令,先报告完成关联命令
{
DeviceIdx = Convert.ToInt32(dv2[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
gs.ActionComplete(DeviceIdx, Convert.ToInt32(dv2[0]["F_MonitorIndex"]), ClearZero);
}
//再报告完成自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
gs.ActionComplete(DeviceIdx, mindex, ClearZero);
}
else
{
//自己是否被关联,先报告完成自己,再报告完成主任务
DataView dv3 = DbHelperSQL.Query("select F_DeviceIndex,F_MonitorIndex from T_Monitor_Task where F_Associate ='" + mindex + "'").Tables[0].DefaultView;
if (dv3.Count > 0)
{ //先报告完成自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
gs.ActionComplete(DeviceIdx, mindex, ClearZero);
//再报告完成主任务
DeviceIdx = Convert.ToInt32(dv3[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
gs.ActionComplete(DeviceIdx, Convert.ToInt32(dv3[0]["F_MonitorIndex"]), ClearZero);
}
else
{
//无关联任务,只报告完成自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
//20091107长输送机链需要给最后一个报告完成的清零
if ((devKind == 2) && (Convert.ToInt32(dv[0]["F_NumParam4"]) > 0) && (dv[0]["F_DeviceCommandIndex"].ToString() == "6"))
{
DeviceIdx = Convert.ToInt32(dv[0]["F_NumParam4"]);
}
gs.ActionComplete(DeviceIdx, mindex, ClearZero);
}
}
}
}
///
/// 指令重发
///
///
///
private void TSMRestore_Click(object sender, EventArgs e)
{
char[] cc = new char[1] { ':' };
string[] split = TSMonitor.Text.Split(cc);
if (split[1] == "") return;
ISendDeviceOrder sdo;
int DeviceIdx;
int devKind;
int mindex = Convert.ToInt32(split[1]);
int fid = ccf.GetManageTaskIndexfromMonitor(mindex);
int mankind = ccf.GetManageTaskKindIndexFromMonitor(mindex);
//20100108改为select *
DataView dv = DbHelperSQL.Query("select * from T_Monitor_Task where F_MonitorIndex=" + mindex).Tables[0].DefaultView;
if (dv.Count > 0)
{
//20100108中间指令被复位时给与提示和警告
DataView dv0 = DbHelperSQL.Query("SELECT MIN(F_MonitorIndex) AS mmi FROM dbo.T_Monitor_Task WHERE (F_ManageTaskIndex = " + fid + ") AND (F_ManageTASKKINDINDEX = " + mankind + ")").Tables[0].DefaultView;
if (dv0.Count > 0)
{
if ((dv0[0]["mmi"] != DBNull.Value) && (dv0[0]["mmi"].ToString() != mindex.ToString()))
{
if (MessageBox.Show("表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”之前还有没执行完成的调度任务,提前【复位】会造成调度任务混乱,您确认要继续操作吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
{
return;
}
}
}
dv0 = null;
//20100108操作黑匣子增加托盘条码
if (MessageBox.Show("您确认表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”需要被重新发送和设备清零吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{
return;
}
//20091107
devKind = BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(dv[0]["F_DeviceIndex"]));
if ((devKind == 6) && (dv[0]["F_AgvNo"] != DBNull.Value))
{
if (MessageBox.Show("您要复位的AGV任务已经分配AGV车号:" + dv[0]["F_AgvNo"].ToString() + ",确认要继续重新下达AGV命令吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{
return;
}
}
string sss = "设备索引:" + dv[0]["F_DeviceIndex"].ToString() + ";设备指令索引:" + dv[0]["F_MonitorIndex"].ToString();
//20100108操作黑匣子增加托盘条码
CCarryConvert.WriteDarkCasket("设备指令管理", "手工复位", "表箱条码:" + dv[0]["F_TxtParam"].ToString(), sss);
//检查关联命令一起复位
//如果mindex是主动任务(f_associatemonitor有数据),先复位被动的任务;如果mindex是被动任务,先复位自己,再复位主动任务;
DataView dv1 = DbHelperSQL.Query("select F_DeviceIndex,F_Associate from T_Monitor_Task where F_Associate IS NOT NULL and F_MonitorIndex=" + mindex).Tables[0].DefaultView;
if (dv1.Count > 0)
{
DataView dv2 = DbHelperSQL.Query("select F_DeviceIndex,F_MonitorIndex from T_Monitor_Task where F_MonitorIndex=" + Convert.ToInt32(dv1[0]["F_Associate"])).Tables[0].DefaultView;
if (dv2.Count > 0)//有关联命令,先复位关联命令
{
DeviceIdx = Convert.ToInt32(dv2[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
if ((devKind == 2) || (devKind == 4))
{//输送机、RGV清零
sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0);
}
if ((devKind == 1)) //堆垛机
{
//只有取货任务才能重发,已经取完货的任务或放货任务不能重发
DataView restart = DbHelperSQL.Query("select * from t_monitor_task,t_manage_task where t_manage_task.fid=t_monitor_task.F_ManageTaskIndex and t_monitor_task.F_MonitorIndex=" + mindex).Tables[0].DefaultView;
//首先取消已经下发的任务
//其次判断是出库还是入库
//出库直接取,入库需要一个允许
MessageBox.Show("Agv不允许重发任务");
//sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
//sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0, 0, 0, 0, 0, 0);
}
DbHelperSQL.ExecuteSql("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + Convert.ToInt32(dv2[0]["F_DeviceIndex"]));
DbHelperSQL.ExecuteSql("update T_Monitor_Task set F_SendCount=0,F_Status=0 where F_MonitorIndex=" + Convert.ToInt32(dv2[0]["F_MonitorIndex"]));
}
//再复位自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
if ((devKind == 2) || (devKind == 4))
{//输送机、RGV清零
sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0);
}
if ((devKind == 1)) //堆垛机
{
MessageBox.Show("Agv不允许重发任务");
//sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
//sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0, 0, 0, 0, 0, 0);
}
DbHelperSQL.ExecuteSql("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + Convert.ToInt32(dv[0]["F_DeviceIndex"]));
DbHelperSQL.ExecuteSql("update T_Monitor_Task set F_SendCount=0,F_Status=0 where F_MonitorIndex=" + Convert.ToInt32(dv[0]["F_MonitorIndex"]));
}
else
{ //自己是否被关联,先复位自己,再复位主任务
DataView dv3 = DbHelperSQL.Query("select F_DeviceIndex,F_MonitorIndex from T_Monitor_Task where F_Associate ='" + mindex + "'").Tables[0].DefaultView;
if (dv3.Count > 0)
{ //先复位自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
if ((devKind == 2) || (devKind == 4))
{//输送机、RGV清零
sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0);
}
if (devKind == 1) //堆垛机
{
MessageBox.Show("Agv不允许重发任务");
//sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
//sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0, 0, 0, 0, 0, 0);
}
DbHelperSQL.ExecuteSql("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + Convert.ToInt32(dv[0]["F_DeviceIndex"]));
DbHelperSQL.ExecuteSql("update T_Monitor_Task set F_SendCount=0,F_Status=0 where F_MonitorIndex=" + mindex);
//再复位主任务
DeviceIdx = Convert.ToInt32(dv3[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
if ((devKind == 2) || (devKind == 4))
{//输送机、RGV清零
sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0);
}
if (devKind == 1) //堆垛机
{
MessageBox.Show("Agv不允许重发任务");
//sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
//sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0, 0, 0, 0, 0, 0);
}
DbHelperSQL.ExecuteSql("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + Convert.ToInt32(dv3[0]["F_DeviceIndex"]));
DbHelperSQL.ExecuteSql("update T_Monitor_Task set F_SendCount=0,F_Status=0 where F_MonitorIndex=" + Convert.ToInt32(dv3[0]["F_MonitorIndex"]));
}
else
{
//无关联任务,只复位自己
DeviceIdx = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
devKind = BaseDeviceService.GetDeviceKindIdx(DeviceIdx);
if ((devKind == 2) || (devKind == 4))
{//输送机、RGV清零
sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0);
}
if ((devKind == 1)) //堆垛机
{
MessageBox.Show("Agv不允许重发任务");
//sdo = CommModeCreate.CreateSendDeviceOrder(DeviceIdx);
//sdo.SendDeviceOrder(2, 0, 0, DeviceIdx, 0, 0, 0, 0, 0, 0);
}
DbHelperSQL.ExecuteSql("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + Convert.ToInt32(dv[0]["F_DeviceIndex"]));
DbHelperSQL.ExecuteSql("update T_Monitor_Task set F_SendCount=0,F_Status=0 where F_MonitorIndex=" + mindex);
}
}
//给管理FERRORCODE清空
if (mankind == 1)
{
}
DbHelperSQL.ExecuteSql("UPDATE T_Manage_Task SET FERRORCODE ='' WHERE FID=" + fid + " and F_ManageTaskKindIndex=" + mankind + "");
}
this.dgvMonitor.DataSource = DbHelperSQL.Query("select * from V_Monitor_Task where " + _monstatus + " order by 设备指令索引 asc ").Tables[0].DefaultView;
}
///
/// 指令删除
///
///
///
private void TSMmonitorDel_Click(object sender, EventArgs e)
{
char[] cc = new char[1] { ':' };
string[] split = TSMonitor.Text.Split(cc);
if (split[1] == "") return;
DataView dv = DbHelperSQL.Query("SELECT * FROM T_Monitor_Task Where F_MonitorIndex=" +
Convert.ToInt32(split[1])).Tables[0].DefaultView;
if (dv.Count > 0)
{
//20100108中间指令被报告完成时给与提示和警告
DataView dv0 = DbHelperSQL.Query("SELECT MIN(F_MonitorIndex) AS mmi FROM dbo.T_Monitor_Task WHERE (F_ManageTaskIndex = " + dv[0]["F_ManageTaskIndex"] + ") AND (F_ManageTASKKINDINDEX = " + dv[0]["F_ManageTASKKINDINDEX"] + ")").Tables[0].DefaultView;
if (dv0.Count > 0)
{
if ((dv0[0]["mmi"] != DBNull.Value) && (dv0[0]["mmi"].ToString() != split[1]))
{
if (MessageBox.Show("表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”之前还有没执行完成的调度任务,提前【删除设备指令】会造成调度任务混乱,您确认要继续操作吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
{
return;
}
}
}
dv0 = null;
//20100108操作黑匣子增加托盘条码
if (MessageBox.Show("您确认表箱条码:" + dv[0]["F_TxtParam"].ToString() + ",设备名称:“" + this.dgvMonitor.CurrentRow.Cells["设备名称"].Value.ToString() + ";设备命令:" + this.dgvMonitor.CurrentRow.Cells["设备命令名称"].Value.ToString() + "”已经不需要设备执行了吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{
return;
}
string sss = "设备索引:" + dv[0]["F_DeviceIndex"].ToString() + ";设备指令索引:" + dv[0]["F_MonitorIndex"].ToString();
{
CCarryConvert.WriteDarkCasket("设备指令管理", "手工删除设备指令", "表箱条码:" + dv[0]["F_TxtParam"].ToString(), sss);
gs.ActionComplete(Convert.ToInt32(dv[0]["F_DeviceIndex"]), Convert.ToInt32(dv[0]["F_MonitorIndex"]), CGeneralFunction.TASKDELETE);//20100905
}
this.dgvMonitor.DataSource = DbHelperSQL.Query("select * from V_Monitor_Task where " + _monstatus + " order by 设备指令索引 asc ").Tables[0].DefaultView;
}
}
private void dgvMonitor_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
foreach (DataGridViewRow DGVRow in this.dgvMonitor.Rows)
{
if (DGVRow != null)
{
if (Convert.ToInt32(DGVRow.Cells["f_status"].Value) >= 30)
{
DGVRow.DefaultCellStyle.BackColor = Color.Red;
}
}
}
}
///
/// 菜单打开
///
///
///
private void cmMonitor_Opening(object sender, CancelEventArgs e)
{
if (this.dgvMonitor.CurrentRow == null)
{
TSMonitor.Visible = false;
TSMManager.Visible = false;
TSMmonitorOK.Visible = false;
TSMRestore.Visible = false;
TSMmonitorDel.Visible = false;
toolStripSeparator2.Visible = false;
return;
}
if (Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells[0].Value) > 0)
{
TSMonitor.Visible = true;
TSMManager.Visible = true;
//TSMSimulateRun.Visible = true;
TSMmonitorOK.Visible = true;
TSMmonitorDel.Visible = true;
TSMRestore.Visible = true;
toolStripSeparator2.Visible = true;
TSMManager.Text = "任务类型:" + this.dgvMonitor.CurrentRow.Cells[1].Value.ToString() +
";调度任务索引:" + this.dgvMonitor.CurrentRow.Cells[0].Value.ToString();
TSMonitor.Text = "设备指令索引:" + this.dgvMonitor.CurrentRow.Cells[2].Value.ToString();
}
}
}
}