Commit c096dc5e LN

中英文完善

1 个父辈 aac3d48b
......@@ -87,24 +87,24 @@ namespace TSA_V.DeviceLibrary
{
if (WaitType.Equals(WaitTypeEnum.NodeMove_1))
{
return "[" + Node.NodeName + "]目标位置[" + TargetPosition + "]";
return "[" + Node.NodeName + "]"+ResourceControl.GetString("arrive","到达目标位置")+"[" + TargetPosition + "]";
}
else if (WaitType.Equals(WaitTypeEnum.NodeHome_2))
{
return "[" + Node.NodeName + "]原点返回";
return "[" + Node.NodeName + "]"+ ResourceControl.GetString("homeMove", "原点返回");
}
else if (WaitType.Equals(WaitTypeEnum.IOSingle_6))
{
ConfigIO io = IOManager.getWaitIO(IoType);
return "IO等待[" + io.DisplayStr + "]=[" + IoValue + "]";
return "IO[" + io.DisplayStr + "]=[" + IoValue + "]";
}
else if (WaitType.Equals(WaitTypeEnum.Time_3))
{
return "时间[" + TimeMSeconds + "]毫秒";
return "[" + TimeMSeconds + "]ms";
}
else if (WaitType.Equals(WaitTypeEnum.XYMoveEnd_5))
{
return "XY轴目标 [" + AxisValue + "] ";
return ResourceControl.GetString("xyAxisArrive", "XY轴目标") +" [" + AxisValue + "] ";
//return "XY轴目标[" + MoveAxis.PortName + "][" + AxisValue + "] ";
}
else if (WaitType.Equals(WaitTypeEnum.Temp_4))
......@@ -113,11 +113,11 @@ namespace TSA_V.DeviceLibrary
}
else if (WaitType.Equals(WaitTypeEnum.WaitCode_7))
{
return "输入条码 ";
return ResourceControl.GetString("getBarcode", "输入条码")+" ";
}
else
{
return "Wait位置类型:WaitType=【" + WaitType + "】";
return "WaitType=【" + WaitType + "】";
}
}
public bool IsEnd { get; set; }
......
......@@ -2725,4 +2725,16 @@
<data name="没有找到记录" xml:space="preserve">
<value>No records found</value>
</data>
<data name="arrive" xml:space="preserve">
<value>Reach target position</value>
</data>
<data name="getBarcode" xml:space="preserve">
<value>Enter barcode</value>
</data>
<data name="homeMove" xml:space="preserve">
<value>Return to origin</value>
</data>
<data name="xyAxisArrive" xml:space="preserve">
<value>XYaxial target</value>
</data>
</root>
\ No newline at end of file
......@@ -2702,4 +2702,17 @@
<data name = "handCount" xml:space = "preserve"> <value> 次数 </value> </data>
<data name = "handTime" xml:space = "preserve"> <value> 总时长 </value> </data>
<data name = "FrmWork_linkLabel1_Text" xml:space = "preserve"> <value> reduction </value> </data>
<data name="arrive" xml:space="preserve">
<value>到达目标位置</value>
</data>
<data name="getBarcode" xml:space="preserve">
<value>输入条码</value>
</data>
<data name="homeMove" xml:space="preserve">
<value>原点返回</value>
</data>
<data name="xyAxisArrive" xml:space="preserve">
<value>XY轴目标</value>
</data>
</root>
\ No newline at end of file
......@@ -2874,5 +2874,19 @@
<data name="没有找到记录" xml:space="preserve">
<value>没有找到记录</value>
</data>
<data name = "FrmWork_linkLabel1_Text" xml:space = "preserve"> <value> 显示原图 </value> </data>
<data name="FrmWork_linkLabel1_Text" xml:space="preserve">
<value> 显示原图 </value>
</data>
<data name="arrive" xml:space="preserve">
<value>到达目标位置</value>
</data>
<data name="getBarcode" xml:space="preserve">
<value>输入条码</value>
</data>
<data name="homeMove" xml:space="preserve">
<value>原点返回</value>
</data>
<data name="xyAxisArrive" xml:space="preserve">
<value>XY轴目标</value>
</data>
</root>
\ No newline at end of file
......@@ -309,18 +309,18 @@
<Compile Include="projector\FrmScreenTest.Designer.cs">
<DependentUpon>FrmScreenTest.cs</DependentUpon>
</Compile>
<Compile Include="workForm\FrmAOICheckN.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="workForm\FrmAOICheckN.Designer.cs">
<DependentUpon>FrmAOICheckN.cs</DependentUpon>
</Compile>
<Compile Include="workForm\FrmAOICheck.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="workForm\FrmAOICheck.Designer.cs">
<DependentUpon>FrmAOICheck.cs</DependentUpon>
</Compile>
<Compile Include="workForm\FrmAOICheckO.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="workForm\FrmAOICheckO.Designer.cs">
<DependentUpon>FrmAOICheckO.cs</DependentUpon>
</Compile>
<Compile Include="cameraPlay\CameraPlay.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -499,12 +499,12 @@
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheckN.resx">
<DependentUpon>FrmAOICheckN.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheck.resx">
<DependentUpon>FrmAOICheck.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheckO.resx">
<DependentUpon>FrmAOICheckO.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="cameraPlay\CameraPlay.resx">
<DependentUpon>CameraPlay.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -34,32 +34,24 @@ namespace TSA_V
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.lblInfo = new System.Windows.Forms.Label();
this.lblError = new System.Windows.Forms.Label();
this.lblCurrWorkTime = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.listErrorView = new System.Windows.Forms.ListView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblResult = new System.Windows.Forms.Label();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.chbAllShow = new System.Windows.Forms.CheckBox();
this.btnExit = new System.Windows.Forms.Button();
this.btnRun = new System.Windows.Forms.Button();
this.panelImg = new System.Windows.Forms.Panel();
this.picResult = new Acc.ImageBox.AccImageBox();
this.panel3 = new System.Windows.Forms.Panel();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.listErrorView = new System.Windows.Forms.ListView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chbAllShow = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.picCurr = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.picStand = new System.Windows.Forms.PictureBox();
this.timerChangeImg = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.panelImg.SuspendLayout();
this.panel3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit();
this.SuspendLayout();
//
......@@ -76,99 +68,119 @@ namespace TSA_V
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1327, 670);
this.panel1.Size = new System.Drawing.Size(1251, 778);
this.panel1.TabIndex = 293;
//
// panel4
//
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel4.Controls.Add(this.panel2);
this.panel4.Controls.Add(this.lblError);
this.panel4.Controls.Add(this.lblCurrWorkTime);
this.panel4.Controls.Add(this.btnExit);
this.panel4.Controls.Add(this.listErrorView);
this.panel4.Controls.Add(this.lblResult);
this.panel4.Controls.Add(this.btnUpdateImg);
this.panel4.Controls.Add(this.chbAllShow);
this.panel4.Controls.Add(this.btnExit);
this.panel4.Controls.Add(this.btnRun);
this.panel4.Location = new System.Drawing.Point(1070, 4);
this.panel4.Location = new System.Drawing.Point(654, 546);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(252, 660);
this.panel4.Size = new System.Drawing.Size(592, 226);
this.panel4.TabIndex = 298;
//
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.panel2.AutoScroll = true;
this.panel2.Controls.Add(this.lblInfo);
this.panel2.Location = new System.Drawing.Point(23, 481);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(214, 166);
this.panel2.TabIndex = 297;
this.panel2.Visible = false;
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInfo.ForeColor = System.Drawing.Color.Blue;
this.lblInfo.Location = new System.Drawing.Point(8, 5);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(53, 17);
this.lblInfo.TabIndex = 0;
this.lblInfo.Text = "Result ?";
this.lblInfo.Visible = false;
//
// lblError
//
this.lblError.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblError.ForeColor = System.Drawing.Color.Red;
this.lblError.Location = new System.Drawing.Point(14, 458);
this.lblError.Name = "lblError";
this.lblError.Size = new System.Drawing.Size(231, 175);
this.lblError.TabIndex = 295;
this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblCurrWorkTime
//
this.lblCurrWorkTime.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblCurrWorkTime.Location = new System.Drawing.Point(7, 304);
this.lblCurrWorkTime.Name = "lblCurrWorkTime";
this.lblCurrWorkTime.Size = new System.Drawing.Size(232, 51);
this.lblCurrWorkTime.TabIndex = 291;
this.lblCurrWorkTime.Text = "3秒后自动检测";
this.lblCurrWorkTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// listErrorView
//
// btnExit
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1;
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listErrorView.HideSelection = false;
this.listErrorView.Location = new System.Drawing.Point(3, 3);
this.listErrorView.MultiSelect = false;
this.listErrorView.Name = "listErrorView";
this.listErrorView.Size = new System.Drawing.Size(586, 138);
this.listErrorView.TabIndex = 299;
this.listErrorView.UseCompatibleStateImageBehavior = false;
this.listErrorView.View = System.Windows.Forms.View.List;
this.listErrorView.SelectedIndexChanged += new System.EventHandler(this.listErrorView_SelectedIndexChanged);
//
this.btnExit.BackColor = System.Drawing.SystemColors.Control;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(55, 405);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(134, 46);
this.btnExit.TabIndex = 293;
this.btnExit.Text = "完成";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click_1);
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.修正ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
//
// 修正ToolStripMenuItem
//
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem";
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.修正ToolStripMenuItem.Text = "修正";
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click);
//
// lblResult
//
this.lblResult.Font = new System.Drawing.Font("宋体", 69.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblResult.Font = new System.Drawing.Font("宋体", 60F, System.Drawing.FontStyle.Bold);
this.lblResult.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.lblResult.Location = new System.Drawing.Point(7, 180);
this.lblResult.Location = new System.Drawing.Point(5, 141);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(232, 113);
this.lblResult.Size = new System.Drawing.Size(124, 85);
this.lblResult.TabIndex = 8;
this.lblResult.Text = "?";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnUpdateImg
//
this.btnUpdateImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnUpdateImg.BackColor = System.Drawing.Color.Transparent;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(210, 174);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(124, 46);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
//
// chbAllShow
//
this.chbAllShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.chbAllShow.AutoSize = true;
this.chbAllShow.Checked = true;
this.chbAllShow.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbAllShow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAllShow.Location = new System.Drawing.Point(133, 188);
this.chbAllShow.Name = "chbAllShow";
this.chbAllShow.Size = new System.Drawing.Size(75, 21);
this.chbAllShow.TabIndex = 302;
this.chbAllShow.Text = "显示所有";
this.chbAllShow.UseVisualStyleBackColor = true;
this.chbAllShow.CheckedChanged += new System.EventHandler(this.chbAllShow_CheckedChanged);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.BackColor = System.Drawing.Color.Transparent;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(462, 174);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(124, 46);
this.btnExit.TabIndex = 293;
this.btnExit.Text = "完成";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click_1);
//
// btnRun
//
this.btnRun.BackColor = System.Drawing.SystemColors.Control;
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.BackColor = System.Drawing.Color.Transparent;
this.btnRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRun.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRun.Location = new System.Drawing.Point(55, 355);
this.btnRun.Location = new System.Drawing.Point(336, 174);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(134, 46);
this.btnRun.Size = new System.Drawing.Size(124, 46);
this.btnRun.TabIndex = 7;
this.btnRun.Text = "执行检测";
this.btnRun.UseVisualStyleBackColor = false;
......@@ -183,159 +195,71 @@ namespace TSA_V
this.panelImg.Controls.Add(this.picResult);
this.panelImg.Location = new System.Drawing.Point(4, 4);
this.panelImg.Name = "panelImg";
this.panelImg.Size = new System.Drawing.Size(720, 660);
this.panelImg.Size = new System.Drawing.Size(644, 768);
this.panelImg.TabIndex = 300;
//
// picResult
//
this.picResult.AllowDoubleClick = true;
this.picResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.picResult.BackColor = System.Drawing.Color.Black;
this.picResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.picResult.DragHandleSize = 9;
this.picResult.GridColor = System.Drawing.Color.Black;
this.picResult.GridColorAlternate = System.Drawing.Color.Black;
this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText;
this.picResult.Location = new System.Drawing.Point(0, 0);
this.picResult.Name = "picResult";
this.picResult.Size = new System.Drawing.Size(720, 660);
this.picResult.Size = new System.Drawing.Size(644, 763);
this.picResult.TabIndex = 297;
this.picResult.Paint += new System.Windows.Forms.PaintEventHandler(this.picResult_Paint);
this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick);
//
// panel3
//
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel3.Controls.Add(this.btnUpdateImg);
this.panel3.Controls.Add(this.listErrorView);
this.panel3.Controls.Add(this.chbAllShow);
this.panel3.Controls.Add(this.label2);
this.panel3.Controls.Add(this.picCurr);
this.panel3.Controls.Add(this.label1);
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panel3.Controls.Add(this.picStand);
this.panel3.Location = new System.Drawing.Point(730, 4);
this.panel3.Location = new System.Drawing.Point(654, 4);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(336, 660);
this.panel3.Size = new System.Drawing.Size(592, 539);
this.panel3.TabIndex = 298;
//
// btnUpdateImg
//
this.btnUpdateImg.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(198, 3);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(130, 40);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
//
// listErrorView
//
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1;
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listErrorView.HideSelection = false;
this.listErrorView.Location = new System.Drawing.Point(3, 45);
this.listErrorView.MultiSelect = false;
this.listErrorView.Name = "listErrorView";
this.listErrorView.Size = new System.Drawing.Size(325, 49);
this.listErrorView.TabIndex = 299;
this.listErrorView.UseCompatibleStateImageBehavior = false;
this.listErrorView.View = System.Windows.Forms.View.List;
this.listErrorView.SelectedIndexChanged += new System.EventHandler(this.listErrorView_SelectedIndexChanged);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.修正ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
//
// 修正ToolStripMenuItem
//
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem";
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.修正ToolStripMenuItem.Text = "修正";
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click);
//
// chbAllShow
//
this.chbAllShow.AutoSize = true;
this.chbAllShow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAllShow.Location = new System.Drawing.Point(5, 6);
this.chbAllShow.Name = "chbAllShow";
this.chbAllShow.Size = new System.Drawing.Size(75, 21);
this.chbAllShow.TabIndex = 302;
this.chbAllShow.Text = "显示所有";
this.chbAllShow.UseVisualStyleBackColor = true;
this.chbAllShow.CheckedChanged += new System.EventHandler(this.chbAllShow_CheckedChanged);
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(5, 376);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 300;
this.label2.Text = "效果图";
//
// picCurr
//
this.picCurr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picCurr.BackColor = System.Drawing.Color.Black;
this.picCurr.Location = new System.Drawing.Point(5, 391);
this.picCurr.Name = "picCurr";
this.picCurr.Size = new System.Drawing.Size(327, 263);
this.picCurr.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picCurr.TabIndex = 299;
this.picCurr.TabStop = false;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(5, 97);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 298;
this.label1.Text = "基准";
//
// picStand
//
this.picStand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picStand.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.picStand.BackColor = System.Drawing.Color.Black;
this.picStand.Location = new System.Drawing.Point(5, 112);
this.picStand.Location = new System.Drawing.Point(4, 3);
this.picStand.Name = "picStand";
this.picStand.Size = new System.Drawing.Size(327, 261);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picStand.Size = new System.Drawing.Size(585, 533);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picStand.TabIndex = 297;
this.picStand.TabStop = false;
this.picStand.TabStop = false;
this.picStand.Paint += new System.Windows.Forms.PaintEventHandler(this.picStand_Paint);
//
// FrmAOICheck
// timerChangeImg
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1327, 670);
this.timerChangeImg.Interval = 1000;
this.timerChangeImg.Tick += new System.EventHandler(this.timerChangeImg_Tick);
//
// FrmAOICheckN
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1251, 778);
this.Controls.Add(this.panel1);
this.MaximizeBox = true;
this.Name = "FrmAOICheck";
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "FrmAOICheckN";
this.Text = "AOI检测";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmCamera_Load);
this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown);
this.panel1.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel4.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.panelImg.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picCurr)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).EndInit();
this.ResumeLayout(false);
......@@ -345,16 +269,9 @@ namespace TSA_V
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.Label lblCurrWorkTime;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label lblError;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox picCurr;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox picStand;
private System.Windows.Forms.ListView listErrorView;
private System.Windows.Forms.Panel panelImg;
......@@ -364,5 +281,6 @@ namespace TSA_V
private System.Windows.Forms.Button btnUpdateImg;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem;
private System.Windows.Forms.Timer timerChangeImg;
}
}
\ No newline at end of file

using AccAOI.camera;
using AOI;
using HalconDotNet;
using AOI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using Acc.ImageBox;
using AccAOI;
using System.Runtime.ExceptionServices;
using Acc.ImageBox;
namespace TSA_V
{
public partial class FrmAOICheck : FrmBase
{
private string loadImg = @"\image\wait.gif";
private List<ResultBean> ResultList = new List<ResultBean>();
private AOI.AoiProject CurrProject = null;
private DateTime showTime = DateTime.Now;
......@@ -33,6 +29,13 @@ namespace TSA_V
/// </summary>
private int CheckResult =0;
private int waitSeconds = 0;
public string defFile { get
{
//return @"G:\1.bmp";
return Application.StartupPath + @"\test (2).bmp";
return Application.StartupPath + @"\test.bmp";
}
set { } }
public FrmAOICheck(AoiProject currAoi )
{
InitializeComponent();
......@@ -40,12 +43,9 @@ namespace TSA_V
updateMName = new List<string>();
}
private void FrmCamera_Load(object sender, EventArgs e)
{
FormStatus(false);
{
btnUpdateImg.Visible = false;
timer1.Start();
lblCurrWorkTime.Visible = true;
timer1.Start();
//默认显示程序配置的 图片
if (CurrProject == null)
......@@ -55,32 +55,48 @@ namespace TSA_V
}
else
{
string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
//string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
string extension = Path.GetExtension(currProjectName);
string filename = currProjectName.Replace(extension, ".bmp");
ShowBaseImg(filename,"Base");
//string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
////string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
//string extension = Path.GetExtension(currProjectName);
//string filename = currProjectName.Replace(extension, ".bmp");
//ShowBaseImg(filename,"Base");
}
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", waitSeconds.ToString());
ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", waitSeconds.ToString()));
修正ToolStripMenuItem.Text = ResourceCulture.GetString("FrmAOICheck_btnUpdateImg_Text", "修正");
this.StartPosition=FormStartPosition.CenterParent;
this.WindowState = FormWindowState.Maximized;
timerChangeImg.Start();
timerChangeImg_Tick(null, null);
// this.picResult.Image = CurrProject.standardImage;
}
private string showMsg = "";
private string showErrMsg = "";
private void ShowMsg(string msg)
{
showMsg = msg;
picResult.Invalidate();
}
private void ShowErrMsg(string msg)
{
showErrMsg = msg;
picResult.Invalidate();
}
private void ShowBaseImg(string filePath,string Text)
{
if (File.Exists(filePath))
{
var bmp = new Bitmap(filePath);
this.picResult.Image= Eyemlib.DeepClone(bmp);
this.picResult.Image= Eyemlib.DeepClone(bmp);
bmp.Dispose();
}
}
private void FormStatus(bool open)
{
}
private bool isAutoClose = false;
private void UpdateTextResult(Label label, int result)
{
......@@ -119,63 +135,51 @@ namespace TSA_V
{
if (times <= 1)
{
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......";
ShowMsg( ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......");
}else
{
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString());
}
lblCurrWorkTime.Visible = true;
ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString()));
}
}
else
{
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测");
lblCurrWorkTime.Visible = true;
ShowMsg(ResourceCulture.GetString("开始自动检测", "开始自动检测"));
CheckResult = AoiCheck();
MesUtil.SetAOIResult(CheckResult);
UpdateTextResult(lblResult, CheckResult);
if (CheckResult.Equals(1))
{
isAutoClose = true;
}
else
{
isAutoClose = false;
}
isAutoClose = CheckResult.Equals(1);
}
}
else
{
lblCurrWorkTime.Text = ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0);
lblCurrWorkTime.Visible = true;
{
ShowMsg(ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0));
if (isAutoClose)
{
TimeSpan closeSpan = DateTime.Now - endTime;
int times = 3 - (int)(closeSpan.TotalSeconds);
if (times < 0)
{
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0);
lblCurrWorkTime.Visible = true;
ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0));
this.Close();
}
else
{
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString());
lblCurrWorkTime.Visible = true;
ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString()));
}
}
}
}
public string defFile = @"G:\1.bmp";
[HandleProcessCorruptedStateExceptions]
private int AoiCheck()
{
GC.Collect(0, GCCollectionMode.Forced);
//GC.Collect();
IsCheck = true;
btnRun.Visible = false;
lblError.Visible = false;
lblInfo.Visible = false;
IsCheck = true;
ShowMsg("");
ShowErrMsg("");
int result = 2;
try
{
......@@ -183,7 +187,7 @@ namespace TSA_V
{
return 0;
}
chbAllShow.Enabled = false;
chbAllShow.Visible = false;
string camera = Setting_NInit.Device_CameraName;
if (camera == "")
......@@ -201,10 +205,7 @@ namespace TSA_V
string file = defFile;
if (File.Exists(file))
{
theImagePath = file;
////从本地加载图片
//Bitmap aa = new Bitmap(file);
//currImage = ImageManager.DeepClone(aa);
theImagePath = file;
}
}
......@@ -276,36 +277,34 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean));
}
}
if (listErrorView.Items.Count > 0)
{
listErrorView.Items[0].Selected = true;
}
//if (listErrorView.Items.Count > 0)
//{
// listErrorView.Items[0].Selected = true;
//}
chbAllShow.Enabled = true;
chbAllShow.Visible = true;
if (result.Equals(1))
{
lblError.Visible = false;
lblInfo.Text = AccAOI.ControlUtil.GetResultsStr(resultBean);
lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + lblInfo.Text);
{
ShowErrMsg("");
string resStr= AccAOI.ControlUtil.GetResultsStr(resultBean);
//lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + resStr);
}
else
{
lblInfo.Visible = false;
lblError.Text = ngList;
lblError.Visible = true;
{
ShowErrMsg(ngList);
LogUtil.info("AOI检测NG:" + ngList);
}
TestImage.Dispose();
}
else
{
lblError.Text = ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败");
lblError.Visible = true;
{
ShowErrMsg(ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败"));
LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg);
return 0;
}
chbAllShow.Enabled = true;
chbAllShow.Visible = true;
}
catch (AccessViolationException e)
{
......@@ -313,10 +312,10 @@ namespace TSA_V
}
catch (Exception ex)
{
lblError.Text = ResourceCulture.GetString("执行检测失败", "执行检测失败");
lblError.Visible = true;
ShowMsg(ResourceCulture.GetString("执行检测失败", "执行检测失败"));
LogUtil.error("检测出错:" + ex.ToString());
}
UpdateResMap(true);
return result;
}
private string GetShowName(ResultBean bean)
......@@ -351,6 +350,19 @@ namespace TSA_V
private void FrmCameraAOI_Shown(object sender, EventArgs e)
{
showTime = DateTime.Now;
if (CurrProject == null)
{
this.Close();
return;
}
else
{
string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
//string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
string extension = Path.GetExtension(currProjectName);
string filename = currProjectName.Replace(extension, ".bmp");
ShowBaseImg(filename, "Base");
}
}
private void btnExit_Click_1(object sender, EventArgs e)
......@@ -369,14 +381,14 @@ namespace TSA_V
{
ResultBean bean = beans[0];
picStand.Image = bean.standardRoiImage;
picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
//picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picResult.SelectionRegion = bean.roiPath;
//如果结果NG,可以修正
if(!bean.result && (!updateMName.Contains(bean.MethodName)))
{
selectResultBean = bean;
//btnUpdateImg.Visible = true;
btnUpdateImg.Visible = true;
listErrorView.ContextMenuStrip = this.contextMenuStrip1;
}
......@@ -385,6 +397,7 @@ namespace TSA_V
listErrorView.ContextMenuStrip = null;
btnUpdateImg.Visible = false;
}
UpdateResMap(false );
//Graphics g = picResult.CreateGraphics();
//g.DrawPath(new Pen(Color.Orange), bean.roiPath);
//g.Dispose();
......@@ -398,6 +411,7 @@ namespace TSA_V
{
return;
}
listErrorView.Items.Clear();
foreach (ResultBean bean in ResultList)
{
......@@ -410,11 +424,12 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean));
}
}
if (listErrorView.Items.Count > 0)
{
listErrorView.Items[0].Selected = true;
}
listErrorView_SelectedIndexChanged(null, null);
UpdateResMap(true);
//if (listErrorView.Items.Count > 0)
//{
// listErrorView.Items[0].Selected = true;
//}
//listErrorView_SelectedIndexChanged(null, null);
}
private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean)
{
......@@ -437,10 +452,10 @@ namespace TSA_V
{
return;
}
if (picCurr.Image == null)
{
return;
}
//if (picCurr.Image == null)
//{
// return;
//}
try
{
......@@ -518,6 +533,94 @@ namespace TSA_V
}
}
}
private void picResult_Paint(object sender, PaintEventArgs e)
{
if (showMsg != "")
{
e.Graphics.DrawString(showMsg, new Font("Arial ", 9, FontStyle.Regular), Brushes.White, new PointF(5, 5)); // 根据需要调整文字位置
}
if (showErrMsg != "")
{
e.Graphics.DrawString(showErrMsg, new Font("Arial ", 9, FontStyle.Regular), Brushes.Red, new PointF(5, picResult.Height - 20)); // 根据需要调整文字位置
}
}
private int currIndex = 0;
private Dictionary<string,Image> resultM = new Dictionary<string,Image>();
private void UpdateResMap(bool isAll)
{
List<ResultBean> beans = new List<ResultBean>();
resultM = new Dictionary<string, Image>();
if ((!isAll) && listErrorView.SelectedItems != null && listErrorView.SelectedItems.Count > 0)
{
string selName = GetNameByText(listErrorView.SelectedItems[0].Text);
beans = (from m in ResultList where m.MethodName.Equals(selName) select m).ToList<ResultBean>();
}
else
{
beans = (from m in ResultList where m.result == false select m).ToList<ResultBean>();
if (beans.Count <= 0)
{
beans = new List<ResultBean>(ResultList);
}
}
if (beans.Count > 0)
{
foreach (ResultBean bean in beans)
{
picStand.Image = bean.standardRoiImage;
resultM.Add(bean.MethodName+ "-standard", bean.standardRoiImage);
resultM.Add(bean.MethodName + "-current", bean.currentRoiImage);
}
}
currIndex = 0;
}
private Image waitImg = null;
private string lastKey = "";
private void timerChangeImg_Tick(object sender, EventArgs e)
{
if (resultM.Count > 0)
{
if (currIndex >= resultM.Count)
{
currIndex = 0;
}
List<string> keys = new List<string>(resultM.Keys);
string key = keys[currIndex];
this.picStand.Image = resultM[key];
currIndex++;
lastKey = key;
picStand.Invalidate();
}
else if (picStand.Image == null)
{
if (waitImg == null)
{
string file = Application.StartupPath + loadImg;
if (File.Exists(file))
{
waitImg = Image.FromFile(file);
}
}
if (waitImg != null)
{
lastKey = "";
this.picStand.Image = waitImg;
picStand.Invalidate();
}
}
}
private void picStand_Paint(object sender, PaintEventArgs e)
{
if (lastKey != "")
{
e.Graphics.DrawString(lastKey, new Font("Arial ", 9, FontStyle.Regular), Brushes.White, new PointF(5, 5)); // 根据需要调整文字位置
}
}
}
}
......@@ -123,6 +123,9 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value>
</metadata>
<metadata name="timerChangeImg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>273, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>103</value>
</metadata>
......
......@@ -2,7 +2,7 @@
namespace TSA_V
{
partial class FrmAOICheckN
partial class FrmAOICheckO
{
/// <summary>
/// Required designer variable.
......@@ -34,24 +34,32 @@ namespace TSA_V
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.listErrorView = new System.Windows.Forms.ListView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblResult = new System.Windows.Forms.Label();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.chbAllShow = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.lblInfo = new System.Windows.Forms.Label();
this.lblError = new System.Windows.Forms.Label();
this.lblCurrWorkTime = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.lblResult = new System.Windows.Forms.Label();
this.btnRun = new System.Windows.Forms.Button();
this.panelImg = new System.Windows.Forms.Panel();
this.picResult = new Acc.ImageBox.AccImageBox();
this.panel3 = new System.Windows.Forms.Panel();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.listErrorView = new System.Windows.Forms.ListView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chbAllShow = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.picCurr = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.picStand = new System.Windows.Forms.PictureBox();
this.timerChangeImg = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout();
this.panel4.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.panel2.SuspendLayout();
this.panelImg.SuspendLayout();
this.panel3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit();
this.SuspendLayout();
//
......@@ -68,119 +76,99 @@ namespace TSA_V
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1251, 778);
this.panel1.Size = new System.Drawing.Size(1327, 670);
this.panel1.TabIndex = 293;
//
// panel4
//
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel4.Controls.Add(this.listErrorView);
this.panel4.Controls.Add(this.lblResult);
this.panel4.Controls.Add(this.btnUpdateImg);
this.panel4.Controls.Add(this.chbAllShow);
this.panel4.Controls.Add(this.panel2);
this.panel4.Controls.Add(this.lblError);
this.panel4.Controls.Add(this.lblCurrWorkTime);
this.panel4.Controls.Add(this.btnExit);
this.panel4.Controls.Add(this.lblResult);
this.panel4.Controls.Add(this.btnRun);
this.panel4.Location = new System.Drawing.Point(654, 546);
this.panel4.Location = new System.Drawing.Point(1070, 4);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(592, 226);
this.panel4.Size = new System.Drawing.Size(252, 660);
this.panel4.TabIndex = 298;
//
// listErrorView
//
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1;
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listErrorView.HideSelection = false;
this.listErrorView.Location = new System.Drawing.Point(3, 3);
this.listErrorView.MultiSelect = false;
this.listErrorView.Name = "listErrorView";
this.listErrorView.Size = new System.Drawing.Size(586, 138);
this.listErrorView.TabIndex = 299;
this.listErrorView.UseCompatibleStateImageBehavior = false;
this.listErrorView.View = System.Windows.Forms.View.List;
this.listErrorView.SelectedIndexChanged += new System.EventHandler(this.listErrorView_SelectedIndexChanged);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.修正ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
//
// 修正ToolStripMenuItem
//
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem";
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.修正ToolStripMenuItem.Text = "修正";
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click);
//
// lblResult
//
this.lblResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblResult.Font = new System.Drawing.Font("宋体", 60F, System.Drawing.FontStyle.Bold);
this.lblResult.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.lblResult.Location = new System.Drawing.Point(5, 141);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(124, 85);
this.lblResult.TabIndex = 8;
this.lblResult.Text = "?";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnUpdateImg
//
this.btnUpdateImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnUpdateImg.BackColor = System.Drawing.Color.Transparent;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(210, 174);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(124, 46);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
//
// chbAllShow
//
this.chbAllShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.chbAllShow.AutoSize = true;
this.chbAllShow.Checked = true;
this.chbAllShow.CheckState = System.Windows.Forms.CheckState.Checked;
this.chbAllShow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAllShow.Location = new System.Drawing.Point(133, 188);
this.chbAllShow.Name = "chbAllShow";
this.chbAllShow.Size = new System.Drawing.Size(75, 21);
this.chbAllShow.TabIndex = 302;
this.chbAllShow.Text = "显示所有";
this.chbAllShow.UseVisualStyleBackColor = true;
this.chbAllShow.CheckedChanged += new System.EventHandler(this.chbAllShow_CheckedChanged);
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.panel2.AutoScroll = true;
this.panel2.Controls.Add(this.lblInfo);
this.panel2.Location = new System.Drawing.Point(23, 481);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(214, 166);
this.panel2.TabIndex = 297;
this.panel2.Visible = false;
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInfo.ForeColor = System.Drawing.Color.Blue;
this.lblInfo.Location = new System.Drawing.Point(8, 5);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(53, 17);
this.lblInfo.TabIndex = 0;
this.lblInfo.Text = "Result ?";
this.lblInfo.Visible = false;
//
// lblError
//
this.lblError.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblError.ForeColor = System.Drawing.Color.Red;
this.lblError.Location = new System.Drawing.Point(14, 458);
this.lblError.Name = "lblError";
this.lblError.Size = new System.Drawing.Size(231, 175);
this.lblError.TabIndex = 295;
this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblCurrWorkTime
//
this.lblCurrWorkTime.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblCurrWorkTime.Location = new System.Drawing.Point(7, 304);
this.lblCurrWorkTime.Name = "lblCurrWorkTime";
this.lblCurrWorkTime.Size = new System.Drawing.Size(232, 51);
this.lblCurrWorkTime.TabIndex = 291;
this.lblCurrWorkTime.Text = "3秒后自动检测";
this.lblCurrWorkTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.BackColor = System.Drawing.Color.Transparent;
this.btnExit.BackColor = System.Drawing.SystemColors.Control;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(462, 174);
this.btnExit.Location = new System.Drawing.Point(55, 405);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(124, 46);
this.btnExit.Size = new System.Drawing.Size(134, 46);
this.btnExit.TabIndex = 293;
this.btnExit.Text = "完成";
this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click_1);
//
// lblResult
//
this.lblResult.Font = new System.Drawing.Font("宋体", 69.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.lblResult.Location = new System.Drawing.Point(7, 180);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(232, 113);
this.lblResult.TabIndex = 8;
this.lblResult.Text = "?";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnRun
//
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.BackColor = System.Drawing.Color.Transparent;
this.btnRun.BackColor = System.Drawing.SystemColors.Control;
this.btnRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRun.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRun.Location = new System.Drawing.Point(336, 174);
this.btnRun.Location = new System.Drawing.Point(55, 355);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(124, 46);
this.btnRun.Size = new System.Drawing.Size(134, 46);
this.btnRun.TabIndex = 7;
this.btnRun.Text = "执行检测";
this.btnRun.UseVisualStyleBackColor = false;
......@@ -195,71 +183,159 @@ namespace TSA_V
this.panelImg.Controls.Add(this.picResult);
this.panelImg.Location = new System.Drawing.Point(4, 4);
this.panelImg.Name = "panelImg";
this.panelImg.Size = new System.Drawing.Size(644, 768);
this.panelImg.Size = new System.Drawing.Size(720, 660);
this.panelImg.TabIndex = 300;
//
// picResult
//
this.picResult.AllowDoubleClick = true;
this.picResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.picResult.BackColor = System.Drawing.Color.Black;
this.picResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.picResult.DragHandleSize = 9;
this.picResult.GridColor = System.Drawing.Color.Black;
this.picResult.GridColorAlternate = System.Drawing.Color.Black;
this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText;
this.picResult.Location = new System.Drawing.Point(0, 0);
this.picResult.Name = "picResult";
this.picResult.Size = new System.Drawing.Size(644, 763);
this.picResult.Size = new System.Drawing.Size(720, 660);
this.picResult.TabIndex = 297;
this.picResult.Paint += new System.Windows.Forms.PaintEventHandler(this.picResult_Paint);
this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick);
//
// panel3
//
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel3.Controls.Add(this.btnUpdateImg);
this.panel3.Controls.Add(this.listErrorView);
this.panel3.Controls.Add(this.chbAllShow);
this.panel3.Controls.Add(this.label2);
this.panel3.Controls.Add(this.picCurr);
this.panel3.Controls.Add(this.label1);
this.panel3.Controls.Add(this.picStand);
this.panel3.Location = new System.Drawing.Point(654, 4);
this.panel3.Location = new System.Drawing.Point(730, 4);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(592, 539);
this.panel3.Size = new System.Drawing.Size(336, 660);
this.panel3.TabIndex = 298;
//
// picStand
// btnUpdateImg
//
this.picStand.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.btnUpdateImg.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(198, 3);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(130, 40);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
//
// listErrorView
//
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1;
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listErrorView.HideSelection = false;
this.listErrorView.Location = new System.Drawing.Point(3, 45);
this.listErrorView.MultiSelect = false;
this.listErrorView.Name = "listErrorView";
this.listErrorView.Size = new System.Drawing.Size(325, 49);
this.listErrorView.TabIndex = 299;
this.listErrorView.UseCompatibleStateImageBehavior = false;
this.listErrorView.View = System.Windows.Forms.View.List;
this.listErrorView.SelectedIndexChanged += new System.EventHandler(this.listErrorView_SelectedIndexChanged);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.修正ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
//
// 修正ToolStripMenuItem
//
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem";
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
this.修正ToolStripMenuItem.Text = "修正";
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click);
//
// chbAllShow
//
this.chbAllShow.AutoSize = true;
this.chbAllShow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAllShow.Location = new System.Drawing.Point(5, 6);
this.chbAllShow.Name = "chbAllShow";
this.chbAllShow.Size = new System.Drawing.Size(75, 21);
this.chbAllShow.TabIndex = 302;
this.chbAllShow.Text = "显示所有";
this.chbAllShow.UseVisualStyleBackColor = true;
this.chbAllShow.CheckedChanged += new System.EventHandler(this.chbAllShow_CheckedChanged);
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(5, 376);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 300;
this.label2.Text = "效果图";
//
// picCurr
//
this.picCurr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picCurr.BackColor = System.Drawing.Color.Black;
this.picCurr.Location = new System.Drawing.Point(5, 391);
this.picCurr.Name = "picCurr";
this.picCurr.Size = new System.Drawing.Size(327, 263);
this.picCurr.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picCurr.TabIndex = 299;
this.picCurr.TabStop = false;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(5, 97);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 298;
this.label1.Text = "基准";
//
// picStand
//
this.picStand.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.picStand.BackColor = System.Drawing.Color.Black;
this.picStand.Location = new System.Drawing.Point(4, 3);
this.picStand.Location = new System.Drawing.Point(5, 112);
this.picStand.Name = "picStand";
this.picStand.Size = new System.Drawing.Size(585, 533);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picStand.Size = new System.Drawing.Size(327, 261);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picStand.TabIndex = 297;
this.picStand.TabStop = false;
this.picStand.Paint += new System.Windows.Forms.PaintEventHandler(this.picStand_Paint);
this.picStand.TabStop = false;
//
// timerChangeImg
// FrmAOICheck
//
this.timerChangeImg.Interval = 1000;
this.timerChangeImg.Tick += new System.EventHandler(this.timerChangeImg_Tick);
//
// FrmAOICheckN
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1251, 778);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1327, 670);
this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "FrmAOICheckN";
this.MaximizeBox = true;
this.Name = "FrmAOICheck";
this.Text = "AOI检测";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmCamera_Load);
this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown);
this.panel1.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panelImg.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picCurr)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).EndInit();
this.ResumeLayout(false);
......@@ -269,9 +345,16 @@ namespace TSA_V
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.Label lblCurrWorkTime;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label lblError;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox picCurr;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox picStand;
private System.Windows.Forms.ListView listErrorView;
private System.Windows.Forms.Panel panelImg;
......@@ -281,6 +364,5 @@ namespace TSA_V
private System.Windows.Forms.Button btnUpdateImg;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem;
private System.Windows.Forms.Timer timerChangeImg;
}
}
\ No newline at end of file

using AccAOI.camera;
using AOI;
using AOI;
using HalconDotNet;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using System.Linq;
using System.Runtime.ExceptionServices;
using Acc.ImageBox;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using Acc.ImageBox;
using AccAOI;
namespace TSA_V
{
public partial class FrmAOICheckN : FrmBase
public partial class FrmAOICheckO : FrmBase
{
private string loadImg = @"\image\wait.gif";
private List<ResultBean> ResultList = new List<ResultBean>();
private AOI.AoiProject CurrProject = null;
private DateTime showTime = DateTime.Now;
......@@ -29,23 +33,19 @@ namespace TSA_V
/// </summary>
private int CheckResult =0;
private int waitSeconds = 0;
public string defFile { get
{
//return @"G:\1.bmp";
return Application.StartupPath + @"\test (2).bmp";
return Application.StartupPath + @"\test.bmp";
}
set { } }
public FrmAOICheckN(AoiProject currAoi )
public FrmAOICheckO(AoiProject currAoi )
{
InitializeComponent();
CurrProject = currAoi;
updateMName = new List<string>();
}
private void FrmCamera_Load(object sender, EventArgs e)
{
{
FormStatus(false);
btnUpdateImg.Visible = false;
timer1.Start();
timer1.Start();
lblCurrWorkTime.Visible = true;
//默认显示程序配置的 图片
if (CurrProject == null)
......@@ -55,48 +55,32 @@ namespace TSA_V
}
else
{
//string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
////string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
//string extension = Path.GetExtension(currProjectName);
//string filename = currProjectName.Replace(extension, ".bmp");
//ShowBaseImg(filename,"Base");
string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
//string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
string extension = Path.GetExtension(currProjectName);
string filename = currProjectName.Replace(extension, ".bmp");
ShowBaseImg(filename,"Base");
}
ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", waitSeconds.ToString()));
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", waitSeconds.ToString());
修正ToolStripMenuItem.Text = ResourceCulture.GetString("FrmAOICheck_btnUpdateImg_Text", "修正");
this.StartPosition=FormStartPosition.CenterParent;
this.WindowState = FormWindowState.Maximized;
timerChangeImg.Start();
timerChangeImg_Tick(null, null);
// this.picResult.Image = CurrProject.standardImage;
}
private string showMsg = "";
private string showErrMsg = "";
private void ShowMsg(string msg)
{
showMsg = msg;
picResult.Invalidate();
}
private void ShowErrMsg(string msg)
{
showErrMsg = msg;
picResult.Invalidate();
}
private void ShowBaseImg(string filePath,string Text)
{
if (File.Exists(filePath))
{
var bmp = new Bitmap(filePath);
this.picResult.Image= Eyemlib.DeepClone(bmp);
this.picResult.Image= Eyemlib.DeepClone(bmp);
bmp.Dispose();
}
}
private void FormStatus(bool open)
{
}
private bool isAutoClose = false;
private void UpdateTextResult(Label label, int result)
{
......@@ -135,51 +119,63 @@ namespace TSA_V
{
if (times <= 1)
{
ShowMsg( ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......");
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......";
}else
{
ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString()));
}
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString());
}
lblCurrWorkTime.Visible = true;
}
else
{
ShowMsg(ResourceCulture.GetString("开始自动检测", "开始自动检测"));
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测");
lblCurrWorkTime.Visible = true;
CheckResult = AoiCheck();
MesUtil.SetAOIResult(CheckResult);
UpdateTextResult(lblResult, CheckResult);
isAutoClose = CheckResult.Equals(1);
if (CheckResult.Equals(1))
{
isAutoClose = true;
}
else
{
isAutoClose = false;
}
}
}
else
{
ShowMsg(ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0));
{
lblCurrWorkTime.Text = ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0);
lblCurrWorkTime.Visible = true;
if (isAutoClose)
{
TimeSpan closeSpan = DateTime.Now - endTime;
int times = 3 - (int)(closeSpan.TotalSeconds);
if (times < 0)
{
ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0));
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0);
lblCurrWorkTime.Visible = true;
this.Close();
}
else
{
ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString()));
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString());
lblCurrWorkTime.Visible = true;
}
}
}
}
public string defFile = @"G:\1.bmp";
[HandleProcessCorruptedStateExceptions]
private int AoiCheck()
{
GC.Collect(0, GCCollectionMode.Forced);
//GC.Collect();
IsCheck = true;
ShowMsg("");
ShowErrMsg("");
IsCheck = true;
btnRun.Visible = false;
lblError.Visible = false;
lblInfo.Visible = false;
int result = 2;
try
{
......@@ -187,7 +183,7 @@ namespace TSA_V
{
return 0;
}
chbAllShow.Visible = false;
chbAllShow.Enabled = false;
string camera = Setting_NInit.Device_CameraName;
if (camera == "")
......@@ -205,7 +201,10 @@ namespace TSA_V
string file = defFile;
if (File.Exists(file))
{
theImagePath = file;
theImagePath = file;
////从本地加载图片
//Bitmap aa = new Bitmap(file);
//currImage = ImageManager.DeepClone(aa);
}
}
......@@ -277,34 +276,36 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean));
}
}
//if (listErrorView.Items.Count > 0)
//{
// listErrorView.Items[0].Selected = true;
//}
if (listErrorView.Items.Count > 0)
{
listErrorView.Items[0].Selected = true;
}
chbAllShow.Visible = true;
chbAllShow.Enabled = true;
if (result.Equals(1))
{
ShowErrMsg("");
string resStr= AccAOI.ControlUtil.GetResultsStr(resultBean);
//lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + resStr);
{
lblError.Visible = false;
lblInfo.Text = AccAOI.ControlUtil.GetResultsStr(resultBean);
lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + lblInfo.Text);
}
else
{
ShowErrMsg(ngList);
{
lblInfo.Visible = false;
lblError.Text = ngList;
lblError.Visible = true;
LogUtil.info("AOI检测NG:" + ngList);
}
TestImage.Dispose();
}
else
{
ShowErrMsg(ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败"));
{
lblError.Text = ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败");
lblError.Visible = true;
LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg);
return 0;
}
chbAllShow.Visible = true;
chbAllShow.Enabled = true;
}
catch (AccessViolationException e)
{
......@@ -312,10 +313,10 @@ namespace TSA_V
}
catch (Exception ex)
{
ShowMsg(ResourceCulture.GetString("执行检测失败", "执行检测失败"));
lblError.Text = ResourceCulture.GetString("执行检测失败", "执行检测失败");
lblError.Visible = true;
LogUtil.error("检测出错:" + ex.ToString());
}
UpdateResMap(true);
return result;
}
private string GetShowName(ResultBean bean)
......@@ -350,19 +351,6 @@ namespace TSA_V
private void FrmCameraAOI_Shown(object sender, EventArgs e)
{
showTime = DateTime.Now;
if (CurrProject == null)
{
this.Close();
return;
}
else
{
string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
//string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
string extension = Path.GetExtension(currProjectName);
string filename = currProjectName.Replace(extension, ".bmp");
ShowBaseImg(filename, "Base");
}
}
private void btnExit_Click_1(object sender, EventArgs e)
......@@ -381,14 +369,14 @@ namespace TSA_V
{
ResultBean bean = beans[0];
picStand.Image = bean.standardRoiImage;
//picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picResult.SelectionRegion = bean.roiPath;
//如果结果NG,可以修正
if(!bean.result && (!updateMName.Contains(bean.MethodName)))
{
selectResultBean = bean;
btnUpdateImg.Visible = true;
//btnUpdateImg.Visible = true;
listErrorView.ContextMenuStrip = this.contextMenuStrip1;
}
......@@ -397,7 +385,6 @@ namespace TSA_V
listErrorView.ContextMenuStrip = null;
btnUpdateImg.Visible = false;
}
UpdateResMap(false );
//Graphics g = picResult.CreateGraphics();
//g.DrawPath(new Pen(Color.Orange), bean.roiPath);
//g.Dispose();
......@@ -411,7 +398,6 @@ namespace TSA_V
{
return;
}
listErrorView.Items.Clear();
foreach (ResultBean bean in ResultList)
{
......@@ -424,12 +410,11 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean));
}
}
UpdateResMap(true);
//if (listErrorView.Items.Count > 0)
//{
// listErrorView.Items[0].Selected = true;
//}
//listErrorView_SelectedIndexChanged(null, null);
if (listErrorView.Items.Count > 0)
{
listErrorView.Items[0].Selected = true;
}
listErrorView_SelectedIndexChanged(null, null);
}
private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean)
{
......@@ -452,10 +437,10 @@ namespace TSA_V
{
return;
}
//if (picCurr.Image == null)
//{
// return;
//}
if (picCurr.Image == null)
{
return;
}
try
{
......@@ -533,94 +518,6 @@ namespace TSA_V
}
}
}
private void picResult_Paint(object sender, PaintEventArgs e)
{
if (showMsg != "")
{
e.Graphics.DrawString(showMsg, new Font("Arial ", 9, FontStyle.Regular), Brushes.White, new PointF(5, 5)); // 根据需要调整文字位置
}
if (showErrMsg != "")
{
e.Graphics.DrawString(showErrMsg, new Font("Arial ", 9, FontStyle.Regular), Brushes.Red, new PointF(5, picResult.Height - 20)); // 根据需要调整文字位置
}
}
private int currIndex = 0;
private Dictionary<string,Image> resultM = new Dictionary<string,Image>();
private void UpdateResMap(bool isAll)
{
List<ResultBean> beans = new List<ResultBean>();
resultM = new Dictionary<string, Image>();
if ((!isAll) && listErrorView.SelectedItems != null && listErrorView.SelectedItems.Count > 0)
{
string selName = GetNameByText(listErrorView.SelectedItems[0].Text);
beans = (from m in ResultList where m.MethodName.Equals(selName) select m).ToList<ResultBean>();
}
else
{
beans = (from m in ResultList where m.result == false select m).ToList<ResultBean>();
if (beans.Count <= 0)
{
beans = new List<ResultBean>(ResultList);
}
}
if (beans.Count > 0)
{
foreach (ResultBean bean in beans)
{
picStand.Image = bean.standardRoiImage;
resultM.Add(bean.MethodName+ "-standard", bean.standardRoiImage);
resultM.Add(bean.MethodName + "-current", bean.currentRoiImage);
}
}
currIndex = 0;
}
private Image waitImg = null;
private string lastKey = "";
private void timerChangeImg_Tick(object sender, EventArgs e)
{
if (resultM.Count > 0)
{
if (currIndex >= resultM.Count)
{
currIndex = 0;
}
List<string> keys = new List<string>(resultM.Keys);
string key = keys[currIndex];
this.picStand.Image = resultM[key];
currIndex++;
lastKey = key;
picStand.Invalidate();
}
else if (picStand.Image == null)
{
if (waitImg == null)
{
string file = Application.StartupPath + loadImg;
if (File.Exists(file))
{
waitImg = Image.FromFile(file);
}
}
if (waitImg != null)
{
lastKey = "";
this.picStand.Image = waitImg;
picStand.Invalidate();
}
}
}
private void picStand_Paint(object sender, PaintEventArgs e)
{
if (lastKey != "")
{
e.Graphics.DrawString(lastKey, new Font("Arial ", 9, FontStyle.Regular), Brushes.White, new PointF(5, 5)); // 根据需要调整文字位置
}
}
}
}
......@@ -123,9 +123,6 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value>
</metadata>
<metadata name="timerChangeImg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>273, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>103</value>
</metadata>
......
......@@ -369,7 +369,7 @@ namespace TSA_V
FrmProjectorScreen.instance.ClearPoint();
//IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
//FrmAOICheck frm = new FrmAOICheck(CurrProject);
FrmAOICheckN frm = new FrmAOICheckN(CurrProject);
FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.ShowDialog();
IOManager.IOMove(IOManager.Device_Led, IO_VALUE.HIGH );
......@@ -961,7 +961,7 @@ namespace TSA_V
FrmProjectorScreen.instance.ClearPoint();
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
//FrmAOICheck frm = new FrmAOICheck(CurrProject);
FrmAOICheckN frm = new FrmAOICheckN(CurrProject);
FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.defFile = "G:\\组装工作站 AOI\\img\\img\\8.bmp";
frm.ShowDialog();
PTipSoundProcess.AOIopen = false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!