123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using WCS_Client.From.From_Montior;
- namespace WCS_Client.From
- {
- public partial class Form_Monitior : Form
- {
- #region
- System.Timers.Timer _timer;
- private delegate void ShowTextDelegate(List<WCS_STACKERDATA> ds);// 创建委托和委托对象
- #endregion;
- public Form_Monitior()
- {
- InitializeComponent();
- InitOne();
- InitTwo();
- }
- private static Form_Monitior childFromInstanc;
- public static Form_Monitior ChildFromInstanc
- {
- get
- {
- if (childFromInstanc == null || childFromInstanc.IsDisposed)
- {
- childFromInstanc = new Form_Monitior();
- }
- return childFromInstanc;
- }
- }
- private void InitOne()
- {
- conveyor_1021.button1.Text = "1021";
- conveyor_1022.button1.Text = "1022";
- conveyor_1038.button1.Text = "1038";
- conveyor_1040.button1.Text = "1040";
- conveyor_1039.button1.Text = "1039";
- conveyor_1037.button1.Text = "1037";
- conveyor_1036.button1.Text = "1036";
- conveyor3_1027.button1.Text = "1027";
- conveyor_1029.button1.Text = "1029";
- conveyor_1019.button1.Text = "1019";
- conveyor_1046.button1.Text = "1046";
- conveyor_1018.button1.Text = "1018";
- conveyor_1048.button1.Text = "1048";
- conveyor_1017.button1.Text = "1017";
- conveyor_1030.button1.Text = "1030";
- conveyor_1031.button1.Text = "1031";
- conveyor_1015.button1.Text = "1015";
- conveyor_1033.button1.Text = "1033";
- conveyor_1013.button1.Text = "1013";
- conveyor_1012.button1.Text = "1012";
- conveyor_1011.button1.Text = "1011";
- conveyor_1032.button1.Text = "1032";
- conveyor_1035.button1.Text = "1035";
- rgv01.btn02.Text = "1024";
- rgv01.btn01.Text = "1023";
- rgv02.btn02.Text = "1008";
- rgv02.btn01.Text = "1007";
- rgv03.btn02.Text = "1057";
- rgv03.btn01.Text = "1056";
- conveyor_1041.button1.Text = "1041";
- conveyor_1044.button1.Text = "1044";
- conveyor_1118.button1.Text = "1118";
- conveyor_1116.button1.Text = "1116";
- conveyor_1115.button1.Text = "1115";
- conveyor_1112.button1.Text = "1112";
- conveyor_1111.button1.Text = "1111";
- conveyor_1110.button1.Text = "1110";
- conveyor_1138.button1.Text = "1138";
- conveyor_1139.button1.Text = "1139";
- conveyor_1001.button1.Text = "1001";
- conveyor_1002.button1.Text = "1002";
- conveyor_1003.button1.Text = "1003";
- conveyor_1004.button1.Text = "1004";
- conveyor_1005.button1.Text = "1005";
- conveyor_1006.button1.Text = "1006";
- conveyor_1050.button1.Text = "1050";
- conveyor_1051.button1.Text = "1051";
- conveyor_1052.button1.Text = "1052";
- conveyor_1053.button1.Text = "1053";
- conveyor_1054.button1.Text = "1054";
- conveyor_1055.button1.Text = "1055";
- conveyor_1061.button1.Text = "1061";
- conveyor_1062.button1.Text = "1062";
- conveyor_1063.button1.Text = "1063";
- conveyor_1064.button1.Text = "1064";
- conveyor_1065.button1.Text = "1065";
- conveyor_1066.button1.Text = "1066";
- conveyor_1067.button1.Text = "1067";
- conveyor_1068.button1.Text = "1068";
- conveyor_1069.button1.Text = "1069";
- conveyor_1070.button1.Text = "1070";
- conveyor_1071.button1.Text = "1071";
- conveyor_1072.button1.Text = "1072";
- }
- private void InitTwo()
- {
- conveyor_1080.button1.Text = "1080";
- conveyor_1081.button1.Text = "1081";
- conveyor_1082.button1.Text = "1082";
- conveyor_1083.button1.Text = "1083";
- conveyor_1084.button1.Text = "1084";
- conveyor_1085.button1.Text = "1085";
- rgv04.btn02.Text = "1087";
- rgv04.btn01.Text = "1086";
- conveyor_1090.button1.Text = "1090";
- conveyor_1091.button1.Text = "1091";
- conveyor_1092.button1.Text = "1092";
- conveyor_1093.button1.Text = "1093";
- conveyor_1094.button1.Text = "1094";
- conveyor_1095.button1.Text = "1095";
- conveyor_1096.button1.Text = "1096";
- conveyor_1097.button1.Text = "1097";
- conveyor_1098.button1.Text = "1098";
- conveyor_1099.button1.Text = "1099";
- conveyor_1100.button1.Text = "1100";
- conveyor_1101.button1.Text = "1101";
- conveyor_1102.button1.Text = "1102";
- conveyor_1103.button1.Text = "1103";
- conveyor_1116.button1.Text = "1116";
- conveyor_1120.button1.Text = "1120";
- conveyor_1121.button1.Text = "1121";
- conveyor_1123.button1.Text = "1123";
- conveyor_1124.button1.Text = "1124";
- conveyor_1126.button1.Text = "1126";
- conveyor_1127.button1.Text = "1127";
- conveyor_1128.button1.Text = "1128";
- conveyor_1130.button1.Text = "1130";
- conveyor_1129.button1.Text = "1129";
- conveyor_1132.button1.Text = "1132";
- conveyor_1133.button1.Text = "1133";
- conveyor_1134.button1.Text = "1134";
- conveyor_1136.button1.Text = "1136";
- conveyor_1137.button1.Text = "1137";
- conveyor_1112.button1.Text = "1114";
- conveyor2_1114.button1.Text = "1114";
- conveyor2_1116.button1.Text = "1116";
- }
- private void myTableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
- {
- #region RGV01轨道边框
- if (e.Row == 2 && e.Column == 9)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- if (e.Row == 3 && e.Column >= 9 && e.Column <= 19)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- if (e.Row == 2 && e.Column >= 9 && e.Column <= 19)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- //if (e.Row == 2 && e.Column == 17)
- //{
- // float x = e.CellBounds.Location.X;
- // float x2 = e.CellBounds.Right;
- // float y = e.CellBounds.Location.Y;
- // float y2 = e.CellBounds.Bottom;
- // e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- //}
- //e.Graphics.DrawRectangle(new Pen(Color.Blue), e.CellBounds);
- #endregion;
- #region RGV02轨道边框
- if (e.Row == 3 && e.Column == 24)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- if (e.Row >= 3 && e.Row <= 18 && e.Column == 24)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row >= 3 && e.Row <= 18 && e.Column == 25)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row == 19 && e.Column == 24)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- #endregion;
- #region RGV03轨道边框
- if (e.Row == 5 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- if (e.Row >= 5 && e.Row <= 19 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row >= 5 && e.Row <= 19 && e.Column == 3)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row == 20 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- #endregion;
- }
- private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
- {
- #region RGV03轨道边框
- if (e.Row == 4 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- if (e.Row >= 4 && e.Row <= 18 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row >= 4 && e.Row <= 18 && e.Column == 3)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x, y2);//竖线
- }
- if (e.Row == 19 && e.Column == 2)
- {
- float x = e.CellBounds.Location.X;
- float x2 = e.CellBounds.Right;
- float y = e.CellBounds.Location.Y;
- float y2 = e.CellBounds.Bottom;
- e.Graphics.DrawLine(new Pen(Color.Blue), x, y, x2, y);//横线
- }
- #endregion;
- }
- private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
- {
- //设置笔刷
- //SolidBrush a = new SolidBrush(Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(144)))), ((int)(((byte)(154))))));
- //SolidBrush blue = new SolidBrush(Color.Blue);
- //StringFormat sf = new StringFormat();
- //sf.Alignment = StringAlignment.Center;
- //sf.LineAlignment = StringAlignment.Center;
-
- //for (int i = 0; i < tabControl1.TabPages.Count; i++)
- //{
- // //绘制背景
- // Rectangle rec1 = tabControl1.GetTabRect(i);
- // e.Graphics.FillRectangle(a, rec1);
- // Rectangle rec = tabControl1.GetTabRect(i);
- // e.Graphics.DrawString(tabControl1.TabPages[i].Text, new Font("宋体", 10), blue, rec, sf);
- //}
- }
- private void Form_Monitior_Load(object sender, EventArgs e)
- {
- _timer = new System.Timers.Timer(5000);
- _timer.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
- _timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
- _timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
- }
- private void theout(object sender, EventArgs e)
- {
- var plcnameSet = new List<string>();
- plcnameSet.Add("conveyor01");
- plcnameSet.Add("conveyor02");
- plcnameSet.Add("srm01");
- plcnameSet.Add("srm02");
- plcnameSet.Add("srm03");
- plcnameSet.Add("rgv01");
- plcnameSet.Add("rgv02");
- plcnameSet.Add("rgv03");
- plcnameSet.Add("rgv04");
- // var list = BaseWorkflow.QueryStackerdData(plcnameSet);
- //ShowData(list);
- }
- private void ShowData(object Dat)
- {
- try
- {
- if (InvokeRequired)
- {
- //List<WCS_STACKERDATA> data = (List<WCS_STACKERDATA>)Dat;//传过来的数据
- object[] obj = { Dat };
- //异步调用委托(后面添加方法需要将方法委托其中)
- this.BeginInvoke(new ShowTextDelegate(pan11), obj);
- //this.BeginInvoke(new ShowTextDelegate(pan10), obj);
- }
- else
- {
- }
- }
- catch (Exception ex)
- {
- LogHelper.Sys_Log.WriteLog(ex.ToString());
- }
- }
- public void pan11(List<WCS_STACKERDATA> dt)
- {
- try
- {
- var conveyorSet = dt.Where(v => v.STA_TYPE == "conveyor").ToList();
- var conveyor1 = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == "1032");
- SetConveyor_R(conveyor_1032, conveyor1);
- var conveyor2 = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == "1035");
- SetConveyor_R(conveyor_1035, conveyor2);
- Control.ControlCollection sonControls = this.Controls;
- var conveyors = sonControls[0].Controls[0].Controls[0];
- //遍历窗体所有控件,
- foreach (Control control in conveyors.Controls)
- {
- var equipmentno = control.Name.Substring(control.Name.Length - 4);
- var conveyor = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == equipmentno);
- if (conveyor != null)
- {
- if (control is Conveyor3_B)
- {
- SetConveyor3_B(control, conveyor);
- }
- else if (control is Conveyor3)
- {
- SetConveyor3(control, conveyor);
- }
- else if (control is Conveyor_L)
- {
- SetConveyor_L(control, conveyor);
- }
- else if (control is Conveyor_R)
- {
- SetConveyor_R(control, conveyor);
- }
- else if (control is Conveyor)
- {
- SetConveyor(control, conveyor);
- }
- else if (control is Conveyor4_left)
- {
- SetConveyor4_left(control, conveyor);
- }
- else if (control is Conveyor4_right)
- {
- SetConveyor4_right(control, conveyor);
- }
- else if (control is Conveyor4_L_R)
- {
- SetConveyor4_L_R(control, conveyor);
- }
- else if (control is Conveyor5)
- {
- SetConveyor5(control, conveyor);
- }
- else if (control is Conveyor6)
- {
- SetConveyor6(control, conveyor);
- }
- }
- }
- var rgvSet = dt.Where(v => v.STA_TYPE == "rgv").ToList();
- foreach (Control control in conveyors.Controls)
- {
- if (control.Name.Contains("rgv"))
- {
- var rgv = rgvSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
- if (rgv != null)
- {
- if (control is Rgv02)
- {
- SetRgv02(control, rgv);
- }
- else if (control is Rgv)
- {
- SetRgv(control, rgv);
- }
- }
- }
- }
- var srmSet = dt.Where(v => v.STA_TYPE == "srm").ToList();
- foreach (Control control in conveyors.Controls)
- {
- if (control.Name.Contains("srm"))
- {
- var srm = srmSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
- if (srm != null)
- {
- if (control is Srm3)
- {
- SetSrmInfo(srm, control);
- }
- }
- }
- }
- var conveyors2 = sonControls[0].Controls[1].Controls[0];
- foreach (Control control in conveyors2.Controls)
- {
- var equipmentno = control.Name.Substring(control.Name.Length - 4);
- var conveyor = conveyorSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == equipmentno);
- if (conveyor != null)
- {
- if (control is Conveyor)
- {
- SetConveyor(control, conveyor);
- }
- else if (control is Conveyor4_L_R)
- {
- SetConveyor4_L_R(control, conveyor);
- }
- else if (control is Conveyor4_left)
- {
- SetConveyor4_left(control, conveyor);
- }
- else if (control is Conveyor4_right)
- {
- SetConveyor4_right(control, conveyor);
- }
- else if (control is Conveyor5)
- {
- SetConveyor5(control, conveyor);
- }
- else if (control is Conveyor3)
- {
- SetConveyor3(control, conveyor);
- }
- else if (control is Conveyor6)
- {
- SetConveyor6(control, conveyor);
- }
- }
- }
- foreach (Control control in conveyors2.Controls)
- {
- if (control.Name.Contains("rgv"))
- {
- var rgv = rgvSet.FirstOrDefault(v => v.STA_EQUIPMENTNO == control.Name);
- if (rgv != null)
- {
- if (control is Rgv)
- {
- SetRgv(control, rgv);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- LogHelper.Sys_Log.WriteLog(ex.ToString());
- }
- }
- private void SetConveyor_R(Conveyor_R conveyor_R, WCS_STACKERDATA conveyor)
- {
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (conveyor_R.button1.Tag.ToString() != "pall")
- {
- conveyor_R.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");
- conveyor_R.button1.Tag = "pall";
- }
- }
- else
- {
- if (conveyor_R.button1.Tag.ToString() != "empty")
- {
- conveyor_R.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");
- conveyor_R.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && conveyor_R.button1.BackColor != Color.Red)
- {
- conveyor_R.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && conveyor_R.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- conveyor_R.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor3_B(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor3_B)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1009R1_B.png");//1009R1_A.png
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1009R1.png");//1009R1.png
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor3(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor3)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor3.png");//1009R1_A.png
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1004LR.png");//1009R1.png
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor_L(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor_L)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_L.png");//1009L11.png
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1009L11.png");//1009L11.png
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor_R(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor_R)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");//1009L1.png
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");//1009L1.png
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1009LR.png");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor4_left(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor4_left)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_left.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1001L.gif");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor4_right(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor4_right)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_right.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor4_L_R(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor4_L_R)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_L_R.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor5(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor5)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/rgv03.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetConveyor6(Control control, WCS_STACKERDATA conveyor)
- {
- var con = (Conveyor6)control;
- if (conveyor.ConveyorSignalItem.DB521_Tasknum > 0)
- {
- if (con.button1.Tag.ToString() != "pall")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
- con.button1.Tag = "pall";
- }
- }
- else
- {
- if (con.button1.Tag.ToString() != "empty")
- {
- con.button1.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
- con.button1.Tag = "empty";
- }
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault && con.button1.BackColor != Color.Red)
- {
- con.button1.BackColor = Color.Red;
- }
- if (conveyor.ConveyorSignalItem.DB523_Fault == false && con.button1.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private void SetRgv02(Control control, WCS_STACKERDATA rgv)
- {
- var con = (Rgv02)control;
- if (con.Name == "rgv01")
- {
- //var tablecelllabel1 = new TableCellLabel2();
- //tablecelllabel1.Dock = DockStyle.Fill;
- //tablecelllabel1.Name = "tableCellLabel23";
- //var tablecelllabel2 = new TableCellLabel2();
- //tablecelllabel2.Dock = DockStyle.Fill;
- //tablecelllabel2.Name = "tableCellLabel27";
- //int column = myTableLayoutPanel1.GetColumn(con);
- //int rgvposCout = 18;
- ////int rgvrunpos = 18;
- //int rgvrunpos = GetRgv01Pos(rgv.RGVSignalItem.DB522_Position_1, 8, 220000, 11, true);
- //if (column != rgvrunpos)
- //{
- // myTableLayoutPanel1.Controls.Remove(con);
- // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel23", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel27", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // myTableLayoutPanel1.Controls.Add(con, rgvrunpos, 2);
- // if (rgvrunpos == 9)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, rgvrunpos + 2, 2);
- // myTableLayoutPanel1.SetColumnSpan(tablecelllabel2, rgvposCout - rgvrunpos);
- // }
- // else if (rgvrunpos == 18)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 9, 2);
- // myTableLayoutPanel1.SetColumnSpan(tablecelllabel1, rgvrunpos - 9);
- // }
- // else
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, rgvrunpos + 2, 2);
- // myTableLayoutPanel1.SetColumnSpan(tablecelllabel2, rgvposCout - rgvrunpos);
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 9, 2);
- // myTableLayoutPanel1.SetColumnSpan(tablecelllabel1, rgvrunpos - 9);
- // }
- //}
- if (rgv.RGVSignalItem.DB522_PH_Status_1)
- {
- if (con.btn01.Tag.ToString() != "pall")
- {
- con.btn01.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
- con.btn01.Tag = "pall";
- }
- }
- else
- {
- if (con.btn01.Tag.ToString() != "empty")
- {
- con.btn01.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
- con.btn01.Tag = "empty";
- }
- }
- if (rgv.RGVSignalItem.DB522_PH_Status_2)
- {
- if (con.btn02.Tag.ToString() != "pall")
- {
- con.btn02.BackgroundImage = Image.FromFile("Resources/Rgv02.png");
- con.btn02.Tag = "pall";
- }
- }
- else
- {
- if (con.btn02.Tag.ToString() != "empty")
- {
- con.btn02.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
- con.btn02.Tag = "empty";
- }
- }
- if (rgv.RGVSignalItem.DB522_Fault_1 && con.btn01.BackColor != Color.Red)
- {
- con.btn01.BackColor = Color.Red;
- }
- if (rgv.RGVSignalItem.DB522_Fault_2 == false && con.btn02.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.btn02.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- }
- private void SetRgv(Control control, WCS_STACKERDATA rgv)
- {
- var con = (Rgv)control;
- if (con.Name == "rgv02")
- {
- //var tablecelllabel1 = new TableCellLabel();
- //tablecelllabel1.Dock = DockStyle.Fill;
- //tablecelllabel1.Name = "tableCellLabel1";
- //var tablecelllabel2 = new TableCellLabel();
- //tablecelllabel2.Dock = DockStyle.Fill;
- //tablecelllabel2.Name = "tableCellLabel12";
- //int column = myTableLayoutPanel1.GetRow(con);
- //int rgvposCout = 19;
- //////int rgvrunpos = 16;
- //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1;
- //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 3, 490000, 16, false);
- ////rgvrunpos = 3;//起点
- ////rgvrunpos = 17;//终点
- //if (column != rgvrunpos)
- //{
- // myTableLayoutPanel1.Controls.Remove(con);
- // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel1", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel12", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // myTableLayoutPanel1.Controls.Add(con, 24, rgvrunpos);
- // if (rgvrunpos == 3)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 24, rgvrunpos + 2);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- // else if (rgvrunpos == 17)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 24, 3);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 3);
- // }
- // else
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 24, 3);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 3);
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 24, rgvrunpos + 2);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- //}
- SetRgvInfo(rgv, con);
- }
- else if (con.Name == "rgv03")
- {
- //var tablecelllabel1 = new TableCellLabel();
- //tablecelllabel1.Dock = DockStyle.Fill;
- //tablecelllabel1.Name = "tableCellLabel15";
- //var tablecelllabel2 = new TableCellLabel();
- //tablecelllabel2.Dock = DockStyle.Fill;
- //tablecelllabel2.Name = "tableCellLabel18";
- //int column = myTableLayoutPanel1.GetRow(con);
- //int rgvposCout = 20;
- //////int rgvrunpos = 18;
- //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1 + 300;
- //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 4, 240300, 15, true);
- //if (column != rgvrunpos)
- //{
- // myTableLayoutPanel1.Controls.Remove(con);
- // var tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel15", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // tablecelllabelSet = myTableLayoutPanel1.Controls.Find("tableCellLabel18", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // myTableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // myTableLayoutPanel1.Controls.Add(con, 2, rgvrunpos);
- // if (rgvrunpos == 5)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- // else if (rgvrunpos == 18)
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 5);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 5);
- // }
- // else
- // {
- // myTableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 5);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 5);
- // myTableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
- // myTableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- //}
- SetRgvInfo(rgv, con);
- }
- else if (con.Name == "rgv04")
- {
- //var tablecelllabel1 = new TableCellLabel();
- //tablecelllabel1.Dock = DockStyle.Fill;
- //tablecelllabel1.Name = "tableCellLabel16";
- //var tablecelllabel2 = new TableCellLabel();
- //tablecelllabel2.Dock = DockStyle.Fill;
- //tablecelllabel2.Name = "tableCellLabel41";
- //int column = tableLayoutPanel1.GetRow(con);
- //int rgvposCout = 19;
- //////int rgvrunpos = 18;
- //int rgvpositon_1 = rgv.RGVSignalItem.DB522_Position_1 + 8000;
- //int rgvrunpos = GetRgv01Pos(rgvpositon_1, 3, 238000, 15, false);
- ////rgvrunpos = 4;//起点
- ////rgvrunpos = 17;//终点
- //if (column != rgvrunpos)
- //{
- // tableLayoutPanel1.Controls.Remove(con);
- // var tablecelllabelSet = tableLayoutPanel1.Controls.Find("tableCellLabel16", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // tableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // tablecelllabelSet = tableLayoutPanel1.Controls.Find("tableCellLabel41", false).ToList();
- // if (tablecelllabelSet.Count > 0)
- // {
- // tableLayoutPanel1.Controls.Remove(tablecelllabelSet[0]);
- // }
- // tableLayoutPanel1.Controls.Add(con, 2, rgvrunpos);
- // if (rgvrunpos == 4)
- // {
- // tableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
- // tableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- // else if (rgvrunpos == 17)
- // {
- // tableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 4);
- // tableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 4);
- // }
- // else
- // {
- // tableLayoutPanel1.Controls.Add(tablecelllabel1, 2, 4);
- // tableLayoutPanel1.SetRowSpan(tablecelllabel1, rgvrunpos - 4);
- // tableLayoutPanel1.Controls.Add(tablecelllabel2, 2, rgvrunpos + 2);
- // tableLayoutPanel1.SetRowSpan(tablecelllabel2, rgvposCout - rgvrunpos - 2);
- // }
- //}
- SetRgvInfo(rgv, con);
- }
- }
- private static void SetRgvInfo(WCS_STACKERDATA rgv, Rgv con)
- {
- if (rgv.RGVSignalItem.DB522_PH_Status_1)
- {
- if (con.btn01.Tag.ToString() != "pall")
- {
- con.btn01.BackgroundImage = Image.FromFile("Resources/rgv03.png");
- con.btn01.Tag = "pall";
- }
- }
- else
- {
- if (con.btn01.Tag.ToString() != "empty")
- {
- con.btn01.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
- con.btn01.Tag = "empty";
- }
- }
- if (rgv.RGVSignalItem.DB522_PH_Status_2)
- {
- if (con.btn02.Tag.ToString() != "pall")
- {
- con.btn02.BackgroundImage = Image.FromFile("Resources/rgv03.png");
- con.btn02.Tag = "pall";
- }
- }
- else
- {
- if (con.btn02.Tag.ToString() != "empty")
- {
- con.btn02.BackgroundImage = Image.FromFile("Resources/shelf16UD1.png");
- con.btn02.Tag = "empty";
- }
- }
- if (rgv.RGVSignalItem.DB522_Fault_1 && con.btn01.BackColor != Color.Red)
- {
- con.btn01.BackColor = Color.Red;
- }
- if (rgv.RGVSignalItem.DB522_Fault_2 == false && con.btn02.BackColor != Color.FromArgb(0, 144, 154))
- {
- con.btn02.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- private static void SetSrmInfo(WCS_STACKERDATA srm, Control con)
- {
- var srmitem = (Srm3)con;
- if (srm.SrmSignalItem.SrmDB541_Alarm && srmitem.BackColor != Color.Red)
- {
- srmitem.button1.BackColor = Color.Red;
- }
- if (srm.SrmSignalItem.SrmDB541_Alarm && srmitem.BackColor != Color.FromArgb(0, 144, 154))
- {
- srmitem.button1.BackColor = Color.FromArgb(0, 144, 154);
- }
- }
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- if (_timer != null)
- {
- _timer.Stop();
- _timer.Dispose();
- }
- System.GC.Collect();
- }
- /// <summary>
- /// 计算RGV要移动的位置
- /// </summary>
- /// <param name="rgvCurPosLength">rgv当前位置长度</param>
- /// <param name="offsets">偏移量</param>
- /// <param name="rgvTracklength">rgv轨道长度</param>
- /// <param name="rgvTrackPosCount">rgv轨道位置总数</param>
- /// <param name="isGetRgvPosBack">是否取AGV反位置</param>
- /// <returns></returns>
- private int GetRgv01Pos(int rgvCurPosLength, int offsets,int rgvTracklength,int rgvTrackPosCount,bool isGetRgvPosBack)
- {
- //取rgv当前位置
- int rgvpos = rgvCurPosLength;
- if (isGetRgvPosBack)
- {
- rgvpos = rgvTracklength - rgvCurPosLength;
- }
- //单个位置长度
- int OnePosLength = rgvTracklength / rgvTrackPosCount;
- int OnePosNum = rgvpos / OnePosLength;
- if ((rgvpos % OnePosLength) > 0)
- {
- if (isGetRgvPosBack==false)
- {
- OnePosNum = OnePosNum + 1;
- }
- }
- if (OnePosNum == 0) OnePosNum++;
- return OnePosNum + offsets;
- }
- }
- }
|