From 52e8eef500031203c9a8fb4fac62c5c40c3d1802 Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期五, 16 一月 2026 12:47:42 +0800
Subject: [PATCH] 修复工具图像输入bug添加项目文件。

---
 /dev/null                                              |  189 -----------------------------------------------
 LB_VisionProcesses/Communicators/CommunicatorConfig.cs |   11 +-
 2 files changed, 6 insertions(+), 194 deletions(-)

diff --git a/LB_VisionProcesses/Communicators/CommunicatorConfig.cs b/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
index 56ea328..1f5cfed 100644
--- a/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
+++ b/LB_VisionProcesses/Communicators/CommunicatorConfig.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing LB_SmartVisionCommon;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Serialization;
 using System.Collections.Concurrent;
 using System.Diagnostics;
@@ -43,12 +44,12 @@
 
                 if (!fullPath.Contains(".json"))
                 {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
+                    AsyncLogHelper.Info("鏂囦欢璺緞涓嶅畬鏁�");
                     return false;
                 }
                 if (string.IsNullOrEmpty(fullPath) || fullPath.Trim() == "")
                 {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
+                    AsyncLogHelper.Info("鏂囦欢璺緞涓嶅畬鏁�");
                     return false;
                 }
 
@@ -58,7 +59,7 @@
 
                 if (!File.Exists(fullPath))
                 {
-                    Debug.WriteLine("鏂囦欢涓嶅瓨鍦ㄥ垱寤虹┖鏂囦欢");
+                    AsyncLogHelper.Info("鏂囦欢涓嶅瓨鍦ㄥ垱寤虹┖鏂囦欢");
                     Save(directoryPath);
                     return true;
                 }
@@ -90,7 +91,7 @@
             {
                 if (string.IsNullOrEmpty(filePath) || filePath.Trim() == "")
                 {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
+                    AsyncLogHelper.Info("鏂囦欢璺緞涓嶅畬鏁�");
                     return false;
                 }
 
diff --git a/LB_VisionProcesses/MotionControl/BaseMotionControl.cs b/LB_VisionProcesses/MotionControl/BaseMotionControl.cs
deleted file mode 100644
index 90ea277..0000000
--- a/LB_VisionProcesses/MotionControl/BaseMotionControl.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LB_VisionProcesses.MotionControl
-{
-    public class BaseMotionControl : IMotionControl
-    {
-        /// <summary>
-        /// 杩愬姩鎺у埗鍚嶇О
-        /// </summary>
-        public string MotionControlName { get; set; } = string.Empty;
-        /// <summary>
-        /// 鏄惁杩炴帴
-        /// </summary>
-        public bool bConnected = true;
-        public bool Connect()
-        {
-            throw new NotImplementedException();
-        }
-
-        public bool Disconnect()
-        {
-            throw new NotImplementedException();
-        }
-
-        public void Dispose()
-        {
-            throw new NotImplementedException();
-        }
-
-        public string ReceiveMsg()
-        {
-            throw new NotImplementedException();
-        }
-
-        public void SendHeartbeat()
-        {
-            throw new NotImplementedException();
-        }
-
-        public bool SendMessage(string message)
-        {
-            throw new NotImplementedException();
-        }
-    }
-}
diff --git a/LB_VisionProcesses/MotionControl/IMotionControl.cs b/LB_VisionProcesses/MotionControl/IMotionControl.cs
deleted file mode 100644
index e77a3ff..0000000
--- a/LB_VisionProcesses/MotionControl/IMotionControl.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LB_VisionProcesses.MotionControl
-{
-    public interface IMotionControl : IDisposable
-    {
-        /// <summary>
-        /// 杩炴帴閫氳
-        /// </summary>
-        /// <returns></returns>
-        bool Connect();
-
-        /// <summary>
-        /// 鏂紑杩炴帴
-        /// </summary>
-        /// <returns></returns>
-        bool Disconnect();
-
-        /// <summary>
-        /// 鎺ユ敹娑堟伅
-        /// </summary>
-        /// <returns></returns>
-        string ReceiveMsg();
-
-        /// <summary>
-        /// 鍙戦�佹秷鎭�
-        /// </summary>
-        /// <param name="message"></param>
-        /// <returns></returns>
-        bool SendMessage(string message);
-
-        /// <summary>
-        /// 鍙戦�佸績璺充俊鍙�
-        /// </summary>
-        void SendHeartbeat();
-
-    }
-}
diff --git a/LB_VisionProcesses/MotionControl/MotionControlConfig.cs b/LB_VisionProcesses/MotionControl/MotionControlConfig.cs
deleted file mode 100644
index 7beb5bc..0000000
--- a/LB_VisionProcesses/MotionControl/MotionControlConfig.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-锘縰sing LB_VisionProcesses.Communicators;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace LB_VisionProcesses.MotionControl
-{
-    [Serializable]
-    [Process("杩愬姩鎺у埗妯″潡", Category = "杩愬姩鎺у埗宸ュ叿", Description = "鍒涘缓杩愬姩鎺у埗宸ュ叿")]
-    public class MotionControlConfig : IProcess
-    {
-        /// <summary>
-        /// 杩愬姩鎺у埗妯″潡闆嗗悎(Key:閫氳鍚嶏紝Value:閫氳鍙ユ焺)
-        /// </summary>
-        public ConcurrentDictionary<string, BaseMotionControl> dicMotionControls { get; set; }
-
-        /// <summary>
-        /// 閫氳闆嗗悎(Key:閫氳鍚嶏紝Value:閫氳鍙ユ焺)
-        /// </summary>
-        public ConcurrentDictionary<string, BaseCommunicator> dicCommunicators { get; set; }
-
-        public MotionControlConfig(ConcurrentDictionary<string, BaseMotionControl> dicMotionControl)
-        {
-            this.dicMotionControls = dicMotionControl;
-            strProcessClass = "LB_VisionProcesses.Communicators.MotionControlConfig";
-
-            Params.Inputs.Add("杩愬姩鎺у埗鍚嶇О", "");
-            //Params.Inputs.Add("X杞碢LC鍦板潃", "");
-            //Params.Inputs.Add("X杞存娴嬩綅缃�", "");
-            //Params.Inputs.Add("Y杞碢LC鍦板潃", "");
-            //Params.Inputs.Add("Z杞碢LC鍦板潃", "");
-            //Params.Inputs.Add("W杞碢LC鍦板潃", "");
-            Params.Outputs.Add("鏀跺埌鐨勪俊鎭�", "");
-        }
-
-        public override object Clone()
-        {
-            return MemberwiseClone();
-        }
-
-        public override void Dispose()
-        {
-            return;
-        }
-
-        public override void InitRunParams()
-        {
-            Result = true;
-            Msg = "";
-
-            if (Record != null)
-            {
-                Record.Dispose();
-            }
-        }
-        /// <summary>
-        /// 鍔犺浇绠楁硶
-        /// </summary>
-        /// <param name="fullPath">瀹屾暣璺緞甯�.json</param>
-        /// <returns></returns>
-        public override bool Load(string fullPath)
-        {
-            try
-            {
-                if (string.IsNullOrEmpty(fullPath))
-                    return false;
-
-                if (!fullPath.Contains(".json"))
-                {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
-                    return false;
-                }
-                if (string.IsNullOrEmpty(fullPath) || fullPath.Trim() == "")
-                {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
-                    return false;
-                }
-
-                // 鑾峰彇涓嶅甫鏂囦欢鍚嶇殑鐩綍璺緞
-                string directoryPath = Path.GetDirectoryName(fullPath);
-                strProcessName = Path.GetFileNameWithoutExtension(fullPath);
-
-                if (!File.Exists(fullPath))
-                {
-                    Debug.WriteLine("鏂囦欢涓嶅瓨鍦ㄥ垱寤虹┖鏂囦欢");
-                    Save(directoryPath);
-                    return true;
-                }
-
-                string strJson = string.Empty;
-                using (StreamReader streamReader = new StreamReader(fullPath, Encoding.UTF8))
-                {
-                    strJson = streamReader.ReadToEnd();
-                    streamReader.Close();
-                }
-                Params = JsonConvert.DeserializeObject<ProcessParams>(strJson);
-                if (Params == null)
-                    return false;
-
-                Params.FixDeserializedData();
-                return true;
-            }
-            catch { return false; }
-        }
-
-        public override bool Run()
-        {
-            InitRunParams();
-            Params.Outputs["鏀跺埌娑堟伅"] = "";
-            string MotionControlName = Params.Inputs["杩愬姩鎺у埗鍚嶇О"].ToString();
-            if (!dicMotionControls.ContainsKey(MotionControlName))
-            {
-                Msg = $"杩愬姩鎺у埗[{MotionControlName}]涓嶅瓨鍦�";
-                Result = false;
-                return Result;
-            }
-            BaseMotionControl BaseMotionControl = dicMotionControls[MotionControlName];
-
-            if (BaseMotionControl == null)
-            {
-                Msg = $"杩愬姩鎺у埗[{MotionControlName}]鏈疄渚嬪寲";
-                Result = false;
-                return Result;
-            }
-
-            if (!BaseMotionControl.bConnected)
-            {
-                Msg = $"杩愬姩鎺у埗[{MotionControlName}]鏈繛鎺�";
-                Result = false;
-                return Result;
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 淇濆瓨绠楁硶
-        /// </summary>
-        /// <param name="filePath">涓嶅甫.json</param>
-        /// <returns></returns>
-        public override bool Save(string filePath = null)
-        {
-            try
-            {
-                if (string.IsNullOrEmpty(filePath) || filePath.Trim() == "")
-                {
-                    Debug.WriteLine("鏂囦欢璺緞涓嶅畬鏁�");
-                    return false;
-                }
-
-                string strJson = string.Empty;
-                var settings = new JsonSerializerSettings
-                {
-                    Formatting = Newtonsoft.Json.Formatting.Indented,
-                    // 鑷畾涔夌缉杩涳紙4绌烘牸锛�
-                    ContractResolver = new DefaultContractResolver
-                    {
-                        NamingStrategy = new CamelCaseNamingStrategy()
-                    }
-                };
-                strJson = JsonConvert.SerializeObject(Params, settings);
-
-                Params = JsonConvert.DeserializeObject<ProcessParams>(strJson);
-                if (Params == null)
-                    return false;
-
-                //鍒ゆ柇鏂囦欢澶规槸鍚﹀瓨鍦紝闃插憜杈撳叆涓烘枃浠跺悕绉�
-                if (!Directory.Exists(filePath))
-                {
-                    try
-                    {
-                        Directory.CreateDirectory(filePath);
-                    }
-                    catch (Exception)
-                    { }
-                }
-                File.WriteAllText(filePath + "//" + strProcessName + ".json", strJson, Encoding.UTF8);
-                return true;
-            }
-            catch { return false; }
-        }
-    }
-}

--
Gitblit v1.9.3