Frm_YongGuanMontior.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Threading;
  7. using System.Windows.Forms;
  8. using WCS.Data;
  9. using WCS.Entity.Protocol.Station;
  10. using WCS_Client.From.From_Montior;
  11. namespace WCS_Client.Frm
  12. {
  13. public partial class Frm_YongGuanMontior : Form
  14. {
  15. private System.Timers.Timer _timer;
  16. private delegate void ShowTextDelegate();// 创建委托和委托对象
  17. private List<string> _plcnameSet = new List<string>();
  18. private List<DDJSatatus> DDJSatatusSet = new List<DDJSatatus>();
  19. private List<RGVSatatus> RGVSatatusSet = new List<RGVSatatus>();
  20. public bool isinitfrm = false;
  21. // 防止闪屏
  22. protected override CreateParams CreateParams
  23. {
  24. get
  25. {
  26. CreateParams cp = base.CreateParams;
  27. cp.ExStyle |= 0x02000000;
  28. return cp;
  29. }
  30. }
  31. public Frm_YongGuanMontior()
  32. {
  33. isinitfrm = false;
  34. InitializeComponent();
  35. Init();
  36. }
  37. private void Init()
  38. {
  39. _plcnameSet.Add("SRM1");
  40. _plcnameSet.Add("SRM2");
  41. _plcnameSet.Add("SRM3");
  42. _plcnameSet.Add("SRM4");
  43. _plcnameSet.Add("SRM5");
  44. _plcnameSet.Add("SRM6");
  45. _plcnameSet.Add("SRM7");
  46. _plcnameSet.Add("SRM8");
  47. _plcnameSet.Add("RGV1");
  48. _plcnameSet.Add("RGV2");
  49. _plcnameSet.Add("RGV3");
  50. _plcnameSet.Add("RGV4");
  51. _plcnameSet.Add("RGV5");
  52. _plcnameSet.Add("RGV6");
  53. _plcnameSet.Add("RGV7");
  54. _plcnameSet.Add("RGV8");
  55. _plcnameSet.Add("RGV9");
  56. _plcnameSet.Add("RGV10");
  57. _plcnameSet.Add("RGV11");
  58. _plcnameSet.Add("RGV12");
  59. _plcnameSet.Add("RGV13");
  60. _plcnameSet.Add("RGV14");
  61. _plcnameSet.Add("Conv");
  62. var plcnameSetsrm = _plcnameSet.Where(value => value.Contains("SRM")).ToList();
  63. for (int i = 0; i < plcnameSetsrm.Count; i++)
  64. {
  65. var item = plcnameSetsrm[i];
  66. if (!DDJSatatusSet.Any(v => v.SrmName == item))
  67. {
  68. var ddjsatatus = new DDJSatatus();
  69. ddjsatatus.SrmName = item;
  70. int index = i + 1;
  71. ddjsatatus.G = (PictureBox)FindControl("G" + index);
  72. ddjsatatus.LblInStatus = (Label)FindControl("lblInStatus" + index);
  73. ddjsatatus.LblOutStatus = (Label)FindControl("lblOutStatus" + index);
  74. ddjsatatus.DdjMode = (Label)FindControl("ddjMode" + index);
  75. ddjsatatus.DdjStatus = (Label)FindControl("ddjStatus" + index);
  76. ddjsatatus.DdjOrdId = (Label)FindControl("ddjOrdId" + index);
  77. ddjsatatus.DdjOptType = (Label)FindControl("ddjOptType" + index);
  78. ddjsatatus.DdjPosCurr = (Label)FindControl("ddjPosCurr" + index);
  79. ddjsatatus.DdjWorkTime = (Label)FindControl("ddjWorkTime" + index);
  80. ddjsatatus.DdjTotal_KM = (Label)FindControl("ddjTotal_KM" + index);
  81. ddjsatatus.DdjPosFrom = (Label)FindControl("ddjPosFrom" + index);
  82. ddjsatatus.DdjPosTo = (Label)FindControl("ddjPosTo" + index);
  83. ddjsatatus.DdjWarning = (Label)FindControl("lblDDJWarning" + index);
  84. DDJSatatusSet.Add(ddjsatatus);
  85. }
  86. }
  87. var plcnameSetrgv = _plcnameSet.Where(value => value.Contains("RGV")).ToList();
  88. for (int i = 0; i < plcnameSetrgv.Count; i++)
  89. {
  90. var item = plcnameSetrgv[i];
  91. if (!RGVSatatusSet.Any(v => v.RGVName == item))
  92. {
  93. var rgvsatatus = new RGVSatatus();
  94. rgvsatatus.RGVName = item;
  95. int index;
  96. if (item.Length > 4)
  97. {
  98. index = Convert.ToInt32(item.Substring(3, 2).ToString());
  99. }
  100. else
  101. {
  102. index = Convert.ToInt32(item.Substring(3, 1).ToString());
  103. }
  104. rgvsatatus.G = (PictureBox)FindControl("GV" + index);
  105. rgvsatatus.RGVMode = (Label)FindControl("rgvMode" + index);
  106. rgvsatatus.RGVStatus = (Label)FindControl("rgvStatus" + index);
  107. rgvsatatus.RGVOrdId = (Label)FindControl("rgvOrdId" + index);
  108. rgvsatatus.RGVPosCurr = (Label)FindControl("rgvPosCurr" + index);
  109. rgvsatatus.RGVPosFrom = (Label)FindControl("rgvPosFrom" + index);
  110. rgvsatatus.RGVPosTo = (Label)FindControl("rgvPosTo" + index);
  111. rgvsatatus.RGVOptType = (Label)FindControl("rgvOptType" + index);
  112. RGVSatatusSet.Add(rgvsatatus);
  113. }
  114. }
  115. }
  116. private Control FindControl(string controlName)
  117. {
  118. var control = Controls.Find(controlName, true);
  119. if (control.Count() > 0)
  120. return control[0];
  121. else
  122. return null;
  123. }
  124. private void Frm_YongGuanMontior_Load(object sender, EventArgs e)
  125. {
  126. _timer = new System.Timers.Timer(4000);
  127. _timer.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
  128. _timer.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
  129. _timer.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
  130. //this.BeginInvoke(new ShowTextDelegate(InItpan11));
  131. }
  132. private static int _theout = 0;
  133. private void theout(object sender, EventArgs e)
  134. {
  135. if (Interlocked.Exchange(ref _theout, 1) == 0)
  136. {
  137. try
  138. {
  139. //Current.RefreshData(true);
  140. //var listDDJ = BaseWorkflow.QueryStackerdDataDDJ(_plcnameSet);
  141. ShowData();
  142. }
  143. catch (Exception ex)
  144. {
  145. }
  146. finally
  147. {
  148. Interlocked.Exchange(ref _theout, 0);
  149. }
  150. }
  151. }
  152. private void ShowData()
  153. {
  154. try
  155. {
  156. if (InvokeRequired)
  157. {
  158. //异步调用委托(后面添加方法需要将方法委托其中)
  159. this.BeginInvoke(new ShowTextDelegate(pan11));
  160. }
  161. else
  162. {
  163. }
  164. }
  165. catch (Exception ex)
  166. {
  167. LogHelper.Sys_Log.WriteLog(ex.ToString());
  168. }
  169. }
  170. public void pan11()
  171. {
  172. try
  173. {
  174. var pack = eqpData.deviceDataPack;
  175. // var frame = pack.Frame;//数据帧(数据产生的时间)
  176. var convdata = pack.StationDatas;//输送线数据
  177. var rgvdata = pack.RGVDatas;//穿梭车数据
  178. var scdata = pack.SCDatas;//堆垛机数据
  179. //SRM
  180. foreach (var item in scdata.Datas)
  181. {
  182. //只更新有变更的数据
  183. //if (eqpData.oldDeviceDataPack != null)
  184. //{
  185. // var oldItem = eqpData.oldDeviceDataPack.SCDatas.Datas.FirstOrDefault(p => p.Code == item.Code);
  186. // if (oldItem.ToString() == item.ToString()) return;
  187. //}
  188. var ddjstatus = DDJSatatusSet.FirstOrDefault(v => v.SrmName == item.Code);
  189. if (ddjstatus != null)
  190. {
  191. //报警信息
  192. if (item.D537.SCAlarm.ToString() == "无")
  193. ddjstatus.DdjWarning.Text = "";
  194. else {
  195. ddjstatus.DdjWarning.Text += item.D537.SCAlarm.ToString();//item.Info.Contains("接口调用") ? "" : item.Info;
  196. }
  197. if (item.Code != null)
  198. {
  199. ddjstatus.DdjPosCurr.Text = item.Code.ToString().Substring(3);
  200. }
  201. if (ddjstatus.DdjWarning.Text != "")
  202. {
  203. ddjstatus.G.Image = Properties.Resources.红;
  204. }
  205. else //(ddjstatus != null)
  206. {
  207. //模式
  208. ddjstatus.DdjMode.Text = item.D521.SRMMode.ToString();
  209. if (!string.IsNullOrEmpty(ddjstatus.DdjMode.Text))
  210. {
  211. if (item.D521.SRMMode.ToString() == "远程")
  212. {
  213. ddjstatus.G.Image = Properties.Resources.绿;
  214. }
  215. else if (item.D521.SRMMode.ToString() == "半自动" || item.D521.SRMMode.ToString() == "手动")
  216. {
  217. ddjstatus.G.Image = Properties.Resources.黄;
  218. }
  219. else if (item.D521.SRMMode.ToString() == "维修")
  220. {
  221. ddjstatus.G.Image = Properties.Resources.红;
  222. }
  223. }
  224. else
  225. {
  226. ddjstatus.DdjMode.Text = "无";
  227. ddjstatus.G.Image = Properties.Resources.黄;
  228. }
  229. }
  230. ////状态
  231. ddjstatus.DdjStatus.Text = item.D521.SRMStatus.ToString();
  232. int taskid = 100;
  233. if (item.D521.TaskID_1 > 10000 && item.D521.TaskID_2 > 10000)
  234. {
  235. taskid = item.D521.TaskID_1;
  236. }
  237. else if (item.D521.TaskID_1 > 10000)
  238. {
  239. taskid = item.D521.TaskID_1;
  240. }
  241. else if (item.D521.TaskID_2 > 10000)
  242. {
  243. taskid = item.D521.TaskID_2;
  244. }
  245. else
  246. {
  247. taskid = item.D521.TaskID_1;
  248. }
  249. //任务号
  250. ddjstatus.DdjOrdId.Text = taskid.ToString();
  251. var task = SugarBase.DB.Queryable<WCS_TASK>().First(v => v.ID == taskid);
  252. if (task != null)
  253. {
  254. //任务类型
  255. ddjstatus.DdjOptType.Text = task.TYPE.ToString();
  256. if (task.TYPE == TaskType.入库)
  257. {
  258. ddjstatus.LblInStatus.BackColor = Color.Lime;
  259. ddjstatus.LblOutStatus.BackColor = Color.DarkGray;
  260. }
  261. else if (task.TYPE == TaskType.出库)
  262. {
  263. ddjstatus.LblInStatus.BackColor = Color.DarkGray;
  264. ddjstatus.LblOutStatus.BackColor = Color.Lime;
  265. }
  266. else
  267. {
  268. ddjstatus.LblInStatus.BackColor = Color.DarkGray;
  269. ddjstatus.LblOutStatus.BackColor = Color.DarkGray;
  270. }
  271. }
  272. else
  273. {
  274. ddjstatus.LblInStatus.BackColor = Color.DarkGray;
  275. ddjstatus.LblOutStatus.BackColor = Color.DarkGray;
  276. }
  277. ////运行时长
  278. ddjstatus.DdjWorkTime.Text = item.D521.Runtime.ToString() + "h";
  279. ////里程数
  280. ddjstatus.DdjTotal_KM.Text = item.D521.TotalKM.ToString() + "KM";
  281. //起始位置
  282. ddjstatus.DdjPosFrom.Text = item.D521.SLine_1.ToString() + "-" + item.D521.SCol_1.ToString() + "-" + item.D521.SLayer_1.ToString();
  283. //目标位置
  284. ddjstatus.DdjPosTo.Text = item.D521.SLine_1.ToString() + "-" + item.D521.SCol_1.ToString() + "-" + item.D521.SLayer_1.ToString();
  285. }
  286. }
  287. //RGV
  288. foreach (var item in rgvdata.Datas)
  289. {
  290. //只更新有变更的数据
  291. //var oldItem = eqpData.oldDeviceDataPack.RGVDatas.Datas.FirstOrDefault(p => p.Code == item.Code);
  292. //if (oldItem.ToString() == item.ToString()) return;
  293. var rgvstatus = RGVSatatusSet.FirstOrDefault(v => v.RGVName == item.Code);
  294. if (rgvstatus != null)
  295. {
  296. string workmode = item.D521.WorkMode.ToString();
  297. //模式
  298. rgvstatus.RGVMode.Text = item.D521.WorkMode.ToString();
  299. if (item.D521.WorkMode.ToString() == "自动")
  300. {
  301. rgvstatus.G.Image = Properties.Resources.绿;
  302. }
  303. else if (item.D521.WorkMode.ToString() == "半自动")
  304. {
  305. rgvstatus.G.Image = Properties.Resources.黄;
  306. }
  307. else if (item.D521.WorkMode.ToString() == "手动")
  308. {
  309. rgvstatus.G.Image = Properties.Resources.黄;
  310. }
  311. else if (item.D521.WorkMode.ToString() == "维护")
  312. {
  313. rgvstatus.G.Image = Properties.Resources.红;
  314. }
  315. else if(item.D521.WorkMode.ToString() == "99")
  316. {
  317. rgvstatus.RGVMode.Text = "手动";
  318. rgvstatus.G.Image = Properties.Resources.黄;
  319. }
  320. ////状态
  321. rgvstatus.RGVStatus.Text = item.D521.SystemStatus.ToString();
  322. //rgvstatus.RGVOrdId.Text = item.D521.TaskID_1.ToString();
  323. //任务Id
  324. if (item.D521.TaskID_1.ToString().Length > 3)
  325. {
  326. rgvstatus.RGVOrdId.Text = item.D521.TaskID_1.ToString();
  327. }
  328. else if (item.D521.TaskID_2.ToString().Length > 3)
  329. {
  330. rgvstatus.RGVOrdId.Text = item.D521.TaskID_2.ToString();
  331. }
  332. else
  333. {
  334. rgvstatus.RGVOrdId.Text = item.D521.TaskID_1.ToString();
  335. }
  336. if (item.D521.Status_1.HasFlag(WCS.Entity.Protocol.RGVStatus.光电) || item.D521.Status_2.HasFlag(WCS.Entity.Protocol.RGVStatus.光电))
  337. {
  338. rgvstatus.RGVPosCurr.Text = "true";
  339. }
  340. else
  341. {
  342. rgvstatus.RGVPosCurr.Text = "false";
  343. }
  344. //作业类型
  345. rgvstatus.RGVOptType.Text = item.D521.TaskType_1.ToString();
  346. //当前位置
  347. //rgvstatus.RGVPosCurr.Text = item.D521.Position.ToString();
  348. //起始位置
  349. rgvstatus.RGVPosFrom.Text = item.D521.Position.ToString(); //item.D521.StartPosition_1.ToString();
  350. //目标位置
  351. rgvstatus.RGVPosTo.Text = item.D521.DestPosition_1.ToString();
  352. var control = FindControl(item.Code);
  353. if (control != null)
  354. {
  355. if (control is Conveyor_R)
  356. {
  357. var con = (Conveyor_R)control;
  358. con.button1.Text = item.Code.ToString();
  359. if (item.D523.Fault != 0) con.BackColor = Color.Red;
  360. else if (item.D523.Status == 0 && item.Code.ToString()!="RGV8") con.BackColor = Color.Yellow;
  361. else con.BackColor = Color.FromArgb(0, 144, 154);
  362. if (item.D521.Status_1.HasFlag(WCS.Entity.Protocol.RGVStatus.光电))
  363. {
  364. if (con.button1.Tag.ToString() != "pall")
  365. {
  366. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");//1009L1.png
  367. con.button1.Tag = "pall";
  368. }
  369. }
  370. else
  371. {
  372. if (con.button1.Tag.ToString() != "empty")
  373. {
  374. con.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");//1009L1.png
  375. con.button1.Tag = "empty";
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. //输送线
  383. foreach (var item in convdata.Datas)
  384. {
  385. //只更新有变更的数据
  386. var control = FindControl("con" + item.Code);
  387. if (control != null)
  388. {
  389. if (control is Conveyor)
  390. {
  391. var con = (Conveyor)control;
  392. if (item.D523.Alarm != 0) con.BackColor = Color.Red;
  393. else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  394. else con.BackColor = Color.FromArgb(0, 144, 154);
  395. con.button1.Text = item.Code.ToString();
  396. if (item.D521.Status.HasFlag(WCS.Entity.Protocol.IstationStatus.光电状态))
  397. {
  398. if (con.button1.Tag.ToString() != "pall")
  399. {
  400. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor.png");
  401. con.button1.Tag = "pall";
  402. }
  403. }
  404. else if (item.D521.Tasknum.ToString().Length > 10000)
  405. {
  406. if (con.button1.Tag.ToString() != "pall")
  407. {
  408. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor.png");
  409. con.button1.Tag = "pall";
  410. }
  411. }
  412. else
  413. {
  414. if (con.button1.Tag.ToString() != "empty")
  415. {
  416. con.button1.BackgroundImage = Image.FromFile("Resources/shelf16UD.png");
  417. con.button1.Tag = "empty";
  418. }
  419. }
  420. }
  421. #region condition
  422. else if (control is Conveyor_L)
  423. {
  424. var con = (Conveyor_L)control;
  425. con.button1.Text = item.Code.ToString();
  426. if (item.D523.Alarm != 0) con.BackColor = Color.Red;
  427. else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  428. else con.BackColor = Color.FromArgb(0, 144, 154);
  429. if (item.D521.Status.HasFlag(WCS.Entity.Protocol.IstationStatus.光电状态))
  430. {
  431. if (con.button1.Tag.ToString() != "pall")
  432. {
  433. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_L.png");//1009L11.png
  434. con.button1.Tag = "pall";
  435. }
  436. }
  437. else
  438. {
  439. if (con.button1.Tag.ToString() != "empty")
  440. {
  441. con.button1.BackgroundImage = Image.FromFile("Resources/1009L11.png");//1009L11.png
  442. con.button1.Tag = "empty";
  443. }
  444. }
  445. }
  446. else if (control is Conveyor_R)
  447. {
  448. var con = (Conveyor_R)control;
  449. con.button1.Text = item.Code.ToString();
  450. if (item.D523.Alarm != 0) con.BackColor = Color.Red;
  451. else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  452. else con.BackColor = Color.FromArgb(0, 144, 154);
  453. if (item.D521.Status.HasFlag(WCS.Entity.Protocol.IstationStatus.光电状态))
  454. {
  455. if (con.button1.Tag.ToString() != "pall")
  456. {
  457. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor_R.png");//1009L1.png
  458. con.button1.Tag = "pall";
  459. }
  460. }
  461. else
  462. {
  463. if (con.button1.Tag.ToString() != "empty")
  464. {
  465. con.button1.BackgroundImage = Image.FromFile("Resources/1009L1.png");//1009L1.png
  466. con.button1.Tag = "empty";
  467. }
  468. }
  469. }
  470. else if (control is Conveyor3_A)
  471. {
  472. var con = (Conveyor3_A)control;
  473. con.button1.Text = item.Code.ToString();
  474. if (item.D523.Alarm != 0) con.BackColor = Color.Red;
  475. else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  476. else con.BackColor = Color.FromArgb(0, 144, 154);
  477. if (item.D521.Status.HasFlag(WCS.Entity.Protocol.IstationStatus.光电状态))
  478. {
  479. if (con.button1.Tag.ToString() != "pall")
  480. {
  481. con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor3_A_Box.png");//Conveyor3_A_Box.png
  482. con.button1.Tag = "pall";
  483. }
  484. }
  485. else
  486. {
  487. if (con.button1.Tag.ToString() != "empty")
  488. {
  489. con.button1.BackgroundImage = Image.FromFile("Resources/1009_A.png");//1009_A.png
  490. con.button1.Tag = "empty";
  491. }
  492. }
  493. }
  494. else if (control is Conveyor3_B)
  495. {
  496. var con = (Conveyor3_B)control;
  497. con.button1.Text = item.Code.ToString();
  498. if (item.D523.Alarm != 0) con.BackColor = Color.Red;
  499. else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  500. else con.BackColor = Color.FromArgb(0, 144, 154);
  501. if (item.D521.Status.HasFlag(WCS.Entity.Protocol.IstationStatus.光电状态))
  502. {
  503. if (con.button1.Tag.ToString() != "pall")
  504. {
  505. con.button1.BackgroundImage = Image.FromFile("Resources/1009R1_B.png");//1009R1_A.png
  506. con.button1.Tag = "pall";
  507. }
  508. }
  509. else
  510. {
  511. if (con.button1.Tag.ToString() != "empty")
  512. {
  513. con.button1.BackgroundImage = Image.FromFile("Resources/1009R1.png");//1009R1.png
  514. con.button1.Tag = "empty";
  515. }
  516. }
  517. }
  518. #region ---
  519. //else if (control is Conveyor4_L_R)
  520. //{
  521. // var con = (Conveyor4_L_R)control;
  522. // con.button1.Text = item.Code.ToString();
  523. // if (item.D523.Fault != 0) con.BackColor = Color.Red;
  524. // else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  525. // else con.BackColor = Color.FromArgb(0, 144, 154);
  526. // if (item.D521.PH_STATUS == true)
  527. // {
  528. // if (con.button1.Tag.ToString() != "pall")
  529. // {
  530. // con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_L_R.png");
  531. // con.button1.Tag = "pall";
  532. // }
  533. // }
  534. // else
  535. // {
  536. // if (con.button1.Tag.ToString() != "empty")
  537. // {
  538. // con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
  539. // con.button1.Tag = "empty";
  540. // }
  541. // }
  542. //}
  543. //else if (control is Conveyor3)
  544. //{
  545. // var con = (Conveyor3)control;
  546. // con.button1.Text = item.Code.ToString();
  547. // if (item.D523.Fault != 0) con.BackColor = Color.Red;
  548. // else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  549. // else con.BackColor = Color.FromArgb(0, 144, 154);
  550. // if (item.D521.PH_STATUS == true)
  551. // {
  552. // if (con.button1.Tag.ToString() != "pall")
  553. // {
  554. // con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor3.png");//1009R1_A.png
  555. // con.button1.Tag = "pall";
  556. // }
  557. // }
  558. // else
  559. // {
  560. // if (con.button1.Tag.ToString() != "empty")
  561. // {
  562. // con.button1.BackgroundImage = Image.FromFile("Resources/1004LR.png");//1009R1.png
  563. // con.button1.Tag = "empty";
  564. // }
  565. // }
  566. //}
  567. //else if (control is Conveyor4_left)
  568. //{
  569. // var con = (Conveyor4_left)control;
  570. // con.button1.Text = item.Code.ToString();
  571. // if (item.D523.Fault != 0) con.BackColor = Color.Red;
  572. // else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  573. // else con.BackColor = Color.FromArgb(0, 144, 154);
  574. // if (item.D521.PH_STATUS == true)
  575. // {
  576. // if (con.button1.Tag.ToString() != "pall")
  577. // {
  578. // con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_left.png");
  579. // con.button1.Tag = "pall";
  580. // }
  581. // }
  582. // else
  583. // {
  584. // if (con.button1.Tag.ToString() != "empty")
  585. // {
  586. // con.button1.BackgroundImage = Image.FromFile("Resources/1001L.gif");
  587. // con.button1.Tag = "empty";
  588. // }
  589. // }
  590. //}
  591. //else if (control is Conveyor4_right)
  592. //{
  593. // var con = (Conveyor4_right)control;
  594. // con.button1.Text = item.Code.ToString();
  595. // if (item.D523.Fault != 0) con.BackColor = Color.Red;
  596. // else if (item.D523.Status == 0) con.BackColor = Color.Yellow;
  597. // else con.BackColor = Color.FromArgb(0, 144, 154);
  598. // if (item.D521.PH_STATUS == true)
  599. // {
  600. // if (con.button1.Tag.ToString() != "pall")
  601. // {
  602. // con.button1.BackgroundImage = Image.FromFile("Resources/Conveyor4_right.png");
  603. // con.button1.Tag = "pall";
  604. // }
  605. // }
  606. // else
  607. // {
  608. // if (con.button1.Tag.ToString() != "empty")
  609. // {
  610. // con.button1.BackgroundImage = Image.FromFile("Resources/1001LR.gif");
  611. // con.button1.Tag = "empty";
  612. // }
  613. // }
  614. //}
  615. #endregion
  616. #endregion
  617. }
  618. }
  619. //string endtTime = DateTime.Now.ToString();
  620. //MessageBox.Show("开始时间--" + startTime + ",结束时间--" + endtTime);
  621. //eqpData.deviceDataPack = pack;
  622. }
  623. catch (Exception ex)
  624. {
  625. }
  626. finally
  627. {
  628. isinitfrm = true;
  629. }
  630. }
  631. private void lblsrm01_Click(object sender, EventArgs e)
  632. {
  633. Label srm = (Label)sender;
  634. string equName = srm.Name.Substring(3);
  635. FrmEquMsg_dtl Frm = new FrmEquMsg_dtl(equName);
  636. Frm.Show();
  637. }
  638. private void Frm_YongGuanMontior_FormClosing(object sender, FormClosingEventArgs e)
  639. {
  640. _timer.Stop();
  641. _timer.Elapsed -= new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
  642. }
  643. #region load
  644. private void con2114_Load(object sender, EventArgs e)
  645. {
  646. }
  647. private void tableCellLabel23_Load(object sender, EventArgs e)
  648. {
  649. }
  650. private void con2035_Load(object sender, EventArgs e)
  651. {
  652. }
  653. private void p_Load(object sender, EventArgs e)
  654. {
  655. }
  656. private void RGV10_Load(object sender, EventArgs e)
  657. {
  658. }
  659. #endregion
  660. }
  661. public class DDJSatatus
  662. {
  663. /// <summary>
  664. /// 状态图标
  665. /// </summary>
  666. public PictureBox G { get; set; }
  667. /// <summary>
  668. /// 堆垛机名称
  669. /// </summary>
  670. public string SrmName { get; set; }
  671. /// <summary>
  672. /// 入库状态
  673. /// </summary>
  674. public Label LblInStatus { get; set; }
  675. /// <summary>
  676. /// 出库状态
  677. /// </summary>
  678. public Label LblOutStatus { get; set; }
  679. /// <summary>
  680. /// 堆垛机模式
  681. /// </summary>
  682. public Label DdjMode { get; set; }
  683. public Label DdjWarning { get; set; }
  684. /// <summary>
  685. /// 堆垛机工作状态
  686. /// </summary>
  687. public Label DdjStatus { get; set; }
  688. /// <summary>
  689. /// 堆垛机工作任务
  690. /// </summary>
  691. public Label DdjOrdId { get; set; }
  692. /// <summary>
  693. /// 堆垛机作业类型
  694. /// </summary>
  695. public Label DdjOptType { get; set; }
  696. /// <summary>
  697. /// 堆垛机当前位置
  698. /// </summary>
  699. public Label DdjPosCurr { get; set; }
  700. /// <summary>
  701. /// 运行时间
  702. /// </summary>
  703. public Label DdjWorkTime { get; set; }
  704. /// <summary>
  705. /// 里程数
  706. /// </summary>
  707. public Label DdjTotal_KM { get; set; }
  708. /// <summary>
  709. /// 源仓位
  710. /// </summary>
  711. public Label DdjPosFrom { get; set; }
  712. /// <summary>
  713. /// 目标仓位
  714. /// </summary>
  715. public Label DdjPosTo { get; set; }
  716. }
  717. public class RGVSatatus
  718. {
  719. /// <summary>
  720. /// 状态图标
  721. /// </summary>
  722. public PictureBox G { get; set; }
  723. /// <summary>
  724. /// RGV名称
  725. /// </summary>
  726. public string RGVName { get; set; }
  727. /// <summary>
  728. /// RGV模式
  729. /// </summary>
  730. public Label RGVMode { get; set; }
  731. /// <summary>
  732. /// RGV工作状态
  733. /// </summary>
  734. public Label RGVStatus { get; set; }
  735. /// <summary>
  736. /// RGV工作任务
  737. /// </summary>
  738. public Label RGVOrdId { get; set; }
  739. /// <summary>
  740. /// RGV作业类型
  741. /// </summary>
  742. public Label RGVOptType { get; set; }
  743. /// <summary>
  744. /// RGV当前位置
  745. /// </summary>
  746. public Label RGVPosCurr { get; set; }
  747. /// <summary>
  748. /// 起始站台
  749. /// </summary>
  750. public Label RGVPosFrom { get; set; }
  751. /// <summary>
  752. /// 目标站台
  753. /// </summary>
  754. public Label RGVPosTo { get; set; }
  755. }
  756. public class WCS_STATION5201 : WCS_Station520
  757. {
  758. public new DateTime UPDATETIME { get; set; }
  759. }
  760. /// <summary>
  761. /// 提示 ToolTip
  762. /// </summary>
  763. public class MoveOverInfoTip
  764. {
  765. #region 基础参数
  766. //信息提示组件
  767. private static ToolTip _toolTip = new ToolTip();
  768. #endregion
  769. #region 公有方法
  770. /// <summary>
  771. /// 设置单个控件提示信息
  772. /// </summary>
  773. /// <typeparam name="T">组件类型</typeparam>
  774. /// <param name="t">组件</param>
  775. /// <param name="tipInfo">需要显示的提示信息</param>
  776. public static void SettingSingleTipInfo<T>(T t, string tipInfo) where T : Control
  777. {
  778. _toolTip.SetToolTip(t, tipInfo);
  779. }
  780. /// <summary>
  781. /// 设置多个同种类型的提示信息
  782. /// </summary>
  783. /// <typeparam name="T">组件类型</typeparam>
  784. /// <param name="dic">组件和提示信息字典</param>
  785. public static void SettingMutiTipInfo<T>(Dictionary<T, string> dic) where T : Control
  786. {
  787. if (dic == null || dic.Count <= 0) return;
  788. foreach (var item in dic)
  789. {
  790. _toolTip.SetToolTip(item.Key, item.Value);
  791. }
  792. }
  793. #endregion
  794. }
  795. }