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.
1417 lines
62 KiB
1417 lines
62 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.Linq;
|
|
using Microsoft.VisualBasic;
|
|
using System.IO.Ports;
|
|
using System.Resources;
|
|
using System.Drawing.Drawing2D;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
|
|
/// <summary>
|
|
/// Creator:Richard.liu
|
|
/// µ÷¶È³ÌÐòÖ÷´°¿Ú
|
|
/// </summary>
|
|
|
|
public partial class FrmControlMonitor : WeifenLuo.WinFormsUI.Docking.DockContent
|
|
{
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
Model.MDevice devinfo;
|
|
FrmDeviceStatus _deviceStatus = new FrmDeviceStatus();
|
|
DBFactory.DBOperator dbo = CStaticClass.dbo;
|
|
DBFactory.DBOperator dbo1 = new DBFactory.DBOperator();
|
|
|
|
private static FrmControlMonitor _formInstance;
|
|
public static FrmControlMonitor FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmControlMonitor();
|
|
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
|
|
public FrmControlMonitor()
|
|
{
|
|
|
|
InitializeComponent();
|
|
//this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
////É趨×ÖÌå´óСΪ12px
|
|
//this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134)));
|
|
|
|
_formInstance = this;
|
|
|
|
|
|
}
|
|
#region ·½·¨
|
|
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
|
|
protected override CreateParams CreateParams
|
|
{
|
|
|
|
get
|
|
{
|
|
|
|
CreateParams cp = base.CreateParams;
|
|
|
|
cp.ExStyle |= 0x02000000;//WS_CLIPCHILDREN Á½¸ö´°Ìåµþ¼Óʱ£¬Öصþ²¿·Ö²»ÖØ»æ
|
|
return cp;
|
|
|
|
}
|
|
|
|
}
|
|
private void timerFlash_Tick(object sender, EventArgs e)
|
|
{
|
|
string[] DS; char[] dd = new char[1] { '.' };
|
|
Model.MDevice device;
|
|
TimeSpan ts = DateTime.Now.TimeOfDay;
|
|
DataView dv; DataView dvJY;
|
|
this.SuspendLayout(); //richard.liu20140806
|
|
try
|
|
{
|
|
if (CStaticClass.WCFOK == true)
|
|
{
|
|
sql.Remove(0, sql.Length);//richard.liu20140806
|
|
sql.Append("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_LockedState = - 1) ");
|
|
dvJY = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;//richard.liu20140806
|
|
dvJY.Sort = "F_DeviceIndex";
|
|
|
|
Button stack1 = bt1_stacker1;
|
|
Button stack2 = bt1_stacker2;
|
|
Button stack3 = bt1_stacker3;
|
|
Button stack4 = bt1_stacker4;
|
|
Button stack5 = bt1_stacker5;
|
|
Button stack6 = bt1_stacker6;
|
|
Button stack7 = bt1_stacker7;
|
|
Button stack8 = bt1_stacker8;
|
|
|
|
TextBox tw1n = tb1_stacker1_Near;
|
|
TextBox tw2n = tb1_stacker2_Near;
|
|
TextBox tw3n = tb1_stacker3_Near;
|
|
TextBox tw4n = tb1_stacker4_Near;
|
|
TextBox tw5n = tb1_stacker5_Near;
|
|
TextBox tw6n = tb1_stacker6_Near;
|
|
TextBox tw7n = tb1_stacker7_Near;
|
|
TextBox tw8n = tb1_stacker8_Near;
|
|
|
|
|
|
Panel pp = plAccessorial1;
|
|
|
|
if (this.tabControl1.SelectedTab.Name == "tabPage1")
|
|
{
|
|
pp = plAccessorial1;
|
|
stack1 = bt1_stacker1;
|
|
stack2 = bt1_stacker2;
|
|
stack3 = bt1_stacker3;
|
|
stack4 = bt1_stacker4;
|
|
|
|
tw1n = tb1_stacker1_Near;
|
|
tw2n = tb1_stacker2_Near;
|
|
tw3n = tb1_stacker3_Near;
|
|
tw4n = tb1_stacker4_Near;
|
|
|
|
|
|
}
|
|
else if (this.tabControl1.SelectedTab.Name == "tabPage2")
|
|
{
|
|
pp = plAccessorial2;
|
|
stack1 = bt2_stacker1;
|
|
stack2 = bt2_stacker2;
|
|
stack3 = bt2_stacker3;
|
|
stack4 = bt2_stacker4;
|
|
|
|
tw1n = tb2_stacker1_Near;
|
|
tw2n = tb2_stacker2_Near;
|
|
tw3n = tb2_stacker3_Near;
|
|
tw4n = tb2_stacker4_Near;
|
|
|
|
}
|
|
else if (this.tabControl1.SelectedTab.Name == "tabPage4")
|
|
{
|
|
pp = plAccessorial4;
|
|
|
|
|
|
}
|
|
else if (this.tabControl1.SelectedTab.Name == "tabPage5")
|
|
{
|
|
pp = plAccessorial5;
|
|
stack5 = bt1_stacker5;
|
|
stack6 = bt1_stacker6;
|
|
stack7 = bt1_stacker7;
|
|
stack8 = bt1_stacker8;
|
|
|
|
tw5n = tb1_stacker5_Near;
|
|
tw6n = tb1_stacker6_Near;
|
|
tw7n = tb1_stacker7_Near;
|
|
tw8n = tb1_stacker8_Near;
|
|
}
|
|
else if (this.tabControl1.SelectedTab.Name == "tabPage6")
|
|
{
|
|
pp = plAccessorial6;
|
|
stack5 = bt2_stacker5;
|
|
stack6 = bt2_stacker6;
|
|
stack7 = bt2_stacker7;
|
|
stack8 = bt2_stacker8;
|
|
|
|
tw5n = tb2_stacker5_Near;
|
|
tw6n = tb2_stacker6_Near;
|
|
tw7n = tb2_stacker7_Near;
|
|
tw8n = tb2_stacker8_Near;
|
|
}
|
|
|
|
|
|
|
|
#region ÿ²ãÂ¥¼àÊÓ»Ãæ
|
|
|
|
//foreach (Button ctrl in pp.Controls.OfType<Button>())
|
|
//{
|
|
// device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
|
|
// if (device == null || device.ToString().Length < 5)
|
|
// {
|
|
// string a = "";
|
|
// }
|
|
//}
|
|
|
|
foreach (Button ctrl in pp.Controls.OfType<Button>())
|
|
{
|
|
|
|
if (ctrl.Enabled == false) continue;
|
|
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
|
|
//if (device.DeviceIndex.ToString().IndexOf("13") == 0) continue;
|
|
//if (device.DeviceIndex.ToString().IndexOf("11") == 0) continue;
|
|
if (device == null)
|
|
{//20100108
|
|
if (tsStatus.Text.IndexOf(ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!") < 0)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!";
|
|
}
|
|
|
|
continue;
|
|
}
|
|
//string deviceindex = ctrl.Name.ToString();
|
|
|
|
//toolTip_DeviceIndex.SetToolTip(sender as Control, deviceindex);
|
|
//²»ÏÔʾ½ûÓõĻ¥³â¶Ñ¶â»ú 20181008
|
|
|
|
#region ¶¯»
|
|
|
|
if (device.DeviceKind == 1)
|
|
{//¶Ñ¶â»ú
|
|
//182500 1225
|
|
//double a = 0;//3.9423=(49-41.1153)/2(14755:¶Ñ¶â»úͼÉÏ¿í¶È£¬44.1152£ºÁ½Áлõ¼ÜͼÉÏ¿í¶È£¬a:×ø±êÆ«²î)
|
|
//double startadd = 178;//;//1ÁÐ×ø±ê
|
|
//double width = 44.05;//881/20=44.05 £¨µ¥Áлõ¼Ü¿í¶È£©
|
|
//int locationX = (int)(startadd + a + width * (device.XCoor - 1));
|
|
////int locationX = (int)(startadd + a + width * (device.XCoor - 1));
|
|
////int locationX = (int)(startadd - a - width * (20 - 1));
|
|
|
|
#region ÍÐÅ̶Ѷâ»ú
|
|
if (device.DeviceIndex >= 10001 &&device.DeviceIndex <= 10008)
|
|
{
|
|
#region ¹ÕÍä¶Ñ¶â»ú
|
|
//double startadd = 269;//µÚ1ÁÐͼÉÏ×ø±ê//
|
|
//double k = (double)(1000) / (double)56;//ͼÉÏ»õ¼Ü³¤¶È/ÁÐÊý
|
|
//double a = 0;
|
|
//int xcoor = device.XCoor;//xyz ÁвãÅÅ
|
|
//int zcoor = device.ZCoor;
|
|
|
|
//int locationX = 0;
|
|
//int locationY = 0;
|
|
//if (device.DeviceIndex == 11001)
|
|
//{
|
|
|
|
// if (textBox_code.Text != "")
|
|
// {
|
|
// xcoor = Convert.ToInt32(textBox_code.Text);
|
|
// }
|
|
// if (textBox_stackZ.Text != "")
|
|
// {
|
|
// zcoor = Convert.ToInt32(textBox_stackZ.Text);
|
|
// }
|
|
// locationX = (int)(startadd + a + k * (xcoor - 1));
|
|
// //if (xcoor == 1)
|
|
// //{
|
|
// // locationX = 184;
|
|
// //}
|
|
|
|
// if (zcoor == 1)
|
|
// {
|
|
// locationY = 730;
|
|
// }
|
|
// if (zcoor == 2)
|
|
// {
|
|
// locationY = 631;
|
|
// }
|
|
// if (zcoor == 3)
|
|
// {
|
|
// locationX = 15;
|
|
// locationY = 684;
|
|
// }
|
|
//}
|
|
//if (device.DeviceIndex == 11002)
|
|
//{
|
|
|
|
// if (textBox_code.Text != "")
|
|
// {
|
|
// xcoor = Convert.ToInt32(textBox_code.Text);
|
|
// }
|
|
// if (textBox_stackZ.Text != "")
|
|
// {
|
|
// zcoor = Convert.ToInt32(textBox_stackZ.Text);
|
|
// }
|
|
// locationX = (int)(startadd - a - k * (xcoor - 35));
|
|
// //if (xcoor == 1)
|
|
// //{
|
|
// // locationX = 184;
|
|
// //}
|
|
|
|
// if (zcoor == 1)
|
|
// {
|
|
// locationY = 531;
|
|
// }
|
|
// if (zcoor == 2)
|
|
// {
|
|
// locationY = 432;
|
|
// }
|
|
// if (zcoor == 3)
|
|
// {
|
|
// locationX = 15;
|
|
// locationY = 484;
|
|
// }
|
|
//}
|
|
//if (device.DeviceIndex == 11003)
|
|
//{
|
|
|
|
// if (textBox_code.Text != "")
|
|
// {
|
|
// xcoor = Convert.ToInt32(textBox_code.Text);
|
|
// }
|
|
// if (textBox_stackZ.Text != "")
|
|
// {
|
|
// zcoor = Convert.ToInt32(textBox_stackZ.Text);
|
|
// }
|
|
// locationX = (int)(startadd - a - k * (xcoor - 35));
|
|
// //if (xcoor == 1)
|
|
// //{
|
|
// // locationX = 184;
|
|
// //}
|
|
|
|
// if (zcoor == 1)
|
|
// {
|
|
// locationY = 332;
|
|
// }
|
|
// if (zcoor == 2)
|
|
// {
|
|
// locationY = 233;
|
|
// }
|
|
// if (zcoor == 3)
|
|
// {
|
|
// locationX = 15;
|
|
// locationY = 282;
|
|
// }
|
|
//}
|
|
//if (device.DeviceIndex == 11004)
|
|
//{
|
|
|
|
// if (textBox_code.Text != "")
|
|
// {
|
|
// xcoor = Convert.ToInt32(textBox_code.Text);
|
|
// }
|
|
// if (textBox_stackZ.Text != "")
|
|
// {
|
|
// zcoor = Convert.ToInt32(textBox_stackZ.Text);
|
|
// }
|
|
// locationX = (int)(startadd - a - k * (xcoor-35));
|
|
// //if (xcoor == 1)
|
|
// //{
|
|
// // locationX = 184;
|
|
// //}
|
|
|
|
// if (zcoor == 1)
|
|
// {
|
|
// locationY = 133;
|
|
// }
|
|
// if (zcoor == 2)
|
|
// {
|
|
// locationY = 34;
|
|
// }
|
|
// if (zcoor == 3)
|
|
// {
|
|
// locationX = 15;
|
|
// locationY = 84;
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
switch (device.DeviceIndex)
|
|
{
|
|
|
|
case 10001:
|
|
//1ÁÐ×ø±ê+£¨»õ¼Ü³¤¶È/ÁÐÊý£©*£¨X×ø±ê-1£©
|
|
stack1.Location = new Point((int)(130 + (700/19) * (device.XCoor-1)), stack1.Location.Y);//
|
|
tw1n.Location = new Point(stack1.Location.X + 10, stack1.Location.Y + 7);
|
|
break;
|
|
case 10002:
|
|
stack2.Location = new Point((int)(130 + (700 / 19) * (device.XCoor-1)), stack2.Location.Y);//
|
|
tw2n.Location = new Point(stack2.Location.X + 10, stack2.Location.Y + 7);
|
|
break;
|
|
case 10003:
|
|
stack3.Location = new Point((int)(130 + (700 / 19) * (device.XCoor - 1)), stack3.Location.Y);//
|
|
tw3n.Location = new Point(stack3.Location.X + 10, stack3.Location.Y + 7);
|
|
break;
|
|
case 10004:
|
|
stack4.Location = new Point((int)(130 + (700 / 19) * (device.XCoor - 1)), stack4.Location.Y);//
|
|
tw4n.Location = new Point(stack4.Location.X + 10, stack4.Location.Y + 7);
|
|
break;
|
|
case 10005:
|
|
stack5.Location = new Point((int)(1277 - (700/19) * (device.XCoor - 1)), stack5.Location.Y);//
|
|
tw5n.Location = new Point(stack5.Location.X + 28, stack5.Location.Y + 7);
|
|
break;
|
|
case 10006:
|
|
stack6.Location = new Point((int)(1277 - (700 / 19) * (device.XCoor - 1)), stack6.Location.Y);//
|
|
tw6n.Location = new Point(stack6.Location.X + 28, stack6.Location.Y + 7);
|
|
break;
|
|
case 10007:
|
|
stack7.Location = new Point((int)(1277 - (700 / 19) * (device.XCoor - 1)), stack7.Location.Y);//
|
|
tw7n.Location = new Point(stack7.Location.X + 28, stack7.Location.Y + 7);
|
|
break;
|
|
case 10008:
|
|
stack8.Location = new Point((int)(1277 - (700 / 19) * (device.XCoor - 1)), stack8.Location.Y);//
|
|
tw8n.Location = new Point(stack8.Location.X + 28, stack8.Location.Y + 7);
|
|
break;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
else if (device.DeviceKind == 4)
|
|
{//RGV
|
|
|
|
|
|
switch (device.DeviceIndex)
|
|
{
|
|
case 14001:
|
|
tw4n.Location = new Point(stack4.Location.X + 8, stack4.Location.Y + 14);
|
|
//tw42n.Location = new Point(stack4.Location.X + 33, stack4.Location.Y + 9);
|
|
break;
|
|
}
|
|
}
|
|
else if (device.DeviceKind ==2)//̨³µ
|
|
{//RGV
|
|
#region ̨³µ
|
|
//if (device.DeviceIndex >= 13001 && device.DeviceIndex <= 13007)
|
|
//{
|
|
// int nearY = 314;
|
|
// int farY = 337;
|
|
// if (device.SplitByte_1 == 1)//Í£¿¿ÔÚ½üλÖÃ
|
|
// {
|
|
// if (ctrl.Location.Y != nearY)
|
|
// {
|
|
// ctrl.Location = new Point(ctrl.Location.X, nearY);
|
|
|
|
// }
|
|
// }
|
|
// else
|
|
// if (device.SplitByte_2 == 1)//Í£¿¿ÔÚԶλÖÃ
|
|
// {
|
|
// if (ctrl.Location.Y != farY)
|
|
// {
|
|
// ctrl.Location = new Point(ctrl.Location.X, farY);
|
|
// }
|
|
// }
|
|
|
|
//switch (device.DeviceIndex)
|
|
//{
|
|
//case 13001:
|
|
// tb13001.Location = new Point(tb13001.Location.X, ctrl.Location.Y+7);
|
|
// break;
|
|
//case 13002:
|
|
// tb13002.Location = new Point(tb13002.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//case 13003:
|
|
// tb13003.Location = new Point(tb13003.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//case 13004:
|
|
// tb13004.Location = new Point(tb13004.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//case 13005:
|
|
// tb13005.Location = new Point(tb13005.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//case 13006:
|
|
// tb13006.Location = new Point(tb13006.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//case 13007:
|
|
// tb13007.Location = new Point(tb13007.Location.X, ctrl.Location.Y + 7);
|
|
// break;
|
|
//}
|
|
// }
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
#region ÉèÖÃÉ豸״̬
|
|
// if (ctrl.Enabled == false) continue;
|
|
switch (device.RunState)
|
|
{
|
|
//¿ÕÏÐ
|
|
case 0:
|
|
if (device.DeviceKind == 1 || device.DeviceKind == 4 || device.DeviceKind == 17)
|
|
{
|
|
if (device.ControlMode > 0)
|
|
{
|
|
ctrl.BackColor = Color.DarkViolet;
|
|
|
|
}
|
|
else
|
|
{
|
|
ctrl.BackColor = Color.Orange;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
if (device.DeviceKind == 2)
|
|
{
|
|
ctrl.BackColor = Color.LightSkyBlue;
|
|
}
|
|
//else
|
|
// if (device.DeviceIndex >= 13007 && device.DeviceIndex <= 13008)
|
|
// {
|
|
// ctrl.BackColor = Color.Khaki;
|
|
// }
|
|
else
|
|
{
|
|
ctrl.BackColor = Color.LightSkyBlue;
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
//ÔËÐÐ
|
|
case 1:
|
|
ctrl.BackColor = Color.Lime;
|
|
break;
|
|
//¹ÊÕÏ
|
|
case 2:
|
|
ctrl.BackColor = Color.Red;
|
|
|
|
break;
|
|
//ÀëÏß
|
|
case 3:
|
|
ctrl.BackColor = Color.LightYellow;
|
|
break;
|
|
//Í£ÓÃ
|
|
case 4:
|
|
ctrl.BackColor = Color.Maroon;
|
|
|
|
break;
|
|
//20090920¶¯×÷Íê³É
|
|
case 5:
|
|
ctrl.BackColor = Color.SeaGreen;//MediumOrchid;
|
|
|
|
break;
|
|
}
|
|
#endregion
|
|
|
|
#region É豸±»½ûÓÃ
|
|
//richar.liu20140806
|
|
int index = dvJY.Find(device.DeviceIndex);
|
|
if (index >= 0)
|
|
{
|
|
ctrl.BackColor = Color.Maroon;
|
|
|
|
}
|
|
if (device.VirtualStack > 0 && index>=0)//»¥³â¶Ñ¶â»ú±»½ûÓÃ
|
|
{
|
|
ctrl.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
ctrl.Visible = true;
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
#region »õÎï̽²â
|
|
foreach (TextBox ctrl in pp.Controls.OfType<TextBox>())
|
|
{
|
|
|
|
if (ctrl.Tag.ToString()=="")
|
|
{
|
|
continue;
|
|
}
|
|
DS = ctrl.Tag.ToString().Split(dd);
|
|
int devicebyte = 0; int devbit = 0;
|
|
int.TryParse(DS[0], out devicebyte);
|
|
int.TryParse(DS[1], out devbit);
|
|
device = Model.CGetInfo.GetDeviceInfo(devicebyte);
|
|
if (device == null)
|
|
{//20100108
|
|
if (tsStatus.Text.IndexOf(ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!") < 0)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!";
|
|
}
|
|
continue;
|
|
}
|
|
|
|
if (device.DeviceIndex == 19002)
|
|
{
|
|
string s = ctrl.Name;
|
|
|
|
}
|
|
int index = dvJY.Find(device.DeviceIndex);
|
|
switch (devbit)
|
|
{
|
|
case 0:
|
|
|
|
|
|
if (device.VirtualStack > 0 && index >= 0)//»¥³â¶Ñ¶â»ú±»½ûÓÃ
|
|
{
|
|
ctrl.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
|
|
}
|
|
break;
|
|
case 1:
|
|
|
|
|
|
if (device.VirtualStack > 0 && index >= 0)//»¥³â¶Ñ¶â»ú±»½ûÓÃ
|
|
{
|
|
ctrl.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
ctrl.Visible = device.SplitByte_1 == 1 ? true : false;
|
|
}
|
|
break;
|
|
case 2:
|
|
ctrl.Visible = device.SplitByte_2 == 1 ? true : false;
|
|
break;
|
|
case 3:
|
|
ctrl.Visible = device.SplitByte_3 == 1 ? true : false;
|
|
break;
|
|
case 4:
|
|
ctrl.Visible = device.SplitByte_4 == 1 ? true : false;
|
|
break;
|
|
case 5:
|
|
ctrl.Visible = device.SplitByte_5 == 1 ? true : false;
|
|
break;
|
|
case 6:
|
|
ctrl.Visible = device.SplitByte_6 == 1 ? true : false;
|
|
ctrl.BackColor = Color.Goldenrod;
|
|
break;
|
|
case 7:
|
|
ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
|
|
break;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region ¸ßλ¿ª¹ØÌ½²â
|
|
foreach (Label ctrl in pp.Controls.OfType<Label>())
|
|
{
|
|
//add for catl FD
|
|
#region catl ɨÂëɨ²»µ½ÏÔʾͼ±ê
|
|
if (ctrl.Tag != null && ctrl.ForeColor == Color.Red)
|
|
{
|
|
string[] strBarCode = { "17510", "17509", "17403", "17401", "27101", "27102", "27103", "37401", "37403", "37510", "37509", "47102", "47103", "47101"
|
|
, "77005", "77006", "77007", "77008", "77004", "77003", "77002", "77001", "77017", "77016", "77010", "77011"
|
|
,"77014", "77013", "77012"};
|
|
//if (Convert.ToInt32(ctrl.Tag) == 77006)
|
|
//{
|
|
// string kk = "";
|
|
//}
|
|
if (strBarCode.Contains(Convert.ToString(ctrl.Tag)))
|
|
{
|
|
sql.Remove(0, sql.Length);
|
|
sql.Append("SELECT F_BARCODE FROM T_BASE_PLC_ASK WHERE F_BARCODE like'111%' and F_DEVICEINDEX = ").Append(Convert.ToInt32(ctrl.Tag));
|
|
DataView barCode = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
|
|
string a = "label" + ctrl.Tag.ToString();
|
|
|
|
#region
|
|
foreach (Label Bar in pp.Controls.OfType<Label>())
|
|
{
|
|
if (Bar.Tag != null && Bar.Name.Length > 9)
|
|
{
|
|
if (!strBarCode.Contains(Bar.Name.Substring(7).ToString()))
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
if (Bar.BackColor == Color.Yellow)
|
|
{
|
|
if (Bar.Name.Equals(a))
|
|
{
|
|
if (barCode.Count > 0)
|
|
{
|
|
Bar.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
Bar.Visible = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
if (ctrl.Tag != null && ctrl.ForeColor != Color.Red)
|
|
{
|
|
|
|
|
|
DS = ctrl.Tag.ToString().Split(dd);
|
|
int devicebyte = 0; int devbit = 0;
|
|
int.TryParse(DS[0], out devicebyte);
|
|
int.TryParse(DS[1], out devbit);
|
|
device = Model.CGetInfo.GetDeviceInfo(devicebyte);
|
|
if (device == null)
|
|
{//20100108
|
|
if (tsStatus.Text.IndexOf(ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!") < 0)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!";
|
|
}
|
|
continue;
|
|
}
|
|
|
|
if (devbit < 8)
|
|
{
|
|
switch (devbit)
|
|
{
|
|
case 0:
|
|
ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
|
|
break;
|
|
case 1:
|
|
ctrl.Visible = device.SplitByte_1 == 1 ? true : false;
|
|
break;
|
|
case 2:
|
|
ctrl.Visible = device.SplitByte_2 == 1 ? true : false;
|
|
break;
|
|
case 3:
|
|
ctrl.Visible = device.SplitByte_3 == 1 ? true : false;
|
|
break;
|
|
case 4:
|
|
ctrl.Visible = device.SplitByte_4 == 1 ? true : false;
|
|
break;
|
|
case 5:
|
|
ctrl.Visible = device.SplitByte_5 == 1 ? true : false;
|
|
break;
|
|
case 6:
|
|
ctrl.Visible = device.SplitByte_6 == 1 ? true : false;
|
|
ctrl.BackColor = Color.Goldenrod;
|
|
break;
|
|
case 7:
|
|
ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
|
|
break;
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
devbit = devbit % 8;
|
|
|
|
switch (devbit)
|
|
{
|
|
case 0:
|
|
ctrl.Visible = (device.SplitByte_5 & 1) == 1 ? true : false;
|
|
break;
|
|
case 1:
|
|
ctrl.Visible = (device.SplitByte_5 & 2) == 2 ? true : false;
|
|
break;
|
|
case 2:
|
|
ctrl.Visible = (device.SplitByte_5 & 4) == 4 ? true : false;
|
|
break;
|
|
case 3:
|
|
ctrl.Visible = (device.SplitByte_5 & 8) == 8 ? true : false;
|
|
break;
|
|
case 4:
|
|
ctrl.Visible = (device.SplitByte_5 & 16) == 16 ? true : false;
|
|
break;
|
|
case 5:
|
|
ctrl.Visible = (device.SplitByte_5 & 32) == 32 ? true : false;
|
|
break;
|
|
case 6:
|
|
ctrl.Visible = (device.SplitByte_5 & 64) == 64 ? true : false;
|
|
break;
|
|
case 7:
|
|
ctrl.Visible = (device.SplitByte_5 & 128) == 128 ? true : false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Âß¼ÓÐÎïÏÔʾ
|
|
|
|
|
|
foreach (RadioButton ctrl in pp.Controls.OfType<RadioButton>())
|
|
{
|
|
//20100108DataView dvh;
|
|
dv = dbo.ExceSQL("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_DeviceIndex = " + ctrl.Tag + ") AND (F_HaveGoods >0)").Tables[0].DefaultView;
|
|
if (dv.Count > 0)
|
|
{
|
|
ctrl.Visible = true;
|
|
ctrl.BackColor = Color.Blue;
|
|
}
|
|
else
|
|
{
|
|
ctrl.Visible = false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region ¹ÊÕϵã
|
|
foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
|
|
{
|
|
if ( ctrl.Tag.ToString()!="")
|
|
{
|
|
DS = ctrl.Tag.ToString().Split(dd);
|
|
if(DS.Length>1)
|
|
{
|
|
int devicebyte = 0; int devbit = 0;
|
|
int.TryParse(DS[0], out devicebyte);
|
|
int.TryParse(DS[1], out devbit);
|
|
device = Model.CGetInfo.GetDeviceInfo(devicebyte);
|
|
if (device == null)
|
|
{//20100108
|
|
if (tsStatus.Text.IndexOf(ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!") < 0)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Tag + "ÔÚÊý¾Ý¿âûÓмǼ!";
|
|
}
|
|
continue;
|
|
}
|
|
|
|
switch (devbit)
|
|
{
|
|
case 0:
|
|
ctrl.Visible = device.SplitByte_0 == 1 ? true : false;
|
|
break;
|
|
case 1:
|
|
ctrl.Visible = device.SplitByte_1 == 1 ? true : false;
|
|
break;
|
|
case 2:
|
|
ctrl.Visible = device.SplitByte_2 == 1 ? true : false;
|
|
break;
|
|
case 3:
|
|
ctrl.Visible = device.SplitByte_3 == 1 ? true : false;
|
|
break;
|
|
case 4:
|
|
ctrl.Visible = device.SplitByte_4 == 1 ? true : false;
|
|
break;
|
|
case 5:
|
|
ctrl.Visible = device.SplitByte_5 == 1 ? true : false;
|
|
break;
|
|
case 6:
|
|
ctrl.Visible = device.SplitByte_6 == 1 ? true : false;
|
|
break;
|
|
case 7:
|
|
ctrl.Visible = device.SplitByte_7 == 1 ? true : false;
|
|
break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region ˢа´Å¥ ¼±Í£°´Å¥Í¨¹ý¶Ñ¶â»ú¹âµç¿ª¹Ø.6·´À¡
|
|
foreach (PictureBox ctrl in pp.Controls.OfType<PictureBox>())
|
|
{
|
|
if ( ctrl.Tag.ToString() != "")
|
|
{
|
|
//Èç¹ûÊǽô¼±Í£³µ°´Å¥µÄʱºò
|
|
if ( !ctrl.Tag.ToString().Contains("."))
|
|
{
|
|
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Name.ToString().Substring(ctrl.Name.Length - 5 ,5)));
|
|
if (device.DeviceKind == 40)
|
|
{
|
|
//È¡¶Ñ¶â»ú״̬À´ÏÔʾÑÕÉ«
|
|
device = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag));
|
|
if (device == null)
|
|
{
|
|
//ÅжÏÉ豸ÔÚÊý¾Ý¿â±íÖд岻´æÔÚ
|
|
if (tsStatus.Text.IndexOf(ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý:" + ctrl.Name.ToString().Substring(ctrl.Name.Length - 5, 5) + "ÔÚÊý¾Ý¿âÎÞ¸ÃÉ豸") == -1)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += ctrl.Name + "¿Ø¼þ¶ÔÓ¦µÄÉ豸Ë÷Òý£º" + ctrl.Name.ToString().Substring(ctrl.Name.Length - 5, 5) + "ÔÚÊý¾ÝÎÞ¸ÃÉ豸";
|
|
}
|
|
continue;
|
|
}
|
|
DataView dwRunDevice = dbo.ExceSQL("select F_DeviceIndex from T_Base_Device where F_DeviceKindIndex = 1 or F_DeviceKindIndex = 4").Tables[0].DefaultView;
|
|
for (int i = 0; i < dwRunDevice.Count; i++)
|
|
{
|
|
if (ctrl.Tag.ToString() == dwRunDevice[i]["F_DeviceIndex"].ToString())
|
|
{
|
|
Model.MDevice deviceRun = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(ctrl.Tag.ToString()));
|
|
|
|
if(deviceRun.SplitByte_6 == 1)
|
|
{
|
|
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop0;
|
|
}
|
|
if (deviceRun.SplitByte_6 == 0)
|
|
{
|
|
ctrl.Image = wcfControlMonitorClient.Properties.Resources.stop1;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{//20100108
|
|
if (tsStatus.Text.IndexOf("ˢнçÃæ¶¯»Ê±£º" + ex.Message) < 0)
|
|
{
|
|
tsStatus.ForeColor = Color.Red;
|
|
this.tsStatus.Text += "ˢнçÃæ¶¯»Ê±£º" + ex.Message;
|
|
}
|
|
}
|
|
finally
|
|
{//20100108
|
|
TimeSpan ts1 = DateTime.Now.TimeOfDay;
|
|
device = null;
|
|
this.ResumeLayout();//richard.liu20140806
|
|
}
|
|
}
|
|
private void ctrl_Click(object sender, EventArgs e)
|
|
{
|
|
Button btn = (Button)sender;
|
|
_deviceStatus.DeviceIndex = Convert.ToInt32(btn.Tag);
|
|
_deviceStatus.ShowDialog();
|
|
}
|
|
|
|
private void Btn_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
int deviceindex;
|
|
string[] DS; char[] dd = new char[1] { '.' };
|
|
string msg = (sender as Control).Tag.ToString();
|
|
string name = (sender as Control).Name.ToString();
|
|
|
|
DS = msg.Split(dd);
|
|
if (DS.Length > 0)
|
|
{
|
|
if (int.TryParse(DS[0], out deviceindex))
|
|
{
|
|
devinfo = Model.CGetInfo.GetDeviceInfo(deviceindex);
|
|
|
|
if (devinfo != null)
|
|
{
|
|
//msg = string.Format("{0},λÖÃX,Y:({1},{2})", devinfo.DeviceName, (sender as Control).Location.X,(sender as Control).Location.Y+83);
|
|
|
|
|
|
//add for CATL YB2 °²È«ÃÅ´ò¿ªÉϱ¨¿ª¹Ø.6
|
|
msg = string.Format("{0}", devinfo.DeviceName);
|
|
if (DS.Length > 1)
|
|
{
|
|
if (DS[1] == "6")
|
|
{
|
|
msg = "°²È«ÃÅ´ò¿ª";
|
|
}
|
|
}
|
|
//msg = string.Format("{0}", devinfo.DeviceName);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
if (name.IndexOf("lift") > 0)
|
|
{
|
|
msg = "ÇëÁ¢¼´°áÀëÍÐÅÌ!";
|
|
}
|
|
|
|
toolTip_DeviceIndex.SetToolTip(sender as Control, msg);
|
|
}
|
|
private void ctrl_ClickLabel(object sender, EventArgs e)
|
|
{
|
|
Label label = (Label)sender;
|
|
_deviceStatus.DeviceIndex = Convert.ToInt32(label.Tag);
|
|
_deviceStatus.ShowDialog();
|
|
}
|
|
/// <summary>
|
|
/// ¹ö¶¯·½·¨
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
void FormSample_MouseWheel(object sender, MouseEventArgs e)
|
|
{
|
|
////»ñÈ¡¹â±êλÖÃ
|
|
//Point mousePoint = new Point(e.X, e.Y);
|
|
////»»Ëã³ÉÏà¶Ô±¾´°ÌåµÄλÖÃ
|
|
//mousePoint.Offset(this.Location.X, this.Location.Y);
|
|
////ÅжÏÊÇ·ñÔÚpanelÄÚ
|
|
//if (panelWareHouse.RectangleToScreen(panelWareHouse.DisplayRectangle).Contains(mousePoint))
|
|
//{
|
|
// //¹ö¶¯
|
|
// panelWareHouse.AutoScrollPosition = new Point(0, panelWareHouse.VerticalScroll.Value - e.Delta);
|
|
//}
|
|
}
|
|
private void FrmControlMonitor_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//this.panelWareHouse.MouseWheel += new MouseEventHandler(FormSample_MouseWheel);
|
|
//this.panelWareHouse.Focus();
|
|
#region Ìí¼ÓÊäËÍ»ú¡¢´©Ë󳵺ͶѶâ»úµÄµ¥»÷ʼþ
|
|
|
|
|
|
//foreach (Control ctrl in this.plAccessorial1.Controls)
|
|
//{
|
|
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_Click);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.BackColor == Color.LightSteelBlue))
|
|
// //{
|
|
// // ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// //}
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
|
|
// {
|
|
// //ctrl.Click += new EventHandler(ctrl_ClickPic);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
|
|
//}
|
|
//foreach (Control ctrl in this.panelWareHouse.Controls)
|
|
//{
|
|
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_Click);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Blue))
|
|
// //{
|
|
// // ctrl.Visible = true;
|
|
// // ctrl.Visible = false;
|
|
// //}
|
|
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.BackColor == Color.LightSteelBlue))
|
|
// //{
|
|
// // ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// //}
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
|
|
// {
|
|
// //ctrl.Click += new EventHandler(ctrl_ClickPic);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
|
|
//}
|
|
//foreach (Control ctrl in this.InOutAreaPanel.Controls)
|
|
//{
|
|
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_Click);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
|
|
// {
|
|
// ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Blue))
|
|
// //{
|
|
// // ctrl.Visible = true;
|
|
// // ctrl.Visible = false;
|
|
// //}
|
|
// //if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.BackColor == Color.LightSteelBlue))
|
|
// //{
|
|
// // ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// //}
|
|
// if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
|
|
// {
|
|
// //ctrl.Click += new EventHandler(ctrl_ClickPic);
|
|
// ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
// }
|
|
|
|
//}
|
|
#endregion
|
|
//¼±Í£Ê¼þ shk
|
|
|
|
foreach (TabPage tabPage in tabControl1.TabPages)
|
|
{
|
|
if (tabPage.Tag.ToString() == CStaticClass.UserArea || CStaticClass.UserArea == "")
|
|
{
|
|
foreach (Control ctrls in tabPage.Controls)
|
|
{
|
|
if (ctrls.GetType().ToString() == "System.Windows.Forms.Panel")
|
|
{
|
|
foreach (Control ctrl in ctrls.Controls)
|
|
{
|
|
|
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Button") && (ctrl.Tag != null))
|
|
{
|
|
ctrl.Click += new EventHandler(ctrl_Click);
|
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
}
|
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.Label") && (ctrl.Tag != null) && (ctrl.ForeColor == Color.Red))
|
|
{
|
|
ctrl.Click += new EventHandler(ctrl_ClickLabel);
|
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
}
|
|
|
|
//½ô¼±Í£³µ°´Å¥
|
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
|
|
{
|
|
if (!ctrl.Tag.ToString().Contains("."))
|
|
{
|
|
ctrl.Click += new EventHandler(ctrl_Click_1);
|
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter_Stop);
|
|
//pic30004.Visible = false;
|
|
// sto30004.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter );
|
|
}
|
|
}
|
|
|
|
|
|
if ((ctrl.GetType().ToString() == "System.Windows.Forms.PictureBox") && (ctrl.Tag != null) && (ctrl.Enabled == true))
|
|
{
|
|
//ctrl.Click += new EventHandler(ctrl_ClickPic);
|
|
ctrl.MouseEnter += new EventHandler(Btn_MouseEnter);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tabPage.Parent = null;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw (ex);
|
|
}
|
|
}
|
|
|
|
private void tsStatus_ForeColorChanged(object sender, EventArgs e)
|
|
{
|
|
FrmErrorMessage.FormInstance.NewForeColor((sender as TextBox).ForeColor);
|
|
}
|
|
|
|
private void tsStatus_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//throw new System.Exception("The method or operation is not implemented.");
|
|
string msg = (sender as TextBox).Text;
|
|
if (msg != "")
|
|
{
|
|
//msg = string.Format("{0}\r\n", msg);
|
|
//msg=msg+"\r\n";
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("Error", msg, "", "", "");
|
|
FrmErrorMessage.FormInstance.NewMessage(msg);
|
|
}
|
|
|
|
}
|
|
|
|
private void tabPage1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
string enddevices, startsdevices, strinfo = string.Empty;//²ð¶âÈÎÎñÖÕµã
|
|
string sqlstr = string.Empty;
|
|
DataView dvdv = new DataView();
|
|
int EndDevice =12018;
|
|
sqlstr = string.Format("select * from T_Base_TaskCount where F_DeviceIndex={0}", EndDevice);//²éÕÒÖÕµãÉ豸¶ÔÓ¦µÄ³ö¿âÈÎÎñ»ñÈ¡ÊýÁ¿ºÍÖ´ÐÐÊýÁ¿
|
|
|
|
dvdv = dbo.ExceSQL(sqlstr).Tables[0].DefaultView;
|
|
if (dvdv.Count > 0)
|
|
{
|
|
int getcount, execount;
|
|
getcount = Convert.ToInt32(dvdv[0]["F_MAXCOUNT"]);
|
|
execount = Convert.ToInt32(dvdv[0]["F_EXECOUNT"]);
|
|
//checkdevice = Convert.ToInt32(dvdv[0]["F_CHECKDEVICE"]);//
|
|
enddevices = Convert.ToString(dvdv[0]["F_CHECKENDDEVICE"]);//ÒªÅжÁÊÇ·ñ´æÔÚ¸ÃÖÕµãµÄÉ豸
|
|
startsdevices = Convert.ToString(dvdv[0]["F_CHECKSTARTDEVICE"]);//ÒªÅжÏÊÇ·ñ´æÔÚ¸ÃÆðµãµÄÉ豸
|
|
|
|
|
|
if (startsdevices != "0" || enddevices != "0")//±íʾͬʱִÐÐʱ
|
|
{
|
|
sqlstr = string.Format("SELECT FID,F_ManageTaskKindIndex FROM T_Manage_Task WHERE (FSTARTDEVICE in({0})) OR (FENDDEVICE in({1}))", startsdevices, enddevices);
|
|
|
|
dvdv = dbo.ExceSQL(sqlstr).Tables[0].DefaultView;
|
|
|
|
if (dvdv.Count > 0)//´æÔÚÏ໥¸ÉÈŵijöÈë¿âÈÎÎñʱ£¬°´³ö¿âÊýÁ¿ÏÞÖÆ
|
|
{
|
|
// outcount = execount;
|
|
}
|
|
else//Ö»´æÔÚµ±Ç°ÖÕµãµÄÈÎÎñʱ£¬°´»ñÈ¡ÊýÁ¿ÏÞÖÆ£¬Ò»°ãÇé¿ö »ñÈ¡ÊýÁ¿Òª´óÓÚÖ´ÐÐÊýÁ¿
|
|
{
|
|
//outcount = getcount;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button6_Click_1(object sender, EventArgs e)
|
|
{
|
|
|
|
bool a = GetTransDeviceIfFull("11003;11004;11005");
|
|
}
|
|
public bool GetTransDeviceIfFull(string Devices)
|
|
{
|
|
try
|
|
{
|
|
char[] cc = new char[1] { ';' };
|
|
string[] sp;
|
|
sp = Devices.Split(cc);
|
|
int count = sp.Length;//É豸ÊýÁ¿
|
|
int goodscount = 0;//»õÎïÊýÁ¿
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
int deviceindex = Convert.ToInt32(sp[i]);
|
|
devinfo = Model.CGetInfo.GetDeviceInfo(deviceindex);
|
|
if (devinfo != null)
|
|
{
|
|
goodscount += devinfo.SplitByte_0;
|
|
goodscount += devinfo.SplitByte_1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (goodscount >= count)
|
|
{
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//private void tabControl1_TabIndexChanged(object sender, EventArgs e)
|
|
//{
|
|
|
|
//}
|
|
|
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
int index = ((TabControl)sender).SelectedIndex;
|
|
if (index == 1)
|
|
{
|
|
//button242.Focus();
|
|
}
|
|
}
|
|
|
|
private void button134_Click(object sender, EventArgs e)
|
|
{
|
|
//textBox85.Visible = true;
|
|
}
|
|
|
|
private void button161_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button20_Click(object sender, EventArgs e)
|
|
{
|
|
//textBox44.Visible = !textBox44.Visible;
|
|
}
|
|
|
|
private void button24_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void plAccessorial1_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void textBox6_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button8_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void textBox17_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
//¼±Í£°´Å¥
|
|
private void ctrl_Click_1(object sender, EventArgs e)
|
|
{
|
|
PictureBox px = (PictureBox)sender;
|
|
int DeviceIndexForRunButton = Convert.ToInt32(px.Name.ToString().Substring(px.Name.Length - 5,5));
|
|
Model.MDevice deviceRun = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(px.Tag.ToString()));
|
|
int iValue = 0;
|
|
iValue = deviceRun.SplitByte_6 == 1 ? 0 : 1;
|
|
CStaticClass.WcfControl.BeginSendDeviceReset(DeviceIndexForRunButton, iValue, new AsyncCallback(SendDeviceResetCallBack), iValue);
|
|
}
|
|
//¼±Í£°´Å¥³ÌÐò
|
|
void SendDeviceResetCallBack(IAsyncResult ar)
|
|
{
|
|
string errtext = string.Empty;
|
|
if (CStaticClass.WcfControl.EndSendDeviceReset(out errtext,ar) == false)
|
|
{
|
|
MessageBox.Show(errtext,"²Ù×÷Ìáʾ",MessageBoxButtons.OK,MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
//¼±Í£ÏÔʾ ÓÃÓÚ½ô¼±¼±Í£°´Å¥Êó±ê·ÅÉÏÈ¥ÏÔʾÉ豸ÐÅÏ¢
|
|
private void Btn_MouseEnter_Stop(object sender, EventArgs e)
|
|
{
|
|
string deviceindex = (sender as Control).Tag.ToString();
|
|
devinfo = Model.CGetInfo.GetDeviceInfo(Convert.ToInt32(deviceindex));
|
|
if (devinfo != null)
|
|
{
|
|
if (devinfo.SplitByte_6 == 1)//δͣ³µ
|
|
{
|
|
deviceindex = string.Format("{0}-δÁª»úÍ£³µ",devinfo.DeviceIndex);
|
|
|
|
}
|
|
if (devinfo.SplitByte_6 == 0)//Í£³µ
|
|
{
|
|
deviceindex = string.Format("{0}-Áª»úÍ£³µ",devinfo.DeviceIndex);
|
|
}
|
|
}
|
|
toolTip_DeviceIndex.SetToolTip(sender as Control,deviceindex);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|