diff --git a/DH.Commons/Base/CameraBase.cs b/DH.Commons/Base/CameraBase.cs
index 12e5ab8..73cf709 100644
--- a/DH.Commons/Base/CameraBase.cs
+++ b/DH.Commons/Base/CameraBase.cs
@@ -49,6 +49,7 @@ namespace DH.Commons.Base
         private bool _isallPicEnabled = true;//默认全画幅
         private bool _isContinueMode = false;
         private bool _isSavePicEnabled = false;
+        private bool _isZoomCamera = false;
         private string _imageSaveDirectory;
         private EnumCamType _CamType;
         private ImageFormat _imageFormat = ImageFormat.Jpeg;
@@ -59,7 +60,7 @@ namespace DH.Commons.Base
         private string _computerIP = string.Empty;
         private bool _isDirectHardwareTrigger = false;
         private float _gain =6;
-        private float _rotateImage = 0;
+        private int _rotateImage = 0;
         private float _exposure = 200;
         private float _triggerDelay = 0;
         private decimal _roiX = 0;
@@ -83,6 +84,16 @@ namespace DH.Commons.Base
                 OnPropertyChanged(nameof(IsContinueMode));
             }
         }
+        public bool IsZoomCamera
+        {
+            get => _isZoomCamera;
+            set
+            {
+                if (_isZoomCamera == value) return;
+                _isZoomCamera = value;
+                OnPropertyChanged(nameof(IsZoomCamera));
+            }
+        }
 
         public virtual bool IsEnabled
         {
@@ -245,7 +256,7 @@ namespace DH.Commons.Base
         [Category("图像旋转")]
         [DisplayName("默认旋转")]
         [Description("默认旋转,相机开启后默认不旋转")]
-        public virtual float RotateImage
+        public virtual int RotateImage
         {
             get => _rotateImage;
             set
diff --git a/DH.Commons/Base/VisualLocalization.cs b/DH.Commons/Base/VisualLocalization.cs
index a38ce7a..66c7694 100644
--- a/DH.Commons/Base/VisualLocalization.cs
+++ b/DH.Commons/Base/VisualLocalization.cs
@@ -16,6 +16,8 @@ namespace DH.Commons.Base
         public string Direction { get; set; }
         public string Speed { get; set; }
 
+        public string MSpeed { get; set; }
+
         // 配置文件路径
         private const string ConfigFile = "VisualConfigs.json";
         private static readonly object _fileLock = new object();
@@ -38,6 +40,7 @@ namespace DH.Commons.Base
                     existing.Threshold = Threshold;
                     existing.Direction = Direction;
                     existing.Speed = Speed;
+                    existing.MSpeed = MSpeed;
                 }
                 else
                 {
diff --git a/DH.Commons/Enums/Enum.cs b/DH.Commons/Enums/Enum.cs
index 6c16f39..7bfbc3f 100644
--- a/DH.Commons/Enums/Enum.cs
+++ b/DH.Commons/Enums/Enum.cs
@@ -115,7 +115,16 @@ namespace DH.Commons.Enums
         NG脉冲,
         状态复位,
         启用定位,
-        定位完成脉冲值
+        定位完成脉冲值,
+        相机步进原点,
+        相机步进位置,
+        相机步进速度,
+        相机步进顺时针,
+        相机步进逆时针,
+        点动相机步进,
+        点动挡杆步进,
+        相机步进实时位置,
+        挡料电机实时位置
 
 
 
diff --git a/DH.Devices.Camera/Do3ThinkCamera.cs b/DH.Devices.Camera/Do3ThinkCamera.cs
index df225db..67aea35 100644
--- a/DH.Devices.Camera/Do3ThinkCamera.cs
+++ b/DH.Devices.Camera/Do3ThinkCamera.cs
@@ -350,14 +350,7 @@ namespace DH.Devices.Camera
         public int ImageCallbackFunc(uint handle, dvpStreamEvent _event, IntPtr pContext, ref dvpFrame refFrame, IntPtr pBuffer)
         {
             Mat cvImage = new Mat();
-            if (this.CameraName.Equals("Cam1"))
-            {
-                Console.WriteLine();
-            }
-            if (this.CameraName.Equals("Cam2"))
-            {
-                Console.WriteLine();
-            }
+
             try
             {
 
@@ -387,11 +380,30 @@ namespace DH.Devices.Camera
                         cvImage = Mat.FromPixelData(nHeight, nWidth, MatType.CV_8UC1, pBuffer);
                         break;
                 }
+
                 Mat smat = cvImage.Clone();
+                Mat rotated = new Mat(); // 显式创建输出对象
+
+                switch (RotateImage)
+                {
+                    case 90:
+                        Cv2.Rotate(smat, rotated, RotateFlags.Rotate90Clockwise);
+                        break;
+                    case 180:
+                        Cv2.Rotate(smat, rotated, RotateFlags.Rotate180);
+                        break;
+                    case 270:
+                        Cv2.Rotate(smat, rotated, RotateFlags.Rotate90Counterclockwise);
+                        break;
+                    default:
+                        rotated = smat.Clone(); // 无旋转时保持原图
+                        break;
+                }
+
                 var imageSet = new MatSet
                 {
 
-                    _mat = smat,
+                    _mat = rotated,
 
                 };
                 InitialImageSet(imageSet);
diff --git a/DH.Devices.PLC/XinJEPLCTcpNet.cs b/DH.Devices.PLC/XinJEPLCTcpNet.cs
index a39b290..dc8a46a 100644
--- a/DH.Devices.PLC/XinJEPLCTcpNet.cs
+++ b/DH.Devices.PLC/XinJEPLCTcpNet.cs
@@ -737,7 +737,55 @@ namespace DH.Devices.PLC
            // LogAsync(DateTime.Now, LogLevel.Information, $"关闭定位");
             //写入流程启动点位配置
             StartProcessAction();
-          //  LogAsync(DateTime.Now, LogLevel.Information, $"写入流程加载点位配置");
+            PLCItem? pLCItem = ConfigModel.GlobalList?
+            .FirstOrDefault()?
+            .StartProcessList?
+            .Where(it => it.Name == "挡料电机回原点速度").FirstOrDefault();
+            if (pLCItem == null)
+            {
+               throw new Exception( $"未找到挡料电机回原点速度地址,请检查该地址是否存在于点位表!");
+            }
+            PLCItem? pLCItem1 = ConfigModel.GlobalList?
+          .FirstOrDefault()?
+          .StartProcessList?
+          .Where(it => it.Name == "挡料电机位置").FirstOrDefault();
+            if (pLCItem1 == null)
+            {
+                throw new Exception($"未找到挡料电机位置地址,请检查该地址是否存在于点位表!");
+            }
+            FeedingMotor(true, Convert.ToInt32(pLCItem.Value), Convert.ToInt32(pLCItem1.Value));
+
+
+            PLCItem? pLCItemmontor = ConfigModel.GlobalList?
+            .FirstOrDefault()?
+            .StartProcessList?
+            .Where(it => it.Name == "相机步进速度").FirstOrDefault();
+            if (pLCItemmontor == null)
+            {
+                throw new Exception($"未找到相机步进速度地址,请检查该地址是否存在于点位表!");
+            }
+            PLCItem? pLCItemmontor1 = ConfigModel.GlobalList?
+          .FirstOrDefault()?
+          .StartProcessList?
+          .Where(it => it.Name == "相机步进位置").FirstOrDefault();
+            if (pLCItemmontor1 == null)
+            {
+                throw new Exception($"未找到相机步进位置地址,请检查该地址是否存在于点位表!");
+            }
+
+            Motor(true, Convert.ToInt32(pLCItemmontor.Value), Convert.ToInt32(pLCItemmontor1.Value));
+            // if (_PLCConfig?.Enable == true)
+            //挡料电机操作
+            //  _PLC.FeedingMotor(_PLCConfig.CunToZeroSpeed, _PLCConfig.CunPos, _PLCConfig.CunSpeed, _PLCConfig.CunDirection);
+
+            //流程开启操作配置
+            // ProcessInitialAction();
+            //  if (_PLC?Enabled == true)
+            //皮带
+            //   _PLC.Belt(true);
+
+
+            //  LogAsync(DateTime.Now, LogLevel.Information, $"写入流程加载点位配置");
             //计数清零
             CountToZero();
             LogAsync(DateTime.Now, LogLevel.Information, $"状态复位-关闭定位-写入流程加载点位配置-计数清零");
@@ -827,6 +875,7 @@ namespace DH.Devices.PLC
             if (pLCItem == null)
                 return;
             WriteBool(pLCItem.Address, b);
+      
         }
 
         /// <summary>
@@ -839,6 +888,7 @@ namespace DH.Devices.PLC
             if (pLCItem == null)
                 return;
             WriteUInt16(pLCItem.Address, (ushort)speed);
+         
         }
 
         /// <summary>
@@ -850,7 +900,6 @@ namespace DH.Devices.PLC
             if (DiskRunItem == null)
                 return;
             WriteBool(DiskRunItem.Address, b);
-            Thread.Sleep(30);
             piecesCount = 0;
         }
 
@@ -914,6 +963,59 @@ namespace DH.Devices.PLC
                 return;
             WriteBool(pLCItem.Address, b);
             Thread.Sleep(30);
+        }
+        public void Motor(bool direction, int speed, int pos)
+        {
+
+
+            int timeout = 5000;
+            int elapsedTime = 0;
+            int checkInterval = 100;
+            MotorToZero(false);
+            // 检查是否不在原点,如果不在,则回原点
+
+
+            MotorSpeed(speed); // 速度
+            Thread.Sleep(300);
+            // 发送回原点指令
+            MotorToZero(true);
+            Thread.Sleep(1000); // 给设备一些时间响应
+
+
+
+            // 等待回到原点
+            while (!ReadMotorToZero())
+            {
+                if (elapsedTime >= timeout)
+                {
+                    break;
+                }
+
+                Thread.Sleep(checkInterval);
+                elapsedTime += checkInterval;
+            }
+            // }
+
+            // 无论是刚回到原点还是已经在原点,执行目标位置、速度和方向设置
+            MotorSpeed(speed);
+
+
+            if (direction)
+            {
+                MotorClockwise(true); // 顺时针转动
+
+            }
+            else
+            {
+                MotorCounterclockwise(true); // 逆时针转动
+
+            }
+            Thread.Sleep(30);
+            MotorPos(pos);   // 目标位置
+            Thread.Sleep(2000);
+
+
+
         }
 
         /// <summary>
@@ -922,60 +1024,26 @@ namespace DH.Devices.PLC
         /// False: 逆时针
         /// </summary>
         /// <param name="u"></param>
-        public void FeedingMotor( bool direction)
+        public void FeedingMotor( bool direction,int speed,int pos)
         {
 
 
-           // 设置最大等待时间,假设为 3 秒
-            int timeout = 3000;
+            int timeout = 5000;
             int elapsedTime = 0;
-            int checkInterval = 100; // 每次检查等待 100ms
-
-            PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点");
-            if (pLCItem == null)
-                return;
-            PLCItem zerospeeditem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点速度");
-            if (zerospeeditem == null)
-                return;
-
-            PLCItem CunSpeed = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机速度");
-            if (CunSpeed == null)
-                return;
-
-            PLCItem CunClockwiseItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机顺时针");
-            if (CunClockwiseItem == null)
-                return;
-
-            PLCItem CunCounterclockwiseItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机逆时针");
-            if (CunCounterclockwiseItem == null)
-                return;
-
-            PLCItem CunPosItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机位置");
-            if (CunPosItem == null)
-                return;
-
-            string CunToZero = pLCItem.Type + pLCItem.Address;
-            string CunToZeroSpeed = zerospeeditem.Type + zerospeeditem.Address;
-            string CunSpeedadress = CunSpeed.Type + CunSpeed.Address;
-            string CunClockwise = CunClockwiseItem.Type + CunClockwiseItem.Address;
-            string CunCounterclockwise = CunCounterclockwiseItem.Type + CunCounterclockwiseItem.Address;
-            string CunPos = CunPosItem.Type + CunPosItem.Address;
-            UInt16 zerospeed = UInt16.Parse(zerospeeditem.Value);
-            UInt16 cunSpeed = UInt16.Parse(CunSpeed.Value);
-            UInt16 u = UInt16.Parse(CunPosItem.Value);
-           // WriteBool(CountToZero, true);
+            int checkInterval = 100;
 
+            BarrierToZero(false);
             // 检查是否不在原点,如果不在,则回原点
-            if (!ReadBool(CunToZero))
-            {
-                WriteUInt16(CunToZeroSpeed, zerospeed); // 速度
-                Thread.Sleep(30);
+
+
+            BarrierToZeroSpeed(speed); // 速度
+                Thread.Sleep(300);
                 // 发送回原点指令
-                WriteBool(CunToZero, true);
+                BarrierToZero(true);
                 Thread.Sleep(1000); // 给设备一些时间响应
 
                 // 等待回到原点
-                while (!ReadBool(CunToZero))
+                while (!ReadBarrierToZero())
                 {
                     if (elapsedTime >= timeout)
                     {
@@ -985,33 +1053,32 @@ namespace DH.Devices.PLC
                     Thread.Sleep(checkInterval);
                     elapsedTime += checkInterval;
                 }
-            }
+            
 
             // 无论是刚回到原点还是已经在原点,执行目标位置、速度和方向设置
+            BarrierSpeed(speed);
 
-
-
-            WriteUInt16(CunSpeedadress,cunSpeed);
-            Thread.Sleep(2000);
-            string dir = string.Empty;
+           
             if (direction)
             {
-                WriteBool(CunClockwise, true); // 顺时针转动
-                dir = "顺时针";
+               BarrierClockwise(true); // 顺时针转动
+              
             }
             else
             {
-                WriteBool(CunCounterclockwise, true); // 逆时针转动
-                dir = "逆时针";
+                BarrierCounterclockwise(true); // 逆时针转动
+             
             }
             Thread.Sleep(30);
-            WriteUInt16(CunPos, u);   // 目标位置
+            BarrierPos(pos);   // 目标位置
             Thread.Sleep(2000);
 
 
 
         }
 
+
+      
         /// <summary>
         /// 转盘清料
         /// </summary>
@@ -1052,16 +1119,226 @@ namespace DH.Devices.PLC
           
         }
 
+        /// <summary>
+        /// 读取定位脉冲
+        /// </summary>
+        /// <returns></returns>
+
         public int ReadVisionPos()
         {
             PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "定位完成脉冲值");
             if (pLCItem == null)
                 return 0;
             int value = ReadInt32(pLCItem.Address);
-            Thread.Sleep(10);
+            Thread.Sleep(100);
             return Math.Abs(value);
         }
 
+        /// <summary>
+        /// 挡杆回原点
+        /// </summary>
+        public void BarrierToZero(bool b)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点");
+            if (pLCItem == null)
+                return;
+            WriteBool(pLCItem.Address, b);
+        }
+        /// <summary>
+        /// 变焦相机回原点
+        /// </summary>
+        public void ZoomcameraToZero(bool b)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "步进电机回原点");
+            if (pLCItem == null)
+                return;
+            WriteBool(pLCItem.Address, b);
+        }
+
+        /// <summary>
+        /// 读取 挡杆回原点状态
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+
+        public bool ReadBarrierToZero()
+        {
+            //PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点");
+            //if (pLCItem == null)
+            //{
+            //    throw new Exception("未找到挡料电机回原点点位");
+            //}
+            //挡料电机传感器感应点
+           return ReadBool("X11");
+        }
+
+        /// <summary>
+        /// 挡杆回原点速度
+        /// </summary>
+        public void BarrierToZeroSpeed(int speed)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点速度");
+            if (pLCItem == null)
+                return;
+            WriteUInt32(pLCItem.Address, (uint)speed);
+        }
+
+
+        /// <summary>
+        /// 挡杆位置
+        /// </summary>
+        public void BarrierPos(int value)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机位置");
+            if (pLCItem == null)
+                return;
+            WriteUInt16(pLCItem.Address, (ushort)value);
+        }
+
+
+        /// <summary>
+        /// 挡杆速度
+        /// </summary>
+        public void BarrierSpeed(int value)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机速度");
+            if (pLCItem == null)
+                return;
+            WriteUInt32(pLCItem.Address, (uint)value);
+        }
+
+
+        /// <summary>
+        /// 挡杆顺时针
+        /// </summary>
+        public void BarrierClockwise(bool b)
+        {
+            PLCItem? DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机顺时针");
+            if (DiskRunItem == null)
+                return;
+            WriteBool(DiskRunItem.Address, b);
+            Thread.Sleep(30);
+        }
+
+        /// <summary>
+        /// 挡杆逆时针
+        /// </summary>
+        public void BarrierCounterclockwise(bool b)
+        {
+            PLCItem? DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机逆时针");
+            if (DiskRunItem == null)
+                return;
+            WriteBool(DiskRunItem.Address, b);
+            Thread.Sleep(30);
+        }
+
+
+
+        /// <summary>
+        /// 相机步进电机回原点
+        /// </summary>
+        /// <param name="b"></param>
+        public void MotorToZero(bool b)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进原点");
+            if (pLCItem == null)
+                return;
+            WriteBool(pLCItem.Address, b);
+        }
+
+        /// <summary>
+        /// 读取相机步进电机回原点状态
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public bool ReadMotorToZero()
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进原点");
+            if (pLCItem == null)
+            {
+                throw new Exception("未找到挡料电机回原点点位");
+            }
+            return ReadBool(pLCItem.Address);
+        }
+
+
+        /// <summary>
+        /// 相机步进电机位置
+        /// </summary>
+        /// <param></param>
+        public void MotorPos(int value)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进位置");
+            if (pLCItem == null)
+                return;
+           WriteUInt16(pLCItem.Address, (ushort)value);
+        }
+
+
+
+
+
+        public int ReadMotorRealPos()
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进实时位置");
+            if (pLCItem == null)
+            {
+                throw new Exception("未找到相机步进实时位置");
+            }
+            return ReadInt16(pLCItem.Address);
+        }
+
+
+
+        /// <summary>
+        /// 相机步进电机速度
+        /// </summary>
+        /// <param name="b"></param>
+        public void MotorSpeed(int speed)
+        {
+            PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进速度");
+            if (pLCItem == null)
+                return;
+            WriteInt32(pLCItem.Address, speed);
+        }
+
+
+        /// <summary>
+        /// 相机步进顺时针
+        /// </summary>
+        public void MotorClockwise(bool b)
+        {
+            PLCItem? DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进顺时针");
+            if (DiskRunItem == null)
+                return;
+            WriteBool(DiskRunItem.Address, b);
+            Thread.Sleep(30);
+        }
+
+        /// <summary>
+        /// 相机步进逆时针
+        /// </summary>
+        public void MotorCounterclockwise(bool b)
+        {
+            PLCItem? DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "相机步进逆时针");
+            if (DiskRunItem == null)
+                return;
+            WriteBool(DiskRunItem.Address, b);
+            Thread.Sleep(30);
+        }
+
+        /// <summary>
+        /// 相机步进点动
+        /// </summary>
+        public void MotorTest(bool b)
+        {
+            PLCItem? DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "点动相机步进");
+            if (DiskRunItem == null)
+                return;
+            WriteBool(DiskRunItem.Address, b);
+            Thread.Sleep(30);
+        }
+
         public void LogAsync(LogMsg msg)
         {
             msg.MsgSource = "PLC";
diff --git a/DHSoftware/MainWindow.cs b/DHSoftware/MainWindow.cs
index ae6e3f9..d6c92f0 100644
--- a/DHSoftware/MainWindow.cs
+++ b/DHSoftware/MainWindow.cs
@@ -694,6 +694,14 @@ namespace DHSoftware
                         cam.CameraName = cameraBase.CameraName;
                         cam.CameraIP = cameraBase.CameraIP;
                         cam.IsEnabled = cameraBase.IsEnabled;
+                        cam.IsZoomCamera = cameraBase.IsZoomCamera;
+                        cam.Exposure = cameraBase.Exposure;
+                        cam.Gain = cameraBase.Gain;
+                        cam.RotateImage = cameraBase.RotateImage;
+                        cam.ROIX= cameraBase.ROIX;
+                        cam.ROIH= cameraBase.ROIH;
+                        cam.ROIW= cameraBase.ROIW;
+                        cam.ROIY=cameraBase.ROIY;
                         cam.ImageSaveDirectory = Path.Combine("D://Projects", cameraBase.CameraName);
                         Cameras.Add(cam);
                         if (cameraBase.IsEnabled)
@@ -1215,120 +1223,127 @@ namespace DHSoftware
 
         private void StartProcess()
         {
-            BatchNO = textBoxBatchNO.Text;
-            textBoxBatchNO.ReadOnly = true;
-            btnCreateBatchNO.Enabled = false;
-            PrepareBatchNO();//生成批次号
-            ProcessstartTime = DateTime.Now;
-            lblStartTime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss");
-            //计数清零
-            PieceCount = 0;
-
-            //CameraSummaries.Clear();
-
-            if (PLC?.Enable == true)
+            try
             {
-                PLC.OnNewPieces -= MainMotion_NewPieces;
-                PLC.OnNewPieces += MainMotion_NewPieces;
-            }
 
-            Cameras.ForEach(d =>
-            {
-                if (d is CameraBase cam)
+
+                BatchNO = textBoxBatchNO.Text;
+                textBoxBatchNO.ReadOnly = true;
+                btnCreateBatchNO.Enabled = false;
+                PrepareBatchNO();//生成批次号
+                ProcessstartTime = DateTime.Now;
+                lblStartTime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss");
+                //计数清零
+                PieceCount = 0;
+
+                //CameraSummaries.Clear();
+
+                if (PLC?.Enable == true)
                 {
-                    cam.SnapshotCount = 0;
+                    PLC.OnNewPieces -= MainMotion_NewPieces;
+                    PLC.OnNewPieces += MainMotion_NewPieces;
                 }
-            });
 
-            //PrepareBatchNO();
-            // isInPositionChecking = false;
-            //isFullTrayChecking = false;
-            //队列清空
-            // var temp = new List<ITriggerSet>();
-            // temp.AddRange(XKRSPLCConfig.TriggerConfigCollection);
-            // temp.AddRange(XKRSPLCConfig.SnapshotTriggerConfigCollection);
-
-            //temp.ForEach(t =>
-            //{
-            //    var diskInfo = XKRSPLCConfig.DiskInfoList.FirstOrDefault(u => u.DiskName == t.DiskName);
-            //    if (diskInfo != null)
-            //    {
-            //        t.AxisNum = diskInfo.DiskAxisNum;
-            //    }
-            //    else
-            //    {
-            //        t.AxisNum = -1;
-            //    }
-            //});
-
-            //if (temp.Any(u => u.AxisNum < 0))
-            //{
-            //    LogAsync(DateTime.Now, LogLevel.Error, "触发信号归属转盘未确认");
-            //    return new ProcessResponse(false);
-            //}
-
-            // _diskInfoListInOrder = XKRSPLCConfig.DiskInfoList.OrderBy(u => u.DiskSequence).ToList();
-            //  var axisNumList = _diskInfoListInOrder.Select(u => u.DiskAxisNum).ToList();
-
-            /// PrepareMLEngine();
-
-            // if (_PLCConfig?.Enable == true)
-            //挡料电机操作
-            //  _PLC.FeedingMotor(_PLCConfig.CunToZeroSpeed, _PLCConfig.CunPos, _PLCConfig.CunSpeed, _PLCConfig.CunDirection);
-
-            //流程开启操作配置
-            // ProcessInitialAction();
-            //  if (_PLC?Enabled == true)
-            //皮带
-            //   _PLC.Belt(true);
-
-            //DeviceCollection.ForEach(d =>
-            //{
-            //    if (d is CameraBase c)
-            //    {
-            //        c.OnHImageOutput -= OnCameraHImageOutput;
-            //        c.OnHImageOutput += OnCameraHImageOutput;
-            //        c.SnapshotCount = 0;
-            //    }
-            //});
-            _productLists.Clear();
-
-            #region 虚拟相机
-
-            //mOfflineImageTimer = new System.Timers.Timer();
-
-            //mOfflineImageTimer.Elapsed += OnEmitSerialPortAsync;
-            //mOfflineImageTimer.Interval = 1000;
-            //mOfflineImageTimer.Start();
-
-            #endregion 虚拟相机
-
-            var settings = _visionEngine.DetectionConfigs.Where(u => u.IsEnabled && u.IsAddStation).ToList();
-            if (settings != null)
-            {
-                settings = settings.Where(s => s.IsEnabled).ToList();
-                ProductBaseCount = settings.Count;
-
-                for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
+                Cameras.ForEach(d =>
                 {
-                    ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
-                    _productLists.Add(products);
+                    if (d is CameraBase cam)
+                    {
+                        cam.SnapshotCount = 0;
+                    }
+                });
+
+                //PrepareBatchNO();
+                // isInPositionChecking = false;
+                //isFullTrayChecking = false;
+                //队列清空
+                // var temp = new List<ITriggerSet>();
+                // temp.AddRange(XKRSPLCConfig.TriggerConfigCollection);
+                // temp.AddRange(XKRSPLCConfig.SnapshotTriggerConfigCollection);
+
+                //temp.ForEach(t =>
+                //{
+                //    var diskInfo = XKRSPLCConfig.DiskInfoList.FirstOrDefault(u => u.DiskName == t.DiskName);
+                //    if (diskInfo != null)
+                //    {
+                //        t.AxisNum = diskInfo.DiskAxisNum;
+                //    }
+                //    else
+                //    {
+                //        t.AxisNum = -1;
+                //    }
+                //});
+
+                //if (temp.Any(u => u.AxisNum < 0))
+                //{
+                //    LogAsync(DateTime.Now, LogLevel.Error, "触发信号归属转盘未确认");
+                //    return new ProcessResponse(false);
+                //}
+
+                // _diskInfoListInOrder = XKRSPLCConfig.DiskInfoList.OrderBy(u => u.DiskSequence).ToList();
+                //  var axisNumList = _diskInfoListInOrder.Select(u => u.DiskAxisNum).ToList();
+
+                /// PrepareMLEngine();
+
+                // if (_PLCConfig?.Enable == true)
+                //挡料电机操作
+                //  _PLC.FeedingMotor(_PLCConfig.CunToZeroSpeed, _PLCConfig.CunPos, _PLCConfig.CunSpeed, _PLCConfig.CunDirection);
+
+                //流程开启操作配置
+                // ProcessInitialAction();
+                //  if (_PLC?Enabled == true)
+                //皮带
+                //   _PLC.Belt(true);
+
+                //DeviceCollection.ForEach(d =>
+                //{
+                //    if (d is CameraBase c)
+                //    {
+                //        c.OnHImageOutput -= OnCameraHImageOutput;
+                //        c.OnHImageOutput += OnCameraHImageOutput;
+                //        c.SnapshotCount = 0;
+                //    }
+                //});
+                _productLists.Clear();
+
+                #region 虚拟相机
+
+                //mOfflineImageTimer = new System.Timers.Timer();
+
+                //mOfflineImageTimer.Elapsed += OnEmitSerialPortAsync;
+                //mOfflineImageTimer.Interval = 1000;
+                //mOfflineImageTimer.Start();
+
+                #endregion 虚拟相机
+
+                var settings = _visionEngine.DetectionConfigs.Where(u => u.IsEnabled && u.IsAddStation).ToList();
+                if (settings != null)
+                {
+                    settings = settings.Where(s => s.IsEnabled).ToList();
+                    ProductBaseCount = settings.Count;
+
+                    for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
+                    {
+                        ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
+                        _productLists.Add(products);
+                    }
                 }
+
+                //   _MGSCameraList = DeviceCollection
+                //.OfType<MGSCameraDriver>()  // 直接筛选出 MGSCameraDriver 类型的元素
+                //.Where(camera => camera.IConfig != null && camera.IConfig.IsEnabled)  // 进一步筛选 IConfig 不为 null 且 IsEnabled 为 true
+                //.ToList();
+
+                //   ProductBaseCount = _MGSCameraList.Count;
+
+
+
+                //流程执行时PLC
+                PLC.StartProcess();
+                InitialOEEStatistic();
+            }
+            catch (Exception ex)
+            {
             }
-
-            //   _MGSCameraList = DeviceCollection
-            //.OfType<MGSCameraDriver>()  // 直接筛选出 MGSCameraDriver 类型的元素
-            //.Where(camera => camera.IConfig != null && camera.IConfig.IsEnabled)  // 进一步筛选 IConfig 不为 null 且 IsEnabled 为 true
-            //.ToList();
-
-            //   ProductBaseCount = _MGSCameraList.Count;
-
-
-
-            //流程执行时PLC
-            PLC.StartProcess();
-            InitialOEEStatistic();
-
 
 
         }
diff --git a/DHSoftware/Views/CameraControl.Designer.cs b/DHSoftware/Views/CameraControl.Designer.cs
index 21cd9ef..4fecb57 100644
--- a/DHSoftware/Views/CameraControl.Designer.cs
+++ b/DHSoftware/Views/CameraControl.Designer.cs
@@ -28,188 +28,63 @@
         /// </summary>
         private void InitializeComponent()
         {
-            swhEnable = new AntdUI.Switch();
+            panel3 = new AntdUI.Panel();
+            btnSizeAdd = new AntdUI.Button();
+            button1 = new AntdUI.Button();
+            button2 = new AntdUI.Button();
+            button3 = new AntdUI.Button();
+            panel4 = new AntdUI.Panel();
+            panel2 = new AntdUI.Panel();
             label18 = new AntdUI.Label();
+            swhEnable = new AntdUI.Switch();
             label1 = new AntdUI.Label();
             label2 = new AntdUI.Label();
             label3 = new AntdUI.Label();
             iptExposure = new AntdUI.InputNumber();
             iptGain = new AntdUI.InputNumber();
-            iptRevolve = new AntdUI.InputNumber();
+            iptRevolve = new AntdUI.Select();
             label4 = new AntdUI.Label();
             sltAcquisitionMode = new AntdUI.Select();
             label5 = new AntdUI.Label();
             sltTriggerMode = new AntdUI.Select();
             label7 = new AntdUI.Label();
-            iptROIW = new AntdUI.InputNumber();
-            iptROIY = new AntdUI.InputNumber();
             iptROIX = new AntdUI.InputNumber();
+            iptROIY = new AntdUI.InputNumber();
+            iptROIW = new AntdUI.InputNumber();
             iptROIH = new AntdUI.InputNumber();
-            pictureBox1 = new PictureBox();
-            btnSizeAdd = new AntdUI.Button();
-            button1 = new AntdUI.Button();
-            button2 = new AntdUI.Button();
-            button3 = new AntdUI.Button();
-            sthPic = new AntdUI.Switch();
             label6 = new AntdUI.Label();
+            sthPic = new AntdUI.Switch();
             label8 = new AntdUI.Label();
             label9 = new AntdUI.Label();
             label10 = new AntdUI.Label();
             label11 = new AntdUI.Label();
-            sthAllPic = new AntdUI.Switch();
             label12 = new AntdUI.Label();
-            sltCamType = new AntdUI.Select();
+            sthAllPic = new AntdUI.Switch();
             label13 = new AntdUI.Label();
+            sltCamType = new AntdUI.Select();
+            label14 = new AntdUI.Label();
+            switch1 = new AntdUI.Switch();
+            panel1 = new AntdUI.Panel();
+            pictureBox1 = new PictureBox();
+            panel3.SuspendLayout();
+            panel4.SuspendLayout();
+            panel2.SuspendLayout();
+            panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
             SuspendLayout();
             // 
-            // swhEnable
+            // panel3
             // 
-            swhEnable.CheckedText = "启用";
-            swhEnable.Location = new Point(93, 13);
-            swhEnable.Name = "swhEnable";
-            swhEnable.Size = new Size(94, 33);
-            swhEnable.TabIndex = 13;
-            swhEnable.UnCheckedText = "关闭";
-            // 
-            // label18
-            // 
-            label18.Location = new Point(28, 23);
-            label18.Name = "label18";
-            label18.Size = new Size(59, 23);
-            label18.TabIndex = 12;
-            label18.Text = "状      态";
-            // 
-            // label1
-            // 
-            label1.Location = new Point(28, 140);
-            label1.Name = "label1";
-            label1.Size = new Size(59, 36);
-            label1.TabIndex = 14;
-            label1.Text = "曝      光";
-            // 
-            // label2
-            // 
-            label2.Location = new Point(28, 183);
-            label2.Name = "label2";
-            label2.Size = new Size(59, 36);
-            label2.TabIndex = 15;
-            label2.Text = "增      益";
-            // 
-            // label3
-            // 
-            label3.Location = new Point(28, 226);
-            label3.Name = "label3";
-            label3.Size = new Size(59, 36);
-            label3.TabIndex = 16;
-            label3.Text = "旋转角度";
-            // 
-            // iptExposure
-            // 
-            iptExposure.Location = new Point(93, 140);
-            iptExposure.Name = "iptExposure";
-            iptExposure.Size = new Size(94, 36);
-            iptExposure.TabIndex = 17;
-            iptExposure.Tag = "";
-            iptExposure.Text = "0";
-            // 
-            // iptGain
-            // 
-            iptGain.Location = new Point(93, 183);
-            iptGain.Name = "iptGain";
-            iptGain.Size = new Size(94, 36);
-            iptGain.TabIndex = 18;
-            iptGain.Text = "0";
-            // 
-            // iptRevolve
-            // 
-            iptRevolve.Location = new Point(93, 226);
-            iptRevolve.Name = "iptRevolve";
-            iptRevolve.Size = new Size(94, 36);
-            iptRevolve.TabIndex = 19;
-            iptRevolve.Text = "0";
-            // 
-            // label4
-            // 
-            label4.Location = new Point(28, 269);
-            label4.Name = "label4";
-            label4.Size = new Size(59, 36);
-            label4.TabIndex = 20;
-            label4.Text = "采图模式";
-            // 
-            // sltAcquisitionMode
-            // 
-            sltAcquisitionMode.List = true;
-            sltAcquisitionMode.Location = new Point(93, 269);
-            sltAcquisitionMode.Name = "sltAcquisitionMode";
-            sltAcquisitionMode.Size = new Size(94, 36);
-            sltAcquisitionMode.TabIndex = 21;
-            // 
-            // label5
-            // 
-            label5.Location = new Point(28, 314);
-            label5.Name = "label5";
-            label5.Size = new Size(59, 36);
-            label5.TabIndex = 22;
-            label5.Text = "触发模式";
-            // 
-            // sltTriggerMode
-            // 
-            sltTriggerMode.List = true;
-            sltTriggerMode.Location = new Point(93, 314);
-            sltTriggerMode.Name = "sltTriggerMode";
-            sltTriggerMode.Size = new Size(94, 36);
-            sltTriggerMode.TabIndex = 26;
-            // 
-            // label7
-            // 
-            label7.Location = new Point(19, 476);
-            label7.Name = "label7";
-            label7.Size = new Size(29, 23);
-            label7.TabIndex = 28;
-            label7.Text = "ROI";
-            // 
-            // iptROIW
-            // 
-            iptROIW.Location = new Point(93, 494);
-            iptROIW.Name = "iptROIW";
-            iptROIW.Size = new Size(94, 37);
-            iptROIW.TabIndex = 31;
-            iptROIW.Text = "0";
-            // 
-            // iptROIY
-            // 
-            iptROIY.Location = new Point(93, 451);
-            iptROIY.Name = "iptROIY";
-            iptROIY.Size = new Size(94, 37);
-            iptROIY.TabIndex = 30;
-            iptROIY.Text = "0";
-            // 
-            // iptROIX
-            // 
-            iptROIX.Location = new Point(93, 408);
-            iptROIX.Name = "iptROIX";
-            iptROIX.Size = new Size(94, 37);
-            iptROIX.TabIndex = 29;
-            iptROIX.Tag = "";
-            iptROIX.Text = "0";
-            // 
-            // iptROIH
-            // 
-            iptROIH.Location = new Point(93, 537);
-            iptROIH.Name = "iptROIH";
-            iptROIH.Size = new Size(94, 37);
-            iptROIH.TabIndex = 32;
-            iptROIH.Text = "0";
-            // 
-            // pictureBox1
-            // 
-            pictureBox1.BorderStyle = BorderStyle.FixedSingle;
-            pictureBox1.Location = new Point(219, 23);
-            pictureBox1.Name = "pictureBox1";
-            pictureBox1.Size = new Size(659, 489);
-            pictureBox1.TabIndex = 33;
-            pictureBox1.TabStop = false;
+            panel3.Controls.Add(button3);
+            panel3.Controls.Add(button2);
+            panel3.Controls.Add(button1);
+            panel3.Controls.Add(btnSizeAdd);
+            panel3.Dock = DockStyle.Bottom;
+            panel3.Location = new Point(0, 552);
+            panel3.Name = "panel3";
+            panel3.Size = new Size(691, 59);
+            panel3.TabIndex = 39;
+            panel3.Text = "panel3";
             // 
             // btnSizeAdd
             // 
@@ -218,10 +93,10 @@
             btnSizeAdd.Ghost = true;
             btnSizeAdd.IconRatio = 0F;
             btnSizeAdd.IconSvg = "";
-            btnSizeAdd.Location = new Point(282, 532);
+            btnSizeAdd.Location = new Point(75, 13);
             btnSizeAdd.Name = "btnSizeAdd";
             btnSizeAdd.Size = new Size(80, 38);
-            btnSizeAdd.TabIndex = 34;
+            btnSizeAdd.TabIndex = 43;
             btnSizeAdd.Text = "连接相机";
             // 
             // button1
@@ -231,10 +106,10 @@
             button1.Ghost = true;
             button1.IconRatio = 0F;
             button1.IconSvg = "";
-            button1.Location = new Point(440, 532);
+            button1.Location = new Point(233, 13);
             button1.Name = "button1";
             button1.Size = new Size(80, 38);
-            button1.TabIndex = 35;
+            button1.TabIndex = 44;
             button1.Text = "断开相机";
             // 
             // button2
@@ -244,10 +119,10 @@
             button2.Ghost = true;
             button2.IconRatio = 0F;
             button2.IconSvg = "";
-            button2.Location = new Point(595, 532);
+            button2.Location = new Point(388, 13);
             button2.Name = "button2";
             button2.Size = new Size(80, 38);
-            button2.TabIndex = 36;
+            button2.TabIndex = 45;
             button2.Text = "单次触发";
             // 
             // button3
@@ -257,169 +132,375 @@
             button3.Ghost = true;
             button3.IconRatio = 0F;
             button3.IconSvg = "";
-            button3.Location = new Point(743, 532);
+            button3.Location = new Point(536, 13);
             button3.Name = "button3";
             button3.Size = new Size(80, 38);
-            button3.TabIndex = 37;
+            button3.TabIndex = 46;
             button3.Text = "连续触发";
             // 
+            // panel4
+            // 
+            panel4.Controls.Add(pictureBox1);
+            panel4.Dock = DockStyle.Fill;
+            panel4.Location = new Point(0, 0);
+            panel4.Name = "panel4";
+            panel4.Size = new Size(691, 552);
+            panel4.TabIndex = 40;
+            panel4.Text = "panel4";
+            // 
+            // panel2
+            // 
+            panel2.Controls.Add(panel4);
+            panel2.Controls.Add(panel3);
+            panel2.Dock = DockStyle.Fill;
+            panel2.Location = new Point(218, 0);
+            panel2.Name = "panel2";
+            panel2.Size = new Size(691, 611);
+            panel2.TabIndex = 49;
+            panel2.Text = "panel2";
+            // 
+            // label18
+            // 
+            label18.Location = new Point(21, 19);
+            label18.Name = "label18";
+            label18.Size = new Size(59, 23);
+            label18.TabIndex = 48;
+            label18.Text = "状      态";
+            // 
+            // swhEnable
+            // 
+            swhEnable.CheckedText = "启用";
+            swhEnable.Location = new Point(86, 9);
+            swhEnable.Name = "swhEnable";
+            swhEnable.Size = new Size(94, 33);
+            swhEnable.TabIndex = 49;
+            swhEnable.UnCheckedText = "关闭";
+            // 
+            // label1
+            // 
+            label1.Location = new Point(21, 136);
+            label1.Name = "label1";
+            label1.Size = new Size(59, 36);
+            label1.TabIndex = 50;
+            label1.Text = "曝      光";
+            // 
+            // label2
+            // 
+            label2.Location = new Point(21, 179);
+            label2.Name = "label2";
+            label2.Size = new Size(59, 36);
+            label2.TabIndex = 51;
+            label2.Text = "增      益";
+            // 
+            // label3
+            // 
+            label3.Location = new Point(21, 222);
+            label3.Name = "label3";
+            label3.Size = new Size(59, 36);
+            label3.TabIndex = 52;
+            label3.Text = "旋转角度";
+            // 
+            // iptExposure
+            // 
+            iptExposure.Location = new Point(86, 136);
+            iptExposure.Name = "iptExposure";
+            iptExposure.Size = new Size(94, 36);
+            iptExposure.TabIndex = 53;
+            iptExposure.Tag = "";
+            iptExposure.Text = "0";
+            // 
+            // iptGain
+            // 
+            iptGain.Location = new Point(86, 179);
+            iptGain.Name = "iptGain";
+            iptGain.Size = new Size(94, 36);
+            iptGain.TabIndex = 54;
+            iptGain.Text = "0";
+            // 
+            // iptRevolve
+            // 
+            iptRevolve.Items.AddRange(new object[] { "0", "90", "180", "270" });
+            iptRevolve.List = true;
+            iptRevolve.Location = new Point(86, 222);
+            iptRevolve.Name = "iptRevolve";
+            iptRevolve.Size = new Size(94, 36);
+            iptRevolve.TabIndex = 55;
+            // 
+            // label4
+            // 
+            label4.Location = new Point(21, 265);
+            label4.Name = "label4";
+            label4.Size = new Size(59, 36);
+            label4.TabIndex = 56;
+            label4.Text = "采图模式";
+            // 
+            // sltAcquisitionMode
+            // 
+            sltAcquisitionMode.List = true;
+            sltAcquisitionMode.Location = new Point(86, 265);
+            sltAcquisitionMode.Name = "sltAcquisitionMode";
+            sltAcquisitionMode.Size = new Size(94, 36);
+            sltAcquisitionMode.TabIndex = 57;
+            // 
+            // label5
+            // 
+            label5.Location = new Point(21, 310);
+            label5.Name = "label5";
+            label5.Size = new Size(59, 36);
+            label5.TabIndex = 58;
+            label5.Text = "触发模式";
+            // 
+            // sltTriggerMode
+            // 
+            sltTriggerMode.List = true;
+            sltTriggerMode.Location = new Point(86, 310);
+            sltTriggerMode.Name = "sltTriggerMode";
+            sltTriggerMode.Size = new Size(94, 36);
+            sltTriggerMode.TabIndex = 59;
+            // 
+            // label7
+            // 
+            label7.Location = new Point(3, 498);
+            label7.Name = "label7";
+            label7.Size = new Size(29, 23);
+            label7.TabIndex = 60;
+            label7.Text = "ROI";
+            // 
+            // iptROIX
+            // 
+            iptROIX.Location = new Point(86, 430);
+            iptROIX.Name = "iptROIX";
+            iptROIX.Size = new Size(94, 37);
+            iptROIX.TabIndex = 61;
+            iptROIX.Tag = "";
+            iptROIX.Text = "0";
+            // 
+            // iptROIY
+            // 
+            iptROIY.Location = new Point(86, 473);
+            iptROIY.Name = "iptROIY";
+            iptROIY.Size = new Size(94, 37);
+            iptROIY.TabIndex = 62;
+            iptROIY.Text = "0";
+            // 
+            // iptROIW
+            // 
+            iptROIW.Location = new Point(86, 516);
+            iptROIW.Name = "iptROIW";
+            iptROIW.Size = new Size(94, 37);
+            iptROIW.TabIndex = 63;
+            iptROIW.Text = "0";
+            // 
+            // iptROIH
+            // 
+            iptROIH.Location = new Point(86, 559);
+            iptROIH.Name = "iptROIH";
+            iptROIH.Size = new Size(94, 37);
+            iptROIH.TabIndex = 64;
+            iptROIH.Text = "0";
+            // 
+            // label6
+            // 
+            label6.Location = new Point(21, 66);
+            label6.Name = "label6";
+            label6.Size = new Size(59, 23);
+            label6.TabIndex = 65;
+            label6.Text = "相  机  图";
+            // 
             // sthPic
             // 
             sthPic.CheckedText = "启用";
-            sthPic.Location = new Point(93, 60);
+            sthPic.Location = new Point(86, 56);
             sthPic.Name = "sthPic";
             sthPic.Size = new Size(94, 33);
-            sthPic.TabIndex = 39;
+            sthPic.TabIndex = 66;
             sthPic.UnCheckedText = "关闭";
             // 
-            // label6
-            // 
-            label6.Location = new Point(28, 70);
-            label6.Name = "label6";
-            label6.Size = new Size(59, 23);
-            label6.TabIndex = 38;
-            label6.Text = "相  机  图";
-            // 
             // label8
             // 
-            label8.Location = new Point(58, 408);
+            label8.Location = new Point(36, 430);
             label8.Name = "label8";
             label8.Size = new Size(29, 37);
-            label8.TabIndex = 40;
+            label8.TabIndex = 67;
             label8.Text = "X:";
             // 
             // label9
             // 
-            label9.Location = new Point(58, 451);
+            label9.Location = new Point(36, 473);
             label9.Name = "label9";
             label9.Size = new Size(29, 37);
-            label9.TabIndex = 41;
+            label9.TabIndex = 68;
             label9.Text = "Y:";
             // 
             // label10
             // 
-            label10.Location = new Point(43, 494);
+            label10.Location = new Point(28, 516);
             label10.Name = "label10";
             label10.Size = new Size(44, 37);
-            label10.TabIndex = 42;
+            label10.TabIndex = 69;
             label10.Text = "宽度:";
             // 
             // label11
             // 
-            label11.Location = new Point(43, 538);
+            label11.Location = new Point(28, 560);
             label11.Name = "label11";
             label11.Size = new Size(44, 36);
-            label11.TabIndex = 43;
+            label11.TabIndex = 70;
             label11.Text = "高度:";
             // 
+            // label12
+            // 
+            label12.Location = new Point(21, 362);
+            label12.Name = "label12";
+            label12.Size = new Size(59, 23);
+            label12.TabIndex = 71;
+            label12.Text = "全 画 幅";
+            // 
             // sthAllPic
             // 
             sthAllPic.CheckedText = "启用";
-            sthAllPic.Location = new Point(93, 356);
+            sthAllPic.Location = new Point(86, 352);
             sthAllPic.Name = "sthAllPic";
             sthAllPic.Size = new Size(94, 33);
-            sthAllPic.TabIndex = 45;
+            sthAllPic.TabIndex = 72;
             sthAllPic.UnCheckedText = "关闭";
             // 
-            // label12
+            // label13
             // 
-            label12.Location = new Point(28, 366);
-            label12.Name = "label12";
-            label12.Size = new Size(59, 23);
-            label12.TabIndex = 44;
-            label12.Text = "全 画 幅";
+            label13.Location = new Point(21, 95);
+            label13.Name = "label13";
+            label13.Size = new Size(59, 36);
+            label13.TabIndex = 73;
+            label13.Text = "相机类型";
             // 
             // sltCamType
             // 
             sltCamType.List = true;
-            sltCamType.Location = new Point(93, 97);
+            sltCamType.Location = new Point(86, 93);
             sltCamType.Name = "sltCamType";
             sltCamType.Size = new Size(94, 36);
-            sltCamType.TabIndex = 47;
+            sltCamType.TabIndex = 74;
             // 
-            // label13
+            // label14
             // 
-            label13.Location = new Point(28, 99);
-            label13.Name = "label13";
-            label13.Size = new Size(59, 36);
-            label13.TabIndex = 46;
-            label13.Text = "相机类型";
+            label14.Location = new Point(21, 401);
+            label14.Name = "label14";
+            label14.Size = new Size(59, 23);
+            label14.TabIndex = 75;
+            label14.Text = "变焦相机";
+            // 
+            // switch1
+            // 
+            switch1.CheckedText = "启用";
+            switch1.Location = new Point(86, 391);
+            switch1.Name = "switch1";
+            switch1.Size = new Size(94, 33);
+            switch1.TabIndex = 76;
+            switch1.UnCheckedText = "关闭";
+            // 
+            // panel1
+            // 
+            panel1.Controls.Add(switch1);
+            panel1.Controls.Add(label14);
+            panel1.Controls.Add(sltCamType);
+            panel1.Controls.Add(label13);
+            panel1.Controls.Add(sthAllPic);
+            panel1.Controls.Add(label12);
+            panel1.Controls.Add(label11);
+            panel1.Controls.Add(label10);
+            panel1.Controls.Add(label9);
+            panel1.Controls.Add(label8);
+            panel1.Controls.Add(sthPic);
+            panel1.Controls.Add(label6);
+            panel1.Controls.Add(iptROIH);
+            panel1.Controls.Add(iptROIW);
+            panel1.Controls.Add(iptROIY);
+            panel1.Controls.Add(iptROIX);
+            panel1.Controls.Add(label7);
+            panel1.Controls.Add(sltTriggerMode);
+            panel1.Controls.Add(label5);
+            panel1.Controls.Add(sltAcquisitionMode);
+            panel1.Controls.Add(label4);
+            panel1.Controls.Add(iptRevolve);
+            panel1.Controls.Add(iptGain);
+            panel1.Controls.Add(iptExposure);
+            panel1.Controls.Add(label3);
+            panel1.Controls.Add(label2);
+            panel1.Controls.Add(label1);
+            panel1.Controls.Add(swhEnable);
+            panel1.Controls.Add(label18);
+            panel1.Dock = DockStyle.Left;
+            panel1.Location = new Point(0, 0);
+            panel1.Name = "panel1";
+            panel1.Size = new Size(218, 611);
+            panel1.TabIndex = 48;
+            panel1.Text = "panel1";
+            // 
+            // pictureBox1
+            // 
+            pictureBox1.BorderStyle = BorderStyle.FixedSingle;
+            pictureBox1.Dock = DockStyle.Fill;
+            pictureBox1.Location = new Point(0, 0);
+            pictureBox1.Name = "pictureBox1";
+            pictureBox1.Size = new Size(691, 552);
+            pictureBox1.TabIndex = 39;
+            pictureBox1.TabStop = false;
             // 
             // CameraControl
             // 
             AutoScaleDimensions = new SizeF(7F, 17F);
             AutoScaleMode = AutoScaleMode.Font;
-            Controls.Add(sltCamType);
-            Controls.Add(label13);
-            Controls.Add(sthAllPic);
-            Controls.Add(label12);
-            Controls.Add(label11);
-            Controls.Add(label10);
-            Controls.Add(label9);
-            Controls.Add(label8);
-            Controls.Add(sthPic);
-            Controls.Add(label6);
-            Controls.Add(button3);
-            Controls.Add(button2);
-            Controls.Add(button1);
-            Controls.Add(btnSizeAdd);
-            Controls.Add(pictureBox1);
-            Controls.Add(iptROIH);
-            Controls.Add(iptROIW);
-            Controls.Add(iptROIY);
-            Controls.Add(iptROIX);
-            Controls.Add(label7);
-            Controls.Add(sltTriggerMode);
-            Controls.Add(label5);
-            Controls.Add(sltAcquisitionMode);
-            Controls.Add(label4);
-            Controls.Add(iptRevolve);
-            Controls.Add(iptGain);
-            Controls.Add(iptExposure);
-            Controls.Add(label3);
-            Controls.Add(label2);
-            Controls.Add(label1);
-            Controls.Add(swhEnable);
-            Controls.Add(label18);
+            Controls.Add(panel2);
+            Controls.Add(panel1);
             Name = "CameraControl";
-            Size = new Size(909, 601);
+            Size = new Size(909, 611);
+            panel3.ResumeLayout(false);
+            panel4.ResumeLayout(false);
+            panel2.ResumeLayout(false);
+            panel1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
             ResumeLayout(false);
         }
 
         #endregion
 
-        private AntdUI.Switch swhEnable;
+        private AntdUI.Panel panel3;
+        private AntdUI.Button button3;
+        private AntdUI.Button button2;
+        private AntdUI.Button button1;
+        private AntdUI.Button btnSizeAdd;
+        private AntdUI.Panel panel4;
+        private PictureBox pictureBox1;
+        private AntdUI.Panel panel2;
         private AntdUI.Label label18;
+        private AntdUI.Switch swhEnable;
         private AntdUI.Label label1;
         private AntdUI.Label label2;
         private AntdUI.Label label3;
         private AntdUI.InputNumber iptExposure;
         private AntdUI.InputNumber iptGain;
-        private AntdUI.InputNumber iptRevolve;
+        private AntdUI.Select iptRevolve;
         private AntdUI.Label label4;
         private AntdUI.Select sltAcquisitionMode;
         private AntdUI.Label label5;
         private AntdUI.Select sltTriggerMode;
         private AntdUI.Label label7;
-        private AntdUI.InputNumber iptROIW;
-        private AntdUI.InputNumber iptROIY;
         private AntdUI.InputNumber iptROIX;
+        private AntdUI.InputNumber iptROIY;
+        private AntdUI.InputNumber iptROIW;
         private AntdUI.InputNumber iptROIH;
-        private PictureBox pictureBox1;
-        private AntdUI.Button btnSizeAdd;
-        private AntdUI.Button button1;
-        private AntdUI.Button button2;
-        private AntdUI.Button button3;
-        private AntdUI.Switch sthPic;
         private AntdUI.Label label6;
+        private AntdUI.Switch sthPic;
         private AntdUI.Label label8;
         private AntdUI.Label label9;
         private AntdUI.Label label10;
         private AntdUI.Label label11;
-        private AntdUI.Switch sthAllPic;
         private AntdUI.Label label12;
-        private AntdUI.Select sltCamType;
+        private AntdUI.Switch sthAllPic;
         private AntdUI.Label label13;
+        private AntdUI.Select sltCamType;
+        private AntdUI.Label label14;
+        private AntdUI.Switch switch1;
+        private AntdUI.Panel panel1;
     }
 }
diff --git a/DHSoftware/Views/CameraControl.cs b/DHSoftware/Views/CameraControl.cs
index 0c99e1b..d348e97 100644
--- a/DHSoftware/Views/CameraControl.cs
+++ b/DHSoftware/Views/CameraControl.cs
@@ -84,7 +84,8 @@ namespace DHSoftware.Views
             // 启用状态绑定
             swhEnable.DataBindings.Add(nameof(swhEnable.Checked), CameraBase, nameof(CameraBase.IsEnabled),
                 true, DataSourceUpdateMode.OnPropertyChanged);
-
+            switch1.DataBindings.Add(nameof(switch1.Checked), CameraBase, nameof(CameraBase.IsZoomCamera),
+            true, DataSourceUpdateMode.OnPropertyChanged);
             // 曝光时间绑定(假设iptExposure是NumericUpDown)
             iptExposure.DataBindings.Add(nameof(iptExposure.Value), CameraBase, nameof(CameraBase.Exposure),
                 true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
@@ -94,7 +95,7 @@ namespace DHSoftware.Views
                 true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
 
             // 旋转角度绑定
-            iptRevolve.DataBindings.Add(nameof(iptRevolve.Value), CameraBase, nameof(CameraBase.RotateImage),
+            iptRevolve.DataBindings.Add(nameof(iptRevolve.Text), CameraBase, nameof(CameraBase.RotateImage),
                 true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
 
             // ROI坐标绑定
@@ -118,6 +119,7 @@ namespace DHSoftware.Views
 
         private void InitData()
         {
+            iptRevolve.Text = Convert.ToInt32(CameraBase.RotateImage).ToString();
             // 获取枚举字段名列表(原描述改为字段名)
             sltCamType.Items.Clear();
             foreach (EnumCamType value in Enum.GetValues(typeof(EnumCamType)))
diff --git a/DHSoftware/Views/CameraControl.resx b/DHSoftware/Views/CameraControl.resx
index af32865..8b2ff64 100644
--- a/DHSoftware/Views/CameraControl.resx
+++ b/DHSoftware/Views/CameraControl.resx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <root>
   <!--
-    Microsoft ResX Schema 
+    Microsoft ResX Schema
 
     Version 2.0
 
@@ -48,7 +48,7 @@
     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
diff --git a/DHSoftware/Views/FrmLog.cs b/DHSoftware/Views/FrmLog.cs
index c1d0022..e1902c9 100644
--- a/DHSoftware/Views/FrmLog.cs
+++ b/DHSoftware/Views/FrmLog.cs
@@ -253,10 +253,16 @@ namespace DHSoftware.Views
 
         private void AutoScrollIfNeeded()
         {
-            if (lvLog.Items.Count > 0 /*&& chkAutoScroll.Checked*/)
+            try
             {
-                lvLog.EnsureVisible(lvLog.Items.Count - 1);
+                if (lvLog.Items.Count > 0 /*&& chkAutoScroll.Checked*/)
+                {
+                    lvLog.EnsureVisible(lvLog.Items.Count - 1);
+                }
             }
+            catch (Exception ex) {
+            }
+            
         }
 
         private void UpdateLayout()
diff --git a/DHSoftware/Views/SettingWindow.cs b/DHSoftware/Views/SettingWindow.cs
index 7cd4df1..ce53ebd 100644
--- a/DHSoftware/Views/SettingWindow.cs
+++ b/DHSoftware/Views/SettingWindow.cs
@@ -598,7 +598,7 @@ namespace DHSoftware.Views
 
                                         var form = new AddCubicleControl(this, "重命名工位操作")
                                         {
-                                            Size = new Size(300, 200),
+                                            Size = new Size(300, 500),
                                             // 传递当前名称到表单
                                             CubicleName = originalName
                                         };
diff --git a/DHSoftware/Views/VisualLocalizationWindow.Designer.cs b/DHSoftware/Views/VisualLocalizationWindow.Designer.cs
index c3941ac..ce11b66 100644
--- a/DHSoftware/Views/VisualLocalizationWindow.Designer.cs
+++ b/DHSoftware/Views/VisualLocalizationWindow.Designer.cs
@@ -53,9 +53,19 @@
             label5 = new AntdUI.Label();
             sltDirection = new AntdUI.Select();
             label4 = new AntdUI.Label();
+            panelMotor = new AntdUI.Panel();
+            btnSaveMotorPos = new AntdUI.Button();
+            iptMotorPos = new AntdUI.InputNumber();
+            label9 = new AntdUI.Label();
+            btnMotorZero = new AntdUI.Button();
+            btnMotorReverse = new AntdUI.Button();
+            btnMotorForward = new AntdUI.Button();
+            iptMotorSpeed = new AntdUI.InputNumber();
+            label8 = new AntdUI.Label();
             imageViewerControl1 = new ImageViewerControl();
             panel1.SuspendLayout();
             panel2.SuspendLayout();
+            panelMotor.SuspendLayout();
             SuspendLayout();
             // 
             // titlebar
@@ -67,11 +77,12 @@
             titlebar.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
             titlebar.ForeColor = Color.White;
             titlebar.Location = new Point(0, 0);
+            titlebar.Margin = new Padding(4, 4, 4, 4);
             titlebar.Mode = AntdUI.TAMode.Dark;
             titlebar.Name = "titlebar";
             titlebar.ShowButton = true;
             titlebar.ShowIcon = true;
-            titlebar.Size = new Size(1210, 37);
+            titlebar.Size = new Size(1551, 44);
             titlebar.SubText = "视觉定位系统";
             titlebar.TabIndex = 1;
             titlebar.Text = "山东迭慧智能科技有限公司";
@@ -89,35 +100,39 @@
             panel1.Controls.Add(sltCameraName);
             panel1.Controls.Add(label1);
             panel1.Dock = DockStyle.Top;
-            panel1.Location = new Point(0, 37);
+            panel1.Location = new Point(0, 44);
+            panel1.Margin = new Padding(4, 4, 4, 4);
             panel1.Name = "panel1";
-            panel1.Size = new Size(1210, 56);
+            panel1.Size = new Size(1551, 66);
             panel1.TabIndex = 2;
             panel1.Text = "panel1";
             // 
             // iptThreshold
             // 
-            iptThreshold.Location = new Point(1094, 6);
+            iptThreshold.Location = new Point(1407, 7);
+            iptThreshold.Margin = new Padding(4, 4, 4, 4);
             iptThreshold.Name = "iptThreshold";
-            iptThreshold.Size = new Size(107, 43);
+            iptThreshold.Size = new Size(138, 51);
             iptThreshold.TabIndex = 15;
             iptThreshold.Text = "0";
             // 
             // label6
             // 
             label6.BackColor = SystemColors.Window;
-            label6.Location = new Point(1044, 18);
+            label6.Location = new Point(1342, 21);
+            label6.Margin = new Padding(4, 4, 4, 4);
             label6.Name = "label6";
-            label6.Size = new Size(57, 23);
+            label6.Size = new Size(73, 27);
             label6.TabIndex = 14;
             label6.Text = "定位阈值";
             // 
             // btnSelectBackImg
             // 
             btnSelectBackImg.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnSelectBackImg.Location = new Point(963, 11);
+            btnSelectBackImg.Location = new Point(1238, 13);
+            btnSelectBackImg.Margin = new Padding(4, 4, 4, 4);
             btnSelectBackImg.Name = "btnSelectBackImg";
-            btnSelectBackImg.Size = new Size(75, 38);
+            btnSelectBackImg.Size = new Size(96, 45);
             btnSelectBackImg.TabIndex = 13;
             btnSelectBackImg.Text = "打开";
             btnSelectBackImg.Type = AntdUI.TTypeMini.Primary;
@@ -125,63 +140,70 @@
             // btnSelectModel
             // 
             btnSelectModel.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnSelectModel.Location = new Point(525, 9);
+            btnSelectModel.Location = new Point(675, 11);
+            btnSelectModel.Margin = new Padding(4, 4, 4, 4);
             btnSelectModel.Name = "btnSelectModel";
-            btnSelectModel.Size = new Size(75, 38);
+            btnSelectModel.Size = new Size(96, 45);
             btnSelectModel.TabIndex = 12;
             btnSelectModel.Text = "打开";
             btnSelectModel.Type = AntdUI.TTypeMini.Primary;
             // 
             // iptBackImg
             // 
-            iptBackImg.Location = new Point(694, 6);
+            iptBackImg.Location = new Point(892, 7);
+            iptBackImg.Margin = new Padding(4, 4, 4, 4);
             iptBackImg.Name = "iptBackImg";
             iptBackImg.PlaceholderText = "请选择背景图片";
-            iptBackImg.Size = new Size(263, 43);
+            iptBackImg.Size = new Size(338, 51);
             iptBackImg.TabIndex = 10;
             // 
             // label3
             // 
             label3.BackColor = SystemColors.Window;
-            label3.Location = new Point(606, 18);
+            label3.Location = new Point(779, 21);
+            label3.Margin = new Padding(4, 4, 4, 4);
             label3.Name = "label3";
-            label3.Size = new Size(82, 23);
+            label3.Size = new Size(105, 27);
             label3.TabIndex = 9;
             label3.Text = "背景图片路径";
             // 
             // iptModel
             // 
-            iptModel.Location = new Point(256, 6);
+            iptModel.Location = new Point(329, 7);
+            iptModel.Margin = new Padding(4, 4, 4, 4);
             iptModel.Name = "iptModel";
             iptModel.PlaceholderText = "请选择算法";
-            iptModel.Size = new Size(263, 43);
+            iptModel.Size = new Size(338, 51);
             iptModel.TabIndex = 3;
             // 
             // label2
             // 
             label2.BackColor = SystemColors.Window;
-            label2.Location = new Point(193, 18);
+            label2.Location = new Point(248, 21);
+            label2.Margin = new Padding(4, 4, 4, 4);
             label2.Name = "label2";
-            label2.Size = new Size(57, 23);
+            label2.Size = new Size(73, 27);
             label2.TabIndex = 2;
             label2.Text = "算法路径";
             // 
             // sltCameraName
             // 
             sltCameraName.List = true;
-            sltCameraName.Location = new Point(72, 7);
+            sltCameraName.Location = new Point(93, 8);
+            sltCameraName.Margin = new Padding(4, 4, 4, 4);
             sltCameraName.MaxCount = 10;
             sltCameraName.Name = "sltCameraName";
             sltCameraName.PlaceholderText = "请选择相机";
-            sltCameraName.Size = new Size(115, 43);
+            sltCameraName.Size = new Size(148, 51);
             sltCameraName.TabIndex = 1;
             // 
             // label1
             // 
             label1.BackColor = SystemColors.Window;
-            label1.Location = new Point(9, 18);
+            label1.Location = new Point(12, 21);
+            label1.Margin = new Padding(4, 4, 4, 4);
             label1.Name = "label1";
-            label1.Size = new Size(57, 23);
+            label1.Size = new Size(73, 27);
             label1.TabIndex = 0;
             label1.Text = "相机名称";
             // 
@@ -200,35 +222,39 @@
             panel2.Controls.Add(sltDirection);
             panel2.Controls.Add(label4);
             panel2.Dock = DockStyle.Top;
-            panel2.Location = new Point(0, 93);
+            panel2.Location = new Point(0, 110);
+            panel2.Margin = new Padding(4, 4, 4, 4);
             panel2.Name = "panel2";
-            panel2.Size = new Size(1210, 56);
+            panel2.Size = new Size(1551, 66);
             panel2.TabIndex = 3;
             panel2.Text = "panel2";
             // 
             // iptSpeed
             // 
-            iptSpeed.Location = new Point(256, 6);
+            iptSpeed.Location = new Point(329, 7);
+            iptSpeed.Margin = new Padding(4, 4, 4, 4);
             iptSpeed.Name = "iptSpeed";
-            iptSpeed.Size = new Size(107, 43);
+            iptSpeed.Size = new Size(138, 51);
             iptSpeed.TabIndex = 20;
             iptSpeed.Text = "0";
             // 
             // label7
             // 
             label7.BackColor = SystemColors.Window;
-            label7.Location = new Point(193, 18);
+            label7.Location = new Point(248, 21);
+            label7.Margin = new Padding(4, 4, 4, 4);
             label7.Name = "label7";
-            label7.Size = new Size(57, 23);
+            label7.Size = new Size(73, 27);
             label7.TabIndex = 19;
             label7.Text = "转盘速度";
             // 
             // btnSaveImg
             // 
             btnSaveImg.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnSaveImg.Location = new Point(1126, 11);
+            btnSaveImg.Location = new Point(1448, 13);
+            btnSaveImg.Margin = new Padding(4, 4, 4, 4);
             btnSaveImg.Name = "btnSaveImg";
-            btnSaveImg.Size = new Size(75, 38);
+            btnSaveImg.Size = new Size(96, 45);
             btnSaveImg.TabIndex = 18;
             btnSaveImg.Text = "保存图像";
             btnSaveImg.Type = AntdUI.TTypeMini.Primary;
@@ -236,9 +262,10 @@
             // btnSavePos
             // 
             btnSavePos.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnSavePos.Location = new Point(1013, 11);
+            btnSavePos.Location = new Point(1302, 13);
+            btnSavePos.Margin = new Padding(4, 4, 4, 4);
             btnSavePos.Name = "btnSavePos";
-            btnSavePos.Size = new Size(75, 38);
+            btnSavePos.Size = new Size(96, 45);
             btnSavePos.TabIndex = 17;
             btnSavePos.Text = "保存定位";
             btnSavePos.Type = AntdUI.TTypeMini.Primary;
@@ -246,9 +273,10 @@
             // btnReverse
             // 
             btnReverse.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnReverse.Location = new Point(904, 11);
+            btnReverse.Location = new Point(1162, 13);
+            btnReverse.Margin = new Padding(4, 4, 4, 4);
             btnReverse.Name = "btnReverse";
-            btnReverse.Size = new Size(75, 38);
+            btnReverse.Size = new Size(96, 45);
             btnReverse.TabIndex = 16;
             btnReverse.Text = "转盘反转";
             btnReverse.Type = AntdUI.TTypeMini.Primary;
@@ -256,9 +284,10 @@
             // btnForward
             // 
             btnForward.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnForward.Location = new Point(804, 11);
+            btnForward.Location = new Point(1034, 13);
+            btnForward.Margin = new Padding(4, 4, 4, 4);
             btnForward.Name = "btnForward";
-            btnForward.Size = new Size(75, 38);
+            btnForward.Size = new Size(96, 45);
             btnForward.TabIndex = 15;
             btnForward.Text = "转盘正转";
             btnForward.Type = AntdUI.TTypeMini.Primary;
@@ -266,9 +295,10 @@
             // btnLocalization
             // 
             btnLocalization.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnLocalization.Location = new Point(704, 11);
+            btnLocalization.Location = new Point(905, 13);
+            btnLocalization.Margin = new Padding(4, 4, 4, 4);
             btnLocalization.Name = "btnLocalization";
-            btnLocalization.Size = new Size(75, 38);
+            btnLocalization.Size = new Size(96, 45);
             btnLocalization.TabIndex = 14;
             btnLocalization.Text = "开始定位";
             btnLocalization.Type = AntdUI.TTypeMini.Primary;
@@ -276,28 +306,31 @@
             // btnAcquisition
             // 
             btnAcquisition.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btnAcquisition.Location = new Point(606, 11);
+            btnAcquisition.Location = new Point(779, 13);
+            btnAcquisition.Margin = new Padding(4, 4, 4, 4);
             btnAcquisition.Name = "btnAcquisition";
-            btnAcquisition.Size = new Size(75, 38);
+            btnAcquisition.Size = new Size(96, 45);
             btnAcquisition.TabIndex = 13;
             btnAcquisition.Text = "开始采集";
             btnAcquisition.Type = AntdUI.TTypeMini.Primary;
             // 
             // iptPosition
             // 
-            iptPosition.Location = new Point(425, 6);
+            iptPosition.Location = new Point(546, 7);
+            iptPosition.Margin = new Padding(4, 4, 4, 4);
             iptPosition.Name = "iptPosition";
             iptPosition.ReadOnly = true;
-            iptPosition.Size = new Size(175, 43);
+            iptPosition.Size = new Size(225, 51);
             iptPosition.TabIndex = 7;
             iptPosition.Text = "0";
             // 
             // label5
             // 
             label5.BackColor = SystemColors.Window;
-            label5.Location = new Point(369, 18);
+            label5.Location = new Point(474, 21);
+            label5.Margin = new Padding(4, 4, 4, 4);
             label5.Name = "label5";
-            label5.Size = new Size(59, 23);
+            label5.Size = new Size(76, 27);
             label5.TabIndex = 6;
             label5.Text = "当前位置";
             // 
@@ -305,45 +338,152 @@
             // 
             sltDirection.Items.AddRange(new object[] { "正方向", "反方向" });
             sltDirection.List = true;
-            sltDirection.Location = new Point(72, 6);
+            sltDirection.Location = new Point(93, 7);
+            sltDirection.Margin = new Padding(4, 4, 4, 4);
             sltDirection.MaxCount = 10;
             sltDirection.Name = "sltDirection";
             sltDirection.PlaceholderText = "请选择方向";
-            sltDirection.Size = new Size(115, 43);
+            sltDirection.Size = new Size(148, 51);
             sltDirection.TabIndex = 5;
             // 
             // label4
             // 
             label4.BackColor = SystemColors.Window;
-            label4.Location = new Point(9, 18);
+            label4.Location = new Point(12, 21);
+            label4.Margin = new Padding(4, 4, 4, 4);
             label4.Name = "label4";
-            label4.Size = new Size(57, 23);
+            label4.Size = new Size(73, 27);
             label4.TabIndex = 4;
             label4.Text = "转盘方向";
             // 
+            // panelMotor
+            // 
+            panelMotor.Controls.Add(btnSaveMotorPos);
+            panelMotor.Controls.Add(iptMotorPos);
+            panelMotor.Controls.Add(label9);
+            panelMotor.Controls.Add(btnMotorZero);
+            panelMotor.Controls.Add(btnMotorReverse);
+            panelMotor.Controls.Add(btnMotorForward);
+            panelMotor.Controls.Add(iptMotorSpeed);
+            panelMotor.Controls.Add(label8);
+            panelMotor.Dock = DockStyle.Top;
+            panelMotor.Location = new Point(0, 176);
+            panelMotor.Margin = new Padding(4, 4, 4, 4);
+            panelMotor.Name = "panelMotor";
+            panelMotor.Size = new Size(1551, 54);
+            panelMotor.TabIndex = 4;
+            panelMotor.Text = "panel3";
+            // 
+            // btnSaveMotorPos
+            // 
+            btnSaveMotorPos.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btnSaveMotorPos.Location = new Point(966, 6);
+            btnSaveMotorPos.Margin = new Padding(4, 4, 4, 4);
+            btnSaveMotorPos.Name = "btnSaveMotorPos";
+            btnSaveMotorPos.Size = new Size(111, 45);
+            btnSaveMotorPos.TabIndex = 21;
+            btnSaveMotorPos.Text = "保存电机位置";
+            btnSaveMotorPos.Type = AntdUI.TTypeMini.Primary;
+            // 
+            // iptMotorPos
+            // 
+            iptMotorPos.Location = new Point(365, 0);
+            iptMotorPos.Margin = new Padding(4, 4, 4, 4);
+            iptMotorPos.Name = "iptMotorPos";
+            iptMotorPos.ReadOnly = true;
+            iptMotorPos.Size = new Size(225, 51);
+            iptMotorPos.TabIndex = 20;
+            iptMotorPos.Text = "0";
+            // 
+            // label9
+            // 
+            label9.BackColor = SystemColors.Window;
+            label9.Location = new Point(261, 12);
+            label9.Margin = new Padding(4, 4, 4, 4);
+            label9.Name = "label9";
+            label9.Size = new Size(104, 27);
+            label9.TabIndex = 19;
+            label9.Text = "变焦电机位置";
+            // 
+            // btnMotorZero
+            // 
+            btnMotorZero.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btnMotorZero.Location = new Point(598, 6);
+            btnMotorZero.Margin = new Padding(4, 4, 4, 4);
+            btnMotorZero.Name = "btnMotorZero";
+            btnMotorZero.Size = new Size(96, 45);
+            btnMotorZero.TabIndex = 18;
+            btnMotorZero.Text = "电机回原点";
+            btnMotorZero.Type = AntdUI.TTypeMini.Primary;
+            // 
+            // btnMotorReverse
+            // 
+            btnMotorReverse.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btnMotorReverse.Location = new Point(847, 6);
+            btnMotorReverse.Margin = new Padding(4, 4, 4, 4);
+            btnMotorReverse.Name = "btnMotorReverse";
+            btnMotorReverse.Size = new Size(96, 45);
+            btnMotorReverse.TabIndex = 17;
+            btnMotorReverse.Text = "电机反转";
+            btnMotorReverse.Type = AntdUI.TTypeMini.Primary;
+            // 
+            // btnMotorForward
+            // 
+            btnMotorForward.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btnMotorForward.Location = new Point(724, 6);
+            btnMotorForward.Margin = new Padding(4, 4, 4, 4);
+            btnMotorForward.Name = "btnMotorForward";
+            btnMotorForward.Size = new Size(96, 45);
+            btnMotorForward.TabIndex = 16;
+            btnMotorForward.Text = "电机正转";
+            btnMotorForward.Type = AntdUI.TTypeMini.Primary;
+            // 
+            // iptMotorSpeed
+            // 
+            iptMotorSpeed.Location = new Point(116, 0);
+            iptMotorSpeed.Margin = new Padding(4, 4, 4, 4);
+            iptMotorSpeed.Name = "iptMotorSpeed";
+            iptMotorSpeed.Size = new Size(138, 51);
+            iptMotorSpeed.TabIndex = 8;
+            iptMotorSpeed.Text = "0";
+            // 
+            // label8
+            // 
+            label8.BackColor = SystemColors.Window;
+            label8.Location = new Point(12, 12);
+            label8.Margin = new Padding(4, 4, 4, 4);
+            label8.Name = "label8";
+            label8.Size = new Size(104, 27);
+            label8.TabIndex = 1;
+            label8.Text = "变焦电机速度";
+            // 
             // imageViewerControl1
             // 
             imageViewerControl1.Dock = DockStyle.Fill;
             imageViewerControl1.Image = null;
-            imageViewerControl1.Location = new Point(0, 149);
+            imageViewerControl1.Location = new Point(0, 230);
+            imageViewerControl1.Margin = new Padding(4, 4, 4, 4);
             imageViewerControl1.Name = "imageViewerControl1";
-            imageViewerControl1.Size = new Size(1210, 558);
-            imageViewerControl1.TabIndex = 4;
+            imageViewerControl1.Size = new Size(1551, 593);
+            imageViewerControl1.TabIndex = 5;
             // 
             // VisualLocalizationWindow
             // 
-            AutoScaleDimensions = new SizeF(7F, 17F);
+            AutoScaleDimensions = new SizeF(9F, 20F);
             AutoScaleMode = AutoScaleMode.Font;
-            ClientSize = new Size(1210, 707);
+            ClientSize = new Size(1551, 823);
             Controls.Add(imageViewerControl1);
+            Controls.Add(panelMotor);
             Controls.Add(panel2);
             Controls.Add(panel1);
             Controls.Add(titlebar);
+            Margin = new Padding(4, 4, 4, 4);
             Name = "VisualLocalizationWindow";
             Text = "CCD光学筛选定位系统";
             WindowState = FormWindowState.Maximized;
             panel1.ResumeLayout(false);
             panel2.ResumeLayout(false);
+            panelMotor.ResumeLayout(false);
             ResumeLayout(false);
         }
 
@@ -370,10 +510,19 @@
         private AntdUI.Button btnForward;
         private AntdUI.Button btnSaveImg;
         private AntdUI.Button btnSavePos;
-        private ImageViewerControl imageViewerControl1;
         private AntdUI.InputNumber iptThreshold;
         private AntdUI.Label label6;
         private AntdUI.InputNumber iptSpeed;
         private AntdUI.Label label7;
+        private AntdUI.Panel panelMotor;
+        private AntdUI.InputNumber iptMotorSpeed;
+        private AntdUI.Label label8;
+        private ImageViewerControl imageViewerControl1;
+        private AntdUI.Button btnMotorReverse;
+        private AntdUI.Button btnMotorForward;
+        private AntdUI.InputNumber iptMotorPos;
+        private AntdUI.Label label9;
+        private AntdUI.Button btnMotorZero;
+        private AntdUI.Button btnSaveMotorPos;
     }
 }
diff --git a/DHSoftware/Views/VisualLocalizationWindow.cs b/DHSoftware/Views/VisualLocalizationWindow.cs
index a63affa..63a8bc4 100644
--- a/DHSoftware/Views/VisualLocalizationWindow.cs
+++ b/DHSoftware/Views/VisualLocalizationWindow.cs
@@ -1,8 +1,11 @@
 using System.Data;
+using System.Diagnostics;
 using System.Drawing.Imaging;
 using AntdUI;
 using DH.Commons.Base;
 using DH.Commons.Enums;
+using DH.Commons.Helper;
+using DH.Commons.Models;
 using DH.Devices.Camera;
 using HalconDotNet;
 using OpenCvSharp.Extensions;
@@ -45,23 +48,228 @@ namespace DHSoftware.Views
             btnSaveImg.Click += BtnSaveImg_Click;
             btnSavePos.Click += BtnSavePos_Click;
             sltCameraName.SelectedIndexChanged += SltCameraName_SelectedIndexChanged;
+            btnMotorForward.MouseDown += BtnMotorForward_MouseDown;
+            btnMotorForward.MouseUp += MotorButton_MouseUp;
+            btnMotorReverse.MouseDown += BtnMotorReverse_MouseDown;
+            btnMotorReverse.MouseUp += MotorButton_MouseUp;
+            btnMotorZero.Click += BtnMotorZero_Click;
+            btnSaveMotorPos.Click += BtnSaveMotorPos_Click;
+            panelMotor.Visible = false;
+           
+
+        }
+
+        private void BtnSaveMotorPos_Click(object? sender, EventArgs e)
+        {
+            //根据工位查找点位
+            PLCItem? pLCItem = ConfigModel.PLCBaseList?
+           .FirstOrDefault()?
+           .PLCItemList?
+           .Where(it => it.Name == "相机步进位置").FirstOrDefault();
+            if (pLCItem == null)
+            {
+                AntdUI.Message.warn(this, $"未找到相机步进位置地址,请检查该地址是否存在于点位表!", autoClose: 3);
+                return;
+            }
+
+            PLCItem? pLCItem1 = ConfigModel.GlobalList?
+            .FirstOrDefault()?
+            .StartProcessList?
+            .Where(it => it.Name == "相机步进位置").FirstOrDefault();
+
+            if (pLCItem1 == null)
+            {
+                pLCItem1 = new PLCItem();
+                pLCItem1.Name = pLCItem.Name;
+                pLCItem1.Address = pLCItem.Address;
+                pLCItem1.Value = iptMotorPos.Text;
+                pLCItem1.Type = pLCItem.Type;
+                pLCItem1.StartExecute = true;
+                ConfigModel.GlobalList?
+               .FirstOrDefault()?
+               .StartProcessList?.Add(pLCItem1);
+            }
+            else
+            {
+                pLCItem1.Value = iptMotorPos.Text;
+            }
+
+            ConfigHelper.SaveConfig();
+            AntdUI.Message.success(this, "保存成功!", autoClose: 3);
+        }
+        private CancellationTokenSource? _motorCts;
+        private bool _isMotorOperating;
+        private bool _isHoming;
+
+
+
+        private CancellationTokenSource _cts;
+        private bool _isBusy;
+
+        // 电机正转控制
+        private async void BtnMotorForward_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (_isBusy) return;
+            _isBusy = true;
 
+            try
+            {
+                // 获取并处理速度值
+                if (!int.TryParse(iptMotorSpeed.Text, out int speed) || speed == 0)
+                {
+                    AntdUI.Message.warn(this, "速度值无效");
+                    return;
+                }
+                int actualSpeed = Math.Abs(speed); // 正转取绝对值
+
+                // 启动PLC控制
+                _cts?.Dispose();
+                _cts = new CancellationTokenSource();
+                MainWindow.Instance.PLC.MotorSpeed(actualSpeed);
+                MainWindow.Instance.PLC.MotorTest(true);
+
+                // 实时更新循环
+                while (!_cts.IsCancellationRequested)
+                {
+                    var pos = await Task.Run(() => MainWindow.Instance.PLC.ReadMotorRealPos());
+                    iptMotorPos.Text = pos.ToString();
+                    await Task.Delay(50);
+                }
+            }
+            catch (Exception ex)
+            {
+                AntdUI.Message.error(this, $"正转异常: {ex.Message}");
+            }
+            finally
+            {
+                MainWindow.Instance.PLC.MotorTest(false);
+                _isBusy = false;
+            }
+        }
+
+        // 电机反转控制
+        // 电机反转控制(带原点保护)
+        private async void BtnMotorReverse_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (_isBusy) return;
+            _isBusy = true;
+
+            try
+            {
+                // 获取并处理速度值
+                if (!int.TryParse(iptMotorSpeed.Text, out int speed) || speed == 0)
+                {
+                    AntdUI.Message.warn(this, "速度值无效");
+                    return;
+                }
+                int actualSpeed = -Math.Abs(speed);
+
+                // 实时位置检查(启动前)
+                int currentPos = MainWindow.Instance.PLC.ReadMotorRealPos();
+                if (currentPos <= 0)
+                {
+                    AntdUI.Message.info(this, "已在原点位置");
+                    return;
+                }
+
+                // 启动PLC控制
+                _cts?.Dispose();
+                _cts = new CancellationTokenSource();
+                MainWindow.Instance.PLC.MotorSpeed(actualSpeed);
+                MainWindow.Instance.PLC.MotorTest(true);
+
+                // 带保护的实时更新循环
+                while (!_cts.IsCancellationRequested)
+                {
+                    currentPos = await Task.Run(() => MainWindow.Instance.PLC.ReadMotorRealPos());
+
+                    // 位置边界保护
+                    if (currentPos <= 0)
+                    {
+                        _cts.Cancel();
+               
+                        break;
+                    }
+
+                    // 更新UI
+                    this.Invoke((MethodInvoker)delegate {
+                        iptMotorPos.Text = currentPos.ToString();
+                    });
+
+                    await Task.Delay(50);
+                }
+            }
+            catch (Exception ex)
+            {
+                AntdUI.Message.error(this, $"反转异常: {ex.Message}");
+            }
+            finally
+            {
+                MainWindow.Instance.PLC.MotorTest(false);
+                _isBusy = false;
+            }
+        }
+
+        // 停止控制(正反转共用)
+        private void MotorButton_MouseUp(object sender, MouseEventArgs e) {
+            _cts?.Cancel();
+            iptMotorPos.Text = MainWindow.Instance.PLC.ReadMotorRealPos().ToString();
+        } 
+
+        // 回零操作
+        private async void BtnMotorZero_Click(object sender, EventArgs e)
+        {
+            if (_isBusy) return;
+            _isBusy = true;
+            btnMotorForward.Enabled = btnMotorReverse.Enabled = false;
+
+            try
+            {
+                // 获取速度值
+                if (!int.TryParse(iptMotorSpeed.Text, out int speed) || speed <= 0)
+                {
+                    AntdUI.Message.warn(this, "速度值无效");
+                    return;
+                }
+
+                // 执行回零
+                MainWindow.Instance.PLC.MotorSpeed(speed);
+                await Task.Run(() => MainWindow.Instance.PLC.MotorToZero(true));
+
+                // 等待回零完成
+                while (MainWindow.Instance.PLC.ReadMotorRealPos() != 0)
+                {
+                    iptMotorPos.Text = MainWindow.Instance.PLC.ReadMotorRealPos().ToString();
+                    await Task.Delay(100);
+                }
+
+                await Task.Run(() => MainWindow.Instance.PLC.MotorToZero(false));
+            }
+            catch (Exception ex)
+            {
+                AntdUI.Message.error(this, $"回零失败: {ex.Message}");
+            }
+            finally
+            {
+                btnMotorForward.Enabled = btnMotorReverse.Enabled = true;
+                _isBusy = false;
+                iptMotorPos.Text = MainWindow.Instance.PLC.ReadMotorRealPos().ToString();
+            }
+        }
+
+        private void SltCameraName_SelectedIndexChanged(object sender, IntEventArgs e)
+        {
             try
             {
                 localizations = VisualLocalization.LoadAll();
-                
+
             }
             catch
             {
 
             }
-
-        }
-
-        private void SltCameraName_SelectedIndexChanged(object sender, IntEventArgs e)
-        {
-            
             string cameraName= sltCameraName.Text;
+            Do3ThinkCamera = MainWindow.Instance.Cameras.Where(it => it.CameraName == cameraName).FirstOrDefault() ?? new Do3ThinkCamera();
             VisualLocalization? visual= localizations.Where(it=>it.CameraName==cameraName).FirstOrDefault();
             if (visual != null) 
             {
@@ -71,6 +279,14 @@ namespace DHSoftware.Views
                 sltDirection.SelectedIndex = visual.Direction == "正方向" ? 0 : 1;
                 iptSpeed.Text = visual.Speed;
             }
+            if (Do3ThinkCamera.IsZoomCamera)
+            {
+                panelMotor.Visible=true;
+            }
+            else
+            {
+                panelMotor.Visible = false;
+            }
         }
 
         private void BtnSavePos_Click(object? sender, EventArgs e)
@@ -272,6 +488,78 @@ namespace DHSoftware.Views
             Do3ThinkCamera.Snapshot();
         }
 
+        private CancellationTokenSource? _rotateCts;
+        private bool _isRotating;
+        /// <summary>
+        /// 统一旋转控制方法
+        /// </summary>
+        private async Task RotateControlAsync(bool direction)
+        {
+            // 防止重复启动
+            if (_isRotating) return;
+            _isRotating = true;
+
+            try
+            {
+                if (!MainWindow.Instance.PLC.Connected)
+                {
+                    this.Invoke(() => AntdUI.Message.warn(this, "未连接PLC!", autoClose: 3));
+                    return;
+                }
+
+                // 输入验证
+                if (string.IsNullOrEmpty(iptSpeed.Text))
+                {
+                    this.Invoke(() => AntdUI.Message.warn(this, "请输入速度!", autoClose: 3));
+                    return;
+                }
+
+                if (!int.TryParse(iptSpeed.Text, out int speed) || speed <= 0)
+                {
+                    this.Invoke(() => AntdUI.Message.warn(this, "速度必须为正整数!", autoClose: 3));
+                    return;
+                }
+
+                // 初始化取消令牌
+                _rotateCts?.Dispose();
+                _rotateCts = new CancellationTokenSource();
+
+                // 设置PLC参数
+                MainWindow.Instance.PLC.TurnSpeed(speed);
+                MainWindow.Instance.PLC.TurnDirection(direction);
+                MainWindow.Instance.PLC.TurnStart(true);
+
+                // 异步更新循环
+                while (!_rotateCts.IsCancellationRequested)
+                {
+                    var position = MainWindow.Instance.PLC.ReadVisionPos();
+                    Debug.WriteLine(position.ToString());
+                    this.BeginInvoke(() => iptPosition.Text = position.ToString());
+                    await Task.Delay(100, _rotateCts.Token);
+                }
+            }
+            catch (OperationCanceledException)
+            {
+                // 正常取消不处理
+            }
+            catch (Exception ex)
+            {
+                this.Invoke(() => AntdUI.Message.error(this, $"操作异常:{ex.Message}"));
+            }
+            finally
+            {
+                // 确保停止转动
+                MainWindow.Instance.PLC.TurnStart(false);
+                var finalPos = MainWindow.Instance.PLC.ReadVisionPos();
+                this.Invoke(() => iptPosition.Text = finalPos.ToString());
+
+                _isRotating = false;
+                _rotateCts?.Dispose();
+                _rotateCts = null;
+            }
+        }
+
+
         /// <summary>
         /// 反转抬起
         /// </summary>
@@ -279,15 +567,7 @@ namespace DHSoftware.Views
         /// <param name="e"></param>
         private void BtnReverse_MouseUp(object? sender, MouseEventArgs e)
         {
-            if (MainWindow.Instance.PLC.Connected)
-            {
-                MainWindow.Instance.PLC.TurnStart(false);
-                iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
-            }
-            else
-            {
-                AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
-            }
+            _rotateCts?.Cancel();
         }
 
         /// <summary>
@@ -295,38 +575,9 @@ namespace DHSoftware.Views
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void BtnReverse_MouseDown(object? sender, MouseEventArgs e)
+        private async void BtnReverse_MouseDown(object? sender, MouseEventArgs e)
         {
-            if (MainWindow.Instance.PLC.Connected)
-            {
-                //开启转盘
-                if (string.IsNullOrEmpty(iptSpeed.Text))
-                {
-                    AntdUI.Message.warn(this, $"请输入速度!", autoClose: 3);
-                    return;
-                }
-                int speed = 0;
-
-                try
-                {
-                    bool isValid = int.TryParse(iptSpeed.Text, out speed);
-                    if (!isValid)
-                    {
-                        AntdUI.Message.warn(this, $"输入的速度不是有效值!", autoClose: 3);
-                        return;
-                    }
-                }
-                catch (Exception ex) { }
-
-                MainWindow.Instance.PLC.TurnSpeed(speed);
-                MainWindow.Instance.PLC.TurnDirection(false);
-                MainWindow.Instance.PLC.TurnStart(true);
-                iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
-            }
-            else
-            {
-                AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
-            }
+            await RotateControlAsync(false);
         }
 
         /// <summary>
@@ -336,15 +587,7 @@ namespace DHSoftware.Views
         /// <param name="e"></param>
         private void BtnForward_MouseUp(object? sender, MouseEventArgs e)
         {
-            if (MainWindow.Instance.PLC.Connected)
-            {
-                MainWindow.Instance.PLC.TurnStart(false);
-                iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
-            }
-            else
-            {
-                AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
-            }
+            _rotateCts?.Cancel();
         }
 
         /// <summary>
@@ -352,38 +595,9 @@ namespace DHSoftware.Views
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void BtnForward_MouseDown(object? sender, MouseEventArgs e)
+        private async void BtnForward_MouseDown(object? sender, MouseEventArgs e)
         {
-            if (MainWindow.Instance.PLC.Connected)
-            {
-                //开启转盘
-                if (string.IsNullOrEmpty(iptSpeed.Text))
-            {
-                AntdUI.Message.warn(this, $"请输入速度!", autoClose: 3);
-                return;
-            }
-            int speed = 0;
-
-            try
-            {
-                bool isValid = int.TryParse(iptSpeed.Text, out speed);
-                if (!isValid)
-                {
-                    AntdUI.Message.warn(this, $"输入的速度不是有效值!", autoClose: 3);
-                    return;
-                }
-            }
-            catch (Exception ex) { }
-
-            MainWindow.Instance.PLC.TurnSpeed(speed);
-            MainWindow.Instance.PLC.TurnDirection(true);
-            MainWindow.Instance.PLC.TurnStart(true);
-            iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
-            }
-            else
-            {
-                AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
-            }
+            await RotateControlAsync(true);
         }
 
         /// <summary>
@@ -488,23 +702,37 @@ namespace DHSoftware.Views
         private void OnCameraHImageOutput(DateTime dt, CameraBase camera, MatSet imageSet)
         {
 
-            imageViewerControl1.Image = imageSet._mat.ToBitmap();
-            HObject obj = OpenCVHelper.MatToHImage(imageSet._mat);
-            HImage hImage = HalconHelper.ConvertHObjectToHImage(obj);
-            // 调用 ProcCall 的方法
-            ProcCall.SetInputIconicParamObject("INPUT_Image", hImage); // 将图像输入Proc
+         
+                  
+                    this.BeginInvoke(new MethodInvoker(delegate ()
+                    {
+                     
+                        imageViewerControl1.Image = imageSet._mat.ToBitmap();
+                        if (isLocationing)
+                        {
+                            HObject obj = OpenCVHelper.MatToHImage(imageSet._mat);
+                            HImage hImage = HalconHelper.ConvertHObjectToHImage(obj);
+                            // 调用 ProcCall 的方法
+                            ProcCall.SetInputIconicParamObject("INPUT_Image", hImage); // 将图像输入Proc
 
-            ProcCall.SetInputIconicParamObject("BackGroundPic", backImage);
+                            ProcCall.SetInputIconicParamObject("BackGroundPic", backImage);
 
-            ProcCall.SetInputCtrlParamTuple("DistThreshold", Convert.ToInt32(iptThreshold.Text));
-            ProcCall.Execute();
-            double nNUm = ProcCall.GetOutputCtrlParamTuple("OUTPUT_Flag");
+                            ProcCall.SetInputCtrlParamTuple("DistThreshold", Convert.ToInt32(iptThreshold.Text));
+                            ProcCall.Execute();
+                            double nNUm = ProcCall.GetOutputCtrlParamTuple("OUTPUT_Flag");
 
-            if (nNUm == 0)
-            {
-              MainWindow.Instance.PLC.TurnStart(false);
-              iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
+                            if (nNUm == 0)
+                            {
+                                MainWindow.Instance.PLC.TurnStart(false);
+                                iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
+                                isLocationing = false;
+                                btnLocalization.Text = "开始定位";
+                                btnLocalization.Type = TTypeMini.Primary;
+                            }
+                        }
+                    }));
+                   
+                }
             }
+           
         }
-    }
-}