Commit bc94711e LN

点料未找到PN所属元器件时直接NG

1 个父辈 dc07c277
正在显示 26 个修改的文件 包含 418 行增加19 行删除
......@@ -58,6 +58,9 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Reference Include="AccImageBox">
<HintPath>..\..\..\..\..\TSAV-智能组装机\Line-Smart-Workstation\dll\AccImageBox.dll</HintPath>
</Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath>
......@@ -119,6 +122,12 @@
<Compile Include="FrmAnalyze.Designer.cs">
<DependentUpon>FrmAnalyze.cs</DependentUpon>
</Compile>
<Compile Include="FrmLearning.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLearning.Designer.cs">
<DependentUpon>FrmLearning.cs</DependentUpon>
</Compile>
<Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -182,6 +191,9 @@
<EmbeddedResource Include="FrmAnalyze.resx">
<DependentUpon>FrmAnalyze.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmLearning.resx">
<DependentUpon>FrmLearning.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="useControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource>
......
using Acc.ImageBox;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.AutoCountClient
{
public partial class FrmLearning : Form
{
public FrmLearning()
{
InitializeComponent();
}
private ImageBox currShowBox = null;
private int CurrType = -1;
private bool IsCanSel = false;
private string CurrFullFileName = "";
private string CurrPN = "";
private void FrmLearning_Load(object sender, EventArgs e)
{
imageBox0.Image = XRayLearnManager.modelImg_0;
imageBox1.Image = XRayLearnManager.modelImg_1;
imageBox2.Image = XRayLearnManager.modelImg_2;
imageBox3.Image = XRayLearnManager.modelImg_3;
imageBox4.Image = XRayLearnManager.modelImg_4;
imageBox5.Image = XRayLearnManager.modelImg_5;
pictureBox1.Image = XRayLearnManager.smodelImg_1;
pictureBox2.Image = XRayLearnManager.smodelImg_2;
pictureBox3.Image = XRayLearnManager.smodelImg_3;
pictureBox4.Image = XRayLearnManager.smodelImg_4;
pictureBox5.Image = XRayLearnManager.smodelImg_5;
imageBox0.Text = "未找到元器件类型";
imageBox1.Text = "小器件";
imageBox2.Text = "大器件";
imageBox3.Text = "异形三角器件";
imageBox4.Text = "异形三脚大器件";
imageBox5.Text = "异形长条形器件";
ChangeImage(imageBox0);
}
public void UpdateCurrImg(string fullFName)
{
string testFile = Application.StartupPath + "\\XRAY\\model\\8D.03906.H11-R515232020062200253-20200812181219.png";
}
private void ChangeSelStatus(bool iscanSel)
{
this.IsCanSel = iscanSel;
ChangeImage(imageBox0, 0, "");
groupBox3.Visible = iscanSel;
}
private bool ChangeImage(ImageBox showImg, int type = 0, string text = "")
{
if (CurrType.Equals(type))
{
return true;
}
CurrType = type;
if (currShowBox == null)
{
imageBox0.Visible = false;
imageBox1.Visible = false;
imageBox2.Visible = false;
imageBox3.Visible = false;
imageBox4.Visible = false;
imageBox5.Visible = false;
}
else
{
currShowBox.Visible = false;
}
showImg.Visible = true;
currShowBox = showImg;
if (text.Equals(""))
{
btnTest.Visible = false;
}
else
{
btnTest.Text = "使用[" + text + "]模板点料测试";
btnTest.Visible = true;
}
return true;
}
private void btnTest_Click(object sender, EventArgs e)
{
int count = 1;
if (imgCurrImg.Image == null || String.IsNullOrEmpty(CurrFullFileName))
{
MessageBox.Show("未加载图片,无法点料");
return;
}
}
private void radioButton0_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox0, 0);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox1, 1, radioButton1.Text);
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox2, 2, radioButton2.Text);
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox3, 3, radioButton3.Text);
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox4, 4, radioButton4.Text);
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
ChangeImage(imageBox5, 5, radioButton5.Text);
}
private void pictureBox1_Click(object sender, EventArgs e)
{
radioButton1.Checked = true;
}
private void pictureBox2_Click(object sender, EventArgs e)
{
radioButton2.Checked = true;
}
private void pictureBox3_Click(object sender, EventArgs e)
{
radioButton3.Checked = true;
}
private void pictureBox4_Click(object sender, EventArgs e)
{
radioButton4.Checked = true;
}
private void pictureBox5_Click(object sender, EventArgs e)
{
radioButton5.Checked = true;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -417,6 +417,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>43</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAA
......
......@@ -445,25 +445,12 @@ namespace OnlineStore.AutoCountClient
btnWorkTest.Enabled = false;
txtResult.Text = "点料中...";
int th = (int)numTh.Value;
int wsize = (int)numWSize.Value;
int outCount = 0;
// equipBean.countImage.GetCount(th, out outCount);
int n = 0;
if (DeviceType.Equals(0))
{
n = equipBean.carerayImage.GetLocalCount(filePath, th, wsize, out outCount, out Asa.API.EyemImage tpDstImg);
}
else if(DeviceType.Equals(1))
{
n = equipBean.carerayImage.GetLocalCountHuge(filePath, th, wsize, out outCount, out Asa.API.EyemImage tpDstImg);
}
else
{
int type = DeviceType - 2;
n = equipBean.carerayImage.GetLocalCountIrregular(filePath, th, type, wsize, out outCount, out Asa.API.EyemImage dst);
}
int wsize = (int)numWSize.Value;
Asa.API.EyemImage tpDstImg ;
CountParam param = new CountParam("", th, wsize, DeviceType);
int outCount = equipBean.GetCountResult(filePath, param, out tpDstImg);
txtResult.Text = outCount.ToString();
LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果[" + n + "]:" + outCount);
LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果:" + outCount);
}
catch (Exception ex)
{
......
......@@ -105,6 +105,7 @@
<Compile Include="bean\InputEquip.cs" />
<Compile Include="manager\RFIDManagercs.cs" />
<Compile Include="manager\SServerManager.cs" />
<Compile Include="manager\XRayLearnManager.cs" />
<Compile Include="model\AxisBean.cs" />
<Compile Include="model\WaitUtil.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" />
......@@ -145,6 +146,39 @@
<Content Include="XRAY\area.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\0.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\2.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\3.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\4.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\5.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\smallmodel\1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\smallmodel\2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\smallmodel\3.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\smallmodel\4.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\model\smallmodel\5.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="XRAY\out\out.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -49,8 +49,12 @@ namespace OnlineStore.DeviceLibrary
public static void SetCancelState(bool isCancel)
{
CurrCancelState = isCancel;
agvClient.CancelState = isCancel;
if (agvClient != null)
{
agvClient.CancelState = isCancel;
}
}
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false)
{
......
......@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary
{
try
{
// XRayLearnManager.Init();
if (!isInit)
{
DeviceConfig.SubDIList = new Dictionary<int, Dictionary<string, ConfigIO>>();
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class XRayLearnManager
{
public static bool InLearnMode = false;
public static Image modelImg_0;
public static Image modelImg_1;
public static Image modelImg_2;
public static Image modelImg_3;
public static Image modelImg_4;
public static Image modelImg_5;
public static Image smodelImg_1;
public static Image smodelImg_2;
public static Image smodelImg_3;
public static Image smodelImg_4;
public static Image smodelImg_5;
public static Image testImg;
/// <summary>
/// 是否已经初始化过了
/// </summary>
public static bool IsInit = false;
public static void Init()
{
string path = Application.StartupPath+ "\\XRAY\\model\\";
try
{
IsInit = true;
modelImg_0 = Image.FromFile(path + "\\0.jpg");
modelImg_1 = Image.FromFile(path + "\\1.png");
modelImg_2 = Image.FromFile(path + "\\2.jpg");
modelImg_3 = Image.FromFile(path + "\\3.jpg");
modelImg_4 = Image.FromFile(path + "\\4.jpg");
modelImg_5 = Image.FromFile(path + "\\5.jpg");
smodelImg_1 = Image.FromFile(path + "\\smallmodel\\1.png");
smodelImg_2 = Image.FromFile(path + "\\smallmodel\\2.png");
smodelImg_3 = Image.FromFile(path + "\\smallmodel\\3.png");
smodelImg_4 = Image.FromFile(path + "\\smallmodel\\4.png");
smodelImg_5 = Image.FromFile(path + "\\smallmodel\\5.png");
testImg = Image.FromFile(path + "\\8D.03906.H11-R515232020062200253-20200812181219.png");
}
catch (Exception ex)
{
Console.Write(ex.ToString());
}
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!