You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
576 lines
24 KiB
576 lines
24 KiB
10 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
|
||
|
using DBFactory;
|
||
|
using System.Net.Sockets;
|
||
|
using System.Threading;
|
||
|
using ICommLayer;
|
||
|
using CommLayerFactory;
|
||
|
using Microsoft.VisualBasic;
|
||
|
|
||
|
|
||
|
namespace ControlSystem
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Creator:Richard.liu
|
||
|
/// ������������
|
||
|
/// </summary>
|
||
|
public partial class FrmModifyManage : Form
|
||
|
{
|
||
|
string _manstatus= " F_Status<>-1 ";
|
||
|
private static FrmModifyManage _formInstance;
|
||
|
|
||
|
public static FrmModifyManage FormInstance
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (_formInstance == null)
|
||
|
{
|
||
|
_formInstance = new FrmModifyManage();
|
||
|
}
|
||
|
return _formInstance;
|
||
|
}
|
||
|
set { _formInstance = value; }
|
||
|
}
|
||
|
CGetState cgs = new CGetState();//20110222
|
||
|
Model.MDevice devinfo;
|
||
|
DBOperator dbo = CStaticClass.dbo;
|
||
|
DBOperator dboM = CStaticClass.dboM;
|
||
|
public FrmModifyManage()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
_formInstance = this;
|
||
|
}
|
||
|
|
||
|
private void rbmanAll_CheckedChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
RadioButton rb = (RadioButton)sender;
|
||
|
if (rb.Checked == true)
|
||
|
{
|
||
|
_manstatus = " F_Status<>-1 ";
|
||
|
}
|
||
|
TSMrefresh_Click(sender, e);
|
||
|
}
|
||
|
|
||
|
private void TSMrefresh_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
CStaticClass.RealRefresh = true;
|
||
|
this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + _manstatus).Tables[0].DefaultView;
|
||
|
}
|
||
|
|
||
|
private void rbmanRun_CheckedChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
if (rbmanRun.Checked == true)
|
||
|
{
|
||
|
_manstatus = " F_Status>=1 ";
|
||
|
}
|
||
|
TSMrefresh_Click(sender, e);
|
||
|
}
|
||
|
|
||
|
private void rbmanWait_CheckedChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
RadioButton rb = (RadioButton)sender;
|
||
|
if (rb.Checked == true)
|
||
|
{
|
||
|
_manstatus = " F_Status=0 ";
|
||
|
}
|
||
|
TSMrefresh_Click(sender, e);
|
||
|
}
|
||
|
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (this.textBox1.Text.Trim().Length == 0) return;
|
||
|
if (this.comboBox1.Text == "��������")
|
||
|
{
|
||
|
//20091016
|
||
|
_manstatus = " ��������='" + this.textBox1.Text.Trim() + "' ";
|
||
|
}
|
||
|
|
||
|
if (this.comboBox1.Text == "������������")
|
||
|
{
|
||
|
_manstatus = " ������������='" + this.textBox1.Text.Trim() + "' ";
|
||
|
}
|
||
|
TSMrefresh_Click(sender, e);
|
||
|
}
|
||
|
|
||
|
private void button2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
_manstatus = " F_Status<>-1 ";
|
||
|
|
||
|
TSMrefresh_Click(sender, e);
|
||
|
}
|
||
|
|
||
|
private void dgvManager_DataSourceChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
dgvManager.Columns["F_Status"].Visible = false;
|
||
|
}
|
||
|
|
||
|
private void cmManager_Opening(object sender, CancelEventArgs e)
|
||
|
{
|
||
|
if (this.dgvManager.CurrentRow == null)
|
||
|
{
|
||
|
TSMmanagerOK.Visible = false;
|
||
|
//TSMrefresh.Visible = false;
|
||
|
TSManager.Visible = false;
|
||
|
toolStripSeparator1.Visible = false;
|
||
|
//TSMmanagerDisassemble.Visible = false;
|
||
|
toolStripMenuItem1.Visible = false;
|
||
|
toolStripSeparator2.Visible = false;
|
||
|
return;
|
||
|
}
|
||
|
if (Convert.ToInt32(this.dgvManager.CurrentRow.Cells[0].Value) > 0)
|
||
|
{
|
||
|
TSMmanagerOK.Visible = true;
|
||
|
|
||
|
TSManager.Visible = true;
|
||
|
toolStripSeparator1.Visible = true;
|
||
|
toolStripSeparator2.Visible = true;
|
||
|
//TSMmanagerDisassemble.Visible = true;
|
||
|
toolStripMenuItem1.Visible = true;
|
||
|
TSManager.Text = "�������ͣ�" + this.dgvManager.CurrentRow.Cells[1].Value.ToString() +
|
||
|
"����������������" + this.dgvManager.CurrentRow.Cells[0].Value.ToString();
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void TSMmanagerOK_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
|
||
|
char[] cc = new char[1] { '��' };
|
||
|
string[] split = TSManager.Text.Split(cc);
|
||
|
if ((split[1] == "") || (split[2] == ""))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
char[] scc = new char[1] { '��' };
|
||
|
string[] strsplit = split[1].Split(scc);
|
||
|
int mti = 0;
|
||
|
int fid = Convert.ToInt32(split[2]);
|
||
|
if (strsplit[0] == "") return;
|
||
|
switch (strsplit[0])
|
||
|
{
|
||
|
case "��������":
|
||
|
mti = 1;
|
||
|
break;
|
||
|
case "�Զ�����":
|
||
|
mti = 2;
|
||
|
break;
|
||
|
case "��ʱ����":
|
||
|
mti = 3;
|
||
|
break;
|
||
|
case "�ֹ�����":
|
||
|
mti = 4;
|
||
|
break;
|
||
|
}
|
||
|
string cap = strsplit[0];
|
||
|
string hw = "";
|
||
|
if (this.dgvManager.CurrentRow.Cells["�յ���λ"].Value.ToString() != "-")
|
||
|
{
|
||
|
hw = ",�յ���λ:" + this.dgvManager.CurrentRow.Cells["�յ���λ"].Value.ToString();
|
||
|
}
|
||
|
//20100108
|
||
|
if (MessageBox.Show("��ȷ���������룺��" + this.dgvManager.CurrentRow.Cells["��������"].Value.ToString()+"����" + cap + split[2] + "�Ѿ������˵��յ��豸��" + this.dgvManager.CurrentRow.Cells["�յ�"].Value.ToString() + hw + "��������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
//20110222CGetState cgs = new CGetState();
|
||
|
dbo.ExceSQL("update T_Monitor_Task set F_STATUS=-1 where F_ManageTaskKindIndex=" + mti + " and F_ManageTaskIndex=" + fid + " and F_STATUS=0");
|
||
|
DataView dv = dbo.ExceSQL("SELECT F_ManageTaskKindIndex, F_ManageTaskIndex,F_DeviceIndex,F_MonitorIndex,F_Status,F_DeviceCommandIndex " +
|
||
|
",F_NumParam2,F_NumParam5,F_TxtParam FROM T_Monitor_Task Where F_ManageTaskIndex=" + fid + " and F_ManageTaskKindIndex= " +
|
||
|
mti).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
string sss = "������������:" + fid.ToString();
|
||
|
//20100108
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("������������", "���������ֹ���������", "�������룺" + this.dgvManager.CurrentRow.Cells["��������"].Value.ToString(), sss);
|
||
|
for (int i = 0; i < dv.Count; i++)
|
||
|
{
|
||
|
if (Convert.ToInt32(dv[i]["F_DeviceIndex"]) == 1001)
|
||
|
{
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), Model.CGeneralFunction.TASKFINISH);
|
||
|
//1 ���ϳ���;2 �����̻���;3�����̻���
|
||
|
if (Convert.ToInt32(dv[i]["F_DeviceCommandIndex"]) == 1)
|
||
|
{
|
||
|
DataTable tableAGVGate = dbo.ExceSQL("SELECT F_AGVGateDeviceIndex FROM T_BASE_AGV_GATE WHERE F_ADDRESS = " + Convert.ToInt32(dv[i]["F_NumParam5"]) + "").Tables[0];
|
||
|
if (tableAGVGate.Rows.Count > 0)
|
||
|
{
|
||
|
|
||
|
dbo.ExecuteSql("UPDATE T_BASE_DEVICE SET F_PALLETBARCODE='" + dv[i]["F_TxtParam"] + "',F_HAVEGOODS = 1 WHERE F_DEVICEINDEX = " + Convert.ToInt32(tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"]) + "");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
if ((Convert.ToInt32(dv[i]["F_DeviceCommandIndex"]) == 2) || (Convert.ToInt32(dv[i]["F_DeviceCommandIndex"]) == 3))
|
||
|
{
|
||
|
DataTable tableAGVGate = dbo.ExceSQL("SELECT F_AGVGateDeviceIndex FROM T_BASE_AGV_GATE WHERE F_ADDRESS = " + Convert.ToInt32(dv[i]["F_NumParam2"]) + "").Tables[0];
|
||
|
if (tableAGVGate.Rows.Count > 0)
|
||
|
{
|
||
|
//if (mti == 1)
|
||
|
//{
|
||
|
// //20090817����������������Ϣ
|
||
|
// dboM.ExecuteSql("UPDATE T_ITEMDEVICE SET devicestatus ='0' WHERE devicecode = '" + tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"] + "'");
|
||
|
//}
|
||
|
dbo.ExecuteSql("UPDATE T_BASE_DEVICE SET F_PALLETBARCODE='-',F_HAVEGOODS = 0 WHERE F_DEVICEINDEX = " + Convert.ToInt32(tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"]) + "");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (Convert.ToInt32(dv[i]["F_Status"]) >= 1)
|
||
|
{
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), 1);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), Model.CGeneralFunction.TASKFINISH);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
|
||
|
if (mti == 1)
|
||
|
{
|
||
|
dboM.ExceSQL("update IO_Control set Control_STATUS=" + Model.CGeneralFunction.TASKFINISH + " where Control_ID=" + fid);
|
||
|
}
|
||
|
//�������
|
||
|
cgs.ReturnManageInfo(fid, mti, cap, true);
|
||
|
}
|
||
|
|
||
|
this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + _manstatus).Tables[0].DefaultView;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
//throw ex;
|
||
|
if (FrmControlMonitor.FormInstance.GetObjectText("tsStatus").IndexOf("���������ֹ�����ʱ��" + ex.Message) < 0)
|
||
|
{
|
||
|
|
||
|
FrmControlMonitor.FormInstance.FlashPanit("tsStatus", "���������ֹ�����ʱ��" + ex.Message, true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void TSMmanagerDisassemble_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
char[] cc = new char[1] { '��' };
|
||
|
string[] split = TSManager.Text.Split(cc);
|
||
|
if ((split[1] == "") || (split[2] == ""))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
char[] scc = new char[1] { '��' };
|
||
|
string[] strsplit = split[1].Split(scc);
|
||
|
int mti = 0;
|
||
|
int fid = Convert.ToInt32(split[2]);
|
||
|
if (strsplit[0] == "") return;
|
||
|
switch (strsplit[0])
|
||
|
{
|
||
|
case "��������":
|
||
|
mti = 1;
|
||
|
break;
|
||
|
case "�Զ�����":
|
||
|
mti = 2;
|
||
|
break;
|
||
|
case "��ʱ����":
|
||
|
mti = 3;
|
||
|
break;
|
||
|
case "�ֹ�����":
|
||
|
mti = 4;
|
||
|
break;
|
||
|
}
|
||
|
if (mti == 1)
|
||
|
{
|
||
|
dbo.ExceSQL("update T_Manage_Task set FIntoStepOK='0' where FID=" + fid + " and FIntoStepOK='-' ");
|
||
|
}
|
||
|
FrmControlMonitor.FormInstance.MonitorRefresh();//20110222
|
||
|
FrmControlMonitor.FormInstance.ManagerRefresh();//20110222
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
//throw ex;
|
||
|
if (FrmControlMonitor.FormInstance.GetObjectText("tsStatus").IndexOf("�ֹ����ֵ�������ʱ��" + ex.Message) < 0)
|
||
|
{
|
||
|
|
||
|
FrmControlMonitor.FormInstance.FlashPanit("tsStatus", "�ֹ����ֵ�������ʱ��" + ex.Message, true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void FrmModifyManage_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
rbmanRun_CheckedChanged(sender, e);
|
||
|
}
|
||
|
|
||
|
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
//ɾ����������900
|
||
|
try
|
||
|
{
|
||
|
char[] cc = new char[1] { '��' };
|
||
|
string[] split = TSManager.Text.Split(cc);
|
||
|
if ((split[1] == "") || (split[2] == ""))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
char[] scc = new char[1] { '��' };
|
||
|
string[] strsplit = split[1].Split(scc);
|
||
|
int mti = 0;
|
||
|
int fid = Convert.ToInt32(split[2]);
|
||
|
if (strsplit[0] == "") return;
|
||
|
switch (strsplit[0])
|
||
|
{
|
||
|
case "��������":
|
||
|
mti = 1;
|
||
|
break;
|
||
|
case "�Զ�����":
|
||
|
mti = 2;
|
||
|
break;
|
||
|
case "��ʱ����":
|
||
|
mti = 3;
|
||
|
break;
|
||
|
case "�ֹ�����":
|
||
|
mti = 4;
|
||
|
break;
|
||
|
}
|
||
|
string hw = "";
|
||
|
if (this.dgvManager.CurrentRow.Cells["������λ"].Value.ToString() != "-")
|
||
|
{
|
||
|
hw = ",������λ:" + this.dgvManager.CurrentRow.Cells["������λ"].Value.ToString();
|
||
|
}
|
||
|
string cap = strsplit[0];
|
||
|
if (MessageBox.Show("��ȷ���������룺��" + this.dgvManager.CurrentRow.Cells["��������"].Value.ToString() + "����" + cap + split[2] + "�Ѿ���ȡ�������������˹����������˻ص������豸��" + this.dgvManager.CurrentRow.Cells["����"].Value.ToString() + hw + "��������", "������ʾ��", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
//20110110
|
||
|
DataView dv = dbo.ExceSQL("SELECT F_ManageTaskKindIndex, F_ManageTaskIndex,F_DeviceIndex,F_MonitorIndex,F_Status,F_DeviceCommandIndex " +
|
||
|
",F_NumParam2,F_NumParam5,F_TxtParam FROM T_Monitor_Task Where F_ManageTaskIndex=" + fid + " and F_ManageTaskKindIndex= " +
|
||
|
mti).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
if ((dv[0]["F_DeviceIndex"].ToString() == "1001") && (Convert.ToInt32(dv[0]["F_Status"]) > 0))
|
||
|
{//20110110
|
||
|
StringBuilder sql = new StringBuilder();
|
||
|
sql.Remove(0, sql.Length);
|
||
|
sql.Append("SELECT F_DeviceIndex,F_DeviceKindIndex, F_LocalIP, F_LocalPort, F_RemoteIP, F_RemotePort FROM T_Base_Device where F_DeviceIndex=1001");
|
||
|
DataView dvaa = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
||
|
if (dvaa.Count > 0)
|
||
|
{
|
||
|
byte[] _Sdata = new byte[6];
|
||
|
_Sdata[0] = Convert.ToByte(60009 & 255);
|
||
|
_Sdata[1] = Convert.ToByte(60009 >> 8);
|
||
|
|
||
|
_Sdata[2] = Convert.ToByte(Convert.ToInt32(dv[0]["F_ManageTaskIndex"]) & 255);
|
||
|
_Sdata[3] = Convert.ToByte(Convert.ToInt32(dv[0]["F_ManageTaskIndex"]) >> 8);
|
||
|
_Sdata[4] = Convert.ToByte(Convert.ToInt32(dv[0]["F_MonitorIndex"]) & 255);
|
||
|
_Sdata[5] = Convert.ToByte(Convert.ToInt32(dv[0]["F_MonitorIndex"]) >> 8);
|
||
|
SocketsTCPIP.CClientTCPIP.Send(dvaa[0]["F_RemoteIP"].ToString(), Convert.ToInt32(dvaa[0]["F_RemotePort"]), _Sdata);
|
||
|
|
||
|
|
||
|
}
|
||
|
dvaa = null;
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
//20110222CGetState cgs = new CGetState();
|
||
|
//20090902
|
||
|
dbo.ExceSQL("update T_Manage_Task set FExceptionNO=" + Model.CGeneralFunction.TASKDELETE + " where (F_ManageTaskKindIndex = " + mti + ") AND (FID = " + fid + ")");
|
||
|
|
||
|
dbo.ExceSQL("update T_Monitor_Task set F_STATUS=-1 where F_ManageTaskKindIndex=" + mti + " and F_ManageTaskIndex=" + fid + " and F_STATUS=0");
|
||
|
//20110110
|
||
|
dv = dbo.ExceSQL("SELECT F_ManageTaskKindIndex, F_ManageTaskIndex,F_DeviceIndex,F_MonitorIndex,F_Status,F_DeviceCommandIndex " +
|
||
|
",F_NumParam2,F_NumParam5,F_TxtParam FROM T_Monitor_Task Where F_ManageTaskIndex=" + fid + " and F_ManageTaskKindIndex= " +
|
||
|
mti).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
string sss = "������������:" + fid.ToString();
|
||
|
//20100108
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("������������", "�����������ֹ�ɾ����", "�������룺" + this.dgvManager.CurrentRow.Cells["��������"].Value.ToString(), sss);
|
||
|
for (int i = 0; i < dv.Count; i++)
|
||
|
{
|
||
|
if (Convert.ToInt32(dv[i]["F_DeviceIndex"]) == 1001)
|
||
|
{
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), Model.CGeneralFunction.TASKDELETE);
|
||
|
//1 ���ϳ���;2 �����̻���;3�����̻���
|
||
|
|
||
|
if ((Convert.ToInt32(dv[i]["F_DeviceCommandIndex"]) == 2) || (Convert.ToInt32(dv[i]["F_DeviceCommandIndex"]) == 3))
|
||
|
{
|
||
|
DataTable tableAGVGate = dbo.ExceSQL("SELECT F_AGVGateDeviceIndex FROM T_BASE_AGV_GATE WHERE F_ADDRESS = " + Convert.ToInt32(dv[i]["F_NumParam2"]) + "").Tables[0];
|
||
|
if (tableAGVGate.Rows.Count > 0)
|
||
|
{
|
||
|
|
||
|
dbo.ExecuteSql("UPDATE T_BASE_DEVICE SET F_PALLETBARCODE='" + dv[i]["F_TxtParam"] + "',F_HAVEGOODS = 1 WHERE F_DEVICEINDEX = " + Convert.ToInt32(tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"]) + "");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (Convert.ToInt32(dv[i]["F_Status"]) >= 1)
|
||
|
{
|
||
|
int fstatus = 1;
|
||
|
//20110608
|
||
|
if(Convert.ToInt32(dv[i]["F_DeviceIndex"])==12088)
|
||
|
{
|
||
|
fstatus = Model.CGeneralFunction.TASKDELETE;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fstatus = 1;
|
||
|
}
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), fstatus);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
cgs.ActionComplete(Convert.ToInt32(dv[i]["F_DeviceIndex"]), Convert.ToInt32(dv[i]["F_MonitorIndex"]), Model.CGeneralFunction.TASKDELETE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{//20110412
|
||
|
string sss = "������������:" + fid.ToString();
|
||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("������������", "�����������ֹ�ɾ����", "�������룺" + this.dgvManager.CurrentRow.Cells["��������"].Value.ToString(), sss);
|
||
|
|
||
|
if (mti == 1)
|
||
|
{
|
||
|
dboM.ExceSQL("update IO_Control set Control_STATUS=" + Model.CGeneralFunction.TASKDELETE + " where Control_ID=" + fid);
|
||
|
}
|
||
|
//�������
|
||
|
cgs.ReturnManageInfo(fid, mti, cap, false);
|
||
|
}
|
||
|
|
||
|
this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + _manstatus).Tables[0].DefaultView;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
//throw ex;
|
||
|
if (FrmControlMonitor.FormInstance.GetObjectText("tsStatus").IndexOf("���������ֹ�����ʱ��" + ex.Message) < 0)
|
||
|
{
|
||
|
|
||
|
FrmControlMonitor.FormInstance.FlashPanit("tsStatus", "���������ֹ�����ʱ��" + ex.Message, true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int GetDeviceKindIdx(int devIdx)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
devinfo = Model.CGetInfo.GetDeviceInfo(devIdx);
|
||
|
return devinfo.DeviceKind;
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
int GetManageTaskIndexfromMonitor(int monitorIdx)
|
||
|
{
|
||
|
DataView dv = dbo.ExceSQL("SELECT F_ManageTaskIndex FROM T_Monitor_Task WHERE (F_MonitorIndex = " + monitorIdx + ")").Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
return Convert.ToInt32(dv[0]["F_ManageTaskIndex"]);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return -1;
|
||
|
}
|
||
|
}
|
||
|
int GetManageTaskKindIndexFromMonitor(int monitorIdx)
|
||
|
{
|
||
|
DataView dv = dbo.ExceSQL("SELECT F_ManageTaskKindIndex FROM T_Monitor_Task WHERE (F_MonitorIndex = " + monitorIdx + ")").Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
return Convert.ToInt32(dv[0]["F_ManageTaskKindIndex"]);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return -1;
|
||
|
}
|
||
|
}
|
||
|
int GetDeviceOrderFromMonitor(int MonitorIndex)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string sql = "select F_DeviceCommandIndex from T_Monitor_Task where (F_DeviceCommandIndex IS NOT NULL) and F_MonitorIndex=" + MonitorIndex;
|
||
|
DataView dv = dbo.ExceSQL(sql).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
return Convert.ToInt32(dv[0]["F_DeviceCommandIndex"]);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return -1;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string df = "";
|
||
|
|
||
|
switch (this.comboBox1.Text)
|
||
|
{
|
||
|
case "��������":
|
||
|
df = "��������";
|
||
|
break;
|
||
|
case "������������":
|
||
|
df = "������������";
|
||
|
break;
|
||
|
|
||
|
|
||
|
|
||
|
default:
|
||
|
return;
|
||
|
}
|
||
|
//20100208
|
||
|
string sql = "select distinct " + df + " from V_Manage_Task ";
|
||
|
DataView dv = dbo.ExceSQL(sql).Tables[0].DefaultView;
|
||
|
if (dv.Count > 0)
|
||
|
{
|
||
|
this.textBox1.DataSource = null;
|
||
|
this.textBox1.DisplayMember = df;
|
||
|
this.textBox1.ValueMember = df;
|
||
|
this.textBox1.DataSource = dv;
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void dgvManager_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
|
||
|
{
|
||
|
if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0) && (e.Button == MouseButtons.Right))//20110309
|
||
|
{
|
||
|
dgvManager.ClearSelection();
|
||
|
dgvManager.Rows[e.RowIndex].Selected = true;
|
||
|
dgvManager.CurrentCell = dgvManager.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|