版博士V2.0程序
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

1776 rindas
76 KiB

  1. using CCWin;
  2. using CCWin.SkinClass;
  3. using CCWin.SkinControl;
  4. using HalconDotNet;
  5. using HZH_Controls.Forms;
  6. using MaiMuAOI.Properties;
  7. using MaiMuAOI.SysCtrl;
  8. using MaiMuAOI.SysUI.DefectPicShow;
  9. using MaiMuAOI.SysUI.Load;
  10. using MaiMuAOI.SysUI.ProcessStep;
  11. using MaiMuAOI.SysUI.ProcessStep.Ctrl;
  12. using MaiMuAOI.SysUI.ProductAndStep;
  13. using MaiMuAOI.SysUI.SysSet;
  14. using MaiMuAOI.SysUI.Web;
  15. using MaiMuAOI.UI.SysSet;
  16. using MaiMuControl.Device;
  17. using MaiMuControl.Device.CamDev;
  18. using MaiMuControl.Device.IOCardDev;
  19. using MaiMuControl.SysStatusMgr.StatusMgr;
  20. using Models;
  21. using Newtonsoft.Json.Linq;
  22. using OpenCvSharp;
  23. using ProductionControl;
  24. using System;
  25. using System.Collections.Generic;
  26. using System.ComponentModel;
  27. using System.Data;
  28. using System.Diagnostics;
  29. using System.Drawing;
  30. using System.Drawing.Imaging;
  31. using System.Linq;
  32. using System.Text;
  33. using System.Threading;
  34. using System.Threading.Tasks;
  35. using System.Windows.Forms;
  36. using static MaiMuAOI.SysCtrl.SysMgr;
  37. namespace MaiMuAOI
  38. {
  39. public partial class MainFrm : Form
  40. {
  41. private Service.ProductService svcProduct = new Service.ProductService();
  42. object AddTextLock = new object();
  43. object AddPicLock = new object();
  44. bool backgroundWorkerDo;
  45. bool DisEnableBuzz;
  46. bool DisEnableDoor;
  47. private Stopwatch RunStartTime = new Stopwatch();
  48. public MainFrm()
  49. {
  50. InitializeComponent();
  51. this.uiTitel1.FatherForm = this;
  52. this.uiTitel1.UserMenuStrip = this.menuStrip1;
  53. this.uiTitel1.ShowContrlBox(true, true, true);
  54. this.uiTitel1.ShowMenu();
  55. this.DoubleBuffered = true;//设置本窗体
  56. SetStyle(ControlStyles.UserPaint, true);
  57. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  58. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  59. SysMgr.Instance.MainRuning += main_running;
  60. SysMgr.Instance.AutoRuning += auto_runing;
  61. SysMgr.Instance.AutoShowImg += auto_ShowMoreImg;
  62. SysMgr.Instance.AutoSizeShowImg += auto_SizeShowMoreImg;
  63. //显示行号与列宽度自动调整
  64. dgvProcess.RowHeadersVisible = true;
  65. dgvProcess.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
  66. dgvProcess.RowPostPaint += (sender, e) =>
  67. {
  68. SysMgr.showRowNum_onDataGrid_RowPostPaint(this.dgvProcess, sender, e);
  69. };
  70. dgvProcess.DefaultCellStyle.ForeColor = System.Drawing.Color.Black;
  71. this.lblTimeLen.Top = toolStrip1.Top + 10;
  72. this.lblTimeLen.Left = toolStrip1.Width - 300;
  73. this.lblOutput.Top = toolStrip1.Top + 10 + lblTimeLen.Height + 5;
  74. this.lblOutput.Left = toolStrip1.Width - 300;
  75. this.chkBuzzer.Top = toolStrip1.Top + 20;
  76. this.chkDoorSensor.Top = toolStrip1.Top + 20;
  77. }
  78. #region 私有方法
  79. /// <summary>
  80. /// 初始化
  81. /// </summary>
  82. /// <returns></returns>
  83. private bool InitSystem()
  84. {
  85. //进入初始化,初始化失败则中断
  86. InitFrm initFrm = new InitFrm();
  87. initFrm.ShowDialog();
  88. if (initFrm.DialogResult == DialogResult.OK)
  89. {
  90. //初始化成功
  91. }
  92. else
  93. {
  94. initFrm.Dispose();
  95. return false;
  96. }
  97. initFrm.Dispose();
  98. return true;
  99. }
  100. /// <summary>
  101. /// 系统是否在运行
  102. /// </summary>
  103. /// <returns></returns>
  104. private bool SystemIsRun()
  105. {
  106. if (SysMgr.Instance.IsRuning)
  107. {
  108. FrmDialog.ShowDialog(this, "设备正在运行中!", "警告", false);
  109. //MessageBox.Show("设备正在运行中!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  110. return false;
  111. }
  112. return true;
  113. }
  114. private void ClearDefectBmps()
  115. {
  116. this.pnlBmpList.Controls.Clear();
  117. this.gboxDefectList.Text = $"缺陷图像";
  118. this.gboxDefectList.Tag = 0;
  119. this.pnlSizeBmpList.Controls.Clear();
  120. this.gboxSizeDefectList.Text = $"尺寸图像";
  121. this.gboxSizeDefectList.Tag = 0;
  122. this.lblDefectAddTag.Text = "";
  123. this.lblDefectAddTag.Tag = 0;
  124. }
  125. private void ResetUI(bool clearSN)
  126. {
  127. //保持产品名称和料号
  128. //txtProductName.Text = txtProductCode.Text = txtProductSN.Text = "";
  129. if(clearSN)
  130. cbProductSN.Text = "";
  131. lblTension.ForeColor = Color.White;
  132. lblTension.Text = "0.00";
  133. lblTensionMax.Text = "0.00";
  134. lblTensionMin.Text = "0.00";
  135. lblHeight.ForeColor = Color.White;
  136. lblHeight.Text = "0.00";
  137. lblHeightMax.Text = "0.00";
  138. lblHeightMin.Text = "0.00";
  139. lblLineWidth.ForeColor = Color.White;
  140. lblLineWidth.Text = "0.00";
  141. lblLineWidthMax.Text = "0.00";
  142. lblLineWidthMin.Text = "0.00";
  143. lblPT.ForeColor = Color.White;
  144. lblPT.Text = "0.00";
  145. lblPTMax.Text = "0.00";
  146. lblPTMin.Text = "0.00";
  147. lblCompareResult.ForeColor = Color.White;
  148. lblCompareResult.Text = "无";
  149. //lblCompareCount.Text = "未通过:";
  150. lblDefectResult.ForeColor = Color.White;
  151. lblDefectResult.Text = "无";
  152. lblDefectResultCount.Text = "无";
  153. this.dgvProcess.DataSource = null;
  154. this.dgvProcess.DataSource = null;
  155. this.lstLog.Items.Clear();
  156. this.ClearDefectBmps();
  157. this.flpProcessStep.Controls.Clear();
  158. this.picScanner0.Image = null;
  159. picScanner0.Refresh();
  160. this.picScanner1.Image = null;
  161. picScanner1.Refresh();
  162. this.tsbtnStop.Enabled = false;
  163. this.cbOrderCode.Enabled = true;
  164. this.cbProductCode.Enabled = true;
  165. this.cbProductSN.Enabled = true;
  166. lblTimeLen.Text = "检测时长: 0 秒";
  167. tslabelTime.Text = "实时测试:0.00s";
  168. tslbSaveSts.Text = "保存队列:0";
  169. int daout = 0;
  170. if(ConfMgr.Instance.GetDailyOutput(out daout))
  171. {
  172. lblOutput.Text = $"当日产量: {daout} 个";
  173. }
  174. MainFrm_Paint(null, null);
  175. this.Refresh();
  176. }
  177. private void UserRightCheck()
  178. {
  179. this.tsmStepMgr.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Step);
  180. this.tsmPdtMgr.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Product);
  181. this.web数据查询ToolStripMenuItem.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Statistics);
  182. this.本地数据库查询ToolStripMenuItem.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Order);
  183. if (this.web数据查询ToolStripMenuItem.Enabled == false && this.本地数据库查询ToolStripMenuItem.Enabled == false)
  184. this.tsmSysDataFind.Visible = false;
  185. else
  186. this.tsmSysDataFind.Visible = true;
  187. //this.tsmSysDataFind.Visible = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Statistics);
  188. this.tsmUserList.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.User);
  189. this.tsmUserRight.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Role);
  190. if(this.tsmUserList.Enabled == false && this.tsmUserRight.Enabled == false)
  191. this.tsmSysUserMgr.Visible = false;
  192. else
  193. this.tsmSysUserMgr.Visible = true;
  194. this.tsmDebug.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Debug);
  195. this.快速调试ToolStripMenuItem.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.Debug);
  196. this.tsmSysSet.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.SysSetting);
  197. this.tsmSysPoints.Enabled = SysMgr.Instance.UserMgr.RightControl(MaiMuControl.SysStatusMgr.UserMgr.UserRightEnum.ParamsSetting);
  198. if (this.tsmDebug.Enabled == false && this.tsmSysSet.Enabled == false && this.快速调试ToolStripMenuItem.Enabled == false && this.tsmSysPoints.Enabled == false)
  199. this.stmSysSet.Visible = false;
  200. else
  201. this.stmSysSet.Visible = true;
  202. }
  203. #endregion
  204. private void MainFrm_Load(object sender, EventArgs e)
  205. {
  206. //登入
  207. if (SysMgr.Instance.LoginSystem())
  208. {
  209. //登入成功
  210. if (InitSystem())
  211. {
  212. this.Cursor = Cursors.WaitCursor;
  213. //this.WindowState = FormWindowState.Normal;
  214. this.Top = 0;
  215. this.Left = 0;
  216. this.Width = SystemInformation.WorkingArea.Width;
  217. this.Height = SystemInformation.WorkingArea.Height;
  218. //this.WindowState = FormWindowState.Maximized;
  219. this.splitContainer1.SplitterDistance = this.Width / 3;
  220. ResetUI(true);
  221. this.Show();
  222. this.dgvProcess.AutoGenerateColumns = false;
  223. this.tsslLoginInfo.Text = $"操作员:{SysMgr.Instance.UserMgr.LoginUser.Code}({SysMgr.Instance.UserMgr.LoginUser.Name})";
  224. //this.tsslLoginTime.Text = $" 登录时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}";
  225. this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
  226. this.tsslLoginTime.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
  227. this.tsslLoginInfo.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
  228. this.tsAxisState.Text = "";
  229. //设置流程卡显示
  230. this.tabControl1.SelectTab(0);
  231. //this.tabControl1.SelectTab(1);
  232. //更新数据库格式
  233. Service.InitDB.initDB();
  234. //权限判断
  235. UserRightCheck();
  236. //开启后台
  237. //timer1.Enabled = true;
  238. backgroundWorkerDo = true;
  239. backgroundWorker1.RunWorkerAsync();
  240. //s_BackWorker = true;
  241. //backgroundWorker.RunWorkerAsync();
  242. //开启web服务器
  243. SysMgr.Instance.InitWebServer();
  244. //开启云端连接
  245. SysMgr.Instance.InitCloudConnect();
  246. //开启产品服务
  247. SysMgr.Instance.InitPdtService();
  248. //开启处理事件反馈
  249. SysMgr.Instance.InitDefectEvent();
  250. //加载产品料号
  251. SysMgr.Instance.LoadProductCodeList();
  252. //加载产品选择
  253. LoadPdtList(SysMgr.Instance.ProductCodeList);
  254. LoadSNList(SysMgr.Instance.ProductSNList);
  255. this.Cursor = Cursors.Default;
  256. //运行前检测磁盘空间
  257. SysMgr.CheckDisk(this, 100);
  258. if (ConfMgr.Instance.SysConfigParams.CustomerName == "JA")
  259. lbJA.Visible = true;
  260. else
  261. lbJA.Visible = false;
  262. }
  263. else
  264. {
  265. Application.Exit();
  266. }
  267. }
  268. else
  269. {
  270. Application.Exit();
  271. }
  272. }
  273. private void MainFrm_FormClosing(object sender, FormClosingEventArgs e)
  274. {
  275. if (SystemIsRun())
  276. {
  277. DialogResult dr = DialogResult.Cancel;
  278. if (SysMgr.Instance.GetSaveQueueCnt() > 0)
  279. {
  280. dr = FrmDialog.ShowDialog(this, "图片正在保存,是否继续退出?", "警告", true);
  281. }
  282. else { dr = DialogResult.OK; }
  283. if (dr == DialogResult.OK)
  284. {
  285. if (SysMgr.Instance.IsInit)
  286. {
  287. dr = FrmDialog.ShowDialog(this, "确定要退出当前系统?", "警告", true);
  288. }
  289. else
  290. dr = DialogResult.OK;
  291. if (dr == DialogResult.Cancel)
  292. {
  293. e.Cancel = true;
  294. }
  295. else
  296. {
  297. backgroundWorkerDo = false;
  298. //Thread.Sleep(300);
  299. Thread.Sleep(300);
  300. if (SysMgr.Instance.IsInit)
  301. SysMgr.Instance.Close();
  302. //SysMgr.Instance.MainRuning -= main_running;
  303. }
  304. }
  305. }
  306. else
  307. e.Cancel = true;
  308. }
  309. #region 主界面
  310. private void toolStrip1_Paint(object sender, PaintEventArgs e)
  311. {
  312. if ((sender as ToolStrip).RenderMode == ToolStripRenderMode.System)
  313. {
  314. Rectangle rect = new Rectangle(0, 0, this.toolStrip1.Width, this.toolStrip1.Height - 2);
  315. e.Graphics.SetClip(rect);
  316. }
  317. }
  318. private void chkBuzzer_CheckedChanged(object sender, EventArgs e)
  319. {
  320. DisEnableBuzz = chkBuzzer.Checked;
  321. }
  322. private void chkDoorSensor_CheckedChanged(object sender, EventArgs e)
  323. {
  324. DisEnableDoor = chkDoorSensor.Checked;
  325. }
  326. private void MainFrm_Shown(object sender, EventArgs e)
  327. {
  328. }
  329. private void tsbCC_Click(object sender, EventArgs e)
  330. {
  331. if(this.tsbCC.Text == "尺寸启用")
  332. {
  333. this.tsbCC.Text = "尺寸禁用";
  334. this.tsbCC.Image = Resources.ccClose;
  335. SysMgr.Instance.SetSizeEnable(false);
  336. }
  337. else
  338. {
  339. this.tsbCC.Text = "尺寸启用";
  340. this.tsbCC.Image = Resources.ccOpen;
  341. SysMgr.Instance.SetSizeEnable(true);
  342. }
  343. }
  344. private void tsbQX_Click(object sender, EventArgs e)
  345. {
  346. if (this.tsbQX.Text == "缺陷启用")
  347. {
  348. this.tsbQX.Text = "缺陷禁用";
  349. this.tsbQX.Image = Resources.qxClose;
  350. SysMgr.Instance.SetDefectEnable(false);
  351. }
  352. else
  353. {
  354. this.tsbQX.Text = "缺陷启用";
  355. this.tsbQX.Image = Resources.qxOpen;
  356. SysMgr.Instance.SetDefectEnable(true);
  357. }
  358. }
  359. #endregion
  360. #region 菜单按钮
  361. private void tsmSysSet_Click(object sender, EventArgs e)
  362. {
  363. if (SystemIsRun())
  364. {
  365. SysMgr.Instance.StatusMgr.GotoSetParams();
  366. SysMgr.Instance.SendStatus();
  367. SysSetFrm frm = new SysSetFrm();
  368. frm.ShowDialog();
  369. MainFrm_Paint(null, null);
  370. SysMgr.Instance.StatusMgr.GotoNormalStandby();
  371. SysMgr.Instance.SendStatus();
  372. }
  373. }
  374. private void tsmUserRight_Click(object sender, EventArgs e)
  375. {
  376. SysMgr.Instance.UserPermissiomMgr();
  377. }
  378. private void tsmUserList_Click(object sender, EventArgs e)
  379. {
  380. SysMgr.Instance.UserListMgr();
  381. }
  382. private void tsmDebug_Click(object sender, EventArgs e)
  383. {
  384. if (SystemIsRun())
  385. {
  386. SysMgr.Instance.StatusMgr.GotoDebug();
  387. SysMgr.Instance.SendStatus();
  388. SysDebugFrm frm = new SysDebugFrm();
  389. frm.ShowDialog();
  390. SysMgr.Instance.StatusMgr.GotoNormalStandby();
  391. SysMgr.Instance.SendStatus();
  392. }
  393. }
  394. private void tsmSysPoints_Click(object sender, EventArgs e)
  395. {
  396. if (SystemIsRun())
  397. {
  398. SysMgr.Instance.StatusMgr.GotoSetParams();
  399. SysMgr.Instance.SendStatus();
  400. SysPointsFrm frm = new SysPointsFrm();
  401. frm.ShowDialog();
  402. SysMgr.Instance.StatusMgr.GotoNormalStandby();
  403. SysMgr.Instance.SendStatus();
  404. }
  405. }
  406. private void tsmSysDataFind_Click(object sender, EventArgs e)
  407. {
  408. //WebFrm frm = new WebFrm("查询统计", $"reportRecordSN?CustomerVer=B",
  409. // "http://127.0.0.1:" + ConfMgr.Instance.SysConfigParams.HttpServerPort.ToString() + "/static/index.html#/");
  410. //WebFrm frm = new WebFrm("查询统计", $"reportRecordSN?CustomerVer=B");
  411. //frm.WindowState = FormWindowState.Maximized;
  412. //frm.Show();
  413. }
  414. private void web数据查询ToolStripMenuItem_Click(object sender, EventArgs e)
  415. {
  416. WebFrm frm = new WebFrm("查询统计", $"reportRecordSN?CustomerVer=B");
  417. frm.WindowState = FormWindowState.Maximized;
  418. frm.Show();
  419. }
  420. private void 本地数据库查询ToolStripMenuItem_Click(object sender, EventArgs e)
  421. {
  422. DataQueryFrm frm = new DataQueryFrm();
  423. frm.WindowState = FormWindowState.Maximized;
  424. frm.Show();
  425. }
  426. private void 系统管理ToolStripMenuItem_Click(object sender, EventArgs e)
  427. {
  428. if (SystemIsRun())
  429. {
  430. ProductListFrm frm = new ProductListFrm();
  431. frm.ShowDialog();
  432. //加载产品料号
  433. SysMgr.Instance.LoadProductCodeList();
  434. //加载产品选择
  435. LoadPdtList(SysMgr.Instance.ProductCodeList);
  436. }
  437. }
  438. private void toolStripMenuItem1_Click(object sender, EventArgs e)
  439. {
  440. if (SystemIsRun())
  441. {
  442. StepListFrm frm = new StepListFrm();
  443. frm.ShowDialog();
  444. }
  445. }
  446. private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
  447. {
  448. this.Close();
  449. }
  450. private void tsmInfoUS_Click(object sender, EventArgs e)
  451. {
  452. SysInfoFrm frm = new SysInfoFrm();
  453. frm.ShowDialog();
  454. }
  455. private void tsmReadLog_Click(object sender, EventArgs e)
  456. {
  457. SysLogFrm frm = new SysLogFrm();
  458. frm.ShowDialog();
  459. }
  460. private void tsmHelpInfo_Click(object sender, EventArgs e)
  461. {
  462. //MessageBox.Show(SysUpdata.Updata, "更新信息");
  463. SysUpdataInfoFrm frm = new SysUpdataInfoFrm(SysUpdata.Updata);
  464. frm.ShowDialog();
  465. }
  466. private void tsmSoftFile_Click(object sender, EventArgs e)
  467. {
  468. string fileName = ConfMgr.Instance.SpecificationPath;//输入打开文件路径
  469. Process.Start(fileName);//使用process进程打开
  470. }
  471. private void 快速调试ToolStripMenuItem_Click(object sender, EventArgs e)
  472. {
  473. DebugTestFrm frm = new DebugTestFrm();
  474. //frm.TopMost = true;
  475. frm.ShowDialog();
  476. }
  477. #endregion
  478. #region 显示图像和消息
  479. private void lstLog_DrawItem(object sender, DrawItemEventArgs e)
  480. {
  481. e.DrawBackground();
  482. if (e.Index < 0) return;
  483. try
  484. {
  485. string str = lstLog.Items[e.Index].ToString();
  486. e.Graphics.DrawString(str.Substring(1), e.Font,
  487. new SolidBrush(str[0] == 'R' ? Color.Red : (str[0] == 'Y' ? Color.Orange : Color.Black)),
  488. e.Bounds);
  489. }
  490. catch(Exception ex)
  491. {
  492. e.Graphics.DrawString(ex.Message, e.Font,
  493. new SolidBrush( Color.Red ),
  494. e.Bounds);
  495. }
  496. }
  497. /// <summary>
  498. /// 异步输出日志
  499. /// </summary>
  500. /// <param name="tag">模板标识</param>
  501. /// <param name="msg">内容</param>
  502. /// <param name="type"></param>
  503. private void AddTextEvent(string tag, string msg, WarningEnum level = WarningEnum.Normal)
  504. {
  505. lock (AddTextLock)
  506. {
  507. if (tag != null && tag != "")
  508. tag = $" - [{tag}]";
  509. var now = DateTime.Now;
  510. msg = now.ToString("HH:mm:ss fff") + tag + " - " + msg;
  511. msg = (level == WarningEnum.Normal ? "B" : level == WarningEnum.Low ? "Y" : "R") + msg;
  512. if (this.lstLog.Items.Count > 1000)
  513. this.lstLog.Items.Clear();
  514. lstLog.Items.Insert(0, msg);
  515. }
  516. }
  517. private void main_running(object sender, MainEventArgs e)
  518. {
  519. ShowMessage(e);
  520. }
  521. private delegate void ShowMessageDelegate(MainEventArgs e);
  522. private void ShowMessage(MainEventArgs e)
  523. {
  524. if (InvokeRequired)
  525. {
  526. ShowMessageDelegate smd = new ShowMessageDelegate(ShowMessage);
  527. this.BeginInvoke(smd, e);
  528. }
  529. else
  530. {
  531. AddTextEvent(e.Tag, e.Message, e.Warning);
  532. }
  533. }
  534. /// <summary>
  535. /// 自动运行流程显示
  536. /// </summary>
  537. /// <param name="sender"></param>
  538. /// <param name="e"></param>
  539. private void auto_runing(object sender, RunEventArgs e)
  540. {
  541. ShowUIEvent(e);
  542. }
  543. private delegate void ShowUIEventDelegate(RunEventArgs e);
  544. Bitmap bmp0;
  545. Bitmap bmp1;
  546. private void ShowUIEvent(RunEventArgs e)
  547. {
  548. if (InvokeRequired)
  549. {
  550. ShowUIEventDelegate smd = new ShowUIEventDelegate(ShowUIEvent);
  551. this.BeginInvoke(smd, e);
  552. }
  553. else
  554. {
  555. try
  556. {
  557. if (e.Cmd == 0) //显示SN和流程
  558. {
  559. this.cbProductSN.Text = e.SN;
  560. if (e.NewStep)
  561. {
  562. this.tabControl1.SelectTab(1);
  563. ShowNewStepProcess(e.StepProcessesList);
  564. }
  565. else
  566. {
  567. this.tabControl1.SelectTab(0);
  568. this.dgvProcess.DataSource = new BindingSource(e.StepProcessesList, null);
  569. }
  570. }
  571. else if (e.Cmd == 1) //显示当前运行步骤
  572. {
  573. this.dgvProcess.Rows[e.StepIndex].Selected = true;
  574. dgvProcess.CurrentCell = dgvProcess.Rows[e.StepIndex].Cells[1];
  575. }
  576. else if (e.Cmd == 2) //显示当前运行步骤 和步骤详情
  577. {
  578. this.dgvProcess.Rows[e.StepIndex].Cells["colValue"].Value = e.Mesg;
  579. }
  580. else if (e.Cmd == 3) //图纸比对结果
  581. {
  582. this.lblCompareResult.Text = (e.CompareResult ? "通过" : $"未通过");
  583. this.lblCompareResultCount.Text = e.Cnt.ToString();
  584. if (!e.CompareResult)
  585. {
  586. this.lblCompareResult.ForeColor = Color.Red;
  587. }
  588. else
  589. this.lblCompareResult.ForeColor = Color.Lime;
  590. }
  591. else if (e.Cmd == 4) //缺陷结果
  592. {
  593. lblDefectResult.Text = "未通过";
  594. lblDefectResultCount.Text = $"总数:{e.Cnt},详细:{e.CompareResultString}";
  595. this.toolTip1.SetToolTip(lblDefectResultCount, lblDefectResultCount.Text);
  596. this.lblDefectResult.Text = (e.CompareResult ? "通过" : "未通过");
  597. if (!e.CompareResult)
  598. {
  599. this.lblDefectResult.ForeColor = Color.Red;
  600. }
  601. else
  602. this.lblDefectResult.ForeColor = Color.Lime;
  603. }
  604. else if (e.Cmd == 5) //加载缺陷小图
  605. {
  606. ;
  607. }
  608. else if (e.Cmd == 6) //显示主图
  609. {
  610. if (e.PicIndex == 0)
  611. {
  612. bmp0 = (Bitmap)CamDev.HImageToBitmap(e.Pic).Clone();
  613. picScanner0.Image = bmp0;
  614. picScanner0.Refresh();
  615. }
  616. else
  617. {
  618. bmp1 = (Bitmap)CamDev.HImageToBitmap(e.Pic).Clone();
  619. picScanner1.Image = bmp1;
  620. picScanner1.Refresh();
  621. }
  622. }
  623. else if (e.Cmd == 7) //显示测试时间
  624. {
  625. lblTimeLen.Text = "检测时长: " + e.Time.ToString("0.000") + " 秒";
  626. }
  627. else if (e.Cmd == 8) //显示测试时间
  628. {
  629. lblOutput.Text = "当日产量: " + e.Num.ToString("0") + " 个";
  630. }
  631. else if (e.Cmd == 10) //测试结束
  632. {
  633. this.tsbtnStart.Enabled = true;
  634. this.tsbtnStop.Enabled = false;
  635. this.cbOrderCode.Enabled = true;
  636. this.cbProductCode.Enabled = true;
  637. this.cbProductSN.Enabled = true;
  638. //演示重新开始
  639. Thread.Sleep(1000);
  640. if(SysMgr.Instance.GetYanShiValue())
  641. {
  642. tsbtnStart_Click(null, null);
  643. }
  644. }
  645. else if (e.Cmd == 21) //厚度显示
  646. {
  647. double value = Math.Round(e.Value.Average(), 2);
  648. double valueMax = e.Value.Max();
  649. double valueMin = e.Value.Min();
  650. Color color = (e.Value_up + e.Value_low > 0 && (value > e.Value_up || value < e.Value_low)) ? Color.Red : Color.White;
  651. Color colorMax = (e.Value_up + e.Value_low > 0 && (valueMax > e.Value_up || valueMax < e.Value_low)) ? Color.Red : Color.White;
  652. Color colorMin = (e.Value_up + e.Value_low > 0 && (valueMin > e.Value_up || valueMin < e.Value_low)) ? Color.Red : Color.White;
  653. this.lblHeight.Text = Math.Round(value, 2).ToString();
  654. this.lblHeight.ForeColor = color;
  655. this.lblHeightMax.Text = Math.Round(valueMax, 2).ToString();
  656. this.lblHeightMax.ForeColor = colorMax;
  657. this.lblHeightMin.Text = Math.Round(valueMin, 2).ToString();
  658. this.lblHeightMin.ForeColor = colorMin;
  659. }
  660. else if (e.Cmd == 22) //PT显示
  661. {
  662. double value = Math.Round(e.Value.Average(), 4);
  663. double valueMax = e.Value.Max();
  664. double valueMin = e.Value.Min();
  665. Color color = (e.Value_up + e.Value_low > 0 && (value > e.Value_up || value < e.Value_low)) ? Color.Red : Color.White;
  666. Color colorMax = (e.Value_up + e.Value_low > 0 && (valueMax > e.Value_up || valueMax < e.Value_low)) ? Color.Red : Color.White;
  667. Color colorMin = (e.Value_up + e.Value_low > 0 && (valueMin > e.Value_up || valueMin < e.Value_low)) ? Color.Red : Color.White;
  668. this.lblPT.Text = Math.Round(value, 4).ToString();
  669. this.lblPT.ForeColor = color;
  670. this.lblPTMax.Text = Math.Round(valueMax, 4).ToString();
  671. this.lblPTMax.ForeColor = colorMax;
  672. this.lblPTMin.Text = Math.Round(valueMin, 4).ToString();
  673. this.lblPTMin.ForeColor = colorMin;
  674. }
  675. else if (e.Cmd == 23) //线宽显示
  676. {
  677. double value = Math.Round(e.Value.Average(), 2);
  678. double valueMax = e.Value.Max();
  679. double valueMin = e.Value.Min();
  680. Color color = (e.Value_up + e.Value_low > 0 && (value > e.Value_up || value < e.Value_low)) ? Color.Red : Color.White;
  681. Color colorMax = (e.Value_up + e.Value_low > 0 && (valueMax > e.Value_up || valueMax < e.Value_low)) ? Color.Red : Color.White;
  682. Color colorMin = (e.Value_up + e.Value_low > 0 && (valueMin > e.Value_up || valueMin < e.Value_low)) ? Color.Red : Color.White;
  683. this.lblLineWidth.Text = Math.Round(value, 2).ToString();
  684. this.lblLineWidth.ForeColor = color;
  685. this.lblLineWidthMax.Text = Math.Round(valueMax, 2).ToString();
  686. this.lblLineWidthMax.ForeColor = colorMax;
  687. this.lblLineWidthMin.Text = Math.Round(valueMin, 2).ToString();
  688. this.lblLineWidthMin.ForeColor = colorMin;
  689. }
  690. else if (e.Cmd == 30) //新流程 厚度, 张力, pt, 线宽显示
  691. {
  692. Control[] controls = flpProcessStep.Controls.Find("Step_" + (e.StepIndex +1), true);
  693. //滚动条滚动
  694. //int scrollStep = (this.flpProcessStep.VerticalScroll.Maximum / (flpProcessStep.Controls.Count - 1));
  695. this.flpProcessStep.VerticalScroll.Value = e.StepIndex * controls[0].Height > this.flpProcessStep.VerticalScroll.Maximum? this.flpProcessStep.VerticalScroll.Maximum: e.StepIndex * controls[0].Height;
  696. if (!e.ProcessType)
  697. {
  698. NewStepShow newStepShow = controls[0] as NewStepShow;
  699. if (e.Mesg == "镜头变焦")
  700. {
  701. string str1 = e.Value_ave == 0 ? "开启自动聚焦" : "关闭自动聚焦";
  702. string str2 = e.Value_up == 0 ? "自动变倍" : "手动变倍";
  703. string str3 = e.Value_low == 0 ? "自动Z轴聚焦" : "手动Z轴聚焦";
  704. string ShowData = e.Mesg + $"-{str1}-{str2}-{str3}";
  705. newStepShow.StepString = ShowData;
  706. }
  707. if (e.Mesg == "光源设置")
  708. {
  709. string ShowData = e.Mesg + $":通道号:{e.Value_up},亮度:{e.Value_low}";
  710. newStepShow.StepString = ShowData;
  711. }
  712. else
  713. {
  714. newStepShow.StepMax = e.Value_up;
  715. newStepShow.StepMin = e.Value_low;
  716. newStepShow.StepData = e.Value_ave;
  717. newStepShow.StepMaxMin = e.Value_up - e.Value_low;
  718. if (e.Value != null && e.Value.Count > 0)
  719. {
  720. string ShowData = e.Mesg + $"1:{e.Value[0].ToString($"f{newStepShow.DataLen}")}";
  721. for (int i = 1; i < e.Value.Count; i++)
  722. {
  723. ShowData += $",{e.Mesg}{i + 1}:{e.Value[i].ToString($"f{newStepShow.DataLen}")}";
  724. }
  725. newStepShow.StepString = ShowData;
  726. }
  727. else
  728. newStepShow.StepString = e.Mesg;
  729. }
  730. if (e.ProcessSts == 1)
  731. newStepShow.StepStatus = NewStepShow.StepStsEnum.Testing;
  732. else if (e.ProcessSts == 2)
  733. newStepShow.StepStatus = NewStepShow.StepStsEnum.OK;
  734. else if (e.ProcessSts == 3)
  735. newStepShow.StepStatus = NewStepShow.StepStsEnum.NG;
  736. else if (e.ProcessSts == 0)
  737. newStepShow.StepStatus = NewStepShow.StepStsEnum.Skip;
  738. else if (e.ProcessSts == 4)
  739. newStepShow.StepStatus = NewStepShow.StepStsEnum.Error;
  740. }
  741. else
  742. {
  743. NewStepShowDefect newStepShowDef = controls[0] as NewStepShowDefect;
  744. if (newStepShowDef != null)
  745. {
  746. newStepShowDef.StepString = e.Mesg;
  747. if (e.ProcessSts == 1)
  748. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.Testing;
  749. else if (e.ProcessSts == 2)
  750. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.OK;
  751. else if (e.ProcessSts == 3)
  752. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.NG;
  753. else if (e.ProcessSts == 0)
  754. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.Skip;
  755. else if (e.ProcessSts == 4)
  756. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.Error;
  757. if (e.Value_ave == 0)
  758. {
  759. newStepShowDef.StepSizeData = (int)e.Value_up;
  760. if (e.Value_up > 0)
  761. newStepShowDef.StepSizeSts = NewStepShowDefect.StepResultEnum.NG;
  762. else if (e.Value_up < 0)
  763. newStepShowDef.StepSizeSts = NewStepShowDefect.StepResultEnum.None;
  764. else if (e.Value_up == 0)
  765. newStepShowDef.StepSizeSts = NewStepShowDefect.StepResultEnum.OK;
  766. else
  767. newStepShowDef.StepSizeSts = NewStepShowDefect.StepResultEnum.Error;
  768. }
  769. else
  770. {
  771. if (e.Value_low == 0)
  772. newStepShowDef.StepDefectData = (int)e.Value_low;
  773. else if (e.Value_low > 0)
  774. newStepShowDef.StepDefectData = newStepShowDef.StepDefectData + (int)e.Value_low;
  775. //if (e.Value_low > 0)
  776. // newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.NG;
  777. //else if (e.Value_low < 0)
  778. // newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.None;
  779. //else if ((e.Value_low == 0)&&(e.Value_up == 0))
  780. // newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.OK;
  781. if ((e.Value_up == -1) && (e.Value_low == -1))
  782. newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.Error;
  783. else if (e.Value_up == 1)
  784. newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.Testing;
  785. else if (e.Value_up == 0)
  786. {
  787. newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.Done;
  788. newStepShowDef.StepDefectData = (int)e.Value_low;
  789. }
  790. }
  791. }
  792. }
  793. }
  794. else if (e.Cmd == 31) //忽略流程 厚度, 张力, pt, 线宽显示
  795. {
  796. Control[] controls = flpProcessStep.Controls.Find("Step_" + (e.StepIndex + 1), true);
  797. if (controls != null)
  798. {
  799. if (!e.ProcessType)
  800. {
  801. NewStepShow newStepShow = controls[0] as NewStepShow;
  802. newStepShow.StepMax = 0;
  803. newStepShow.StepMin = 0;
  804. newStepShow.StepData = 0;
  805. string ShowData = e.Mesg;
  806. newStepShow.StepString = ShowData;
  807. if (e.ProcessSts == 4)
  808. newStepShow.StepStatus = NewStepShow.StepStsEnum.Error;
  809. else
  810. newStepShow.StepStatus = NewStepShow.StepStsEnum.Skip;
  811. }
  812. else
  813. {
  814. NewStepShowDefect newStepShowDef = controls[0] as NewStepShowDefect;
  815. newStepShowDef.StepStatus = NewStepShowDefect.StepStsEnum.Skip;
  816. newStepShowDef.StepDefectData = -1;
  817. newStepShowDef.StepDefectSts = NewStepShowDefect.StepResultEnum.None;
  818. newStepShowDef.StepSizeData = -1;
  819. newStepShowDef.StepSizeSts = NewStepShowDefect.StepResultEnum.None;
  820. newStepShowDef.StepString = "未启用或被禁用";
  821. newStepShowDef.StepString = e.Mesg;
  822. }
  823. }
  824. }
  825. else if (e.Cmd == 36) //显示主图
  826. {
  827. if (e.PicIndex == 0)
  828. {
  829. bmp0 = (Bitmap)e.Map.Clone();
  830. picScanner0.Image = bmp0;
  831. picScanner0.Refresh();
  832. }
  833. else
  834. {
  835. bmp1 = (Bitmap)e.Map.Clone();
  836. picScanner1.Image = bmp1;
  837. picScanner1.Refresh();
  838. }
  839. }
  840. Application.DoEvents();
  841. }
  842. catch { }
  843. }
  844. }
  845. void ShowNewStepProcess(List<StepProcess> list)
  846. {
  847. flpProcessStep.Controls.Clear();
  848. int index = 0;
  849. int splitWidth = 5;
  850. foreach (StepProcess stepProcess in list)
  851. {
  852. index++;
  853. if (stepProcess.ProcessCode != "SizeAndDefect")
  854. {
  855. NewStepShow newStepShow = new NewStepShow();
  856. int dl = 4;
  857. if(stepProcess.ProcessCode == "PointTest")
  858. {
  859. string tp = JObject.Parse(stepProcess.ProcessParams).Value<string>("TestType");
  860. var tdl = ConfMgr.Instance.SizeItemParamsList.Find(x => x.Name == tp);
  861. if (tdl != null) { dl = tdl.dataLen; }
  862. }
  863. newStepShow.DataLen = dl;
  864. newStepShow.Width = flpProcessStep.Width - splitWidth * 2 - 30;
  865. newStepShow.StepName = stepProcess.ProcessName;
  866. newStepShow.StepIndex = index;
  867. newStepShow.StepMax = 0;
  868. newStepShow.StepMin = 0;
  869. newStepShow.StepData = 0;
  870. newStepShow.StepString = "";
  871. newStepShow.StepStatus = NewStepShow.StepStsEnum.Wait;
  872. newStepShow.Margin = new Padding(splitWidth, splitWidth, 0, 0);
  873. newStepShow.Name = "Step_" + index;
  874. flpProcessStep.Controls.Add(newStepShow);
  875. }
  876. else
  877. {
  878. NewStepShowDefect newStepShowDefect = new NewStepShowDefect();
  879. newStepShowDefect.Width = flpProcessStep.Width - splitWidth * 2 - 30;
  880. newStepShowDefect.StepName = stepProcess.ProcessName;
  881. newStepShowDefect.StepIndex = index;
  882. bool opensize = JObject.Parse(stepProcess.ProcessParams).Value<bool>("OpenSize");
  883. newStepShowDefect.StepSizeSts = opensize ? NewStepShowDefect.StepResultEnum.Wait: NewStepShowDefect.StepResultEnum.None;
  884. newStepShowDefect.StepSizeData = -1;
  885. bool opendefect = JObject.Parse(stepProcess.ProcessParams).Value<bool>("OpenDefect");
  886. newStepShowDefect.StepDefectSts = opendefect? NewStepShowDefect.StepResultEnum.Wait: NewStepShowDefect.StepResultEnum.None;
  887. newStepShowDefect.StepDefectData = -1;
  888. newStepShowDefect.StepString = "";
  889. newStepShowDefect.StepStatus = NewStepShowDefect.StepStsEnum.Wait;
  890. newStepShowDefect.Margin = new Padding(splitWidth, splitWidth, 0, 0);
  891. newStepShowDefect.Name = "Step_" + index;
  892. flpProcessStep.Controls.Add(newStepShowDefect);
  893. }
  894. }
  895. }
  896. /// <summary>
  897. /// 缺陷小图多图显示
  898. /// </summary>
  899. /// <param name="sender"></param>
  900. /// <param name="e"></param>
  901. private void auto_ShowMoreImg(object sender, ImgEventArgs e)
  902. {
  903. ShowImgEvent(e);
  904. }
  905. private delegate void ShowImgEventDelegate(ImgEventArgs e);
  906. private void ShowImgEvent(ImgEventArgs e)
  907. {
  908. if (InvokeRequired)
  909. {
  910. ShowImgEventDelegate smd = new ShowImgEventDelegate(ShowImgEvent);
  911. this.BeginInvoke(smd, e);
  912. }
  913. else
  914. {
  915. //Task<int> tt = new Task<int>(() =>
  916. //{
  917. //lock (AddPicLock)
  918. {
  919. //加载缺陷小图
  920. //纵向显示
  921. int imgWidth = this.pnlBmpList.ClientSize.Width - 50;
  922. int imgHeight = (int)((e.Bitmaps[0].Height * 1.0f / e.Bitmaps[0].Width) * imgWidth + 0.5);
  923. int splitWidth = 20;
  924. int pnlWidth = this.pnlBmpList.ClientSize.Width;
  925. int index = (int)this.gboxDefectList.Tag;
  926. //横向显示
  927. //int imgHeight = this.pnlBmpList.Height - 50;
  928. //int imgWidth = (int)((e.Bitmaps[0].Width * 1.0f / e.Bitmaps[0].Height) * imgHeight + 0.5);
  929. //int splitWidth = 20;
  930. //int pnlWidth = this.pnlBmpList.Height;
  931. //int index = (int)this.gboxDefectList.Tag;
  932. int len = e.Info.Count();
  933. int range = 100;
  934. int uselen = len > 100 ? 100 : len;
  935. for (int x = 0; x < uselen / range + 1; x++)
  936. {
  937. for (int i = 0; i < (x < (uselen / range) ? range : uselen % range); i++)
  938. {
  939. foreach (var item in e.Info[(x * range + i)]) //单个info[x] = {"1":[["92.7542","80.85799","99.54083","86.05363","dk","0.52"]]}
  940. {
  941. //统计缺陷类型
  942. SysMgr.Instance.countDefectClass(item.Value);//[["92.7542","80.85799","99.54083","86.05363","dk","0.52"]]
  943. //
  944. PictureBox picbox = new PictureBox();
  945. picbox.Width = imgWidth;
  946. picbox.Height = imgHeight;
  947. picbox.Image = (Bitmap)e.Bitmaps[(x * range + i)].Clone();
  948. picbox.Name = "imgDefect_" + index;
  949. picbox.Tag = item.Key + "," + e.X + "," + e.Y;
  950. picbox.Click += new EventHandler(defectBmpBox_Click);
  951. picbox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  952. picbox.BorderStyle = BorderStyle.FixedSingle;
  953. //picbox.Margin = new Padding((pnlWidth - picbox.Height) / 2, splitWidth, 0, 0);
  954. picbox.Margin = new Padding((pnlWidth - picbox.Width) / 2, splitWidth, 0, 0);
  955. picbox.MouseHover += simpleTip_MouseHover;
  956. picbox.Visible = true;
  957. //this.Invoke(new MethodInvoker(() =>
  958. // {
  959. this.pnlBmpList.Controls.Add(picbox);
  960. //this.Refresh();
  961. //this.dgvProcess.Refresh();
  962. //this.lstLog.Refresh();
  963. //this.statusStrip1.Refresh();
  964. // }));
  965. break;
  966. }
  967. //
  968. index++;
  969. //Thread.Sleep(10);
  970. //Application.DoEvents();
  971. }
  972. //Application.DoEvents();
  973. //this.Invoke(new MethodInvoker(() =>
  974. //{
  975. //this.Refresh();
  976. pnlBmpList.VerticalScroll.Value = pnlBmpList.VerticalScroll.Maximum;
  977. //}));
  978. //Thread.Sleep(10);
  979. }
  980. //this.Invoke(new MethodInvoker(() =>
  981. //{
  982. //this.gboxDefectList.Tag = len + (int)this.gboxDefectList.Tag;
  983. this.gboxDefectList.Tag = index;
  984. this.gboxDefectList.Text = $"缺陷图像:{index} 张";
  985. }
  986. //}));
  987. //return 0;
  988. // });
  989. // tt.Start();
  990. // await tt;
  991. }
  992. }
  993. /// <summary>
  994. /// 尺寸小图多图显示
  995. /// </summary>
  996. /// <param name="sender"></param>
  997. /// <param name="e"></param>
  998. private void auto_SizeShowMoreImg(object sender, ImgEventArgs e)
  999. {
  1000. SizeShowImgEvent(e);
  1001. }
  1002. private delegate void SizeShowImgEventDelegate(ImgEventArgs e);
  1003. private void SizeShowImgEvent(ImgEventArgs e)
  1004. {
  1005. if (InvokeRequired)
  1006. {
  1007. SizeShowImgEventDelegate smd = new SizeShowImgEventDelegate(SizeShowImgEvent);
  1008. this.BeginInvoke(smd, e);
  1009. }
  1010. else
  1011. {
  1012. //Task<int> tt = new Task<int>(() =>
  1013. //{
  1014. //lock (AddPicLock)
  1015. //加载缺陷小图
  1016. //纵向显示
  1017. int imgWidth = this.pnlSizeBmpList.ClientSize.Width - 50;
  1018. int imgHeight = (int)((e.Bitmaps[0].Height * 1.0f / e.Bitmaps[0].Width) * imgWidth + 0.5);
  1019. int splitWidth = 20;
  1020. int pnlWidth = this.pnlSizeBmpList.ClientSize.Width;
  1021. int index = (int)this.gboxSizeDefectList.Tag;
  1022. //
  1023. PictureBox picbox = new PictureBox();
  1024. picbox.Width = imgWidth;
  1025. picbox.Height = imgHeight;
  1026. picbox.Image = (Bitmap)e.Bitmaps[0].Clone();
  1027. picbox.Name = "imgSize_" + index;
  1028. picbox.Tag = index + "," + e.X + "," + e.Y;
  1029. picbox.Click += new EventHandler(defectBmpBox2_Click);
  1030. picbox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  1031. picbox.BorderStyle = BorderStyle.FixedSingle;
  1032. //picbox.Margin = new Padding((pnlWidth - picbox.Height) / 2, splitWidth, 0, 0);
  1033. picbox.Margin = new Padding((pnlWidth - picbox.Width) / 2, splitWidth, 0, 0);
  1034. picbox.MouseHover += simpleTip_MouseHover;
  1035. picbox.Visible = true;
  1036. this.pnlSizeBmpList.Controls.Add(picbox);
  1037. index++;
  1038. pnlSizeBmpList.VerticalScroll.Value = pnlSizeBmpList.VerticalScroll.Maximum;
  1039. this.gboxSizeDefectList.Tag = index;
  1040. this.gboxSizeDefectList.Text = $"尺寸图像:{index} 张";
  1041. }
  1042. }
  1043. #endregion
  1044. #region 工具栏
  1045. private void tsbtnImpStop_Click(object sender, EventArgs e)
  1046. {
  1047. SysMgr.Instance.LedPause();
  1048. AddTextEvent("急停", "手动急停", WarningEnum.High);
  1049. this.tsbtnStart.Enabled = false;
  1050. this.tsbtnReset.Enabled = false;
  1051. SysMgr.Instance.StatusMgr.GotoWarning( WarningEnum.High, "急停", "手动急停");
  1052. SysMgr.Instance.SendStatus();
  1053. SysMgr.Instance.EmergencyStop();
  1054. }
  1055. private void tsbOpenLight_Click(object sender, EventArgs e)
  1056. {
  1057. if (this.tsbOpenLight.Text == "开灯")
  1058. {
  1059. SysMgr.Instance.OpenFloodlight(true);
  1060. this.tsbOpenLight.Text = "关灯";
  1061. }
  1062. else
  1063. {
  1064. SysMgr.Instance.OpenFloodlight(false);
  1065. this.tsbOpenLight.Text = "开灯";
  1066. }
  1067. }
  1068. private void tsbtnStart_Click(object sender, EventArgs e)
  1069. {
  1070. if (!SysMgr.Instance.IsRuning)
  1071. {
  1072. //低报警自动复位
  1073. if(SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Warning)
  1074. {
  1075. if (SysMgr.Instance.StatusMgr.Warning == WarningEnum.Low)
  1076. {
  1077. SysMgr.Instance.StatusMgr.ClearWarning();
  1078. SysMgr.Instance.StatusMgr.GotoNormalStandby();
  1079. }
  1080. }
  1081. //提示正在报警中
  1082. if (SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Warning)
  1083. {
  1084. FrmDialog.ShowDialog(this, "系统报警中!无法启动运行!", "警告", false);
  1085. return;
  1086. }
  1087. this.Cursor = Cursors.WaitCursor;
  1088. //System.Windows.Forms.Application.DoEvents();
  1089. if (SysMgr.Instance.StatusMgr.Status != SystemStsEnum.Pause)
  1090. {
  1091. ResetUI(false);
  1092. AddTextEvent("运行", $"启动自动检测流程");
  1093. this.lstLog.Refresh();
  1094. if (SysMgr.Instance.StartRun(this, this.cbOrderCode.Text, (int)this.numDefectCnt.Value, this.cbProductCode.Text, this.cbProductSN.Text))
  1095. {
  1096. this.tsbtnStop.Enabled = true;
  1097. this.tsbtnStart.Enabled = false;
  1098. //锁定信息
  1099. this.cbOrderCode.Enabled = false;
  1100. this.cbProductCode.Enabled = false;
  1101. this.cbProductSN.Enabled = false;
  1102. //记录开始运行时间
  1103. RunStartTime.Restart();
  1104. }
  1105. }
  1106. else //暂停状态开始
  1107. {
  1108. if (SysMgr.Instance.ReStartRun())
  1109. {
  1110. this.tsbtnStop.Enabled = true;
  1111. this.tsbtnStart.Enabled = false;
  1112. }
  1113. }
  1114. this.Cursor = Cursors.Default;
  1115. }
  1116. }
  1117. private void tsbtnStop_Click(object sender, EventArgs e)
  1118. {
  1119. AddTextEvent("暂停", "手动暂停");
  1120. this.tsbtnStart.Enabled = true;
  1121. SysMgr.Instance.StatusMgr.GotoPause();
  1122. SysMgr.Instance.SendStatus();
  1123. SysMgr.Instance.LedPause();
  1124. //this.tsbtnStart.Enabled = true;
  1125. }
  1126. private void tsbtnReset_Click(object sender, EventArgs e)
  1127. {
  1128. if (SystemIsRun())
  1129. {
  1130. DialogResult dr = DialogResult.Cancel;
  1131. dr = FrmDialog.ShowDialog(this, "确定要复位当前系统?", "警告", true);
  1132. if (dr == DialogResult.OK)
  1133. {
  1134. this.Cursor = Cursors.WaitCursor;
  1135. this.tsbtnStart.Enabled = false;
  1136. //this.tsbtnStop.Enabled = false;
  1137. //Task.Factory.StartNew(() =>
  1138. //{
  1139. SysMgr.Instance.LedRset(true);
  1140. SysMgr.Instance.GotoReadyPosAndIO();
  1141. SysMgr.Instance.LedRset(false);
  1142. this.tsbtnStart.Enabled = true;
  1143. this.tsbtnStop.Enabled = false;
  1144. //});
  1145. this.Cursor = Cursors.Default;
  1146. ResetUI(true);
  1147. //AddTextEvent("复位", "复位完成");
  1148. }
  1149. }
  1150. }
  1151. private void tsbtnWarning_Click(object sender, EventArgs e)
  1152. {
  1153. if(SysMgr.Instance.StatusMgr.Warning != WarningEnum.Normal)
  1154. {
  1155. AddTextEvent("清除", "手动清除报警");
  1156. SysMgr.Instance.StatusMgr.ClearWarning();
  1157. SysMgr.Instance.LedReady();
  1158. if (SysMgr.Instance.IsAuto)
  1159. SysMgr.Instance.StatusMgr.GotoPause();
  1160. else
  1161. SysMgr.Instance.StatusMgr.GotoNormalStandby();
  1162. SysMgr.Instance.SendStatus();
  1163. }
  1164. }
  1165. private void tsbGoHome_Click(object sender, EventArgs e)
  1166. {
  1167. if (SystemIsRun())
  1168. {
  1169. DialogResult dr = DialogResult.Cancel;
  1170. dr = FrmDialog.ShowDialog(this, "确定要复位当前系统所有硬件位置?", "警告", true);
  1171. if (dr == DialogResult.OK)
  1172. {
  1173. this.tsbtnStart.Enabled = false;
  1174. this.tsbtnReset.Enabled = false;
  1175. this.tsbtnStop.Enabled = false;
  1176. this.Cursor = Cursors.WaitCursor;
  1177. System.Windows.Forms.Application.DoEvents();
  1178. //Task.Factory.StartNew(() =>
  1179. //{
  1180. SysMgr.Instance.LedRset(true);
  1181. SysMgr.Instance.AllResetAndGoHome();
  1182. SysMgr.Instance.LedRset(false);
  1183. this.tsbtnStart.Enabled = true;
  1184. this.tsbtnReset.Enabled = true;
  1185. this.tsbtnStop.Enabled = false;
  1186. //});
  1187. this.Cursor = Cursors.Default;
  1188. }
  1189. }
  1190. }
  1191. //缺陷+比对与图纸查看
  1192. private void tsbtnDefectImage_Click(object sender, EventArgs e)
  1193. {
  1194. try
  1195. {
  1196. string gbxBmpPath = "";
  1197. Order temp_order = null;
  1198. if (SysMgr.Instance.GetDefectDistribution(out gbxBmpPath, out temp_order))
  1199. {
  1200. //
  1201. ToolStripButton btn = sender as ToolStripButton;
  1202. DefectImageShowFrm frm = new DefectImageShowFrm(gbxBmpPath , temp_order, string.IsNullOrEmpty(btn.Tag.ToString()) ? 0 : Convert.ToInt32(btn.Tag.ToString()));
  1203. frm.Show();
  1204. }
  1205. }
  1206. catch (Exception ex)
  1207. {
  1208. MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
  1209. }
  1210. }
  1211. #endregion
  1212. #region 小图操作
  1213. private void defectBmpBox_Click(object sender, EventArgs e)
  1214. {
  1215. PictureBox picbox = sender as PictureBox;
  1216. if (SysMgr.Instance.IsAuto || SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Auto)//检测中
  1217. {
  1218. //只查看
  1219. AddTextEvent("查看", $"运行中查看缺陷{SysMgr.Instance.IsAuto} - {SysMgr.Instance.StatusMgr.Status}");
  1220. ImageShowFrm frm = new ImageShowFrm(this.pnlBmpList.Controls, Convert.ToInt32(picbox.Name.Split(new char[] { '_' })[1]));
  1221. frm.ShowDialog(this);
  1222. }
  1223. else//完成
  1224. {
  1225. AddTextEvent("查看", $"查看缺陷{ConfMgr.Instance.SysConfigParams.OpenDefectSanp}");
  1226. ImageShowFrm frm = new ImageShowFrm(this.pnlBmpList.Controls,
  1227. Convert.ToInt32(picbox.Name.Split(new char[] { '_' })[1]), ConfMgr.Instance.SysConfigParams.OpenDefectSanp);
  1228. frm.ShowDialog(this);
  1229. }
  1230. }
  1231. private void defectBmpBox2_Click(object sender, EventArgs e)
  1232. {
  1233. PictureBox picbox = sender as PictureBox;
  1234. if (SysMgr.Instance.IsAuto || SysMgr.Instance.StatusMgr.Status == SystemStsEnum.Auto)//检测中
  1235. {
  1236. //只查看
  1237. AddTextEvent("查看", $"运行中查看缺陷{SysMgr.Instance.IsAuto} - {SysMgr.Instance.StatusMgr.Status}");
  1238. ImageShowFrm frm = new ImageShowFrm(this.pnlSizeBmpList.Controls, Convert.ToInt32(picbox.Name.Split(new char[] { '_' })[1]));
  1239. frm.ShowDialog(this);
  1240. }
  1241. else//完成
  1242. {
  1243. AddTextEvent("查看", $"查看缺陷{ConfMgr.Instance.SysConfigParams.OpenDefectSanp}");
  1244. ImageShowFrm frm = new ImageShowFrm(this.pnlSizeBmpList.Controls,
  1245. Convert.ToInt32(picbox.Name.Split(new char[] { '_' })[1]));
  1246. frm.ShowDialog(this);
  1247. }
  1248. }
  1249. private void simpleTip_MouseHover(object sender, EventArgs e)
  1250. {
  1251. PictureBox pb = sender as PictureBox;
  1252. // 创建the ToolTip
  1253. ToolTip toolTip1 = new ToolTip();
  1254. // 设置显示样式
  1255. toolTip1.AutoPopDelay = 5000;//提示信息的可见时间
  1256. toolTip1.InitialDelay = 500;//事件触发多久后出现提示
  1257. toolTip1.ReshowDelay = 500;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
  1258. toolTip1.ShowAlways = true;//是否显示提示框
  1259. // 设置伴随的对象.
  1260. toolTip1.SetToolTip(pb, pb.Name + "[" +pb.Tag.ToString() + "]");//设置提示按钮和提示内容
  1261. }
  1262. #endregion
  1263. #region 时钟捕获
  1264. GetPN pn = new GetPN();
  1265. private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  1266. {
  1267. while (backgroundWorkerDo)
  1268. {
  1269. try
  1270. {
  1271. this.Invoke(new MethodInvoker(() =>
  1272. {
  1273. this.tsslLoginTime.Text = $" 当前时间:{DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")}";
  1274. }));
  1275. //检测按钮和实时状态
  1276. if (SysMgr.Instance.IsInit)
  1277. {
  1278. bool sts = SysMgr.Instance.WarningShowLed(DisEnableBuzz);
  1279. if (sts)
  1280. {
  1281. this.Invoke(new MethodInvoker(() =>
  1282. {
  1283. this.tsbtnStart.Enabled = true;
  1284. this.tsbtnStop.Enabled = false;
  1285. }));
  1286. }
  1287. int stsno = 0;
  1288. stsno = SysMgr.Instance.ButtonIOTrg(DisEnableDoor);
  1289. if (stsno == 1)
  1290. {
  1291. this.Invoke(new MethodInvoker(() =>
  1292. {
  1293. tsbtnStart_Click(null, null);
  1294. }));
  1295. }
  1296. else if (stsno == 2)
  1297. {
  1298. this.Invoke(new MethodInvoker(() =>
  1299. {
  1300. this.tsbtnStart.Enabled = true;
  1301. }));
  1302. SysMgr.Instance.LedPause();
  1303. }
  1304. else if (stsno == 3)
  1305. {
  1306. this.Invoke(new MethodInvoker(() =>
  1307. {
  1308. tsbtnReset_Click(null, null);
  1309. }));
  1310. }
  1311. else if (stsno == 4) //老流程张力读取
  1312. {
  1313. TensionResult tensionResult;
  1314. if (SysMgr.Instance.TensionGetValue(out tensionResult) >= 0)
  1315. {
  1316. this.Invoke(new MethodInvoker(() =>
  1317. {
  1318. this.lblTension.Text = Math.Round(tensionResult.value, 2).ToString();
  1319. this.lblTension.ForeColor = tensionResult.color;
  1320. this.lblTensionMax.Text = Math.Round(tensionResult.valueMax, 2).ToString();
  1321. this.lblTensionMax.ForeColor = tensionResult.colorMax;
  1322. this.lblTensionMin.Text = Math.Round(tensionResult.valueMin, 2).ToString();
  1323. this.lblTensionMin.ForeColor = tensionResult.colorMin;
  1324. }));
  1325. }
  1326. }
  1327. else if (stsno == 5) //新流程张力读取
  1328. {
  1329. //this.Invoke(new MethodInvoker(() =>
  1330. //{
  1331. // tsbtnReset_Click(null, null);
  1332. //}));
  1333. }
  1334. //显示实际位置
  1335. this.Invoke(new MethodInvoker(() =>
  1336. {
  1337. tsAxisState.Text = SysMgr.Instance.GetAxisPos();
  1338. }));
  1339. }
  1340. if (pn.P(SysMgr.Instance.IsRuning))
  1341. {
  1342. //继续计时
  1343. RunStartTime.Start();
  1344. }
  1345. if (pn.N(SysMgr.Instance.IsRuning))
  1346. {
  1347. //停止计时
  1348. RunStartTime.Stop();
  1349. }
  1350. if (SysMgr.Instance.IsRuning)
  1351. {
  1352. //实时显示
  1353. RunStartTime.Stop();
  1354. this.Invoke(new MethodInvoker(() =>
  1355. {
  1356. tslabelTime.Text = "实时测试:" + ((double)RunStartTime.ElapsedMilliseconds / 1000.0).ToString("0.000") + "s";
  1357. //this.Refresh();
  1358. }));
  1359. RunStartTime.Start();
  1360. }
  1361. this.Invoke(new MethodInvoker(() =>
  1362. {
  1363. tslbSaveSts.Text = $"保存队列:{SysMgr.Instance.GetSaveQueueCnt()}";
  1364. //this.Refresh();
  1365. }));
  1366. Thread.Sleep(100);
  1367. Application.DoEvents();
  1368. }
  1369. catch (Exception ex){
  1370. AddTextEvent("后台", $"出错-{ex.Message}", WarningEnum.Low);
  1371. }
  1372. }
  1373. }
  1374. /// <summary>
  1375. /// 信号上升沿下降沿捕获
  1376. /// </summary>
  1377. class GetPN
  1378. {
  1379. bool _P = false;
  1380. bool _N = false;
  1381. /// <summary>
  1382. /// 判断上升沿
  1383. /// </summary>
  1384. /// <param name="Value"></param>
  1385. /// <returns></returns>
  1386. public bool P(bool Value)
  1387. {
  1388. if (Value && !_P)
  1389. {
  1390. _P = true;
  1391. return true;
  1392. }
  1393. if (!Value)
  1394. _P = false;
  1395. return false;
  1396. }
  1397. /// <summary>
  1398. /// 判断下降沿
  1399. /// </summary>
  1400. /// <param name="Value"></param>
  1401. /// <returns></returns>
  1402. public bool N(bool Value)
  1403. {
  1404. if (!Value && _N)
  1405. {
  1406. _N = false;
  1407. return true;
  1408. }
  1409. if (Value)
  1410. _N = true;
  1411. return false;
  1412. }
  1413. }
  1414. #endregion
  1415. #region 料号和产品编码选择
  1416. private void txtProductCode_DoubleClick(object sender, EventArgs e)
  1417. {
  1418. try
  1419. {
  1420. string pdtName = SysMgr.Instance.SelectProduct();
  1421. if (!string.IsNullOrWhiteSpace(pdtName))
  1422. this.cbProductCode.Text = pdtName;
  1423. }
  1424. catch { }
  1425. }
  1426. private void txtProductCode_TextChanged(object sender, EventArgs e)
  1427. {
  1428. }
  1429. private void txtProductSN_DoubleClick(object sender, EventArgs e)
  1430. {
  1431. InputFrm frm = new InputFrm(null, "请输入网版编码:");
  1432. if (frm.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(frm.inputData))
  1433. {
  1434. this.cbProductSN.Text = frm.inputData;
  1435. }
  1436. else
  1437. {
  1438. this.cbProductSN.Text = "";
  1439. }
  1440. }
  1441. private string[] pdtlistData;
  1442. private string[] snlistData;
  1443. private void LoadPdtList(List<string> list)
  1444. {
  1445. try
  1446. {
  1447. this.cbProductCode.Items.Clear();
  1448. this.pdtlistData = list.ToArray();
  1449. cbProductCode.Items.AddRange(pdtlistData);//比使用DataSource速度要快一些
  1450. cbProductCode.TextUpdate += cobList_TextUpdate;//重新绑定事件
  1451. cbProductCode.KeyDown += CobList_KeyDown;
  1452. this.cbProductCode.Text = "";
  1453. cbProductCode.Focus();
  1454. cbProductCode.SelectAll();
  1455. }catch { }
  1456. }
  1457. private void LoadSNList(List<string> list)
  1458. {
  1459. this.cbProductSN.Items.Clear();
  1460. this.snlistData = list.ToArray();
  1461. cbProductSN.Items.AddRange(snlistData);//比使用DataSource速度要快一些
  1462. //cbProductSN.TextUpdate += cobList_TextUpdate;//重新绑定事件
  1463. cbProductSN.KeyDown += CobList_KeyDown;
  1464. this.cbProductSN.Text = "";
  1465. cbProductSN.Focus();
  1466. cbProductSN.SelectAll();
  1467. }
  1468. private void CobList_KeyDown(object sender, KeyEventArgs e)
  1469. {
  1470. try
  1471. {
  1472. ComboBox ctrl = sender as ComboBox;
  1473. if (e.KeyCode == Keys.Enter)
  1474. {
  1475. if (ctrl.Items.Count == 1)
  1476. ctrl.Text = ctrl.Items[0].ToString();
  1477. }
  1478. }
  1479. catch { }
  1480. }
  1481. private void cobList_TextUpdate(object sender, EventArgs e)
  1482. {
  1483. try
  1484. {
  1485. ComboBox ctrl = sender as ComboBox;
  1486. ctrl.AutoCompleteMode = AutoCompleteMode.None;
  1487. ctrl.AutoCompleteSource = AutoCompleteSource.None;
  1488. if (ctrl.Text != null)
  1489. {
  1490. string str = ctrl.Text; //获取cb_material控件输入内
  1491. //清空combobox
  1492. ctrl.DataSource = null;
  1493. ctrl.Items.Clear();
  1494. string[] workOrderFiltered;
  1495. if (ctrl.Name == "cbProductCode")
  1496. workOrderFiltered = pdtlistData.Where(x => x.IndexOf(str, StringComparison.CurrentCultureIgnoreCase) != -1).ToArray();//忽略大小写
  1497. else
  1498. workOrderFiltered = snlistData.Where(x => x.IndexOf(str, StringComparison.CurrentCultureIgnoreCase) != -1).ToArray();//忽略大小写
  1499. ctrl.Items.AddRange(workOrderFiltered);//比使用DataSource速度要快一些
  1500. // 不存在符合条件时
  1501. //设置光标位置,若不设置:光标位置始终保持在第一列,造成输入关键词的倒序排列
  1502. ctrl.SelectedIndex = -1;
  1503. //ctrl.SelectionStart = str.Length; // 设置光标位置,若不设置:光标位置始终保持在第一列,造成输入关键词的倒序排列
  1504. if (workOrderFiltered.Length > 0)
  1505. {
  1506. if (!ctrl.DroppedDown)
  1507. {
  1508. ctrl.DroppedDown = true; // 自动弹出下拉框
  1509. ctrl.SelectedText = str;
  1510. }
  1511. }
  1512. ctrl.Cursor = Cursors.Default; //保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置
  1513. ctrl.SelectionStart = str.Length; // 设置光标位置,若不设置:光标位置始终保持在第一列,造成输入关键词的倒序排列
  1514. }
  1515. }
  1516. catch { }
  1517. }
  1518. #endregion
  1519. #region 界面变化
  1520. private void MainFrm_SizeChanged(object sender, EventArgs e)
  1521. {
  1522. if (this.WindowState == FormWindowState.Maximized)
  1523. {
  1524. this.WindowState = FormWindowState.Normal;
  1525. this.Top = 0;
  1526. this.Left = 0;
  1527. this.Width = SystemInformation.WorkingArea.Width;
  1528. this.Height = SystemInformation.WorkingArea.Height;
  1529. }
  1530. }
  1531. private void tsmSysUserMgr_Click(object sender, EventArgs e)
  1532. {
  1533. }
  1534. private void tabPage1_Resize(object sender, EventArgs e)
  1535. {
  1536. int allWidth = this.tabPage1.Width;
  1537. this.flpnlResultData.Width = allWidth;
  1538. kanban1.Width = kanban2.Width = kanban3.Width = kanban4.Width = kanban5.Width = kanban6.Width = (flpnlResultData.Width - 30) / 6;
  1539. tabControl1.Region = new Region(new RectangleF(this.tabPage1.Left, this.tabPage1.Top, this.tabPage1.Width, this.tabPage1.Height));
  1540. }
  1541. private void tabPage2_Resize(object sender, EventArgs e)
  1542. {
  1543. int allWidth = this.tabPage2.Width;
  1544. tabControl1.Region = new Region(new RectangleF(this.tabPage2.Left, this.tabPage2.Top, this.tabPage2.Width, this.tabPage2.Height));
  1545. }
  1546. private void MainFrm_Paint(object sender, PaintEventArgs e)
  1547. {
  1548. this.tsbtnReset.Visible = ConfMgr.Instance.SysConfigParams.ShowResetBtn;
  1549. this.chkBuzzer.Visible = ConfMgr.Instance.SysConfigParams.ShowBuzz;
  1550. this.chkDoorSensor.Visible = ConfMgr.Instance.SysConfigParams.ShowDoorAlm;
  1551. this.tsbtnDefectImage.Visible = ConfMgr.Instance.SysConfigParams.ShowDistribution;
  1552. this.tsbtnSizeImage.Visible = ConfMgr.Instance.SysConfigParams.ShowDistribution;
  1553. toolStripSeparator7.Visible = ConfMgr.Instance.SysConfigParams.ShowDistribution;
  1554. this.tsbCC.Visible = ConfMgr.Instance.SysConfigParams.ShowSizeBtn;
  1555. this.tsbQX.Visible = ConfMgr.Instance.SysConfigParams.ShowDefectBtn;
  1556. toolStripSeparator8.Visible = ConfMgr.Instance.SysConfigParams.ShowSizeBtn || ConfMgr.Instance.SysConfigParams.ShowDefectBtn;
  1557. }
  1558. private void flpProcessStep_SizeChanged(object sender, EventArgs e)
  1559. {
  1560. int splitWidth = 5;
  1561. foreach (Control item in this.flpProcessStep.Controls)
  1562. {
  1563. item.Width = flpProcessStep.Width - splitWidth * 2 - 30;
  1564. }
  1565. this.flpProcessStep.Refresh();
  1566. this.gpbProcessList.Refresh();
  1567. }
  1568. private void cbProductSN_MouseDoubleClick(object sender, MouseEventArgs e)
  1569. {
  1570. this.cbProductSN.Text = "";
  1571. this.cbProductSN.Select();
  1572. }
  1573. #endregion
  1574. private void lblCompareResult_Click(object sender, EventArgs e)
  1575. {
  1576. if (SysMgr.Instance.lstCompareFailZoomImage.Count < 1) return;
  1577. PhotoFrm frm = new PhotoFrm(SysMgr.Instance.lstCompareFailZoomImage);
  1578. frm.ShowDialog();
  1579. }
  1580. #region 演示功能
  1581. private void tsbtnYanShi_Click(object sender, EventArgs e)
  1582. {
  1583. if (this.tsbtnYanShi.Text == "演示开启")
  1584. {
  1585. this.tsbtnYanShi.Text = "演示关闭";
  1586. this.tsbtnYanShi.Image = Resources.交互演示动画__1_;
  1587. SysMgr.Instance.SetYanShiEnable(false);
  1588. }
  1589. else
  1590. {
  1591. this.tsbtnYanShi.Text = "演示开启";
  1592. this.tsbtnYanShi.Image = Resources.交互演示动画;
  1593. SysMgr.Instance.SetYanShiEnable(true);
  1594. }
  1595. }
  1596. #endregion
  1597. }
  1598. }