Commit c096dc5e LN

中英文完善

1 个父辈 aac3d48b
...@@ -87,24 +87,24 @@ namespace TSA_V.DeviceLibrary ...@@ -87,24 +87,24 @@ namespace TSA_V.DeviceLibrary
{ {
if (WaitType.Equals(WaitTypeEnum.NodeMove_1)) if (WaitType.Equals(WaitTypeEnum.NodeMove_1))
{ {
return "[" + Node.NodeName + "]目标位置[" + TargetPosition + "]"; return "[" + Node.NodeName + "]"+ResourceControl.GetString("arrive","到达目标位置")+"[" + TargetPosition + "]";
} }
else if (WaitType.Equals(WaitTypeEnum.NodeHome_2)) else if (WaitType.Equals(WaitTypeEnum.NodeHome_2))
{ {
return "[" + Node.NodeName + "]原点返回"; return "[" + Node.NodeName + "]"+ ResourceControl.GetString("homeMove", "原点返回");
} }
else if (WaitType.Equals(WaitTypeEnum.IOSingle_6)) else if (WaitType.Equals(WaitTypeEnum.IOSingle_6))
{ {
ConfigIO io = IOManager.getWaitIO(IoType); ConfigIO io = IOManager.getWaitIO(IoType);
return "IO等待[" + io.DisplayStr + "]=[" + IoValue + "]"; return "IO[" + io.DisplayStr + "]=[" + IoValue + "]";
} }
else if (WaitType.Equals(WaitTypeEnum.Time_3)) else if (WaitType.Equals(WaitTypeEnum.Time_3))
{ {
return "时间[" + TimeMSeconds + "]毫秒"; return "[" + TimeMSeconds + "]ms";
} }
else if (WaitType.Equals(WaitTypeEnum.XYMoveEnd_5)) else if (WaitType.Equals(WaitTypeEnum.XYMoveEnd_5))
{ {
return "XY轴目标 [" + AxisValue + "] "; return ResourceControl.GetString("xyAxisArrive", "XY轴目标") +" [" + AxisValue + "] ";
//return "XY轴目标[" + MoveAxis.PortName + "][" + AxisValue + "] "; //return "XY轴目标[" + MoveAxis.PortName + "][" + AxisValue + "] ";
} }
else if (WaitType.Equals(WaitTypeEnum.Temp_4)) else if (WaitType.Equals(WaitTypeEnum.Temp_4))
...@@ -113,11 +113,11 @@ namespace TSA_V.DeviceLibrary ...@@ -113,11 +113,11 @@ namespace TSA_V.DeviceLibrary
} }
else if (WaitType.Equals(WaitTypeEnum.WaitCode_7)) else if (WaitType.Equals(WaitTypeEnum.WaitCode_7))
{ {
return "输入条码 "; return ResourceControl.GetString("getBarcode", "输入条码")+" ";
} }
else else
{ {
return "Wait位置类型:WaitType=【" + WaitType + "】"; return "WaitType=【" + WaitType + "】";
} }
} }
public bool IsEnd { get; set; } public bool IsEnd { get; set; }
......
...@@ -2725,4 +2725,16 @@ ...@@ -2725,4 +2725,16 @@
<data name="没有找到记录" xml:space="preserve"> <data name="没有找到记录" xml:space="preserve">
<value>No records found</value> <value>No records found</value>
</data> </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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -2702,4 +2702,17 @@ ...@@ -2702,4 +2702,17 @@
<data name = "handCount" xml:space = "preserve"> <value> 次数 </value> </data> <data name = "handCount" xml:space = "preserve"> <value> 次数 </value> </data>
<data name = "handTime" 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 = "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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -2874,5 +2874,19 @@ ...@@ -2874,5 +2874,19 @@
<data name="没有找到记录" xml:space="preserve"> <data name="没有找到记录" xml:space="preserve">
<value>没有找到记录</value> <value>没有找到记录</value>
</data> </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> </root>
\ No newline at end of file \ No newline at end of file
...@@ -309,18 +309,18 @@ ...@@ -309,18 +309,18 @@
<Compile Include="projector\FrmScreenTest.Designer.cs"> <Compile Include="projector\FrmScreenTest.Designer.cs">
<DependentUpon>FrmScreenTest.cs</DependentUpon> <DependentUpon>FrmScreenTest.cs</DependentUpon>
</Compile> </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"> <Compile Include="workForm\FrmAOICheck.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="workForm\FrmAOICheck.Designer.cs"> <Compile Include="workForm\FrmAOICheck.Designer.cs">
<DependentUpon>FrmAOICheck.cs</DependentUpon> <DependentUpon>FrmAOICheck.cs</DependentUpon>
</Compile> </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"> <Compile Include="cameraPlay\CameraPlay.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -499,12 +499,12 @@ ...@@ -499,12 +499,12 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheckN.resx">
<DependentUpon>FrmAOICheckN.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheck.resx"> <EmbeddedResource Include="workForm\FrmAOICheck.resx">
<DependentUpon>FrmAOICheck.cs</DependentUpon> <DependentUpon>FrmAOICheck.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="workForm\FrmAOICheckO.resx">
<DependentUpon>FrmAOICheckO.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="cameraPlay\CameraPlay.resx"> <EmbeddedResource Include="cameraPlay\CameraPlay.resx">
<DependentUpon>CameraPlay.cs</DependentUpon> <DependentUpon>CameraPlay.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -34,32 +34,24 @@ namespace TSA_V ...@@ -34,32 +34,24 @@ namespace TSA_V
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel(); this.listErrorView = new System.Windows.Forms.ListView();
this.lblInfo = new System.Windows.Forms.Label(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.lblError = new System.Windows.Forms.Label(); this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblCurrWorkTime = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.lblResult = new System.Windows.Forms.Label(); 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.btnRun = new System.Windows.Forms.Button();
this.panelImg = new System.Windows.Forms.Panel(); this.panelImg = new System.Windows.Forms.Panel();
this.picResult = new Acc.ImageBox.AccImageBox(); this.picResult = new Acc.ImageBox.AccImageBox();
this.panel3 = new System.Windows.Forms.Panel(); 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.picStand = new System.Windows.Forms.PictureBox();
this.timerChangeImg = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel4.SuspendLayout(); this.panel4.SuspendLayout();
this.panel2.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.panelImg.SuspendLayout(); this.panelImg.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -76,99 +68,119 @@ namespace TSA_V ...@@ -76,99 +68,119 @@ namespace TSA_V
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; 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; this.panel1.TabIndex = 293;
// //
// panel4 // panel4
// //
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panel4.Controls.Add(this.panel2); this.panel4.Controls.Add(this.listErrorView);
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.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.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.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(252, 660); this.panel4.Size = new System.Drawing.Size(592, 226);
this.panel4.TabIndex = 298; this.panel4.TabIndex = 298;
// //
// panel2 // listErrorView
//
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.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; // contextMenuStrip1
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.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnExit.Location = new System.Drawing.Point(55, 405); this.修正ToolStripMenuItem});
this.btnExit.Name = "btnExit"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.btnExit.Size = new System.Drawing.Size(134, 46); this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
this.btnExit.TabIndex = 293; //
this.btnExit.Text = "完成"; // 修正ToolStripMenuItem
this.btnExit.UseVisualStyleBackColor = false; //
this.btnExit.Click += new System.EventHandler(this.btnExit_Click_1); 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 // 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.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.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.TabIndex = 8;
this.lblResult.Text = "?"; this.lblResult.Text = "?";
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 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 // 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.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.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.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.TabIndex = 7;
this.btnRun.Text = "执行检测"; this.btnRun.Text = "执行检测";
this.btnRun.UseVisualStyleBackColor = false; this.btnRun.UseVisualStyleBackColor = false;
...@@ -183,159 +195,71 @@ namespace TSA_V ...@@ -183,159 +195,71 @@ namespace TSA_V
this.panelImg.Controls.Add(this.picResult); this.panelImg.Controls.Add(this.picResult);
this.panelImg.Location = new System.Drawing.Point(4, 4); this.panelImg.Location = new System.Drawing.Point(4, 4);
this.panelImg.Name = "panelImg"; 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; this.panelImg.TabIndex = 300;
// //
// picResult // picResult
// //
this.picResult.AllowDoubleClick = true; 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.BackColor = System.Drawing.Color.Black;
this.picResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.picResult.DragHandleSize = 9; this.picResult.DragHandleSize = 9;
this.picResult.GridColor = System.Drawing.Color.Black; this.picResult.GridColor = System.Drawing.Color.Black;
this.picResult.GridColorAlternate = System.Drawing.Color.Black; this.picResult.GridColorAlternate = System.Drawing.Color.Black;
this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText; this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText;
this.picResult.Location = new System.Drawing.Point(0, 0); this.picResult.Location = new System.Drawing.Point(0, 0);
this.picResult.Name = "picResult"; 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.TabIndex = 297;
this.picResult.Paint += new System.Windows.Forms.PaintEventHandler(this.picResult_Paint);
this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick); this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick);
// //
// panel3 // panel3
// //
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
| 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.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.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(336, 660); this.panel3.Size = new System.Drawing.Size(592, 539);
this.panel3.TabIndex = 298; 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 // 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.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.Name = "picStand";
this.picStand.Size = new System.Drawing.Size(327, 261); this.picStand.Size = new System.Drawing.Size(585, 533);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picStand.TabIndex = 297; 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.timerChangeImg.Interval = 1000;
this.ClientSize = new System.Drawing.Size(1327, 670); 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.Controls.Add(this.panel1);
this.MaximizeBox = true; this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "FrmAOICheck"; this.Name = "FrmAOICheckN";
this.Text = "AOI检测"; this.Text = "AOI检测";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmCamera_Load); this.Load += new System.EventHandler(this.FrmCamera_Load);
this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown); this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown);
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel4.ResumeLayout(false); this.panel4.ResumeLayout(false);
this.panel2.ResumeLayout(false); this.panel4.PerformLayout();
this.panel2.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false);
this.panelImg.ResumeLayout(false); this.panelImg.ResumeLayout(false);
this.panel3.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(); ((System.ComponentModel.ISupportInitialize)(this.picStand)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -345,16 +269,9 @@ namespace TSA_V ...@@ -345,16 +269,9 @@ namespace TSA_V
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnRun; private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label lblResult; private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.Label lblCurrWorkTime;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnExit; 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.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.PictureBox picStand;
private System.Windows.Forms.ListView listErrorView; private System.Windows.Forms.ListView listErrorView;
private System.Windows.Forms.Panel panelImg; private System.Windows.Forms.Panel panelImg;
...@@ -364,5 +281,6 @@ namespace TSA_V ...@@ -364,5 +281,6 @@ namespace TSA_V
private System.Windows.Forms.Button btnUpdateImg; private System.Windows.Forms.Button btnUpdateImg;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem;
private System.Windows.Forms.Timer timerChangeImg;
} }
} }
\ No newline at end of file \ No newline at end of file
 
using AccAOI.camera; using AccAOI.camera;
using AOI; using AOI;
using HalconDotNet;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary; using TSA_V.DeviceLibrary;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using Acc.ImageBox; using Acc.ImageBox;
using AccAOI;
namespace TSA_V namespace TSA_V
{ {
public partial class FrmAOICheck : FrmBase public partial class FrmAOICheck : FrmBase
{ {
private string loadImg = @"\image\wait.gif";
private List<ResultBean> ResultList = new List<ResultBean>(); private List<ResultBean> ResultList = new List<ResultBean>();
private AOI.AoiProject CurrProject = null; private AOI.AoiProject CurrProject = null;
private DateTime showTime = DateTime.Now; private DateTime showTime = DateTime.Now;
...@@ -33,6 +29,13 @@ namespace TSA_V ...@@ -33,6 +29,13 @@ namespace TSA_V
/// </summary> /// </summary>
private int CheckResult =0; private int CheckResult =0;
private int waitSeconds = 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 ) public FrmAOICheck(AoiProject currAoi )
{ {
InitializeComponent(); InitializeComponent();
...@@ -41,11 +44,8 @@ namespace TSA_V ...@@ -41,11 +44,8 @@ namespace TSA_V
} }
private void FrmCamera_Load(object sender, EventArgs e) private void FrmCamera_Load(object sender, EventArgs e)
{ {
FormStatus(false);
btnUpdateImg.Visible = false; btnUpdateImg.Visible = false;
timer1.Start(); timer1.Start();
lblCurrWorkTime.Visible = true;
//默认显示程序配置的 图片 //默认显示程序配置的 图片
if (CurrProject == null) if (CurrProject == null)
...@@ -55,17 +55,37 @@ namespace TSA_V ...@@ -55,17 +55,37 @@ namespace TSA_V
} }
else else
{ {
string currProjectName = BoardManager.CurrBoard.GetAoiFileName(); //string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
//string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp"; ////string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
string extension = Path.GetExtension(currProjectName); //string extension = Path.GetExtension(currProjectName);
string filename = currProjectName.Replace(extension, ".bmp"); //string filename = currProjectName.Replace(extension, ".bmp");
ShowBaseImg(filename,"Base"); //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", "修正"); 修正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; // 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) private void ShowBaseImg(string filePath,string Text)
{ {
if (File.Exists(filePath)) if (File.Exists(filePath))
...@@ -77,10 +97,6 @@ namespace TSA_V ...@@ -77,10 +97,6 @@ namespace TSA_V
} }
private void FormStatus(bool open)
{
}
private bool isAutoClose = false; private bool isAutoClose = false;
private void UpdateTextResult(Label label, int result) private void UpdateTextResult(Label label, int result)
{ {
...@@ -119,53 +135,42 @@ namespace TSA_V ...@@ -119,53 +135,42 @@ namespace TSA_V
{ {
if (times <= 1) if (times <= 1)
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......"; ShowMsg( ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......");
}else }else
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString()); ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString()));
} }
lblCurrWorkTime.Visible = true;
} }
else else
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测"); ShowMsg(ResourceCulture.GetString("开始自动检测", "开始自动检测"));
lblCurrWorkTime.Visible = true;
CheckResult = AoiCheck(); CheckResult = AoiCheck();
MesUtil.SetAOIResult(CheckResult); MesUtil.SetAOIResult(CheckResult);
UpdateTextResult(lblResult, CheckResult); UpdateTextResult(lblResult, CheckResult);
if (CheckResult.Equals(1)) isAutoClose = CheckResult.Equals(1);
{
isAutoClose = true;
}
else
{
isAutoClose = false;
}
} }
} }
else else
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0); ShowMsg(ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0));
lblCurrWorkTime.Visible = true;
if (isAutoClose) if (isAutoClose)
{ {
TimeSpan closeSpan = DateTime.Now - endTime; TimeSpan closeSpan = DateTime.Now - endTime;
int times = 3 - (int)(closeSpan.TotalSeconds); int times = 3 - (int)(closeSpan.TotalSeconds);
if (times < 0) if (times < 0)
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0); ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0));
lblCurrWorkTime.Visible = true;
this.Close(); this.Close();
} }
else else
{ {
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString()); ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", times.ToString()));
lblCurrWorkTime.Visible = true;
} }
} }
} }
} }
public string defFile = @"G:\1.bmp";
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
private int AoiCheck() private int AoiCheck()
...@@ -173,9 +178,8 @@ namespace TSA_V ...@@ -173,9 +178,8 @@ namespace TSA_V
GC.Collect(0, GCCollectionMode.Forced); GC.Collect(0, GCCollectionMode.Forced);
//GC.Collect(); //GC.Collect();
IsCheck = true; IsCheck = true;
btnRun.Visible = false; ShowMsg("");
lblError.Visible = false; ShowErrMsg("");
lblInfo.Visible = false;
int result = 2; int result = 2;
try try
{ {
...@@ -183,7 +187,7 @@ namespace TSA_V ...@@ -183,7 +187,7 @@ namespace TSA_V
{ {
return 0; return 0;
} }
chbAllShow.Enabled = false; chbAllShow.Visible = false;
string camera = Setting_NInit.Device_CameraName; string camera = Setting_NInit.Device_CameraName;
if (camera == "") if (camera == "")
...@@ -202,9 +206,6 @@ namespace TSA_V ...@@ -202,9 +206,6 @@ namespace TSA_V
if (File.Exists(file)) if (File.Exists(file))
{ {
theImagePath = file; theImagePath = file;
////从本地加载图片
//Bitmap aa = new Bitmap(file);
//currImage = ImageManager.DeepClone(aa);
} }
} }
...@@ -276,36 +277,34 @@ namespace TSA_V ...@@ -276,36 +277,34 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean)); listErrorView.Items.Add(GetShowName(bean));
} }
} }
if (listErrorView.Items.Count > 0) //if (listErrorView.Items.Count > 0)
{ //{
listErrorView.Items[0].Selected = true; // listErrorView.Items[0].Selected = true;
} //}
chbAllShow.Enabled = true; chbAllShow.Visible = true;
if (result.Equals(1)) if (result.Equals(1))
{ {
lblError.Visible = false; ShowErrMsg("");
lblInfo.Text = AccAOI.ControlUtil.GetResultsStr(resultBean); string resStr= AccAOI.ControlUtil.GetResultsStr(resultBean);
lblInfo.Visible = true; //lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + lblInfo.Text); LogUtil.info("AOI检测OK:" + resStr);
} }
else else
{ {
lblInfo.Visible = false; ShowErrMsg(ngList);
lblError.Text = ngList;
lblError.Visible = true;
LogUtil.info("AOI检测NG:" + ngList); LogUtil.info("AOI检测NG:" + ngList);
} }
TestImage.Dispose(); TestImage.Dispose();
} }
else else
{ {
lblError.Text = ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败"); ShowErrMsg(ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败"));
lblError.Visible = true;
LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg); LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg);
return 0; return 0;
} }
chbAllShow.Enabled = true; chbAllShow.Visible = true;
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
...@@ -313,10 +312,10 @@ namespace TSA_V ...@@ -313,10 +312,10 @@ namespace TSA_V
} }
catch (Exception ex) catch (Exception ex)
{ {
lblError.Text = ResourceCulture.GetString("执行检测失败", "执行检测失败"); ShowMsg(ResourceCulture.GetString("执行检测失败", "执行检测失败"));
lblError.Visible = true;
LogUtil.error("检测出错:" + ex.ToString()); LogUtil.error("检测出错:" + ex.ToString());
} }
UpdateResMap(true);
return result; return result;
} }
private string GetShowName(ResultBean bean) private string GetShowName(ResultBean bean)
...@@ -351,6 +350,19 @@ namespace TSA_V ...@@ -351,6 +350,19 @@ namespace TSA_V
private void FrmCameraAOI_Shown(object sender, EventArgs e) private void FrmCameraAOI_Shown(object sender, EventArgs e)
{ {
showTime = DateTime.Now; 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) private void btnExit_Click_1(object sender, EventArgs e)
...@@ -369,14 +381,14 @@ namespace TSA_V ...@@ -369,14 +381,14 @@ namespace TSA_V
{ {
ResultBean bean = beans[0]; ResultBean bean = beans[0];
picStand.Image = bean.standardRoiImage; picStand.Image = bean.standardRoiImage;
picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage); //picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picResult.SelectionRegion = bean.roiPath; picResult.SelectionRegion = bean.roiPath;
//如果结果NG,可以修正 //如果结果NG,可以修正
if(!bean.result && (!updateMName.Contains(bean.MethodName))) if(!bean.result && (!updateMName.Contains(bean.MethodName)))
{ {
selectResultBean = bean; selectResultBean = bean;
//btnUpdateImg.Visible = true; btnUpdateImg.Visible = true;
listErrorView.ContextMenuStrip = this.contextMenuStrip1; listErrorView.ContextMenuStrip = this.contextMenuStrip1;
} }
...@@ -385,6 +397,7 @@ namespace TSA_V ...@@ -385,6 +397,7 @@ namespace TSA_V
listErrorView.ContextMenuStrip = null; listErrorView.ContextMenuStrip = null;
btnUpdateImg.Visible = false; btnUpdateImg.Visible = false;
} }
UpdateResMap(false );
//Graphics g = picResult.CreateGraphics(); //Graphics g = picResult.CreateGraphics();
//g.DrawPath(new Pen(Color.Orange), bean.roiPath); //g.DrawPath(new Pen(Color.Orange), bean.roiPath);
//g.Dispose(); //g.Dispose();
...@@ -398,6 +411,7 @@ namespace TSA_V ...@@ -398,6 +411,7 @@ namespace TSA_V
{ {
return; return;
} }
listErrorView.Items.Clear(); listErrorView.Items.Clear();
foreach (ResultBean bean in ResultList) foreach (ResultBean bean in ResultList)
{ {
...@@ -410,11 +424,12 @@ namespace TSA_V ...@@ -410,11 +424,12 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean)); listErrorView.Items.Add(GetShowName(bean));
} }
} }
if (listErrorView.Items.Count > 0) UpdateResMap(true);
{ //if (listErrorView.Items.Count > 0)
listErrorView.Items[0].Selected = true; //{
} // listErrorView.Items[0].Selected = true;
listErrorView_SelectedIndexChanged(null, null); //}
//listErrorView_SelectedIndexChanged(null, null);
} }
private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean) private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean)
{ {
...@@ -437,10 +452,10 @@ namespace TSA_V ...@@ -437,10 +452,10 @@ namespace TSA_V
{ {
return; return;
} }
if (picCurr.Image == null) //if (picCurr.Image == null)
{ //{
return; // return;
} //}
try try
{ {
...@@ -519,5 +534,93 @@ namespace TSA_V ...@@ -519,5 +534,93 @@ 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 @@ ...@@ -123,6 +123,9 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value> <value>109, 17</value>
</metadata> </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"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>103</value> <value>103</value>
</metadata> </metadata>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace TSA_V namespace TSA_V
{ {
partial class FrmAOICheckN partial class FrmAOICheckO
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
...@@ -34,24 +34,32 @@ namespace TSA_V ...@@ -34,24 +34,32 @@ namespace TSA_V
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel();
this.listErrorView = new System.Windows.Forms.ListView(); this.panel2 = new System.Windows.Forms.Panel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.lblInfo = new System.Windows.Forms.Label();
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.lblError = new System.Windows.Forms.Label();
this.lblResult = new System.Windows.Forms.Label(); this.lblCurrWorkTime = 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.btnExit = new System.Windows.Forms.Button();
this.lblResult = new System.Windows.Forms.Label();
this.btnRun = new System.Windows.Forms.Button(); this.btnRun = new System.Windows.Forms.Button();
this.panelImg = new System.Windows.Forms.Panel(); this.panelImg = new System.Windows.Forms.Panel();
this.picResult = new Acc.ImageBox.AccImageBox(); this.picResult = new Acc.ImageBox.AccImageBox();
this.panel3 = new System.Windows.Forms.Panel(); 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.picStand = new System.Windows.Forms.PictureBox();
this.timerChangeImg = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel4.SuspendLayout(); this.panel4.SuspendLayout();
this.contextMenuStrip1.SuspendLayout(); this.panel2.SuspendLayout();
this.panelImg.SuspendLayout(); this.panelImg.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -68,119 +76,99 @@ namespace TSA_V ...@@ -68,119 +76,99 @@ namespace TSA_V
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; 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; this.panel1.TabIndex = 293;
// //
// panel4 // panel4
// //
this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panel4.Controls.Add(this.listErrorView); this.panel4.Controls.Add(this.panel2);
this.panel4.Controls.Add(this.lblResult); this.panel4.Controls.Add(this.lblError);
this.panel4.Controls.Add(this.btnUpdateImg); this.panel4.Controls.Add(this.lblCurrWorkTime);
this.panel4.Controls.Add(this.chbAllShow);
this.panel4.Controls.Add(this.btnExit); this.panel4.Controls.Add(this.btnExit);
this.panel4.Controls.Add(this.lblResult);
this.panel4.Controls.Add(this.btnRun); 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.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(592, 226); this.panel4.Size = new System.Drawing.Size(252, 660);
this.panel4.TabIndex = 298; this.panel4.TabIndex = 298;
// //
// listErrorView // panel2
// //
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right))); this.panel2.AutoScroll = true;
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1; this.panel2.Controls.Add(this.lblInfo);
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.panel2.Location = new System.Drawing.Point(23, 481);
this.listErrorView.HideSelection = false; this.panel2.Name = "panel2";
this.listErrorView.Location = new System.Drawing.Point(3, 3); this.panel2.Size = new System.Drawing.Size(214, 166);
this.listErrorView.MultiSelect = false; this.panel2.TabIndex = 297;
this.listErrorView.Name = "listErrorView"; this.panel2.Visible = false;
this.listErrorView.Size = new System.Drawing.Size(586, 138); //
this.listErrorView.TabIndex = 299; // lblInfo
this.listErrorView.UseCompatibleStateImageBehavior = false; //
this.listErrorView.View = System.Windows.Forms.View.List; this.lblInfo.AutoSize = true;
this.listErrorView.SelectedIndexChanged += new System.EventHandler(this.listErrorView_SelectedIndexChanged); 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;
// contextMenuStrip1 this.lblInfo.Location = new System.Drawing.Point(8, 5);
// this.lblInfo.Name = "lblInfo";
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lblInfo.Size = new System.Drawing.Size(53, 17);
this.修正ToolStripMenuItem}); this.lblInfo.TabIndex = 0;
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.lblInfo.Text = "Result ?";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26); this.lblInfo.Visible = false;
// //
// 修正ToolStripMenuItem // lblError
// //
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem"; this.lblError.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); this.lblError.ForeColor = System.Drawing.Color.Red;
this.修正ToolStripMenuItem.Text = "修正"; this.lblError.Location = new System.Drawing.Point(14, 458);
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click); this.lblError.Name = "lblError";
// this.lblError.Size = new System.Drawing.Size(231, 175);
// lblResult this.lblError.TabIndex = 295;
// this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
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); // lblCurrWorkTime
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.lblCurrWorkTime.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblResult.Name = "lblResult"; this.lblCurrWorkTime.Location = new System.Drawing.Point(7, 304);
this.lblResult.Size = new System.Drawing.Size(124, 85); this.lblCurrWorkTime.Name = "lblCurrWorkTime";
this.lblResult.TabIndex = 8; this.lblCurrWorkTime.Size = new System.Drawing.Size(232, 51);
this.lblResult.Text = "?"; this.lblCurrWorkTime.TabIndex = 291;
this.lblResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblCurrWorkTime.Text = "3秒后自动检测";
// this.lblCurrWorkTime.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 // btnExit
// //
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnExit.BackColor = System.Drawing.SystemColors.Control;
this.btnExit.BackColor = System.Drawing.Color.Transparent;
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 293;
this.btnExit.Text = "完成"; this.btnExit.Text = "完成";
this.btnExit.UseVisualStyleBackColor = false; this.btnExit.UseVisualStyleBackColor = false;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click_1); 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 // btnRun
// //
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnRun.BackColor = System.Drawing.SystemColors.Control;
this.btnRun.BackColor = System.Drawing.Color.Transparent;
this.btnRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.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.TabIndex = 7;
this.btnRun.Text = "执行检测"; this.btnRun.Text = "执行检测";
this.btnRun.UseVisualStyleBackColor = false; this.btnRun.UseVisualStyleBackColor = false;
...@@ -195,71 +183,159 @@ namespace TSA_V ...@@ -195,71 +183,159 @@ namespace TSA_V
this.panelImg.Controls.Add(this.picResult); this.panelImg.Controls.Add(this.picResult);
this.panelImg.Location = new System.Drawing.Point(4, 4); this.panelImg.Location = new System.Drawing.Point(4, 4);
this.panelImg.Name = "panelImg"; 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; this.panelImg.TabIndex = 300;
// //
// picResult // picResult
// //
this.picResult.AllowDoubleClick = true; 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.BackColor = System.Drawing.Color.Black;
this.picResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.picResult.DragHandleSize = 9; this.picResult.DragHandleSize = 9;
this.picResult.GridColor = System.Drawing.Color.Black; this.picResult.GridColor = System.Drawing.Color.Black;
this.picResult.GridColorAlternate = System.Drawing.Color.Black; this.picResult.GridColorAlternate = System.Drawing.Color.Black;
this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText; this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText;
this.picResult.Location = new System.Drawing.Point(0, 0); this.picResult.Location = new System.Drawing.Point(0, 0);
this.picResult.Name = "picResult"; 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.TabIndex = 297;
this.picResult.Paint += new System.Windows.Forms.PaintEventHandler(this.picResult_Paint);
this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick); this.picResult.DoubleClick += new System.EventHandler(this.picResult_DoubleClick);
// //
// panel3 // 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.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.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(592, 539); this.panel3.Size = new System.Drawing.Size(336, 660);
this.panel3.TabIndex = 298; 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))); | 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.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.Name = "picStand";
this.picStand.Size = new System.Drawing.Size(585, 533); this.picStand.Size = new System.Drawing.Size(327, 261);
this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picStand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picStand.TabIndex = 297; this.picStand.TabIndex = 297;
this.picStand.TabStop = false; this.picStand.TabStop = false;
this.picStand.Paint += new System.Windows.Forms.PaintEventHandler(this.picStand_Paint);
// //
// timerChangeImg // FrmAOICheck
// //
this.timerChangeImg.Interval = 1000; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.timerChangeImg.Tick += new System.EventHandler(this.timerChangeImg_Tick); this.ClientSize = new System.Drawing.Size(1327, 670);
//
// 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.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.MaximizeBox = true;
this.Name = "FrmAOICheckN"; this.Name = "FrmAOICheck";
this.Text = "AOI检测"; this.Text = "AOI检测";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmCamera_Load); this.Load += new System.EventHandler(this.FrmCamera_Load);
this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown); this.Shown += new System.EventHandler(this.FrmCameraAOI_Shown);
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel4.ResumeLayout(false); this.panel4.ResumeLayout(false);
this.panel4.PerformLayout(); this.panel2.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false); this.panel2.PerformLayout();
this.panelImg.ResumeLayout(false); this.panelImg.ResumeLayout(false);
this.panel3.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(); ((System.ComponentModel.ISupportInitialize)(this.picStand)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -269,9 +345,16 @@ namespace TSA_V ...@@ -269,9 +345,16 @@ namespace TSA_V
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnRun; private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.Label lblResult; private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.Label lblCurrWorkTime;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnExit; 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.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.PictureBox picStand;
private System.Windows.Forms.ListView listErrorView; private System.Windows.Forms.ListView listErrorView;
private System.Windows.Forms.Panel panelImg; private System.Windows.Forms.Panel panelImg;
...@@ -281,6 +364,5 @@ namespace TSA_V ...@@ -281,6 +364,5 @@ namespace TSA_V
private System.Windows.Forms.Button btnUpdateImg; private System.Windows.Forms.Button btnUpdateImg;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem;
private System.Windows.Forms.Timer timerChangeImg;
} }
} }
\ No newline at end of file \ No newline at end of file
 
using AccAOI.camera; using AccAOI.camera;
using AOI; using AOI;
using HalconDotNet;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary; using TSA_V.DeviceLibrary;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using Acc.ImageBox; using Acc.ImageBox;
using AccAOI;
namespace TSA_V 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 List<ResultBean> ResultList = new List<ResultBean>();
private AOI.AoiProject CurrProject = null; private AOI.AoiProject CurrProject = null;
private DateTime showTime = DateTime.Now; private DateTime showTime = DateTime.Now;
...@@ -29,14 +33,7 @@ namespace TSA_V ...@@ -29,14 +33,7 @@ namespace TSA_V
/// </summary> /// </summary>
private int CheckResult =0; private int CheckResult =0;
private int waitSeconds = 0; private int waitSeconds = 0;
public string defFile { get public FrmAOICheckO(AoiProject currAoi )
{
//return @"G:\1.bmp";
return Application.StartupPath + @"\test (2).bmp";
return Application.StartupPath + @"\test.bmp";
}
set { } }
public FrmAOICheckN(AoiProject currAoi )
{ {
InitializeComponent(); InitializeComponent();
CurrProject = currAoi; CurrProject = currAoi;
...@@ -44,8 +41,11 @@ namespace TSA_V ...@@ -44,8 +41,11 @@ namespace TSA_V
} }
private void FrmCamera_Load(object sender, EventArgs e) private void FrmCamera_Load(object sender, EventArgs e)
{ {
FormStatus(false);
btnUpdateImg.Visible = false; btnUpdateImg.Visible = false;
timer1.Start(); timer1.Start();
lblCurrWorkTime.Visible = true;
//默认显示程序配置的 图片 //默认显示程序配置的 图片
if (CurrProject == null) if (CurrProject == null)
...@@ -55,37 +55,17 @@ namespace TSA_V ...@@ -55,37 +55,17 @@ namespace TSA_V
} }
else else
{ {
//string currProjectName = BoardManager.CurrBoard.GetAoiFileName(); string currProjectName = BoardManager.CurrBoard.GetAoiFileName();
////string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp"; //string filePath = Application.StartupPath + @"\config\\AOIConfig" + currProjectName + "bmp";
//string extension = Path.GetExtension(currProjectName); string extension = Path.GetExtension(currProjectName);
//string filename = currProjectName.Replace(extension, ".bmp"); string filename = currProjectName.Replace(extension, ".bmp");
//ShowBaseImg(filename,"Base"); 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", "修正"); 修正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; // 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) private void ShowBaseImg(string filePath,string Text)
{ {
if (File.Exists(filePath)) if (File.Exists(filePath))
...@@ -97,6 +77,10 @@ namespace TSA_V ...@@ -97,6 +77,10 @@ namespace TSA_V
} }
private void FormStatus(bool open)
{
}
private bool isAutoClose = false; private bool isAutoClose = false;
private void UpdateTextResult(Label label, int result) private void UpdateTextResult(Label label, int result)
{ {
...@@ -135,42 +119,53 @@ namespace TSA_V ...@@ -135,42 +119,53 @@ namespace TSA_V
{ {
if (times <= 1) if (times <= 1)
{ {
ShowMsg( ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......"); lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测") + "......";
}else }else
{ {
ShowMsg(ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString())); lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", times.ToString());
} }
lblCurrWorkTime.Visible = true;
} }
else else
{ {
ShowMsg(ResourceCulture.GetString("开始自动检测", "开始自动检测")); lblCurrWorkTime.Text = ResourceCulture.GetString("开始自动检测", "开始自动检测");
lblCurrWorkTime.Visible = true;
CheckResult = AoiCheck(); CheckResult = AoiCheck();
MesUtil.SetAOIResult(CheckResult); MesUtil.SetAOIResult(CheckResult);
UpdateTextResult(lblResult, CheckResult); UpdateTextResult(lblResult, CheckResult);
isAutoClose = CheckResult.Equals(1); if (CheckResult.Equals(1))
{
isAutoClose = true;
}
else
{
isAutoClose = false;
}
} }
} }
else else
{ {
ShowMsg(ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0)); lblCurrWorkTime.Text = ResourceCulture.GetString("请点击完成按钮结束检测", "请点击完成按钮结束检测", 0);
lblCurrWorkTime.Visible = true;
if (isAutoClose) if (isAutoClose)
{ {
TimeSpan closeSpan = DateTime.Now - endTime; TimeSpan closeSpan = DateTime.Now - endTime;
int times = 3 - (int)(closeSpan.TotalSeconds); int times = 3 - (int)(closeSpan.TotalSeconds);
if (times < 0) if (times < 0)
{ {
ShowMsg(ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0)); lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动完成", "{0}秒后自动完成", 0);
lblCurrWorkTime.Visible = true;
this.Close(); this.Close();
} }
else 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] [HandleProcessCorruptedStateExceptions]
private int AoiCheck() private int AoiCheck()
...@@ -178,8 +173,9 @@ namespace TSA_V ...@@ -178,8 +173,9 @@ namespace TSA_V
GC.Collect(0, GCCollectionMode.Forced); GC.Collect(0, GCCollectionMode.Forced);
//GC.Collect(); //GC.Collect();
IsCheck = true; IsCheck = true;
ShowMsg(""); btnRun.Visible = false;
ShowErrMsg(""); lblError.Visible = false;
lblInfo.Visible = false;
int result = 2; int result = 2;
try try
{ {
...@@ -187,7 +183,7 @@ namespace TSA_V ...@@ -187,7 +183,7 @@ namespace TSA_V
{ {
return 0; return 0;
} }
chbAllShow.Visible = false; chbAllShow.Enabled = false;
string camera = Setting_NInit.Device_CameraName; string camera = Setting_NInit.Device_CameraName;
if (camera == "") if (camera == "")
...@@ -206,6 +202,9 @@ namespace TSA_V ...@@ -206,6 +202,9 @@ namespace TSA_V
if (File.Exists(file)) if (File.Exists(file))
{ {
theImagePath = file; theImagePath = file;
////从本地加载图片
//Bitmap aa = new Bitmap(file);
//currImage = ImageManager.DeepClone(aa);
} }
} }
...@@ -277,34 +276,36 @@ namespace TSA_V ...@@ -277,34 +276,36 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean)); listErrorView.Items.Add(GetShowName(bean));
} }
} }
//if (listErrorView.Items.Count > 0) if (listErrorView.Items.Count > 0)
//{ {
// listErrorView.Items[0].Selected = true; listErrorView.Items[0].Selected = true;
//} }
chbAllShow.Visible = true; chbAllShow.Enabled = true;
if (result.Equals(1)) if (result.Equals(1))
{ {
ShowErrMsg(""); lblError.Visible = false;
string resStr= AccAOI.ControlUtil.GetResultsStr(resultBean); lblInfo.Text = AccAOI.ControlUtil.GetResultsStr(resultBean);
//lblInfo.Visible = true; lblInfo.Visible = true;
LogUtil.info("AOI检测OK:" + resStr); LogUtil.info("AOI检测OK:" + lblInfo.Text);
} }
else else
{ {
ShowErrMsg(ngList); lblInfo.Visible = false;
lblError.Text = ngList;
lblError.Visible = true;
LogUtil.info("AOI检测NG:" + ngList); LogUtil.info("AOI检测NG:" + ngList);
} }
TestImage.Dispose(); TestImage.Dispose();
} }
else else
{ {
ShowErrMsg(ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败")); lblError.Text = ResourceCulture.GetString("获取相机图片失败", "获取相机图片失败");
lblError.Visible = true;
LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg); LogUtil.error("AOI检测:获取相机图片失败:" + CameraManager.ErrorMsg);
return 0; return 0;
} }
chbAllShow.Visible = true; chbAllShow.Enabled = true;
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
...@@ -312,10 +313,10 @@ namespace TSA_V ...@@ -312,10 +313,10 @@ namespace TSA_V
} }
catch (Exception ex) catch (Exception ex)
{ {
ShowMsg(ResourceCulture.GetString("执行检测失败", "执行检测失败")); lblError.Text = ResourceCulture.GetString("执行检测失败", "执行检测失败");
lblError.Visible = true;
LogUtil.error("检测出错:" + ex.ToString()); LogUtil.error("检测出错:" + ex.ToString());
} }
UpdateResMap(true);
return result; return result;
} }
private string GetShowName(ResultBean bean) private string GetShowName(ResultBean bean)
...@@ -350,19 +351,6 @@ namespace TSA_V ...@@ -350,19 +351,6 @@ namespace TSA_V
private void FrmCameraAOI_Shown(object sender, EventArgs e) private void FrmCameraAOI_Shown(object sender, EventArgs e)
{ {
showTime = DateTime.Now; 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) private void btnExit_Click_1(object sender, EventArgs e)
...@@ -381,14 +369,14 @@ namespace TSA_V ...@@ -381,14 +369,14 @@ namespace TSA_V
{ {
ResultBean bean = beans[0]; ResultBean bean = beans[0];
picStand.Image = bean.standardRoiImage; picStand.Image = bean.standardRoiImage;
//picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage); picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picResult.SelectionRegion = bean.roiPath; picResult.SelectionRegion = bean.roiPath;
//如果结果NG,可以修正 //如果结果NG,可以修正
if(!bean.result && (!updateMName.Contains(bean.MethodName))) if(!bean.result && (!updateMName.Contains(bean.MethodName)))
{ {
selectResultBean = bean; selectResultBean = bean;
btnUpdateImg.Visible = true; //btnUpdateImg.Visible = true;
listErrorView.ContextMenuStrip = this.contextMenuStrip1; listErrorView.ContextMenuStrip = this.contextMenuStrip1;
} }
...@@ -397,7 +385,6 @@ namespace TSA_V ...@@ -397,7 +385,6 @@ namespace TSA_V
listErrorView.ContextMenuStrip = null; listErrorView.ContextMenuStrip = null;
btnUpdateImg.Visible = false; btnUpdateImg.Visible = false;
} }
UpdateResMap(false );
//Graphics g = picResult.CreateGraphics(); //Graphics g = picResult.CreateGraphics();
//g.DrawPath(new Pen(Color.Orange), bean.roiPath); //g.DrawPath(new Pen(Color.Orange), bean.roiPath);
//g.Dispose(); //g.Dispose();
...@@ -411,7 +398,6 @@ namespace TSA_V ...@@ -411,7 +398,6 @@ namespace TSA_V
{ {
return; return;
} }
listErrorView.Items.Clear(); listErrorView.Items.Clear();
foreach (ResultBean bean in ResultList) foreach (ResultBean bean in ResultList)
{ {
...@@ -424,12 +410,11 @@ namespace TSA_V ...@@ -424,12 +410,11 @@ namespace TSA_V
listErrorView.Items.Add(GetShowName(bean)); listErrorView.Items.Add(GetShowName(bean));
} }
} }
UpdateResMap(true); if (listErrorView.Items.Count > 0)
//if (listErrorView.Items.Count > 0) {
//{ listErrorView.Items[0].Selected = true;
// listErrorView.Items[0].Selected = true; }
//} listErrorView_SelectedIndexChanged(null, null);
//listErrorView_SelectedIndexChanged(null, null);
} }
private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean) private string getSaveImagePath(string aoiFileName, ResultBean selectResultBean)
{ {
...@@ -452,10 +437,10 @@ namespace TSA_V ...@@ -452,10 +437,10 @@ namespace TSA_V
{ {
return; return;
} }
//if (picCurr.Image == null) if (picCurr.Image == null)
//{ {
// return; return;
//} }
try try
{ {
...@@ -534,93 +519,5 @@ namespace TSA_V ...@@ -534,93 +519,5 @@ 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 @@ ...@@ -123,9 +123,6 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value> <value>109, 17</value>
</metadata> </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"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>103</value> <value>103</value>
</metadata> </metadata>
......
...@@ -369,7 +369,7 @@ namespace TSA_V ...@@ -369,7 +369,7 @@ namespace TSA_V
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
//IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH); //IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
//FrmAOICheck frm = new FrmAOICheck(CurrProject); //FrmAOICheck frm = new FrmAOICheck(CurrProject);
FrmAOICheckN frm = new FrmAOICheckN(CurrProject); FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.ShowDialog(); frm.ShowDialog();
IOManager.IOMove(IOManager.Device_Led, IO_VALUE.HIGH ); IOManager.IOMove(IOManager.Device_Led, IO_VALUE.HIGH );
...@@ -961,7 +961,7 @@ namespace TSA_V ...@@ -961,7 +961,7 @@ namespace TSA_V
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH); // IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
//FrmAOICheck frm = new FrmAOICheck(CurrProject); //FrmAOICheck frm = new FrmAOICheck(CurrProject);
FrmAOICheckN frm = new FrmAOICheckN(CurrProject); FrmAOICheck frm = new FrmAOICheck(CurrProject);
frm.defFile = "G:\\组装工作站 AOI\\img\\img\\8.bmp"; frm.defFile = "G:\\组装工作站 AOI\\img\\img\\8.bmp";
frm.ShowDialog(); frm.ShowDialog();
PTipSoundProcess.AOIopen = false; PTipSoundProcess.AOIopen = false;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!