From d881dc6ec05ae725110fdb1dd891e1eff5c0e103 Mon Sep 17 00:00:00 2001 From: TD Date: Mon, 24 Mar 2025 17:24:14 +0800 Subject: [PATCH] 1 --- DH.Devices.PLC/XinJEPLCTcpNet.cs | 7 ++++--- DHSoftware/MainWindow.cs | 16 +++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DH.Devices.PLC/XinJEPLCTcpNet.cs b/DH.Devices.PLC/XinJEPLCTcpNet.cs index ca4e862..6a38193 100644 --- a/DH.Devices.PLC/XinJEPLCTcpNet.cs +++ b/DH.Devices.PLC/XinJEPLCTcpNet.cs @@ -55,10 +55,11 @@ namespace DH.Devices.PLC if (ret.IsSuccess) { Connected = true; + CountToZero(); + TcpNet.Write("M122", true); MonitorPieces(); - - TurntableOpen(Convert.ToInt32(itemSpeed.Value) , true); - + TurntableStop(); + return true; } else diff --git a/DHSoftware/MainWindow.cs b/DHSoftware/MainWindow.cs index eca17f6..49071cf 100644 --- a/DHSoftware/MainWindow.cs +++ b/DHSoftware/MainWindow.cs @@ -453,7 +453,7 @@ namespace DHSoftware cam.CameraIP = cameraBase.CameraIP; cam.IsEnabled = cameraBase.IsEnabled; Cameras.Add(cam); - //cam.CameraConnect(); + cam.CameraConnect(); cam.OnHImageOutput += OnCameraHImageOutput; } else if(cameraBase.CamType == EnumCamType.海康hik) @@ -540,7 +540,7 @@ namespace DHSoftware CtrlVisionRunBase ctrlVisionRun = new CtrlVisionRunBase(_visionEngine); tabImgDisplay.Controls.Add(ctrlVisionRun); - + StartProcess(); @@ -658,9 +658,15 @@ namespace DHSoftware // 转盘操作 - // if (_PLC?.IIConfig?.IsEnabled == true) + // if (_PLC?.IIConfig?.IsEnabled == true) - // _PLC.TurntableOpen(XKRSPLCConfig.TurnSpeed, XKRSPLCConfig.TurnDirection); + // _PLC.TurntableOpen(XKRSPLCConfig.TurnSpeed, XKRSPLCConfig.TurnDirection); + PLCItem itemSpeed = PLC.PLCItemList.FirstOrDefault(u => u.Name == "转盘速度"); + if (itemSpeed != null) + { + PLC.TurntableOpen(Convert.ToInt32(itemSpeed.Value), true); + + } Thread.Sleep(500); @@ -1407,7 +1413,7 @@ namespace DHSoftware Cameras.Clear(); Dectection.Clear(); // Add the code for the "停止" button click here - // PLC.TurntableStop(); + PLC.TurntableStop(); CurrentMachine = true; sLDMotion.Stop(); }