修改流程

This commit is contained in:
YZJ 2024-07-15 17:45:27 +08:00
parent 791bfb85d2
commit f1a9e75917
2 changed files with 58 additions and 157 deletions

View File

@ -29,11 +29,6 @@
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
OpenCvSharp.Mat mat1 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat2 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat3 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat4 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat5 = new OpenCvSharp.Mat();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
tabPage2 = new TabPage();
panel1 = new Panel();
@ -128,6 +123,8 @@
originMatShow = new PictureBox();
ResultMatShow = new PictureBox();
panel8 = new Panel();
label24 = new Label();
ScannerBox = new TextBox();
textBox2 = new TextBox();
label36 = new Label();
textBox1 = new TextBox();
@ -173,11 +170,6 @@
queryALLBtn = new Button();
label32 = new Label();
InsertDataDgv = new DataGridView();
canvas4 = new XKRS.UI.Canvas();
canvas3 = new XKRS.UI.Canvas();
canvas2 = new XKRS.UI.Canvas();
canvas1 = new XKRS.UI.Canvas();
canvas5 = new XKRS.UI.Canvas();
timer1 = new System.Windows.Forms.Timer(components);
timer2 = new System.Windows.Forms.Timer(components);
timer3 = new System.Windows.Forms.Timer(components);
@ -1230,6 +1222,8 @@
//
// panel8
//
panel8.Controls.Add(label24);
panel8.Controls.Add(ScannerBox);
panel8.Controls.Add(textBox2);
panel8.Controls.Add(label36);
panel8.Controls.Add(textBox1);
@ -1253,6 +1247,25 @@
panel8.TabIndex = 2;
panel8.Paint += panel8_Paint;
//
// label24
//
label24.AutoSize = true;
label24.Location = new Point(33, 287);
label24.Margin = new Padding(4, 0, 4, 0);
label24.Name = "label24";
label24.Size = new Size(50, 17);
label24.TabIndex = 19;
label24.Text = "扫码器";
//
// ScannerBox
//
ScannerBox.Location = new Point(91, 284);
ScannerBox.Margin = new Padding(4, 2, 4, 2);
ScannerBox.Name = "ScannerBox";
ScannerBox.ReadOnly = true;
ScannerBox.Size = new Size(255, 23);
ScannerBox.TabIndex = 18;
//
// textBox2
//
textBox2.Location = new Point(437, 287);
@ -1724,111 +1737,6 @@
InsertDataDgv.Size = new Size(1601, 206);
InsertDataDgv.TabIndex = 0;
//
// canvas4
//
canvas4.AllowSelectDefect = true;
canvas4.BrushColor = null;
canvas4.ImagePath = "";
mat1.IsEnabledDispose = true;
canvas4.ImaMAt = mat1;
canvas4.ImgData = null;
canvas4.Location = new Point(367, 517);
canvas4.MoveStep = 5F;
canvas4.Name = "canvas4";
canvas4.Route = 0D;
canvas4.Scale = 1D;
canvas4.Size = new Size(351, 198);
canvas4.TabIndex = 7;
canvas4.WholeScale = 0F;
canvas4.XMove = 0F;
canvas4.XScale = 0F;
canvas4.YMove = 0F;
canvas4.YScale = 0F;
//
// canvas3
//
canvas3.AllowSelectDefect = true;
canvas3.BrushColor = null;
canvas3.ImagePath = "";
mat2.IsEnabledDispose = true;
canvas3.ImaMAt = mat2;
canvas3.ImgData = null;
canvas3.Location = new Point(0, 515);
canvas3.MoveStep = 5F;
canvas3.Name = "canvas3";
canvas3.Route = 0D;
canvas3.Scale = 1D;
canvas3.Size = new Size(351, 198);
canvas3.TabIndex = 6;
canvas3.WholeScale = 0F;
canvas3.XMove = 0F;
canvas3.XScale = 0F;
canvas3.YMove = 0F;
canvas3.YScale = 0F;
//
// canvas2
//
canvas2.AllowSelectDefect = true;
canvas2.BrushColor = null;
canvas2.ImagePath = "";
mat3.IsEnabledDispose = true;
canvas2.ImaMAt = mat3;
canvas2.ImgData = null;
canvas2.Location = new Point(367, 237);
canvas2.MoveStep = 5F;
canvas2.Name = "canvas2";
canvas2.Route = 0D;
canvas2.Scale = 1D;
canvas2.Size = new Size(351, 198);
canvas2.TabIndex = 5;
canvas2.WholeScale = 0F;
canvas2.XMove = 0F;
canvas2.XScale = 0F;
canvas2.YMove = 0F;
canvas2.YScale = 0F;
//
// canvas1
//
canvas1.AllowSelectDefect = true;
canvas1.BrushColor = null;
canvas1.ImagePath = "";
mat4.IsEnabledDispose = true;
canvas1.ImaMAt = mat4;
canvas1.ImgData = null;
canvas1.Location = new Point(8, 237);
canvas1.MoveStep = 5F;
canvas1.Name = "canvas1";
canvas1.Route = 0D;
canvas1.Scale = 1D;
canvas1.Size = new Size(351, 198);
canvas1.TabIndex = 4;
canvas1.WholeScale = 0F;
canvas1.XMove = 0F;
canvas1.XScale = 0F;
canvas1.YMove = 0F;
canvas1.YScale = 0F;
//
// canvas5
//
canvas5.AllowSelectDefect = true;
canvas5.BrushColor = null;
canvas5.ImagePath = "";
mat5.IsEnabledDispose = true;
canvas5.ImaMAt = mat5;
canvas5.ImgData = null;
canvas5.Location = new Point(7, 515);
canvas5.MoveStep = 5F;
canvas5.Name = "canvas5";
canvas5.Route = 0D;
canvas5.Scale = 1D;
canvas5.Size = new Size(351, 198);
canvas5.TabIndex = 18;
canvas5.WholeScale = 0F;
canvas5.XMove = 0F;
canvas5.XScale = 0F;
canvas5.YMove = 0F;
canvas5.YScale = 0F;
//
// richTextBox1
//
richTextBox1.Dock = DockStyle.Bottom;
@ -2054,5 +1962,7 @@
private XKRS.UI.Canvas canvas6;
private XKRS.UI.Canvas canvas2;
private Button button1;
private Label label24;
private TextBox ScannerBox;
}
}

View File

@ -597,7 +597,7 @@ namespace HisenceYoloDetection
melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//黄灯
melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 0);//绿灯
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//不报警
//t = new System.Timers.Timer(10000);//实例化Timer类设置间隔时间为10000毫秒
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//到达时间的时候执行事件;
//t.AutoReset = true;//设置是执行一次false还是一直执行(true)
@ -1486,16 +1486,22 @@ namespace HisenceYoloDetection
//这里改成和海信的对接需求
string OcrBar = "";
string FinalDefIDToFind = m_sKEYENCEBar.Substring(1, 18);// 目标 FinalDefID
#if false
{
OcrBar=FormBarType(FinalDefIDToFind)
this.Invoke(new Action(() =>
{
ScannerBox.Text = FinalDefIDToFind;
}));
myLog("扫码器结果" + m_sKEYENCEBar, DateTime.Now);
#if true
OcrBar = FormBarType(FinalDefIDToFind);
#else
OcrBar = "OZ.洗衣机.WF3G7014-NVW001CZA.WSG374A.白";
#endif
// if(Oldm_sKEYENCEBar!= m_sKEYENCEBar)
if (DayTypeDics.ContainsKey(FinalDefIDToFind))//当日的post请求有此类SN 得到此类型号
{
OcrBar = DayTypeDics[FinalDefIDToFind];
}
if (OcrBar.IsNullOrEmpty())
{
break;
@ -1512,7 +1518,7 @@ namespace HisenceYoloDetection
if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$"))
{
myLog("型号匹配成功" + xKNow.OcrBar, DateTime.Now);
// myLog("型号匹配成功" + xKNow.OcrBar, DateTime.Now);
}
@ -1706,8 +1712,8 @@ namespace HisenceYoloDetection
{
Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\类型\\1\\001.jpg"); ;
//Cam1ImgOne = cameraMat;
// Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\类型\\1\\001.jpg"); ;
Cam1ImgOne = cameraMat;
IfCam1OneTriger = true;
originMatShow.Image = cameraMat.ToBitmap();
//pictureBox1.Image = cameraMat.ToBitmap();
@ -1800,6 +1806,17 @@ namespace HisenceYoloDetection
// IOcrBAr = "W821PWMS27106WD2";
// IOcrBAr=
//根据条码数据库比对
if (xKNow == null)
{
myLog("未匹配条码" , DateTime.Now);
break;
}
if (xKNow.OcrBar == null)
{
myLog("未匹配成功" + xKNow.OcrBar, DateTime.Now);
break;
}
string IOcrBAr = xKNow.OcrBar;
//xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值
//这里改成和海信的对接需求
@ -1811,17 +1828,7 @@ namespace HisenceYoloDetection
{
xK_HisenceSQLWord = xkWordList[0];
}
if (xKNow == null)
{
myLog("未匹配条码" + IOcrBAr, DateTime.Now);
break;
}
if (xKNow.OcrBar == null)
{
myLog("未匹配成功" + IOcrBAr, DateTime.Now);
break;
}
if (xKNow.Detect != "")
{
////此时运行的洗衣机是和之前一个语言模型
@ -1893,22 +1900,6 @@ namespace HisenceYoloDetection
}
////进行推理
//MLRequest req2 = new MLRequest();
//req2.currentMat = Cam1ImgTwo;
//req2.ResizeWidth = 640;
//req2.ResizeHeight = 640;
//req2.Score = 0.3f;
//req2.in_lable_path = LablePath;//标签路径
//req2.confThreshold = 0.3f;//模型置信度
//req2.iouThreshold = 0.4f;//检测IOU
//req2.out_node_name = "output";
//MLResult mL2 = simboObjectDetection.RunInferenceFixed(req2);
//if (mL2.ResultMap != null)
//{
// mL2.ResultMap.Save("D://cam1//" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
// ResultMatShow2.Image = mL2.ResultMap;
//}
List<string> strMatListTwo = new List<string>();
List<string> strMatFuzzyListTwo = new List<string>();
@ -1967,8 +1958,8 @@ namespace HisenceYoloDetection
{
//判断块值是否有含有匹配false
bool containsFalseValue = keyValueResult.ContainsValue(false);
bool containsFalseValue2 = keyValueResult2.ContainsValue(false);
if (containsFalseValue || containsFalseValue2)
if (containsFalseValue)
MatchStr = false;
@ -2351,7 +2342,7 @@ namespace HisenceYoloDetection
TriggerCameral2();//光电触发拍照 根据SN获取型号 从数据库中得到块值
ReadyDetect();//相机拍照后检测线程
ThreadPost();//相机拍照后获取当日的型号
//ThreadPost();//相机拍照后获取当日的型号
myLog("开启流程成功", DateTime.Now);
}