From 15df28b3b4bc359ab264b60b662b66e24dc694a6 Mon Sep 17 00:00:00 2001
From: "xhm\\HP" <1173131411@qq.com>
Date: Fri, 5 Jul 2024 16:04:47 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BB=E7=A0=81=E5=99=A8?=
=?UTF-8?q?=E5=92=8CMES=E7=B3=BB=E7=BB=9F=E5=AF=B9=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
HisenceYoloDetection.sln | 4 +-
.../HisenceYoloDetection.csproj | 3 +-
HisenceYoloDetection/MainForm.Designer.cs | 124 ++++----
HisenceYoloDetection/MainForm.cs | 266 +++++++++++++++---
HisenceYoloDetection/TCPClienDriver.cs | 8 +-
XKRS.UI/XKRS.UI.csproj | 8 +-
6 files changed, 306 insertions(+), 107 deletions(-)
diff --git a/HisenceYoloDetection.sln b/HisenceYoloDetection.sln
index a288222..9433848 100644
--- a/HisenceYoloDetection.sln
+++ b/HisenceYoloDetection.sln
@@ -17,8 +17,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0DE28139-2917-4B58-8240-4B4E11114730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DE28139-2917-4B58-8240-4B4E11114730}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0DE28139-2917-4B58-8240-4B4E11114730}.Debug|X64.ActiveCfg = Debug|X64
- {0DE28139-2917-4B58-8240-4B4E11114730}.Debug|X64.Build.0 = Debug|X64
+ {0DE28139-2917-4B58-8240-4B4E11114730}.Debug|X64.ActiveCfg = Debug|Any CPU
+ {0DE28139-2917-4B58-8240-4B4E11114730}.Debug|X64.Build.0 = Debug|Any CPU
{0DE28139-2917-4B58-8240-4B4E11114730}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DE28139-2917-4B58-8240-4B4E11114730}.Release|Any CPU.Build.0 = Release|Any CPU
{0DE28139-2917-4B58-8240-4B4E11114730}.Release|X64.ActiveCfg = Release|X64
diff --git a/HisenceYoloDetection/HisenceYoloDetection.csproj b/HisenceYoloDetection/HisenceYoloDetection.csproj
index c5049ed..58a9c1d 100644
--- a/HisenceYoloDetection/HisenceYoloDetection.csproj
+++ b/HisenceYoloDetection/HisenceYoloDetection.csproj
@@ -2,13 +2,14 @@
WinExe
- net7.0-windows
+ net7.0-windows7.0
enable
true
enable
AnyCPU;X64
True
bin\X64\Debug\net7.0-windows\Logo.ico
+ output
diff --git a/HisenceYoloDetection/MainForm.Designer.cs b/HisenceYoloDetection/MainForm.Designer.cs
index 661e2ee..9a0ae84 100644
--- a/HisenceYoloDetection/MainForm.Designer.cs
+++ b/HisenceYoloDetection/MainForm.Designer.cs
@@ -136,12 +136,12 @@
originMatShow = new PictureBox();
ResultMatShow = new PictureBox();
panel8 = new Panel();
+ canvas6 = new XKRS.UI.Canvas();
+ canvas2 = new XKRS.UI.Canvas();
textBox2 = new TextBox();
label36 = new Label();
textBox1 = new TextBox();
label35 = new Label();
- canvas6 = new XKRS.UI.Canvas();
- canvas2 = new XKRS.UI.Canvas();
实时显示 = new Label();
OKOrNGShow = new PictureBox();
OKDNum = new TextBox();
@@ -1226,7 +1226,7 @@
groupBox2.Margin = new Padding(4, 2, 4, 2);
groupBox2.Name = "groupBox2";
groupBox2.Padding = new Padding(4, 2, 4, 2);
- groupBox2.Size = new Size(1102, 718);
+ groupBox2.Size = new Size(1083, 718);
groupBox2.TabIndex = 0;
groupBox2.TabStop = false;
groupBox2.Text = "图片";
@@ -1240,7 +1240,7 @@
mat1.IsEnabledDispose = true;
canvas5.ImaMAt = mat1;
canvas5.ImgData = null;
- canvas5.Location = new Point(758, 464);
+ canvas5.Location = new Point(693, 440);
canvas5.MoveStep = 5F;
canvas5.Name = "canvas5";
canvas5.Route = 0D;
@@ -1261,7 +1261,7 @@
mat2.IsEnabledDispose = true;
canvas4.ImaMAt = mat2;
canvas4.ImgData = null;
- canvas4.Location = new Point(382, 464);
+ canvas4.Location = new Point(350, 440);
canvas4.MoveStep = 5F;
canvas4.Name = "canvas4";
canvas4.Route = 0D;
@@ -1282,7 +1282,7 @@
mat3.IsEnabledDispose = true;
canvas3.ImaMAt = mat3;
canvas3.ImgData = null;
- canvas3.Location = new Point(8, 464);
+ canvas3.Location = new Point(7, 440);
canvas3.MoveStep = 5F;
canvas3.Name = "canvas3";
canvas3.Route = 0D;
@@ -1368,12 +1368,12 @@
//
// panel8
//
+ panel8.Controls.Add(canvas6);
+ panel8.Controls.Add(canvas2);
panel8.Controls.Add(textBox2);
panel8.Controls.Add(label36);
panel8.Controls.Add(textBox1);
panel8.Controls.Add(label35);
- panel8.Controls.Add(canvas6);
- panel8.Controls.Add(canvas2);
panel8.Controls.Add(实时显示);
panel8.Controls.Add(OKOrNGShow);
panel8.Controls.Add(OKDNum);
@@ -1393,6 +1393,49 @@
panel8.TabIndex = 2;
panel8.Paint += panel8_Paint;
//
+ // canvas6
+ //
+ canvas6.AllowSelectDefect = true;
+ canvas6.BrushColor = null;
+ canvas6.ImagePath = "";
+ mat5.IsEnabledDispose = true;
+ canvas6.ImaMAt = mat5;
+ canvas6.ImgData = null;
+ canvas6.Location = new Point(10, 440);
+ canvas6.Margin = new Padding(4, 3, 4, 3);
+ canvas6.MoveStep = 5F;
+ canvas6.Name = "canvas6";
+ canvas6.Route = 0D;
+ canvas6.Scale = 1D;
+ canvas6.Size = new Size(433, 188);
+ canvas6.TabIndex = 13;
+ canvas6.WholeScale = 0F;
+ canvas6.XMove = 0F;
+ canvas6.XScale = 0F;
+ canvas6.YMove = 0F;
+ canvas6.YScale = 0F;
+ //
+ // canvas2
+ //
+ canvas2.AllowSelectDefect = true;
+ canvas2.BrushColor = null;
+ canvas2.ImagePath = "";
+ mat6.IsEnabledDispose = true;
+ canvas2.ImaMAt = mat6;
+ canvas2.ImgData = null;
+ canvas2.Location = new Point(10, 226);
+ canvas2.MoveStep = 5F;
+ canvas2.Name = "canvas2";
+ canvas2.Route = 0D;
+ canvas2.Scale = 1D;
+ canvas2.Size = new Size(337, 200);
+ canvas2.TabIndex = 18;
+ canvas2.WholeScale = 0F;
+ canvas2.XMove = 0F;
+ canvas2.XScale = 0F;
+ canvas2.YMove = 0F;
+ canvas2.YScale = 0F;
+ //
// textBox2
//
textBox2.Location = new Point(437, 287);
@@ -1429,49 +1472,6 @@
label35.TabIndex = 14;
label35.Text = "误检率";
//
- // canvas6
- //
- canvas6.AllowSelectDefect = true;
- canvas6.BrushColor = null;
- canvas6.ImagePath = "";
- mat5.IsEnabledDispose = true;
- canvas6.ImaMAt = mat5;
- canvas6.ImgData = null;
- canvas6.Location = new Point(19, 454);
- canvas6.MoveStep = 5F;
- canvas6.Name = "canvas6";
- canvas6.Route = 0D;
- canvas6.Scale = 1D;
- canvas6.Size = new Size(318, 200);
- canvas6.TabIndex = 13;
- canvas6.WholeScale = 0F;
- canvas6.XMove = 0F;
- canvas6.XScale = 0F;
- canvas6.YMove = 0F;
- canvas6.YScale = 0F;
- //
- // canvas2
- //
- canvas2.AllowSelectDefect = true;
- canvas2.BrushColor = null;
- canvas2.ImagePath = "";
- mat6.IsEnabledDispose = true;
- canvas2.ImaMAt = mat6;
- canvas2.ImgData = null;
- canvas2.Location = new Point(19, 238);
- canvas2.Margin = new Padding(4, 3, 4, 3);
- canvas2.MoveStep = 5F;
- canvas2.Name = "canvas2";
- canvas2.Route = 0D;
- canvas2.Scale = 1D;
- canvas2.Size = new Size(318, 188);
- canvas2.TabIndex = 10;
- canvas2.WholeScale = 0F;
- canvas2.XMove = 0F;
- canvas2.XScale = 0F;
- canvas2.YMove = 0F;
- canvas2.YScale = 0F;
- //
// 实时显示
//
实时显示.AutoSize = true;
@@ -1562,10 +1562,10 @@
//
// ScanDevList
//
- ScanDevList.Location = new Point(297, 22);
+ ScanDevList.Location = new Point(296, 18);
ScanDevList.Margin = new Padding(4, 2, 4, 2);
ScanDevList.Name = "ScanDevList";
- ScanDevList.Size = new Size(96, 22);
+ ScanDevList.Size = new Size(96, 30);
ScanDevList.TabIndex = 2;
ScanDevList.Text = "Scan";
ScanDevList.UseVisualStyleBackColor = true;
@@ -2211,15 +2211,21 @@
private XKRS.UI.Canvas DefetShow7;
private XKRS.UI.Canvas DefetShow6;
private Button handStopBtn;
- private XKRS.UI.Canvas canvas1;
- private XKRS.UI.Canvas canvas5;
- private XKRS.UI.Canvas canvas4;
- private XKRS.UI.Canvas canvas3;
- private XKRS.UI.Canvas canvas6;
- private XKRS.UI.Canvas canvas2;
+ //private XKRS.UI.Canvas canvas1;
+ //private XKRS.UI.Canvas canvas5;
+ //private XKRS.UI.Canvas canvas4;
+ //private XKRS.UI.Canvas canvas3;
+ //private XKRS.UI.Canvas canvas6;
+ //private XKRS.UI.Canvas canvas2;
private TextBox textBox1;
private Label label35;
private TextBox textBox2;
private Label label36;
+ private XKRS.UI.Canvas canvas5;
+ private XKRS.UI.Canvas canvas4;
+ private XKRS.UI.Canvas canvas3;
+ private XKRS.UI.Canvas canvas1;
+ private XKRS.UI.Canvas canvas6;
+ private XKRS.UI.Canvas canvas2;
}
}
diff --git a/HisenceYoloDetection/MainForm.cs b/HisenceYoloDetection/MainForm.cs
index 9a2f192..ab627d6 100644
--- a/HisenceYoloDetection/MainForm.cs
+++ b/HisenceYoloDetection/MainForm.cs
@@ -1,5 +1,6 @@
using DVPCameraType;
using Microsoft.VisualBasic.Logging;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OpenCvSharp;
using OpenCvSharp.Dnn;
@@ -191,6 +192,143 @@ namespace HisenceYoloDetection
}
+ ///
+ /// GET·½Ê½·¢Ë͵ýá¹û
+ ///
+ /// ÇëÇóµÄurl
+ /// ·þÎñÆ÷ÏìÓ¦µÄÊý¾Ý
+ public static string getHttpRequest(string url)
+ {
+ //Ô¤±¸ÇëÇóµÄ×ÊÔ´
+ HttpWebRequest request = null;
+ HttpWebResponse response = null;
+ StreamReader reader = null;
+
+ string content = string.Empty;
+
+ try
+ {
+ request = (HttpWebRequest)WebRequest.Create(url);
+ request.Method = "GET";
+
+ response = (HttpWebResponse)request.GetResponse();
+ using (reader = new StreamReader(response.GetResponseStream()))
+ {
+ content = reader.ReadToEnd();
+ }
+ }
+ catch (System.Exception err)
+ {
+ MessageBox.Show("1.GET³öÏÖÁË´íÎó£¡\n´íÎóÀ´Ô´£º" + err.Source + "\n´íÎóÐÅÏ¢£º" + err.Message + "\n" + err);
+ Console.WriteLine("1.GET³öÏÖÁË´íÎó£¡\n´íÎóÀ´Ô´£º" + err.Source + "´íÎóÐÅÏ¢£º" + err.Message);
+ }
+
+ //ÓÃÍêÏú»Ù
+ response.Dispose();
+ reader.Dispose();
+
+ return content;
+ }
+
+ ///
+ /// ·¢ÆðÒ»¸öhttpÇëÇ󣬷½Ê½ÎªPOST
+ ///
+ /// ·¢ËÍÇëÇóµÄÄ¿±êurl
+ /// Òª·¢Ë͵ÄÏûÏ¢
+ /// ·þÎñÆ÷ÏìÓ¦µÄÊý¾Ý
+ public string postHttpRequest(string uri, string msg)
+ {
+ //Ô¤±¸ÇëÇóµÄ×ÊÔ´
+ HttpWebRequest request = null;
+ HttpWebResponse response = null;
+ Stream requestStream = null;
+ StreamReader reader = null;
+
+ var data = Encoding.UTF8.GetBytes(string.Format("a={0}&b={1}", "message", msg));
+ string content = "";
+
+ try
+ {
+ request = (HttpWebRequest)WebRequest.Create(uri);
+ request.Method = "POST";
+ requestStream = request.GetRequestStream();
+
+ request.ContentType = "application/text";
+
+ requestStream.Write(data, 0, data.Length);
+ response = (HttpWebResponse)request.GetResponse();
+
+ using (reader = new StreamReader(response.GetResponseStream()))
+ {
+ content = reader.ReadToEnd();
+ }
+ }
+ catch (Exception err)
+ {
+ MessageBox.Show("1.POST³öÏÖÁË´íÎó£¡\n´íÎóÀ´Ô´£º" + err.Source + "\n´íÎóÐÅÏ¢£º" + err.Message + "\n" + err);
+ Console.WriteLine("1.POST³öÏÖÁË´íÎó£¡\n´íÎóÀ´Ô´£º" + err.Source + "´íÎóÐÅÏ¢£º" + err.Message);
+ }
+
+ //×ÊÔ´ÓÃÍê»ØÊÕ
+ requestStream.Dispose();
+ response.Dispose();
+ reader.Dispose();
+
+ return content;
+ }
+
+ #region PostÇëÇó
+ ///
+ /// http PostÇëÇó
+ ///
+ /// ²ÎÊý
+ /// ·ÃÎʵØÖ·
+ /// ĬÈÏ application/json , application/x-www-form-urlencoded,multipart/form-data,raw,binary
+ /// ĬÈÏapplication/json
+ ///
+ public string Post(string parameterData, string serviceUrl, string ContentType = "application/json", string Accept = "application/json")
+ {
+ //Ïȸù¾ÝÓû§ÇëÇóµÄuri¹¹ÔìÇëÇóµØÖ·
+ //string serviceUrl = string.Format("{0}/{1}", this.BaseUri, uri);
+
+ //´´½¨Web·ÃÎʶÔÏó
+ HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);
+ //°ÑÓû§´«¹ýÀ´µÄÊý¾Ýת³É¡°UTF-8¡±µÄ×Ö½ÚÁ÷
+ byte[] buf = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(parameterData);
+
+ myRequest.Method = "POST";
+ //myRequest.Accept = "application/json";
+ //myRequest.ContentType = "application/json"; // //Content-Type: application/x-www-form-urlencoded
+ myRequest.AutomaticDecompression = DecompressionMethods.GZip;
+ myRequest.Accept = Accept;
+ //myRequest.ContentType = ContentType;
+ myRequest.ContentType = "application/json; charset=UTF-8";
+ myRequest.ContentLength = buf.Length;
+ myRequest.MaximumAutomaticRedirections = 1;
+ myRequest.AllowAutoRedirect = true;
+
+ //myRequest.Headers.Add("content-type", "application/json");
+ //myRequest.Headers.Add("accept-encoding", "gzip");
+ //myRequest.Headers.Add("accept-charset", "utf-8");
+
+ //·¢ËÍÇëÇó
+ Stream stream = myRequest.GetRequestStream();
+ stream.Write(buf, 0, buf.Length);
+ stream.Close();
+
+ //ͨ¹ýWeb·ÃÎʶÔÏó»ñÈ¡ÏìÓ¦ÄÚÈÝ
+ HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
+ //ͨ¹ýÏìÓ¦ÄÚÈÝÁ÷´´½¨StreamReader¶ÔÏó£¬ÒòΪStreamReader¸ü¸ß¼¶¸ü¿ì
+ StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
+ //string returnXml = HttpUtility.UrlDecode(reader.ReadToEnd());//Èç¹ûÓбàÂëÎÊÌâ¾ÍÓÃÕâ¸ö·½·¨
+ string returnData = reader.ReadToEnd();//ÀûÓÃStreamReader¾Í¿ÉÒÔ´ÓÏìÓ¦ÄÚÈÝ´ÓÍ·¶Áµ½Î²
+
+ reader.Close();
+ myResponse.Close();
+
+ return returnData;
+ }
+ #endregion
///
/// Ö÷´°¿Ú
@@ -200,9 +338,38 @@ namespace HisenceYoloDetection
private void MainForm_Load(object sender, EventArgs e)
{
//±¨¾¯µØÖ·
-
-
+ //string url = "https://inner-apisix.hisense.com/mes-plus/api/Fcc/GetWorkOrderBOMlnfo?user_key=k7gzo1fsfcami7n5hmpxtybyluf9xeue";
+ string url = "https://echo.hoppscotch.io";
+ string PostUrl = url;
+ DateTime dt= DateTime.Now;
+ string starttime=string.Format("{0:yyyy_mm_dd}", dt); //17 17 2017 2017
+
+ string startTime = starttime;
+ string EndTime = starttime;
+ string lineBody = "ZZ-P5";
+ string MaterialDescripts = "ÖÆÀäÆ÷";
+ string MaterialDescripts2 = "¹¤ÒÕ¹Ü";
+ JObject patientinfo = new JObject();
+ JArray ids = new JArray();
+ ids.Add(MaterialDescripts);
+ ids.Add(MaterialDescripts2);
+ patientinfo["startTime"] = startTime;
+ patientinfo["EndTime"] = EndTime;
+ patientinfo["lineBody"] = lineBody;
+ patientinfo["MaterialDescripts"] = ids;
+ string sendData = JsonConvert.SerializeObject(patientinfo);
+ //eg: ·¢ËÍUrlÐèÒªµÄ¸ñʽ£ºsendData={"ids":[123],"Name":СºÚ}
+ string resultData = Post(sendData, PostUrl);
+ resultData = "{\r\n\t\"Result\": [],\r\n\t\"success\": false,\r\n\t\"ReturnMsg\": \"²ÎÊý-starttime ²»ÕýÈ·!\"\r\n}";
+ JObject jo = (JObject)JsonConvert.DeserializeObject(resultData);
+ string sucessIf = jo["success"].ToString();
+ if(sucessIf.ToLower()=="true")
+ {
+ string ProductType = jo["ProductType"].ToString();
+ string FinalDefIo = jo["FinalDefIo"].ToString();
+ //½âÎö×Ö¶Î
+ }
if (_runHandleBefore == null)
{
_runHandleBefore = new AutoResetEvent(false);
@@ -413,6 +580,7 @@ namespace HisenceYoloDetection
AllDSum.Text = AllDsums.ToString();
OKDNum.Text = OKDsums.ToString();
NGDNum.Text = NGDsums.ToString();
+ textBox1.Text = WUsums.ToString();
using (StreamWriter stream = new StreamWriter("D://information.log", true))
{
stream.WriteLine(Logtxt);
@@ -610,12 +778,12 @@ namespace HisenceYoloDetection
OKOrNGShow.Image = OKbitmap;
//³õʼ»¯É¨Âëǹ
- //Scanner.Strart();
- //Scanner.OnClientDataReceived -= OnDataReceived;
- //Scanner.OnClientDataReceived += OnDataReceived;
- //Scanner.btnSendMsg("LON\r");//·¢ËÍ¿ªÆôÖ¸Áî
- //myLog("·¢ËͶ÷ʿɨÂëǹ¿ªÆôÖ¸Áî", DateTime.Now);
-
+ Scanner.Strart();
+ Scanner.OnClientDataReceived -= OnDataReceived;
+ Scanner.OnClientDataReceived += OnDataReceived;
+ Scanner.btnSendMsg("LON\r");//·¢ËÍ¿ªÆôÖ¸Áî
+ myLog("·¢ËͶ÷ʿɨÂëǹ¿ªÆôÖ¸Áî", DateTime.Now);
+
//PLCʹÄÜ¿ªÆô
melsecPLCTCPDriver.WriteInt("581", 0);//¶¨Î»ËÉ¿ª
melsecPLCTCPDriver.WriteInt("504", 0);//¶¨Î»ËÉ¿ª
@@ -1010,14 +1178,18 @@ namespace HisenceYoloDetection
if (bBar)
{
_runHandleBefore.WaitOne();
- bBarTriger = true;//Ð޸ijÉÏà»úÅÄÕÕ»ñÈ¡ÐͺÅ
-
+ //ÕâÀï¸Ä³ÉºÍº£ÐŵĶԽÓÐèÇó
- xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
- //xKNow = GetModeFromBar(m_sKEYENCEBar);//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
+ //xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
+ xKNow = GetModeFromBar(m_sKEYENCEBar);//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
+ if(xKNow==null)
+ {
+ myLog("Êý¾Ý¿âûÓÐÌõÂëÆ¥Åä" + m_sKEYENCEBar, DateTime.Now);
+ break;
+ }
if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$"))
{
- myLog("ÐͺÅÆ¥Åä³É¹¦" + m_sKEYENCEBar, DateTime.Now);
+ myLog("ÐͺÅÆ¥Åä³É¹¦" + xKNow.OcrBar, DateTime.Now);
bBarTriger = true;
//MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLC¿ØÖƵç»úÒƶ¯ËÄÖá
}
@@ -1116,10 +1288,12 @@ namespace HisenceYoloDetection
}
if (iNum1 >= 2)
{
- //if (bBarTriger)
+#if false
+
+ if (bBarTriger)//Ö¤Ã÷¶ÁÂëÆ÷¶Áµ½¶«Î÷
{
-#if false
+
if (!StopM)
{
melsecPLCTCPDriver.WriteInt("550", 1);//×èÈû
@@ -1183,6 +1357,7 @@ namespace HisenceYoloDetection
iNum0 = 0;
iNum1 = 0;
break;
+ }
#else
myLog("µÚÒ»´Î²É¼¯Í¼Ïñ", DateTime.Now);
//Òƶ¯Ä£×é ¶ÁÈý´Î²â¾àµÄµØÖ· ¿´ÊÇ·ñÍùÇ°Òƶ¯
@@ -1242,7 +1417,7 @@ namespace HisenceYoloDetection
#endif
- }
+
}
@@ -1370,34 +1545,42 @@ namespace HisenceYoloDetection
//ÐźÅÁ¿×èÈû ʹÆä²»ÔÚ×ÜÊýÔö¼ÓºÍÉÁ˸
_runHandleAfter.WaitOne();
//Ïà»ú2µÚÒ»´ÎÅÄÕÕ
- if (IfCam2Triger)
+ //if (IfCam2Triger)
{
IfCam2Triger = false;
//OCRʶ±ð
- MLRequest req = new MLRequest();
- req.currentMat = Cam2ImgShowBar;
- //req.currentMat = Cv2.ImRead("D:\\Hisence\\ÀàÐÍ\\1\\bar.jpg");
+ //MLRequest req = new MLRequest();
+ //req.currentMat = Cam2ImgShowBar;
+ ////req.currentMat = Cv2.ImRead("D:\\Hisence\\ÀàÐÍ\\1\\bar.jpg");
- //Ïà»úʶ±ðµÄ×Ö·û´®
- string IOcrBAr = DetMachineBar(ref req);
- DateTime dt = DateTime.Now;
- using (StreamWriter sw = new StreamWriter("D://Hisence//logsBar.log", true))
- {
- string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
- sw.WriteLine(filename + "\n");
- sw.WriteLine(IOcrBAr + "\n");
- sw.Flush();
- }
- // IOcrBAr = "BatchW9659ModelWNHPI74SCPSDE";
- IOcrBAr = "W821PWMS27106WD2";
+ ////Ïà»úʶ±ðµÄ×Ö·û´®
+ //string IOcrBAr = DetMachineBar(ref req);
+ //DateTime dt = DateTime.Now;
+ //using (StreamWriter sw = new StreamWriter("D://Hisence//logsBar.log", true))
+ //{
+ // string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
+ // sw.WriteLine(filename + "\n");
+ // sw.WriteLine(IOcrBAr + "\n");
+ // sw.Flush();
+ //}
+ // IOcrBAr = "BatchW9659ModelWNHPI74SCPSDE";
+ // IOcrBAr = "W821PWMS27106WD2";
+ // IOcrBAr=
//¸ù¾ÝÌõÂëÊý¾Ý¿â±È¶Ô
- xKNow = GetModeFromBar(IOcrBAr);//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
+ string IOcrBAr = xKNow.OcrBar;
+ //xKNow = GetModeFromBar(IOcrBAr);//´ÓÊý¾Ý¿âÖвéѯµ½Õâ¸öÌõÂëµÄËÄÖáµÄÖµ
+ //ÕâÀï¸Ä³ÉºÍº£ÐŵĶԽÓÐèÇó
+
List xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr);
if (xkWordList.Count() == 1)
{
xK_HisenceSQLWord = xkWordList[0];
}
-
+ if(xKNow==null)
+ {
+ myLog("δƥÅäÌõÂë" + IOcrBAr, DateTime.Now);
+ break;
+ }
if (xKNow.OcrBar == null)
{
@@ -1423,7 +1606,7 @@ namespace HisenceYoloDetection
//}
myLog("ÐͺÅÆ¥Åä³É¹¦" + IOcrBAr, DateTime.Now);
- bBarTriger = true;
+
}
@@ -1437,7 +1620,7 @@ namespace HisenceYoloDetection
// if (IfCam1TwoTriger && bBarTriger)
{
IfCam1TwoTriger = false;
- bBarTriger = false;
+ bBarTriger = false;//¿ÉÄÜûʲôÓÃÁË
_runHandleAfter.Reset();
//³õʼ»¯°å
Defet_OnDetectionDone(whiteMat, 1);
@@ -1582,7 +1765,7 @@ namespace HisenceYoloDetection
{
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 1);//ºìµÆ
melsecPLCTCPDriver.WriteInt(WaringAdress, 1);//±¨¾¯
- myLog("Æ¥Åäʧ°Ü", DateTime.Now);
+
//¼ÓÉÏÈËΪÅжÏÊÇ·ñÊÇNGÏ´Ò»ú
DialogResult dr = MessageBox.Show("ÊÇ·ñÎó¼ì£¿", "ÊÇ·ñÎó¼ì", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
@@ -1598,7 +1781,7 @@ namespace HisenceYoloDetection
textBox1.Text = percentText;
OKOrNGShow.Image = OKbitmap;
}));
-
+ myLog("Æ¥Åäʧ°Ü", DateTime.Now);
}
else
{
@@ -1610,6 +1793,7 @@ namespace HisenceYoloDetection
{
OKOrNGShow.Image = NGbitmap;
}));
+ myLog("Æ¥Åä³É¹¦", DateTime.Now);
}
@@ -1699,6 +1883,7 @@ namespace HisenceYoloDetection
//
if (data.Length > 10)
{
+ m_sKEYENCEBar=string.Empty;
m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data);
// myLog("ÐͺÅOcr" + m_sKEYENCEBar, DateTime.Now);
_runHandleBefore.Set();
@@ -1899,7 +2084,7 @@ namespace HisenceYoloDetection
CheckDiffSciHelper1.CheckDiffSci(path2, pathmat, rect2, rect2, false, "D://Hisence//Test1");
*/
- //OnGetBar();
+ OnGetBar();
melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 1);//»ÆµÆ
TriggerCameral2();
ReadyDetect();
@@ -3141,7 +3326,7 @@ namespace HisenceYoloDetection
{
SQLStr = SQlxK_HisenceWord.SixblockMainWord;
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SixblockMainWord, SQlxK_HisenceWord.SixblockMainWord);
-
+ OneIF1 = false;//²âÊÔ
Rect rect = new Rect(0, 0, 0, 0);
string PathSql = SQlxK_HisenceWord.SixblockPath;
//µÚÁù¿é¾í»ýÉèÖÃһֱΪtrue
@@ -3173,6 +3358,7 @@ namespace HisenceYoloDetection
{
SQLStr = SQlxK_HisenceWord.SevenblockMainWord;
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
+
Rect rect = new Rect(0, 0, 0, 0);
string PathSql = SQlxK_HisenceWord.SevenblockPath;
diff --git a/HisenceYoloDetection/TCPClienDriver.cs b/HisenceYoloDetection/TCPClienDriver.cs
index f94e26c..ba29b8c 100644
--- a/HisenceYoloDetection/TCPClienDriver.cs
+++ b/HisenceYoloDetection/TCPClienDriver.cs
@@ -18,10 +18,10 @@ namespace HisenceYoloDetection
public void Strart()
{
client = new TcpClient();
- client.Host = "192.168.3.100";
- client.Port= 9004;
- //client.Host = "127.0.0.1";
- //client.Port = 9000;
+ // client.Host = "192.168.3.100";
+ // client.Port= 9004;
+ client.Host = "127.0.0.1";
+ client.Port = 9000;
client.Connect();
client.OnDataReceived += Client_OnDataReceived;
diff --git a/XKRS.UI/XKRS.UI.csproj b/XKRS.UI/XKRS.UI.csproj
index b57a0cb..3ed89d4 100644
--- a/XKRS.UI/XKRS.UI.csproj
+++ b/XKRS.UI/XKRS.UI.csproj
@@ -5,8 +5,14 @@
enable
true
enable
- .\bin\X64\Debug
+
Library
+ output
+ x64
+
+
+
+ False