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 { /// /// Creator:Richard.liu /// 调度程序主窗口 /// 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 { #region 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 stackcp1 = bt111011; Button stackcp2 = bt111021; Button stackcp3 = bt21101; Button stackcp4 = bt14401; Button stackcp5 = bt14402; //Button stackcp9 = bt11009; //Button stackcp10 = bt11010; //Button stackcp11 = bt11011; //Button stackcp12 = bt11012; // 成品堆垛机载物 TextBox twcp11 = t111011;//t111011; TextBox twcp12 = t111021;//t111021; TextBox twcp13 = t211011;// t211011; TextBox twcp31 = t111013; TextBox twcp32 = t111023; TextBox twcp33 = t211013; TextBox twcp4 = t14401; //TextBox twcp5 = t14402; int smallbarcode = 0; int bigbarcode = 0; int stackInitX = 0; double StackcpInitXX = 0; Panel pp = plAccessorial1; double startXadd = 0;//第一列图上坐标 double startDadd = 0;//第一列图上坐标 double kcpX = 0;//图上货架长度/ double kcpD = 0;//图上货架长度/ double startcode2 = 0;//第一列对应的实际坐标 kcpX = (double)(pictureBox22.Size.Width) / 38;//图上货架长度/ kcpD = (double)(pictureBox2.Size.Height) / 10;//图上货架长度/ startXadd = button65.Location.X; startDadd = pictureBox2.Location.Y; if (this.tabControl1.SelectedTab.Name == "tabPage1")// 1楼 { pp = plAccessorial1; } else if (this.tabControl1.SelectedTab.Name == "tabPage2") { pp = plAccessorial2; stackcp3 = btn211012; t211011 = t211012; } else if (this.tabControl1.SelectedTab.Name == "tabPage3") { pp = plAccessorial3; stackcp1 = bt111013; stackcp2 = bt111023; //t111011 = t111013; //t111021 = t111023; //stackcp3 = bt211013; //t211011 = t211013; } #region 每层楼监视画面 #region 设备状态动画 foreach (Button ctrl in pp.Controls.OfType