1135 lines
41 KiB
C#
1135 lines
41 KiB
C#
|
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;
|
|||
|
using System.IO.Ports;
|
|||
|
using System.Resources;
|
|||
|
using System.Drawing.Drawing2D;
|
|||
|
|
|||
|
namespace ControlSystem
|
|||
|
{
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Creator:Richard.liu
|
|||
|
/// <20><><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public partial class FrmControlMonitor : WeifenLuo.WinFormsUI.Docking.DockContent
|
|||
|
{
|
|||
|
FrmDeviceStatus _deviceStatus = new FrmDeviceStatus();
|
|||
|
FrmWorkstationStatus _worstation = new FrmWorkstationStatus();
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public void FlashPanit(string obj, bool visible)
|
|||
|
{
|
|||
|
this.Controls[obj].Visible = visible;
|
|||
|
}
|
|||
|
public void FlashPanit(string obj, Image backgroundImage)
|
|||
|
{
|
|||
|
this.Controls[obj].BackgroundImage = backgroundImage;
|
|||
|
}
|
|||
|
public void FlashPanit(string obj, ImageLayout backgroundImageLayout)
|
|||
|
{
|
|||
|
this.Controls[obj].BackgroundImageLayout = backgroundImageLayout;
|
|||
|
}
|
|||
|
|
|||
|
public void FlashPanit(string obj, int top, int left)
|
|||
|
{
|
|||
|
this.Controls[obj].Top = top;
|
|||
|
this.Controls[obj].Left = left;
|
|||
|
}
|
|||
|
|
|||
|
public void FlashPanit(string obj, string text, bool append)
|
|||
|
{
|
|||
|
if (append == true)
|
|||
|
{
|
|||
|
this.Controls[obj].Text += text;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.Controls[obj].Text = text;
|
|||
|
}
|
|||
|
}
|
|||
|
public string GetObjectText(string obj)
|
|||
|
{
|
|||
|
return this.Controls[obj].Text;
|
|||
|
}
|
|||
|
public void MonitorRefresh(object dataSource)
|
|||
|
{
|
|||
|
#region Added by DingXiaoxu for Dock TaskList on 20101219
|
|||
|
FrmTaskList.FormInstance.MonitorRefresh(dataSource);
|
|||
|
#endregion
|
|||
|
|
|||
|
//this.dgvMonitor.DataSource = dataSource;
|
|||
|
////20100108
|
|||
|
//dataSource = null;
|
|||
|
}
|
|||
|
public void ManagerRefresh(object dataSource)
|
|||
|
{
|
|||
|
#region Added by DingXiaoxu for Dock TaskList on 20101219
|
|||
|
FrmTaskList.FormInstance.ManagerRefresh(dataSource);
|
|||
|
#endregion
|
|||
|
|
|||
|
//this.dgvManager.DataSource = dataSource;
|
|||
|
////20100108
|
|||
|
//dataSource = null;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
private static FrmControlMonitor _formInstance;
|
|||
|
public static FrmControlMonitor FormInstance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_formInstance == null)
|
|||
|
{
|
|||
|
_formInstance = new FrmControlMonitor();
|
|||
|
|
|||
|
}
|
|||
|
return _formInstance;
|
|||
|
}
|
|||
|
set { _formInstance = value; }
|
|||
|
}
|
|||
|
//IGetDeviceState gds;
|
|||
|
CGetState gs = new CGetState();
|
|||
|
CControl cc = new CControl();
|
|||
|
CListenPLCAsk cplc = new CListenPLCAsk();
|
|||
|
CCommonFunction ccf = new CCommonFunction();
|
|||
|
DBOperator dbo = CStaticClass.dbo;
|
|||
|
DBOperator dbo1 = CStaticClass.dbo1;
|
|||
|
DBOperator dboM =CStaticClass.dboM;
|
|||
|
|
|||
|
|
|||
|
// static ICommLayer.ISendDeviceOrder sdo;
|
|||
|
string[] wv = new string[1] { "2" };
|
|||
|
string[] witemnames = new string[1];
|
|||
|
//20110108 <20><>ʼ<EFBFBD><CABC>ˢ<EFBFBD><CBA2>
|
|||
|
|
|||
|
Panel pp;
|
|||
|
Button stack1, stack2, stack3 ,stack4, stack5;//<2F>Ѷ<EFBFBD><D1B6><EFBFBD>
|
|||
|
|
|||
|
TextBox twj1, twj2, twj3, twj4, twj5;//<2F><><EFBFBD>翪<EFBFBD><E7BFAA>
|
|||
|
//TextBox twy1, twy2, twy3, twy4, twy5, twy6;//Զ<><D4B6><EFBFBD><EFBFBD><EFBFBD>翪<EFBFBD><E7BFAA>
|
|||
|
|
|||
|
public FrmControlMonitor()
|
|||
|
{
|
|||
|
|
|||
|
InitializeComponent();
|
|||
|
_formInstance = this;
|
|||
|
|
|||
|
}
|
|||
|
protected override CreateParams CreateParams
|
|||
|
{
|
|||
|
|
|||
|
get
|
|||
|
{
|
|||
|
|
|||
|
CreateParams cp = base.CreateParams;
|
|||
|
|
|||
|
cp.ExStyle |= 0x02000000;//WS_CLIPCHILDREN <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2>ػ<EFBFBD>
|
|||
|
return cp;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void FrmControlMonitor_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
// CStaticClass.GetBackStackStatus();
|
|||
|
foreach (Control ctrl in this.plAccessorial1.Controls)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͶѶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
|
|||
|
|
|||
|
foreach (Control ctrl in this.panel4.Controls)
|
|||
|
{
|
|||
|
if (ctrl.GetType().ToString() == "System.Windows.Forms.Button" || ctrl.GetType().ToString() == "CommonClassLib.tButton")
|
|||
|
{
|
|||
|
ctrl.Click += new EventHandler(ctrl_Click);
|
|||
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|||
|
}
|
|||
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null))
|
|||
|
{
|
|||
|
ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|||
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
foreach (Control ctrl in this.panel3.Controls)
|
|||
|
{
|
|||
|
if (ctrl.GetType().ToString() == "System.Windows.Forms.Button")
|
|||
|
{
|
|||
|
ctrl.Click += new EventHandler(ctrl_Click);
|
|||
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|||
|
}
|
|||
|
|
|||
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null))
|
|||
|
{
|
|||
|
ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|||
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void ctrl_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Button btn = (Button)sender;
|
|||
|
_deviceStatus.DeviceIndex = Convert.ToInt32(btn.Tag);
|
|||
|
_deviceStatus.ShowDialog();
|
|||
|
}
|
|||
|
private void ctrl_ClickTxt(object sender, EventArgs e)
|
|||
|
{
|
|||
|
TextBox txt = (TextBox)sender;
|
|||
|
_worstation.DeviceIndex = Convert.ToInt32(txt.Tag);
|
|||
|
_worstation.ShowDialog();
|
|||
|
}
|
|||
|
private void ctrl_ClickLabel(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Label label = (Label)sender;
|
|||
|
_deviceStatus.DeviceIndex = Convert.ToInt32(label.Tag);
|
|||
|
_deviceStatus.ShowDialog();
|
|||
|
}
|
|||
|
private void ctrl_ClickPic(object sender, EventArgs e)
|
|||
|
{
|
|||
|
PictureBox btn = (PictureBox)sender;
|
|||
|
_deviceStatus.DeviceIndex = Convert.ToInt32(btn.Tag );
|
|||
|
_deviceStatus.ShowDialog();
|
|||
|
}
|
|||
|
private void timer1_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
if (CStaticClass.Order == true )
|
|||
|
{
|
|||
|
// string ss = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
//20090920
|
|||
|
// CStaticClass.GetAllReturns();
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
gs.GetDeviceState();
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("GetDeviceState<74><65><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt2 - dt1).ToString());
|
|||
|
// System.Diagnostics.Trace.WriteLine("GetDeviceState" + Convert.ToString(dt2 - dt1));
|
|||
|
if (tsStatus.Text.Length > 300)
|
|||
|
tsStatus.Text = "";
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void TSMrefresh_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//CStaticClass.RealRefresh = true;
|
|||
|
//this.dgvManager.DataSource = dbo.ExceSQL("select * from V_Manage_Task where " + CStaticClass.Manstatus).Tables[0].DefaultView;
|
|||
|
}
|
|||
|
private void TSMMonitorRefresh_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//CStaticClass.RealRefresh = true;
|
|||
|
//this.dgvMonitor.DataSource = dbo.ExceSQL("select * from V_Monitor_Task where " + CStaticClass.Monstatus + " order by <20>豸ָ<E8B1B8><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> asc ").Tables[0].DefaultView;
|
|||
|
}
|
|||
|
private void rbmanAll_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Manstatus = " F_Status<>-1 ";
|
|||
|
}
|
|||
|
TSMrefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void rbmanRun_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Manstatus = " F_Status=1 ";
|
|||
|
}
|
|||
|
TSMrefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void rbmanWait_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Manstatus = " F_Status=0 ";
|
|||
|
}
|
|||
|
TSMrefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void rbmonAll_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Monstatus = " F_Status<>-1 ";
|
|||
|
}
|
|||
|
TSMMonitorRefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void rbmonRun_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Monstatus = " (F_Status>=1) ";
|
|||
|
}
|
|||
|
TSMMonitorRefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void rbmonWait_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
RadioButton rb = (RadioButton)sender;
|
|||
|
if (rb.Checked == true)
|
|||
|
{
|
|||
|
CStaticClass.Monstatus = " F_Status=0 ";
|
|||
|
}
|
|||
|
TSMMonitorRefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
CStaticClass.Monstatus = " F_Status<>-1 ";
|
|||
|
|
|||
|
TSMMonitorRefresh_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void timer2_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
//DataTable dt; string ss1;
|
|||
|
//string ss12; string ss13; string ss14;
|
|||
|
try
|
|||
|
{
|
|||
|
//ss12 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
if ((CStaticClass.RealRefresh == true) && (CStaticClass.Order == true))
|
|||
|
{
|
|||
|
|
|||
|
//if ((CStaticClass.gcCount % 10) == 0)
|
|||
|
//{
|
|||
|
// #region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ
|
|||
|
|
|||
|
// ss1 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
// string sql = "SELECT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>, <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> FROM V_Device_Error_log where <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> like '" + DateTime.Today.ToString("yyyy-MM-dd") + "%' order by <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> asc";
|
|||
|
// //20091128
|
|||
|
// dt = dbo1.ExceSQL(sql).Tables[0];
|
|||
|
// if (dt.Rows.Count > 0)
|
|||
|
// {
|
|||
|
// this.listView1.Items.Clear();
|
|||
|
// for (int i = 0; i < dt.Rows.Count; i++)
|
|||
|
// {
|
|||
|
// ListViewItem lvi = new ListViewItem();
|
|||
|
// lvi.Text = dt.Rows[i]["<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"].ToString();
|
|||
|
// lvi.SubItems.Add(dt.Rows[i]["<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>"].ToString());
|
|||
|
// lvi.SubItems.Add(dt.Rows[i]["<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>"].ToString());
|
|||
|
// lvi.SubItems.Add(dt.Rows[i]["<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"].ToString());
|
|||
|
// lvi.SubItems.Add(dt.Rows[i]["<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>"].ToString());
|
|||
|
// listView1.Items.Add(lvi);
|
|||
|
// //20091128
|
|||
|
// lvi = null;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
//}
|
|||
|
bool ifflash = false;
|
|||
|
if (FrmMain.FormInstance.dockPanel1.ActiveAutoHideContent != null)
|
|||
|
{
|
|||
|
if (FrmMain.FormInstance.dockPanel1.ActiveAutoHideContent.ToString().IndexOf("FrmTaskList") < 0)
|
|||
|
{
|
|||
|
ifflash = false;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ifflash = true;
|
|||
|
}
|
|||
|
//System.Diagnostics.Trace.WriteLine("1.ActiveAutoHideContent:" + FrmMain.FormInstance.dockPanel1.ActiveAutoHideContent.ToString());
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (FrmTaskList.FormInstance.DockState == WeifenLuo.WinFormsUI.Docking.DockState.DockBottom)
|
|||
|
{
|
|||
|
ifflash = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ifflash = false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//<2F><>ʾ<EFBFBD>豸ָ<E8B1B8><D6B8>
|
|||
|
//20100108
|
|||
|
if(ifflash==true)
|
|||
|
{
|
|||
|
FrmControlMonitor.FormInstance.MonitorRefresh(dbo1.ExceSQL("select * from V_Monitor_Task where " + CStaticClass.Monstatus + " order by <20>豸ָ<E8B1B8><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> asc ").Tables[0].DefaultView);
|
|||
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FrmControlMonitor.FormInstance.ManagerRefresh(
|
|||
|
dbo1.ExceSQL("select * from V_Manage_Task where " + CStaticClass.Manstatus).Tables[0].DefaultView);
|
|||
|
// System.Diagnostics.Trace.WriteLine("ˢ<><CBA2>");
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (CStaticClass.ObtainManageTask == true)
|
|||
|
{
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
|
|||
|
if (CObtainTask.GetManagerTask() == 0)
|
|||
|
{
|
|||
|
this.tsStatus.ForeColor = Color.Red;
|
|||
|
if (this.tsStatus.Text.IndexOf(CObtainTask.CObtainTaskError) < 0)
|
|||
|
{
|
|||
|
this.tsStatus.Text += CObtainTask.CObtainTaskError;
|
|||
|
}
|
|||
|
}
|
|||
|
if (CObtainTask.CObtainTaskError.Length > 0)
|
|||
|
{
|
|||
|
if (this.tsStatus.Text.IndexOf(CObtainTask.CObtainTaskError) < 0)
|
|||
|
{
|
|||
|
this.tsStatus.ForeColor = Color.Red;
|
|||
|
this.tsStatus.Text += CObtainTask.CObtainTaskError;
|
|||
|
}
|
|||
|
}
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("ObtainTask<73><6B><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt2 - dt1).ToString());
|
|||
|
CObtainTask.CObtainTaskError = "";
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//ss13 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (tsStatus.Text.IndexOf("<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" + ex.Message) < 0)
|
|||
|
{
|
|||
|
tsStatus.Text += "<22><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" + ex.Message;
|
|||
|
}
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
//dt = null;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void timer3_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (CStaticClass.Order == true || CStaticClass.isDisassembleTask)
|
|||
|
{
|
|||
|
|
|||
|
string ss1 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>MyTaskIntoSteps();
|
|||
|
|
|||
|
CDisassembleTask.MyTaskIntoSteps();
|
|||
|
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
System.Diagnostics.Trace.WriteLine("MyTaskIntoSteps" + Convert.ToString(dt2 - dt1));
|
|||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("MyTaskIntoSteps<70><73><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt2 - dt1).ToString());
|
|||
|
|
|||
|
if (CDisassembleTask .DisassembleTaskError!= "")
|
|||
|
{
|
|||
|
if (tsStatus.Text.IndexOf(CDisassembleTask.DisassembleTaskError) < 0)
|
|||
|
{
|
|||
|
tsStatus.ForeColor = Color.Red;
|
|||
|
tsStatus.Text += CDisassembleTask.DisassembleTaskError;
|
|||
|
}
|
|||
|
CDisassembleTask.DisassembleTaskError = "";
|
|||
|
}
|
|||
|
if (CStaticClass.ObtainManageTask)
|
|||
|
{
|
|||
|
DateTime dt3 = DateTime.Now;
|
|||
|
|
|||
|
cplc.DealwithPLCAsk();
|
|||
|
DateTime dt4 = DateTime.Now;
|
|||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("DealwithPLCAsk<73><6B><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt4 - dt3).ToString());
|
|||
|
if (cplc.ListenPLCAskError != "")
|
|||
|
{
|
|||
|
if (tsStatus.Text.IndexOf(cplc.ListenPLCAskError) < 0)
|
|||
|
{
|
|||
|
tsStatus.ForeColor = Color.Red;
|
|||
|
tsStatus.Text += cplc.ListenPLCAskError;
|
|||
|
}
|
|||
|
}
|
|||
|
cplc.ListenPLCAskError = "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void timer4_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (CStaticClass.Order == true)
|
|||
|
{
|
|||
|
#region <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>PLC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
//System.Diagnostics.Trace.WriteLine("------------------------------------------" + Convert.ToString(dt1.ToLongTimeString));
|
|||
|
//string ss1 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
//System.Diagnostics.Trace.WriteLine(ss1);
|
|||
|
CStaticClass.GetAllReturns();//20100610
|
|||
|
|
|||
|
//string ss11 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("GetAllReturns<6E><73><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt2 - dt1).ToString());
|
|||
|
//System.Diagnostics.Trace.WriteLine("GetAllReturns"+Convert.ToString(dt2 - dt1));
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void timer5_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (CStaticClass.Order == true ) // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>plc
|
|||
|
{
|
|||
|
string ss1 = DateTime.Now.Second.ToString() + "-" + DateTime.Now.Millisecond.ToString();
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
cc.StartOrder(); //δ<><CEB4>PLC<4C><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
// CommonClassLib.CCarryConvert.WriteDarkCasket("StartOrder<65><72><EFBFBD><EFBFBD>", dt1.ToString("u"), dt2.ToString("u"), (dt2 - dt1).ToString());
|
|||
|
System.Diagnostics.Trace.WriteLine("StartOrder" + Convert.ToString(dt2 - dt1));
|
|||
|
if (cc.CControlError != "")
|
|||
|
{
|
|||
|
if (tsStatus.Text.IndexOf(cc.CControlError) < 0)
|
|||
|
{
|
|||
|
tsStatus.ForeColor = Color.Red;
|
|||
|
tsStatus.Text += cc.CControlError;
|
|||
|
}
|
|||
|
}
|
|||
|
cc.CControlError = "";
|
|||
|
// DateTime dt3 = DateTime.Now;
|
|||
|
// cplc.DealwithPLCAsk();
|
|||
|
// DateTime dt4 = DateTime.Now;
|
|||
|
//System.Diagnostics.Trace.WriteLine("DealwithPLCAsk" + Convert.ToString(dt4 - dt3));
|
|||
|
// if (cc.CControlError != "")
|
|||
|
// if (cplc.ListenPLCAskError != "")
|
|||
|
// {
|
|||
|
// if (tsStatus.Text.IndexOf(cplc.ListenPLCAskError) < 0)
|
|||
|
// {
|
|||
|
// tsStatus.ForeColor = Color.Red;
|
|||
|
// tsStatus.Text += cplc.ListenPLCAskError;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// cplc.ListenPLCAskError = "";
|
|||
|
// if (ccf.DisassembleTaskError!= "")
|
|||
|
// {
|
|||
|
// if (tsStatus.Text.IndexOf(ccf.DisassembleTaskError) < 0)
|
|||
|
// {
|
|||
|
// tsStatus.ForeColor = Color.Red;
|
|||
|
// tsStatus.Text += ccf.DisassembleTaskError;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// ccf.DisassembleTaskError = "";
|
|||
|
//if (CListenAGVState.TcpServerError != "")
|
|||
|
//{
|
|||
|
// if (tsStatus.Text.IndexOf(CListenAGVState.TcpServerError) < 0)
|
|||
|
// {
|
|||
|
// tsStatus.ForeColor = Color.Red;
|
|||
|
// tsStatus.Text += CListenAGVState.TcpServerError;
|
|||
|
// }
|
|||
|
//}
|
|||
|
//CListenAGVState.TcpServerError = "";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void timerFlash_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//return;
|
|||
|
//20100108
|
|||
|
DateTime dt1 = DateTime.Now;
|
|||
|
DataView dvh;
|
|||
|
Model.MDevice device = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if (CStaticClass.Order == true)
|
|||
|
{
|
|||
|
|
|||
|
if (!CStaticClass.LIKUSTATUS)
|
|||
|
{
|
|||
|
this.label40.Text = "<22>Զ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ؿ<DFBB><D8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD>";
|
|||
|
this.label40.ForeColor = Color.Red;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.label40.Text = string.Empty;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
pp = panel4;
|
|||
|
stack1 = bt1_11001;
|
|||
|
stack2 = bt1_11002;
|
|||
|
stack3 = bt1_11003;
|
|||
|
stack4 = bt1_11004;
|
|||
|
stack5 = bt1_11005;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
twj1 = t1_110010;
|
|||
|
|
|||
|
|
|||
|
twj2 = t1_110020;
|
|||
|
twj3 = t1_110030;
|
|||
|
twj4 = t1_110040;
|
|||
|
twj5 = t1_110050;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
switch (tabControl1.SelectedIndex)
|
|||
|
{
|
|||
|
|
|||
|
case 0:
|
|||
|
#region һ<EFBFBD><EFBFBD><EFBFBD>豸
|
|||
|
pp = panel4;
|
|||
|
stack1 = bt1_11001;
|
|||
|
stack2 = bt1_11002;
|
|||
|
stack3 = bt1_11003;
|
|||
|
stack4 = bt1_11004;
|
|||
|
stack5 = bt1_11005;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
twj1 = t1_110010;
|
|||
|
|
|||
|
|
|||
|
twj2 = t1_110020;
|
|||
|
twj3 = t1_110030;
|
|||
|
twj4 = t1_110040;
|
|||
|
twj5 = t1_110050;
|
|||
|
|
|||
|
break;
|
|||
|
#endregion
|
|||
|
case 1:
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸
|
|||
|
|
|||
|
pp = panel3;
|
|||
|
|
|||
|
break;
|
|||
|
#endregion
|
|||
|
//case 2:
|
|||
|
// #region <20><><EFBFBD><EFBFBD><EFBFBD>豸
|
|||
|
// pp = plAccessorial3;
|
|||
|
|
|||
|
|
|||
|
// #endregion
|
|||
|
}
|
|||
|
|
|||
|
#region ÿ<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
foreach (Control ctrl in pp.Controls)
|
|||
|
{
|
|||
|
if (((ctrl.GetType().ToString() == "System.Windows.Forms.Button") ||
|
|||
|
(ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox")) &&
|
|||
|
(ctrl.Enabled == true))
|
|||
|
{
|
|||
|
if (ctrl.Tag == null)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
|
|||
|
|
|||
|
if (device == null)
|
|||
|
{//20100108
|
|||
|
if (tsStatus.Text.IndexOf("<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + ctrl.Tag + "<22><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>û<EFBFBD>м<EFBFBD>¼!") < 0)
|
|||
|
{
|
|||
|
tsStatus.ForeColor = Color.Red;
|
|||
|
this.tsStatus.Text += "<22>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + ctrl.Tag + "<22><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>û<EFBFBD>м<EFBFBD>¼!";
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
continue;
|
|||
|
|
|||
|
}
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸״̬
|
|||
|
switch (device.RunState)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
case 0:
|
|||
|
if (device.DeviceKind == 1 || device.DeviceKind == 3 || device.DeviceKind == 4)
|
|||
|
{
|
|||
|
|
|||
|
ctrl.BackColor = Color.DarkOrange;
|
|||
|
}
|
|||
|
else
|
|||
|
if (device.DeviceKind != 18)
|
|||
|
{
|
|||
|
ctrl.BackColor = SystemColors.InactiveCaptionText;
|
|||
|
}
|
|||
|
if (device.DeviceIndex == 12026 || device.DeviceIndex == 12207 || device.DeviceIndex == 12116)
|
|||
|
{
|
|||
|
ctrl.BackColor = Color.DarkOrange;
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
case 1:
|
|||
|
ctrl.BackColor = Color.Lime;
|
|||
|
break;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
case 2:
|
|||
|
ctrl.BackColor = Color.Red;
|
|||
|
break;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
case 3:
|
|||
|
ctrl.BackColor = Color.LightYellow;
|
|||
|
break;
|
|||
|
//ͣ<><CDA3>
|
|||
|
case 4:
|
|||
|
ctrl.BackColor = Color.Maroon;
|
|||
|
break;
|
|||
|
//20090920<32><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 5:
|
|||
|
if (device.DeviceKind == 1 || device.DeviceKind == 4)
|
|||
|
{
|
|||
|
ctrl.BackColor = Color.MediumSlateBlue;//MediumOrchid;
|
|||
|
}
|
|||
|
else
|
|||
|
if (device.DeviceKind != 18)
|
|||
|
{
|
|||
|
ctrl.BackColor = Color.Gray;
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region <EFBFBD>ƶ<EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F>Ѷ<EFBFBD><D1B6><EFBFBD>
|
|||
|
|
|||
|
if (device.DeviceKind == 1)// && device.XCoor != 0)
|
|||
|
{ //841.719528208
|
|||
|
//0.033930776
|
|||
|
|
|||
|
//859.4549381
|
|||
|
//0.03479335
|
|||
|
double startadd = 225;
|
|||
|
double k = 0.0225349;
|
|||
|
double p = 0.022533;
|
|||
|
|
|||
|
if (device.XCoor < 1800)
|
|||
|
{
|
|||
|
//startadd = 841.719528208;
|
|||
|
//k = 0.033530776;
|
|||
|
}
|
|||
|
|
|||
|
int locationX = (int)(startadd + (k) * (device.XCoor - 635));
|
|||
|
if (device.DeviceIndex == 11005)
|
|||
|
{
|
|||
|
locationX = (int)(startadd + (p) * (62370 - device.XCoor));
|
|||
|
}
|
|||
|
switch (device.DeviceIndex)
|
|||
|
{
|
|||
|
|
|||
|
case 11001:
|
|||
|
if (stack1.Location.X != locationX)
|
|||
|
{
|
|||
|
stack1.Location = new Point(locationX, stack1.Location.Y);
|
|||
|
twj1.Location = new Point(locationX + 15, twj1.Location.Y);
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case 11002:
|
|||
|
locationX = (int)(startadd + (k) * (device.XCoor - 6305));
|
|||
|
if (stack2.Location.X != locationX)
|
|||
|
{
|
|||
|
|
|||
|
stack2.Location = new Point(locationX, stack2.Location.Y);
|
|||
|
twj2.Location = new Point(locationX + 15, twj2.Location.Y);
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
case 11003:
|
|||
|
if (stack3.Location.X != locationX)
|
|||
|
{
|
|||
|
stack3.Location = new Point(locationX, stack3.Location.Y);
|
|||
|
twj3.Location = new Point(locationX + 15, twj3.Location.Y);
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
case 11004:
|
|||
|
if (stack4.Location.X != locationX)
|
|||
|
{
|
|||
|
stack4.Location = new Point(locationX, stack4.Location.Y);
|
|||
|
twj4.Location = new Point(locationX + 15, twj4.Location.Y);
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
case 11005:
|
|||
|
{
|
|||
|
stack5.Location = new Point(locationX, stack5.Location.Y);
|
|||
|
twj5.Location = new Point(locationX + 15, twj5.Location.Y);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.TextBox") || ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Name.Substring(0, 1) == "t")))
|
|||
|
{
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD>20101118
|
|||
|
|
|||
|
if ( ctrl.Tag ==null || ctrl.Tag.ToString() == string.Empty)
|
|||
|
{
|
|||
|
ctrl.Visible = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (ctrl.Tag.ToString() == "124111.1")
|
|||
|
{
|
|||
|
//ctrl.Visible = true;
|
|||
|
}
|
|||
|
|
|||
|
ctrl.Visible = CStaticClass.GetDevicePhotoelectric(ctrl.Tag.ToString()) == 1 ? true : false;
|
|||
|
if (CStaticClass.GetDevicePhotoelectric(ctrl.Tag.ToString()) == -2)
|
|||
|
{
|
|||
|
string str = ctrl.Name;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
|||
|
|
|||
|
else if (ctrl.GetType().ToString() == "System.Windows.Forms.RadioButton")
|
|||
|
{
|
|||
|
//20100108DataView dvh;
|
|||
|
dvh = dbo.ExceSQL("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_DeviceIndex = " + ctrl.Tag + ") AND (F_HaveGoods = 1)").Tables[0].DefaultView;
|
|||
|
if (dvh.Count > 0)
|
|||
|
{
|
|||
|
ctrl.Visible = true;
|
|||
|
// ctrl.BackColor = Color.Blue;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ctrl.Visible = false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
DateTime dt2 = DateTime.Now;
|
|||
|
|
|||
|
System.Diagnostics.Trace.WriteLine("REFLASH" + (dt2 - dt1).ToString());
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{//20100108
|
|||
|
if (tsStatus.Text.IndexOf("ˢ<>½<EFBFBD><C2BD>涯<EFBFBD><E6B6AF>ʱ<EFBFBD><CAB1>" + ex.Message) < 0)
|
|||
|
{
|
|||
|
tsStatus.ForeColor = Color.Red;
|
|||
|
this.tsStatus.Text += "ˢ<>½<EFBFBD><C2BD>涯<EFBFBD><E6B6AF>ʱ<EFBFBD><CAB1>" + ex.Message;
|
|||
|
}
|
|||
|
}
|
|||
|
finally
|
|||
|
{//20100108
|
|||
|
dvh = null;
|
|||
|
device = null;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void tabPage1_Paint(object sender, PaintEventArgs e)
|
|||
|
{
|
|||
|
Graphics g = e.Graphics;
|
|||
|
g.TranslateTransform(this.tabPage1.AutoScrollPosition.X, this.tabPage1.AutoScrollPosition.Y);
|
|||
|
//20100108
|
|||
|
g.Dispose();
|
|||
|
}
|
|||
|
|
|||
|
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 timerCamera_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
return;
|
|||
|
//20100108<30><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>29<32><39>ÿ<EFBFBD><C3BF><EFBFBD>豸<EFBFBD><E8B1B8>F_LocalPort<72><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_RemotePort<72><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>1--12<31><32>
|
|||
|
//<2F><><EFBFBD><EFBFBD>F_LocalPort<72><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_RemotePort<72>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_LockedState=0
|
|||
|
if (CStaticClass.Order == false) return;
|
|||
|
DataView dv;
|
|||
|
DataView dv1;
|
|||
|
DataView dvs;
|
|||
|
try
|
|||
|
{
|
|||
|
dv = dbo.ExceSQL("select F_DeviceIndex,F_LockedState from T_Base_Device where F_DeviceKindIndex=29 and F_LockedState>0").Tables[0].DefaultView;
|
|||
|
for (int i = 0; i < dv.Count; i++)
|
|||
|
{
|
|||
|
if (dv[i]["F_LockedState"] != DBNull.Value)
|
|||
|
{//<2F><><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ס<EFBFBD><D7A1><EFBFBD><EFBFBD>ͷ
|
|||
|
dv1 = dbo.ExceSQL("SELECT F_RemotePort FROM T_Base_Device WHERE F_DeviceIndex=" + dv[i]["F_LockedState"] + "").Tables[0].DefaultView;
|
|||
|
if (dv1.Count > 0)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD>F_LocalPort<72><74><EFBFBD><EFBFBD>ͷ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_RemotePort<72><74><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_LockedState=0
|
|||
|
dvs = dbo.ExceSQL("SELECT SUM(F_ErrorCode) AS errs FROM T_Base_Device WHERE (F_LocalPort = " + dv[i]["F_DeviceIndex"] + " and F_RemotePort=" + dv1[0]["F_RemotePort"] + ") ").Tables[0].DefaultView;
|
|||
|
|
|||
|
if (dvs[0]["errs"] != DBNull.Value)
|
|||
|
{
|
|||
|
if (Convert.ToInt32(dvs[0]["errs"]) <= 0)
|
|||
|
{
|
|||
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
dbo.ExceSQL("update T_Base_Device set F_LockedState=0 where F_DeviceIndex=" + dv[i]["F_DeviceIndex"] + " and F_LockedState>0");
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (tsStatus.Text.IndexOf(ex.Message) < 0)
|
|||
|
{
|
|||
|
tsStatus.Text += ex.Message;
|
|||
|
}
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
dv = null;
|
|||
|
dvs = null;
|
|||
|
dv1 = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
//{
|
|||
|
// try
|
|||
|
// {
|
|||
|
// string df = "";
|
|||
|
|
|||
|
// switch (this.comboBox1.Text)
|
|||
|
// {
|
|||
|
// case "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
// df = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
// break;
|
|||
|
// case "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
// df = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
// break;
|
|||
|
// case "<22>豸ָ<E8B1B8><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>":
|
|||
|
// df = "<22>豸ָ<E8B1B8><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
// break;
|
|||
|
|
|||
|
|
|||
|
// default:
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// //20100208
|
|||
|
// string sql = "select distinct " + df + " from V_Monitor_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 button5_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
FrmLaneTest.FormInstance.ShowDialog();
|
|||
|
}
|
|||
|
|
|||
|
//private void button6_Click(object sender, EventArgs e)
|
|||
|
//{
|
|||
|
// ResourceManager resource = new ResourceManager("ControlSystem.Properties.Resources",this.GetType().Assembly);
|
|||
|
// pBAAB.Image = (System.Drawing.Image)resource.GetObject("ABB_FREE");
|
|||
|
//}
|
|||
|
|
|||
|
//private void button16_Click(object sender, EventArgs e)
|
|||
|
//{
|
|||
|
// ResourceManager resource = new ResourceManager("ControlSystem.Properties.Resources", this.GetType().Assembly);
|
|||
|
// pBAAB.Image = (System.Drawing.Image)resource.GetObject("ABB_ACTION");
|
|||
|
//}
|
|||
|
|
|||
|
//private void button17_Click(object sender, EventArgs e)
|
|||
|
//{
|
|||
|
// ResourceManager resource = new ResourceManager("ControlSystem.Properties.Resources", this.GetType().Assembly);
|
|||
|
// pBAAB.Image = (System.Drawing.Image)resource.GetObject("ABB_ERROR");
|
|||
|
//}
|
|||
|
|
|||
|
//private void button18_Click(object sender, EventArgs e)
|
|||
|
//{
|
|||
|
// ResourceManager resource = new ResourceManager("ControlSystem.Properties.Resources", this.GetType().Assembly);
|
|||
|
// pBAAB.Image = (System.Drawing.Image)resource.GetObject("ABB_FORBID");
|
|||
|
//}
|
|||
|
|
|||
|
private void FrmControlMonitor_Resize(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//if (this.WindowState == FormWindowState.Maximized)//20100610zl
|
|||
|
//{
|
|||
|
// this.FormBorderStyle = FormBorderStyle.None;
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// this.FormBorderStyle = FormBorderStyle.Sizable;
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void button6_Click_2(object sender, EventArgs e)
|
|||
|
{
|
|||
|
dboM = CStaticClass.dboM;
|
|||
|
dboM.GetManageTableIndex("IO_CONTROL_APPLY");
|
|||
|
}
|
|||
|
|
|||
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void plAccessorial1_Paint(object sender, PaintEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#region Added by DingXiaoxu for tooltip on 20101219
|
|||
|
private void Btn_MouseEnter(object sender, EventArgs e)
|
|||
|
{
|
|||
|
toolTip_DeviceIndex.SetToolTip(sender as Control, Convert.ToString((sender as Control).Tag));
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
private void button3_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void tsStatus_TextChanged(object sender, System.EventArgs e)
|
|||
|
{
|
|||
|
//throw new System.Exception("The method or operation is not implemented.");
|
|||
|
|
|||
|
FrmErrorMessage.FormInstance.NewMessage((sender as TextBox).Text);
|
|||
|
}
|
|||
|
|
|||
|
public void tsStatus_ForeColorChanged(object sender, System.EventArgs e)
|
|||
|
{
|
|||
|
FrmErrorMessage.FormInstance.NewForeColor((sender as TextBox).ForeColor);
|
|||
|
}
|
|||
|
|
|||
|
private void timerTransDeviceStatus_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (CStaticClass.Order == true)//<2F><><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
|
|||
|
{
|
|||
|
ccf.ReportDeviceState();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button56_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
FrmSystemInit.FormInstance.ShowDialog();
|
|||
|
}
|
|||
|
|
|||
|
private void toolTip_DeviceIndex_Popup(object sender, PopupEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void tabPage2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void button136_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void plAccessorial1_Paint_1(object sender, PaintEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void label16_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|