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.
624 lines
29 KiB
624 lines
29 KiB
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 System.ServiceModel;
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
/// <summary>
|
|
/// Creator:Richard.liu
|
|
/// É豸ָÁî¶ÓÁйÜÀí
|
|
/// </summary>
|
|
public partial class FrmModifyMonitor : Form
|
|
{
|
|
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; }
|
|
}
|
|
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
DBOperator dboM = CStaticClass.dboM;
|
|
|
|
|
|
public FrmModifyMonitor()
|
|
{
|
|
InitializeComponent();
|
|
_formInstance = this;
|
|
}
|
|
|
|
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;
|
|
tsmAGV.Visible = false;
|
|
tsmAGVGet.Visible = false;
|
|
tsmAGVSend.Visible = false;
|
|
tsmAGVBank.Visible = false;
|
|
tsmAGVGoods.Visible = false;
|
|
return;
|
|
}
|
|
if (Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells["µ÷¶ÈÈÎÎñË÷Òý"].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["ÌõÂë"].Value.ToString() +
|
|
"£»µ÷¶ÈÈÎÎñË÷Òý£º" + this.dgvMonitor.CurrentRow.Cells["µ÷¶ÈÈÎÎñË÷Òý"].Value.ToString();
|
|
TSMonitor.Text = "É豸ָÁîË÷Òý£º" + this.dgvMonitor.CurrentRow.Cells["É豸ָÁîË÷Òý"].Value.ToString();
|
|
//string CorrelRGV = "12008,12016,12024,32008,32016,32024,42008,42016,42024";//-1,-3
|
|
//string Upok = "32027,32040";//+2,+6
|
|
//int device=Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells["É豸Ë÷Òý"].Value);
|
|
//TSMmonitorOK.DropDownItems.Clear();
|
|
//if (CorrelRGV.IndexOf(device.ToString()) >= 0)
|
|
//{
|
|
|
|
// ToolStripMenuItem tsmi = new ToolStripMenuItem(Convert.ToInt32(device - 1).ToString());
|
|
// tsmi.Click += new EventHandler(TSMmonitorOK_Click);
|
|
// TSMmonitorOK.DropDownItems.Add(tsmi);
|
|
// ToolStripMenuItem tsmi1 = new ToolStripMenuItem(Convert.ToInt32(device - 3).ToString());
|
|
// TSMmonitorOK.DropDownItems.Add(tsmi1);
|
|
// tsmi1.Click += new EventHandler(TSMmonitorOK_Click);
|
|
|
|
//}
|
|
//else if (Upok.IndexOf(device.ToString()) >= 0)
|
|
//{
|
|
|
|
// ToolStripMenuItem tsmi = new ToolStripMenuItem(Convert.ToInt32(device +2).ToString());
|
|
// tsmi.Click += new EventHandler(TSMmonitorOK_Click);
|
|
// TSMmonitorOK.DropDownItems.Add(tsmi);
|
|
// ToolStripMenuItem tsmi1 = new ToolStripMenuItem(Convert.ToInt32(device + 6).ToString());
|
|
// tsmi1.Click += new EventHandler(TSMmonitorOK_Click);
|
|
// TSMmonitorOK.DropDownItems.Add(tsmi1);
|
|
|
|
//}
|
|
|
|
//if (this.dgvMonitor.CurrentRow.Cells[3].Value.ToString() == "1001")
|
|
//{
|
|
// TSMSimulateRun.Visible = false;
|
|
// TSMmonitorOK.Visible = false;
|
|
|
|
// TSMRestore.Visible = true;
|
|
|
|
// toolStripSeparator2.Visible = false;
|
|
// tsmAGV.Visible = true;
|
|
// tsmAGVGet.Visible = true;
|
|
// tsmAGVSend.Visible = true;
|
|
// if (this.dgvMonitor.CurrentRow.Cells[5].Value.ToString() == "2")//1219¿ÕÍÐÅÌ»ØÊÕ
|
|
// {
|
|
// tsmAGVGoods.Visible = false;
|
|
// tsmAGVBank.Visible = true;
|
|
// tsmAGVSend.Visible = false;
|
|
// return;
|
|
// }
|
|
// else
|
|
// {
|
|
// tsmAGVSend.Visible = true;
|
|
// tsmAGVBank.Visible = false;
|
|
// }
|
|
// if (this.dgvMonitor.CurrentRow.Cells[5].Value.ToString() == "3")//1220²ÐÍÐÅÌ»ØÊÕ
|
|
// {
|
|
// tsmAGVBank.Visible = false;
|
|
// tsmAGVGoods.Visible = true;
|
|
// tsmAGVSend.Visible = false;
|
|
// return;
|
|
// }
|
|
// else
|
|
// {
|
|
// tsmAGVSend.Visible = true;
|
|
// tsmAGVGoods.Visible = false;
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
tsmAGV.Visible = false;
|
|
tsmAGVGet.Visible = false;
|
|
tsmAGVSend.Visible = false;
|
|
tsmAGVBank.Visible = false;
|
|
tsmAGVGoods.Visible = false;
|
|
//}
|
|
}
|
|
}
|
|
|
|
private void TSMmonitorOK_Click(object sender, EventArgs e)
|
|
{
|
|
ToolStripMenuItem tsm = sender as ToolStripMenuItem;
|
|
if (tsm.DropDownItems.Count > 0) return;
|
|
int deviceindex = 0;
|
|
int.TryParse(tsm.Text, out deviceindex);
|
|
char[] cc = new char[1] { '£º' };
|
|
string[] split = TSMonitor.Text.Split(cc);
|
|
if (split[1] == "") return;
|
|
try
|
|
{
|
|
|
|
DataView dv = dbo.ExceSQL("SELECT * FROM T_Monitor_Task Where F_MonitorIndex=" +
|
|
Convert.ToInt32(split[1])).Tables[0].DefaultView;
|
|
if (dv.Count > 0)
|
|
{
|
|
//20100108ÖмäÖ¸Áî±»±¨¸æÍê³Éʱ¸øÓëÌáʾºÍ¾¯¸æ
|
|
|
|
DataView dv0 = dbo.ExceSQL("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();
|
|
//20100108²Ù×÷ºÚÏ»×ÓÔö¼ÓÍÐÅÌÌõÂë
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("É豸ָÁî¹ÜÀí", "ÊÖ¹¤±¨¸æÍê³É", "ÌõÂ룺" + dv[0]["F_TxtParam"].ToString(), sss);
|
|
string errtext = string.Empty;
|
|
if (deviceindex == 0)
|
|
{
|
|
deviceindex = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
|
|
}
|
|
if (dv[0]["F_NumParam4"].ToString() != "0" && CStaticClass.GetDeviceKindIdx(deviceindex) == 2)
|
|
{//20120906ÊäËÍ»úµÄËͳöÖ¸ÁÒÔÖÕµãÊäËÍ»ú×÷ΪÈÎÎñÍê³ÉÉ豸
|
|
deviceindex = Convert.ToInt32(dv[0]["F_NumParam4"]);
|
|
}
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(deviceindex,Convert.ToInt32(dv[0]["F_MonitorIndex"]), Model.CGeneralFunction.TASKFINISH, new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
//{
|
|
// MessageBox.Show(errtext, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
//}
|
|
|
|
TSMMonitorRefresh_Click();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void TSMRestore_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
char[] cc = new char[1] { '£º' };
|
|
string[] split = TSMonitor.Text.Split(cc);
|
|
if (split[1] == "") return;
|
|
|
|
try
|
|
{
|
|
string errtext = string.Empty;
|
|
|
|
int devKind;
|
|
int mindex = Convert.ToInt32(split[1]);
|
|
|
|
int fid = 0;
|
|
int mankind =0;
|
|
|
|
|
|
//20100108¸ÄΪselect *
|
|
DataView dv = dbo.ExceSQL("select * from T_Monitor_Task where F_MonitorIndex=" + mindex).Tables[0].DefaultView;
|
|
if (dv.Count > 0)
|
|
{
|
|
fid = Convert.ToInt32(dv[0]["F_ManageTaskIndex"]);
|
|
mankind = Convert.ToInt32(dv[0]["F_ManageTASKKINDINDEX"]);
|
|
//20100108ÖмäÖ¸Áî±»¸´Î»Ê±¸øÓëÌáʾºÍ¾¯¸æ
|
|
DataView dv0 = dbo.ExceSQL("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 =CStaticClass.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²Ù×÷ºÚÏ»×ÓÔö¼ÓÍÐÅÌÌõÂë
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("É豸ָÁî¹ÜÀí", "ÊÖ¹¤¸´Î»", "ÌõÂë:" + dv[0]["F_TxtParam"].ToString(), sss);
|
|
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(Convert.ToInt32(dv[0]["F_DeviceIndex"]), Convert.ToInt32(dv[0]["F_MonitorIndex"]), Model.CGeneralFunction.TASKRESTORE,
|
|
new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
//{
|
|
// MessageBox.Show(errtext, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
//}
|
|
TSMMonitorRefresh_Click();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
|
|
private void rbmonAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = (RadioButton)sender;
|
|
if (rb.Checked == true)
|
|
{
|
|
_monstatus = " F_Status>=-1 ";
|
|
}
|
|
TSMMonitorRefresh_Click();
|
|
}
|
|
private void TSMMonitorRefresh_Click()
|
|
{
|
|
|
|
this.dgvMonitor.DataSource = dbo.ExceSQL("select * from V_Monitor_Task where " + _monstatus + " order by É豸ָÁîË÷Òý asc ").Tables[0].DefaultView;
|
|
}
|
|
|
|
private void rbmonRun_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
if (rbmonRun.Checked == true)
|
|
{
|
|
_monstatus = " (F_Status>=1) ";
|
|
}
|
|
TSMMonitorRefresh_Click();
|
|
}
|
|
|
|
private void rbmonWait_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = (RadioButton)sender;
|
|
if (rb.Checked == true)
|
|
{
|
|
_monstatus = " F_Status=0 ";
|
|
}
|
|
TSMMonitorRefresh_Click();
|
|
}
|
|
|
|
public void button1_Click(object sender, EventArgs e)
|
|
{//20140218
|
|
try
|
|
{
|
|
if (this.textBox1.Text.Trim().Length == 0) return;
|
|
string _manstatus = " F_Status>=-1 ";
|
|
if (this.comboBox1.Text == "ÌõÂë")
|
|
{
|
|
_monstatus = " ÌõÂë='" + this.textBox1.Text.Trim() + "' ";
|
|
_manstatus = " ÌõÂë like '%" + this.textBox1.Text.Trim() + "%' ";
|
|
}
|
|
if (this.comboBox1.Text == "É豸ָÁîË÷Òý")
|
|
{
|
|
_monstatus = " É豸ָÁîË÷Òý='" + this.textBox1.Text.Trim() + "' ";
|
|
_manstatus = " µ÷¶ÈÈÎÎñË÷Òý='" + CStaticClass.GetManageTaskIndexfromMonitor(Convert.ToInt32(this.textBox1.Text.Trim())) + "' ";
|
|
}
|
|
if (this.comboBox1.Text == "µ÷¶ÈÈÎÎñË÷Òý")
|
|
{
|
|
_monstatus = " µ÷¶ÈÈÎÎñË÷Òý='" + this.textBox1.Text.Trim() + "' ";
|
|
_manstatus = " µ÷¶ÈÈÎÎñË÷Òý='" + this.textBox1.Text.Trim() + "' ";
|
|
}
|
|
if (this.comboBox1.Text == "É豸Ë÷Òý")//20130817richard
|
|
{
|
|
_monstatus = " F_Status<>0 and É豸Ë÷Òý='" + this.textBox1.Text.Trim() + "' ";
|
|
int manFID = Convert.ToInt32(dbo.GetSingle("SELECT F_ManageTaskIndex,F_DeviceIndex,F_Status FROM T_Monitor_Task where F_Status<>0 and F_DeviceIndex='" + this.textBox1.Text.Trim() + "' "));
|
|
_manstatus = " µ÷¶ÈÈÎÎñË÷Òý='" + manFID + "' ";
|
|
}
|
|
TSMMonitorRefresh_Click();
|
|
this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + _manstatus).Tables[0].DefaultView;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
_monstatus = " F_Status>=-1 ";
|
|
|
|
TSMMonitorRefresh_Click();
|
|
}
|
|
|
|
private void dgvMonitor_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
dgvMonitor.Columns["F_Status"].Visible = false;
|
|
}
|
|
|
|
private void FrmModifyMonitor_Load(object sender, EventArgs e)
|
|
{
|
|
rbmonRun_CheckedChanged(sender, e);
|
|
}
|
|
|
|
private void tsmAGVGet_Click(object sender, EventArgs e)
|
|
{
|
|
string sql = "";
|
|
//ÓÉT_Monitor_Task±íÖлñµÃF_NumParam2×Ö¶ÎÖµ Ìõ¼þ£ºÏûÏ¢·µ»ØµÄС³µÈÎÎñºÅ
|
|
DataTable tableMonitorTask = dbo.ExceSQL("SELECT F_ManageTASKKINDINDEX,F_ManageTaskIndex,F_NumParam2,F_AgvTask,F_AgvNo FROM T_MONITOR_TASK WHERE F_DeviceIndex=1001 and F_MonitorIndex=" + this.dgvMonitor.CurrentRow.Cells[2].Value + "").Tables[0];
|
|
if (tableMonitorTask.Rows.Count > 0)
|
|
{
|
|
if (MessageBox.Show("ÄúÈ·ÈÏÊÖ¹¤±¨¸æAGV²æ»õÍê³ÉÂð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
sql = "UPDATE T_Monitor_Task SET F_Status = 2 WHERE (F_MonitorIndex =" + this.dgvMonitor.CurrentRow.Cells[2].Value + ")";
|
|
dbo.ExceSQL(sql);
|
|
|
|
//ÓÉT_Base_AGV_Gate±íÖлñµÃF_AGVGateDeviceIndex×Ö¶ÎÖµ Ìõ¼þ£ºT_Base_AGV_Gate.F_Address = T_Monitor_Task.F_NumParam2
|
|
DataTable tableAGVGate = dbo.ExceSQL("SELECT F_AGVGateDeviceIndex FROM T_BASE_AGV_GATE WHERE F_ADDRESS = " + Convert.ToInt32(tableMonitorTask.Rows[0]["F_NumParam2"]) + "").Tables[0];
|
|
if (tableAGVGate.Rows.Count > 0)
|
|
{
|
|
if (MessageBox.Show("ÄúÈ·¶¨Òª°ÑÉ豸:" + tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"] + "Öóɡ¾ÎÞÍÐÅÌ¡¿×´Ì¬Âð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
//¸ü¸ÄT_Base_Device±íÖеÄF_HaveGoods×Ö¶ÎֵΪ0¡£Ìõ¼þ£ºT_Base_Device.F_DeviceIndex = T_Base_AGV_Gate.F_AGVGateDeviceIndex
|
|
dbo.ExecuteSql("UPDATE T_BASE_DEVICE SET F_PALLETBARCODE='-',F_HAVEGOODS = 0 WHERE F_DEVICEINDEX = " + Convert.ToInt32(tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"]) + "");
|
|
string errtext=string.Empty;
|
|
|
|
if (tableMonitorTask.DefaultView[0]["F_ManageTASKKINDINDEX"].ToString() == "1")
|
|
{
|
|
//20090817¸ø¹ÜÀíÖÃÎÞÍÐÅÌÐÅÏ¢
|
|
dboM.ExecuteSql("UPDATE T_ITEMDEVICE SET devicestatus ='0' WHERE devicecode = '" + tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"] + "'");
|
|
}
|
|
}
|
|
string sss = "AGV³µºÅ:" + tableMonitorTask.Rows[0]["F_AgvNo"].ToString() + ";É豸ָÁîË÷Òý:" + this.dgvMonitor.CurrentRow.Cells[2].Value.ToString();
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("É豸ָÁî¹ÜÀí", "ÊÖ¹¤±¨¸æAGV²æ»õÍê³É", tableMonitorTask.Rows[0]["F_AgvNo"].ToString() + "ºÅ³µ", sss);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Ö»ÓÐAGVÈÎÎñ²Å¿ÉÒÔÊÖ¹¤±¨¸æAGV²æ»õÍê³É£¡", "Îó²Ù×÷Ìáʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
private void tsmAGVSend_Click(object sender, EventArgs e)
|
|
{
|
|
//ÓÉT_Monitor_Task±íÖлñµÃF_NumParam5×Ö¶ÎÖµ Ìõ¼þ£ºÏûÏ¢·µ»ØµÄС³µÈÎÎñºÅ
|
|
DataTable tableMonitorTask = dbo.ExceSQL("SELECT F_TxtParam,F_NumParam5,F_AgvTask,F_AgvNo FROM T_MONITOR_TASK WHERE F_DeviceIndex=1001 and F_MonitorIndex=" + this.dgvMonitor.CurrentRow.Cells[2].Value + "").Tables[0];
|
|
if (tableMonitorTask.Rows.Count > 0)
|
|
{
|
|
|
|
if (MessageBox.Show("ÄúÈ·ÈÏÊÖ¹¤±¨¸æAGVж»õÍê³ÉÂð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//ÓÉT_Base_AGV_Gate±íÖлñµÃF_AGVGateDeviceIndex×Ö¶ÎÖµ Ìõ¼þ£ºT_Base_AGV_Gate.F_Address = T_Monitor_Task.F_NumParam2
|
|
DataTable tableAGVGate = dbo.ExceSQL("SELECT F_AGVGateDeviceIndex FROM T_BASE_AGV_GATE WHERE F_ADDRESS = " + Convert.ToInt32(tableMonitorTask.Rows[0]["F_NumParam5"]) + "").Tables[0];
|
|
if (tableAGVGate.Rows.Count > 0)
|
|
{
|
|
if (MessageBox.Show("ÄúÈ·¶¨Òª°ÑÉ豸:" + tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"] + "Öóɡ¾ÓÐÍÐÅÌ¡¿×´Ì¬Âð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
//¸ü¸ÄT_Base_Device±íÖеÄF_HaveGoods×Ö¶ÎֵΪ0¡£Ìõ¼þ£ºT_Base_Device.F_DeviceIndex = T_Base_AGV_Gate.F_AGVGateDeviceIndex
|
|
dbo.ExecuteSql("UPDATE T_BASE_DEVICE SET F_PALLETBARCODE='" + tableMonitorTask.Rows[0]["F_TxtParam"] + "',F_HAVEGOODS = 1 WHERE F_DEVICEINDEX = " + Convert.ToInt32(tableAGVGate.Rows[0]["F_AGVGateDeviceIndex"]) + "");
|
|
|
|
}
|
|
string sss = "AGV³µºÅ:" + tableMonitorTask.Rows[0]["F_AgvNo"].ToString() + ";É豸ָÁîË÷Òý:" + this.dgvMonitor.CurrentRow.Cells[2].Value.ToString();
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("É豸ָÁî¹ÜÀí", "ÊÖ¹¤±¨¸æAGVж»õÍê³É", tableMonitorTask.Rows[0]["F_AgvNo"].ToString() + "ºÅ³µ", sss);
|
|
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(1001,Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells[2].Value), Model.CGeneralFunction.TASKFINISH ,new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Ö»ÓÐAGVÈÎÎñ²Å¿ÉÒÔÊÖ¹¤±¨¸æAGV·Å»õÍê³É£¡", "Îó²Ù×÷Ìáʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void tsmAGVBank_Click(object sender, EventArgs e)
|
|
{
|
|
string errtext=string.Empty;
|
|
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(1001,Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells[2].Value), Model.CGeneralFunction.TASKFINISH, new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
|
|
}
|
|
|
|
private void tsmAGVGoods_Click(object sender, EventArgs e)
|
|
{
|
|
string errtext = string.Empty;
|
|
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(1001,Convert.ToInt32(this.dgvMonitor.CurrentRow.Cells[2].Value), Model.CGeneralFunction.TASKFINISH ,new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 TSMmonitorDel_Click(object sender, EventArgs e)
|
|
{
|
|
char[] cc = new char[1] { '£º' };
|
|
string[] split = TSMonitor.Text.Split(cc);
|
|
if (split[1] == "") return;
|
|
|
|
try
|
|
{
|
|
DataView dv = dbo.ExceSQL("SELECT * FROM T_Monitor_Task Where F_MonitorIndex=" +
|
|
Convert.ToInt32(split[1])).Tables[0].DefaultView;
|
|
if (dv.Count > 0)
|
|
{
|
|
//20100108ÖмäÖ¸Áî±»±¨¸æÍê³Éʱ¸øÓëÌáʾºÍ¾¯¸æ
|
|
|
|
DataView dv0 = dbo.ExceSQL("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();
|
|
//20100108²Ù×÷ºÚÏ»×ÓÔö¼ÓÍÐÅÌÌõÂë
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("É豸ָÁî¹ÜÀí", "ÊÖ¹¤É¾³ýÉ豸ָÁî", "ÌõÂ룺" + dv[0]["F_TxtParam"].ToString(), sss);
|
|
|
|
CStaticClass.WcfControl.BeginModifyMonitorTask(Convert.ToInt32(dv[0]["F_DeviceIndex"]), Convert.ToInt32(dv[0]["F_MonitorIndex"]), Model.CGeneralFunction.TASKDELETE, new AsyncCallback(ModifyMonitorTaskCallBack), null);
|
|
//{
|
|
// MessageBox.Show(sss, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
//}
|
|
TSMMonitorRefresh_Click();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string df = "";
|
|
string wherestr = " where 1=1 ";
|
|
switch (this.comboBox1.Text)
|
|
{
|
|
case "ÌõÂë":
|
|
df = "ÌõÂë";
|
|
break;
|
|
case "µ÷¶ÈÈÎÎñË÷Òý":
|
|
df = "µ÷¶ÈÈÎÎñË÷Òý";
|
|
break;
|
|
case "É豸ָÁîË÷Òý":
|
|
df = "É豸ָÁîË÷Òý";
|
|
wherestr = " where f_status<>0 ";
|
|
break;
|
|
case "É豸Ë÷Òý":
|
|
df = "É豸Ë÷Òý";//20130817richard
|
|
wherestr = " where f_status<>0 ";
|
|
break;
|
|
|
|
default:
|
|
return;
|
|
}
|
|
//20100208
|
|
string sql = "select distinct " + df + " from V_Monitor_Task " + wherestr;
|
|
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 dgvMonitor_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
string errtext = string.Empty;
|
|
if ((e.RowIndex >= 0))//&&(e.Button == MouseButtons.Right)
|
|
{
|
|
dgvMonitor.ClearSelection();
|
|
dgvMonitor.Rows[e.RowIndex].Selected = true;
|
|
dgvMonitor.CurrentCell = dgvMonitor.Rows[e.RowIndex].Cells[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void ModifyMonitorTaskCallBack(IAsyncResult ar)
|
|
{
|
|
if (this.IsDisposed == true) return;
|
|
string errtext = string.Empty;
|
|
this.BeginInvoke(new MethodInvoker(delegate()
|
|
{
|
|
|
|
if (CStaticClass.WcfControl.EndModifyMonitorTask(out errtext, ar) == false)
|
|
{
|
|
MessageBox.Show(errtext, "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
|
|
TSMMonitorRefresh_Click();
|
|
}));
|
|
}
|
|
|
|
private void FrmModifyMonitor_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
_formInstance = null;
|
|
}
|
|
|
|
}
|
|
}
|