using Opc.Ua;
using OPCClient;
using Snap7;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace wcfControlMonitorClient
{
///
/// Creator:Richard.liu
/// 调度程序主窗口
///
public partial class FrmControlMonitor : WeifenLuo.WinFormsUI.Docking.DockContent
{
StringBuilder sql = new StringBuilder();
Model.MDevice devinfo;
Model.MDevice devinfostop;
FrmDeviceStatus _deviceStatus = new FrmDeviceStatus();
DBFactory.DBOperator dbo = CStaticClass.dbo;
DBFactory.DBOperator dboM = CStaticClass.dboM;
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; }
}
#region 货物探测重写-1 zcy
//第一步和第二步,是为了减少了第三步中的时间
TextBox[] myTextBox = new System.Windows.Forms.TextBox[800]; //海湾输送线500左右,此处定义数组数量要大于输送线数量
int initNum = 0;
#endregion
public FrmControlMonitor()
{
InitializeComponent();
#region 货物探测重写-2 zcy 只定义最基本的属性
for (int i =0; i< myTextBox.Length; i++)
{
myTextBox[i] = new System.Windows.Forms.TextBox();
myTextBox[i].BackColor = System.Drawing.Color.Blue;
myTextBox[i].BorderStyle = System.Windows.Forms.BorderStyle.None;
myTextBox[i].Enabled = false;
myTextBox[i].Multiline = true;
myTextBox[i].Visible = false;
}
#endregion
//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;
}
}
#region 每个项目需要重新填的
double laneStartlocation = 400;
double laneEndlocation = 1160;
int lastCellY = 62; //最大货位列
#endregion
private void timerFlash_Tick(object sender, EventArgs e)
{
string[] DS; char[] dd = new char[1] { '.' };
Model.MDevice device;
DataView dv; DataView dvJY;
this.SuspendLayout(); //richard.liu20140806
try
{
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";
#region 堆垛机绑定
Button stack1 = bStack11;
Button stack2 = bStack12;
Button stack3 = bStack13;
Button stack4 = bStack14;
Button stack5 = bStack15;
Button stack6 = bStack16;
Button stack7 = bStack17;
Button stack8 = bStack18;
Button stack9 = bStack19;
TextBox tw1n = tb11;
TextBox tw2n = tb12;
TextBox tw3n = tb13;
TextBox tw4n = tb14;
TextBox tw5n = tb15;
TextBox tw6n = tb16;
TextBox tw7n = tb17;
TextBox tw8n = tb18;
TextBox tw9n = tb19;
//step 堆垛机之间的距离长度,areastep立库两跨之间的额外长度
int step = 105; int areastep = 65;
Panel pp = plAccessorial1;
if (this.tabControl1.SelectedTab.Name == "tabPage2")
{
pp = plAccessorial2;
stack1 = bStack21;
stack2 = bStack22;
stack3 = bStack23;
stack4 = bStack24;
stack5 = bStack25;
stack6 = bStack26;
stack7 = bStack27;
stack8 = bStack28;
stack9 = bStack29;
tw1n = tb21;
tw2n = tb22;
tw3n = tb23;
tw4n = tb24;
tw5n = tb25;
tw6n = tb26;
tw7n = tb27;
tw8n = tb28;
tw9n = tb29;
laneStartlocation = 423;//第一、二跨的列起点
laneEndlocation = 154;//第一、二跨的列终点
}
else if (this.tabControl1.SelectedTab.Name == "tabPage3")
{
pp = plAccessorial3;
stack1 = bStack31;
stack2 = bStack32;
stack3 = bStack33;
stack4 = bStack34;
stack5 = bStack35;
stack6 = bStack36;
stack7 = bStack37;
stack8 = bStack38;
stack9 = bStack39;
tw1n = tb31;
tw2n = tb32;
tw3n = tb33;
tw4n = tb34;
tw5n = tb35;
tw6n = tb36;
tw7n = tb37;
tw8n = tb38;
tw9n = tb39;
laneStartlocation = 398;//第三、四跨的列起点
laneEndlocation = 398+760;//第三、四跨的列终点
}
#endregion 堆垛机绑定
#region 每层楼监视画面
foreach (Button ctrl in pp.Controls.OfType