using System; 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; } } 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; DataView ds = dbo.ExceSQL("SELECT F_DeviceIndex,F_BindingDevice,F_DeviceName FROM T_Base_PLC_Ask where F_Askkind = 4 ").Tables[0].DefaultView; if (ds.Count > 0) { cbBarCodeReader.ValueMember = "F_BindingDevice"; cbBarCodeReader.DisplayMember = "F_DeviceName"; cbBarCodeReader.DataSource = ds; } } #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"; #region 堆垛机绑定 Button stack1 = bStack1; Button stack2 = bStack1; Button stack3 = bStack1; Button stack4 = bStack1; Button stack5 = bStack1; Button stack6 = bStack1; Button stack7 = bStack1; Button stack8 = bStack1; Button stack9 = bStack1; Button stack10 = bStack1; Button stack11 = bStack1; Button stack12 = bStack1; Button stack13 = bStack1; Button stack14 = bStack1; Button stack15 = bStack1; Button stack16 = bStack1; Button stack17 = bStack1; Button stack18 = bStack1; Button stack19 = bStack1; Button stack20 = bStack1; Button stack21 = bStack1; Button stack22 = bStack1; Button stack23 = bStack1; Button stack24 = bStack1; TextBox tw1n = tb1; TextBox tw2n = tb1; TextBox tw3n = tb1; TextBox tw4n = tb1; TextBox tw5n = tb1; TextBox tw6n = tb1; TextBox tw7n = tb1; TextBox tw8n = tb1; TextBox tw9n = tb1; TextBox tw10n = tb1; TextBox tw11n = tb1; TextBox tw12n = tb1; TextBox tw13n = tb1; TextBox tw14n = tb1; TextBox tw15n = tb1; TextBox tw16n = tb1; TextBox tw17n = tb1; TextBox tw18n = tb1; TextBox tw19n = tb1; TextBox tw20n = tb1; TextBox tw21n = tb1; TextBox tw22n = tb1; TextBox tw23n = tb1; TextBox tw24n = tb1; //step 堆垛机之间的距离长度,areastep立库区域之间的额外长度 int step = 105; int areastep = 65; double startadd = 241;//第1个图上坐标 列起点 Panel pp = plAccessorial1; if (this.tabControl1.SelectedTab.Name == "tabPage2") { pp = plAccessorial2; stack1 = bStack1; stack2 = bStack2; stack3 = bStack3; stack4 = bStack4; stack5 = bStack5; stack6 = bStack6; stack7 = bStack7; stack8 = bStack8; stack9 = bStack9; stack10 = bStack10; stack11 = bStack11; stack12 = bStack12; tw1n = tb1; tw2n = tb2; tw3n = tb3; tw4n = tb4; tw5n = tb5; tw6n = tb6; tw7n = tb7; tw8n = tb8; tw9n = tb9; tw10n = tb10; tw11n = tb11; tw12n = tb12; //areastep = 25; //startadd = 154; startadd = 423; } else if(this.tabControl1.SelectedTab.Name == "tabPage3") { pp = plAccessorial3; stack1 = bStack13; stack2 = bStack14; stack3 = bStack15; stack4 = bStack16; stack5 = bStack17; stack6 = bStack18; stack7 = bStack19; stack8 = bStack20; stack9 = bStack21; stack10 = bStack22; stack11 = bStack23; stack12 = bStack24; tw1n = tb13; tw2n = tb14; tw3n = tb15; tw4n = tb16; tw5n = tb17; tw6n = tb18; tw7n = tb19; tw8n = tb20; tw9n = tb21; tw10n = tb22; tw11n = tb23; tw12n = tb24; //areastep = 80; //startadd = 300; startadd = 570; } #endregion 堆垛机绑定 #region 每层楼监视画面 foreach (Button ctrl in pp.Controls.OfType