Commit bc94711e LN

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

1 个父辈 dc07c277
正在显示 26 个修改的文件 包含 494 行增加79 行删除
...@@ -58,6 +58,9 @@ ...@@ -58,6 +58,9 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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"> <Reference Include="Asa.CarerayImage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath> <HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath>
...@@ -119,6 +122,12 @@ ...@@ -119,6 +122,12 @@
<Compile Include="FrmAnalyze.Designer.cs"> <Compile Include="FrmAnalyze.Designer.cs">
<DependentUpon>FrmAnalyze.cs</DependentUpon> <DependentUpon>FrmAnalyze.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmLearning.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmLearning.Designer.cs">
<DependentUpon>FrmLearning.cs</DependentUpon>
</Compile>
<Compile Include="useControl\AxisMoveControl.cs"> <Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -182,6 +191,9 @@ ...@@ -182,6 +191,9 @@
<EmbeddedResource Include="FrmAnalyze.resx"> <EmbeddedResource Include="FrmAnalyze.resx">
<DependentUpon>FrmAnalyze.cs</DependentUpon> <DependentUpon>FrmAnalyze.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmLearning.resx">
<DependentUpon>FrmLearning.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="useControl\AxisMoveControl.resx"> <EmbeddedResource Include="useControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon> <DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource> </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 \ No newline at end of file
...@@ -417,6 +417,9 @@ ...@@ -417,6 +417,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </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"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAA AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAA
......
...@@ -446,24 +446,11 @@ namespace OnlineStore.AutoCountClient ...@@ -446,24 +446,11 @@ namespace OnlineStore.AutoCountClient
txtResult.Text = "点料中..."; txtResult.Text = "点料中...";
int th = (int)numTh.Value; int th = (int)numTh.Value;
int wsize = (int)numWSize.Value; int wsize = (int)numWSize.Value;
int outCount = 0; Asa.API.EyemImage tpDstImg ;
// equipBean.countImage.GetCount(th, out outCount); CountParam param = new CountParam("", th, wsize, DeviceType);
int n = 0; int outCount = equipBean.GetCountResult(filePath, param, out tpDstImg);
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);
}
txtResult.Text = outCount.ToString(); txtResult.Text = outCount.ToString();
LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果[" + n + "]:" + outCount); LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果:" + outCount);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
<Compile Include="bean\InputEquip.cs" /> <Compile Include="bean\InputEquip.cs" />
<Compile Include="manager\RFIDManagercs.cs" /> <Compile Include="manager\RFIDManagercs.cs" />
<Compile Include="manager\SServerManager.cs" /> <Compile Include="manager\SServerManager.cs" />
<Compile Include="manager\XRayLearnManager.cs" />
<Compile Include="model\AxisBean.cs" /> <Compile Include="model\AxisBean.cs" />
<Compile Include="model\WaitUtil.cs" /> <Compile Include="model\WaitUtil.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" /> <Compile Include="deviceLibrary\halcon\CodeManager.cs" />
...@@ -145,6 +146,39 @@ ...@@ -145,6 +146,39 @@
<Content Include="XRAY\area.txt"> <Content Include="XRAY\area.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </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"> <Content Include="XRAY\out\out.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
......
...@@ -49,9 +49,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -49,9 +49,13 @@ namespace OnlineStore.DeviceLibrary
public static void SetCancelState(bool isCancel) public static void SetCancelState(bool isCancel)
{ {
CurrCancelState = isCancel; CurrCancelState = isCancel;
if (agvClient != null)
{
agvClient.CancelState = isCancel; agvClient.CancelState = isCancel;
} }
}
public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false) public static void SetStatus(string id, string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low,bool isMust=false)
{ {
......
...@@ -222,7 +222,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -222,7 +222,12 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.XW12_XRayStart)) else if (MoveInfo.IsStep(StepEnum.XW12_XRayStart))
{ {
XW13_GetXRayImage(); MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
CapImage();
MoveInfo.EndStepWait();
} }
else if (MoveInfo.IsStep(StepEnum.XW13_GetXRayImage)) else if (MoveInfo.IsStep(StepEnum.XW13_GetXRayImage))
...@@ -317,20 +322,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -317,20 +322,11 @@ namespace OnlineStore.DeviceLibrary
WorkLog("料盘处理:启动X射线[" + result + "],等待1秒"); WorkLog("料盘处理:启动X射线[" + result + "],等待1秒");
} }
private void XW13_GetXRayImage()
{
MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
CapImage();
MoveInfo.EndStepWait();
}
#endregion #endregion
#region 点料处理 #region 点料处理
private string lastFileName = ""; private string lastFileName = "";
private CountParam lastParam = new CountParam();
private void XW15_GetResult() private void XW15_GetResult()
{ {
if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW))
...@@ -346,41 +342,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -346,41 +342,27 @@ namespace OnlineStore.DeviceLibrary
{ {
xRay.Stop(); xRay.Stop();
} }
int count = 99999; InXWork = false;
string fileP = path1_tif + @"\" + lastFileName; WorkLog("点料:停止X射线,设置 InXWork = false,开始获取点料结果");
int n = 0;
if (lastParam.Sign.Equals(0))
{
WorkLog("点料:开始调用 carerayImage.GetLocalCount ");
n = carerayImage.GetLocalCount(fileP, lastParam.Threshold, lastParam.WindowSize, out count, out Asa.API.EyemImage tpDstImg);
}
else if(lastParam.Sign.Equals(1))
{
WorkLog("点料:开始调用 carerayImage.GetLocalCountHuge ");
n = carerayImage.GetLocalCountHuge(fileP, lastParam.Threshold, lastParam.WindowSize, out count, out Asa.API.EyemImage tpDstImg);
}
else
{
int type = lastParam.Sign - 2;
WorkLog("点料:开始调用 carerayImage.GetLocalCountIrregular ");
n = carerayImage.GetLocalCountIrregular(fileP, lastParam.Threshold, type, lastParam.WindowSize, out count, out Asa.API.EyemImage dst);
}
bool isNg = false; bool isNg = false;
string NgMsg = ""; string NgMsg = "";
int count = 0;
CountParam lastParam = UpdateParamByPN(Work_ReelInfo.WareCode);
if (lastParam != null)
{
string fileP = path1_tif + @"\" + lastFileName;
count = GetCountResult(fileP, lastParam, out Asa.API.EyemImage tpDstImg);
if (count < ResultMinCount) if (count < ResultMinCount)
{ {
isNg = true; isNg = true;
NgMsg = "NG:点料结果小于" + ResultMinCount; NgMsg = "NG:点料结果小于" + ResultMinCount;
} }
WorkLog("点料:获取点料结果 【" + count + "】 " + lastParam.ToStr() + ",n =" + n + ", " + NgMsg); WorkLog("点料: 调用 GetCountResult 获取点料结果 【" + count + "】 " + lastParam.ToStr() + ", " + NgMsg);
if (Work_ReelInfo.WareCount <= 0) if (Work_ReelInfo.WareCount <= 0)
{ {
MoveInfo.MoveParam.WareCount = count; MoveInfo.MoveParam.WareCount = count;
Work_ReelInfo.WareCount = count; Work_ReelInfo.WareCount = count;
} }
InXWork = false;
if (!isNg && SServerManager.CanConnect()) if (!isNg && SServerManager.CanConnect())
{ {
// string msg = "暂不上传"; // string msg = "暂不上传";
...@@ -392,12 +374,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -392,12 +374,12 @@ namespace OnlineStore.DeviceLibrary
NgMsg = msg; NgMsg = msg;
} }
} }
if (isNg) }
else
{ {
MoveInfo.MoveParam.IsNgReel = true; isNg = true;
Work_ReelInfo.IsNgReel = true; NgMsg = "NG:未找到元器件类型,PN[" + GetCodeStrPN(Work_ReelInfo.WareCode) + "]";
MoveInfo.MoveParam.NgMsg = NgMsg; WorkLog("点料:" + NgMsg);
Work_ReelInfo.NgMsg = NgMsg;
} }
string outF = path2_out + lastFileName; string outF = path2_out + lastFileName;
...@@ -407,14 +389,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -407,14 +389,18 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
MoveInfo.MoveParam.IsNgReel = true;
Work_ReelInfo.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = NgMsg;
Work_ReelInfo.NgMsg = NgMsg;
outF = NgMsg; outF = NgMsg;
} }
int c = RobotManager.robot.sQLite.Insert(Work_ReelInfo.WareCode, Work_ReelInfo.PlateW, Work_ReelInfo.PlateH, count, outF); int c = RobotManager.robot.sQLite.Insert(Work_ReelInfo.WareCode, Work_ReelInfo.PlateW, Work_ReelInfo.PlateH, count, outF);
LogUtil.info("插入数据【" + Work_ReelInfo.WareCode + "】【" + count + "】结果:" + c + " ," + RobotManager.robot.sQLite.ErrInfo); LogUtil.info("插入数据【" + Work_ReelInfo.WareCode + "】【" + count + "】【" + outF + "】结果:" + c + " ," + RobotManager.robot.sQLite.ErrInfo);
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("XW15_GetResult出错:"+ex.ToString()); LogUtil.error("XW15_GetResult出错:" + ex.ToString());
} }
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
} }
...@@ -489,8 +475,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -489,8 +475,6 @@ namespace OnlineStore.DeviceLibrary
} }
WorkLog("点料:获取X射线图形,保存到: " + fileP + ",备份到:" + backFile + ",记录时间" + lastData + ",停止X射线"); WorkLog("点料:获取X射线图形,保存到: " + fileP + ",备份到:" + backFile + ",记录时间" + lastData + ",停止X射线");
GetImageEvent?.Invoke(bmp); GetImageEvent?.Invoke(bmp);
UpdateArea(Work_ReelInfo.WareCode);
} }
else else
{ {
...@@ -523,32 +507,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -523,32 +507,29 @@ namespace OnlineStore.DeviceLibrary
} }
private void UpdateArea(string codeStr) private CountParam UpdateParamByPN(string codeStr)
{
//bool result = false;
//CountParam lastParam = new CountParam("", ThresholdValue, 3);
string pn = GetCodeStrPN(codeStr);
if (countParamMap.ContainsKey(pn))
{
CountParam lastParam = countParamMap[pn];
LogUtil.debug ("【" + codeStr + "】使用参数 " + lastParam.ToStr() + " ");
return lastParam;
}
return null;
}
private string GetCodeStrPN(string codeStr)
{ {
lastParam = new CountParam("", ThresholdValue, 3);
string[] codeArray = codeStr.Split(';'); string[] codeArray = codeStr.Split(';');
// string fileValue = "";
// string area = "";
if (codeArray.Length.Equals(2)) if (codeArray.Length.Equals(2))
{ {
string pn = codeArray[0]; string pn = codeArray[0];
return pn;
//string type = pn.Substring(0, 2) + pn.Substring(pn.Length - 3, 3);
//if (countParamMap.ContainsKey(pn))
//{
// area = countParamMap[pn].AreaValue;
// fileValue = lastFileName + " " + area;
// lastParam = countParamMap[pn];
//}
//else
if (countParamMap.ContainsKey(pn))
{
lastParam = countParamMap[pn];
}
} }
LogUtil.info("【" + codeStr + "】使用参数 " + lastParam.ToStr() + " "); return "";
//LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【" + fileValue + "】");
//File.WriteAllText(path3_area, fileValue);
} }
private void ClearFilePath() private void ClearFilePath()
...@@ -575,6 +556,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -575,6 +556,41 @@ namespace OnlineStore.DeviceLibrary
} }
public int GetCountResult(string fileP, CountParam param,out Asa.API.EyemImage tpDstImg)
{
int count = 0;
int result = 0;
int type = param.Sign;
int threshold = param.Threshold;
int windowsize = param.WindowSize;
if (param.Sign.Equals(0))
{
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out count, out tpDstImg);
LogUtil.info("GetCountResult "+ type + " 调用 GetLocalCount 【" + fileP+"】【"+threshold+"】【"+windowsize+"】,返回【"+result+"】,结果【"+count+"】");
}
else if (param.Sign.Equals(1))
{
result = carerayImage.GetLocalCountHuge(fileP, threshold, windowsize, out count, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + count + "】");
}
else
{
int t = param.Sign - 2;
WorkLog("点料:开始调用 carerayImage.GetLocalCountIrregular ");
result = carerayImage.GetLocalCountIrregular(fileP, threshold, t, windowsize, out count, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】["+t+"]【" + windowsize + "】,返回【" + result + "】,结果【" + count + "】");
}
return count;
}
public Bitmap ImgChange(Asa.API.EyemImage tpDstImg)
{
Bitmap bit = null;
return bit;
}
#endregion #endregion
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -47,6 +47,7 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
// XRayLearnManager.Init();
if (!isInit) if (!isInit)
{ {
DeviceConfig.SubDIList = new Dictionary<int, Dictionary<string, ConfigIO>>(); 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!