From 45045dab394abe534fa5221a1e09a90c1eebf835 Mon Sep 17 00:00:00 2001
From: qiuyao <qiuyao@hnkhzn.com>
Date: 星期一, 24 三月 2025 10:29:21 +0800
Subject: [PATCH] 更新通讯源码

---
 项目代码/WIDESEAWCS_Server 正式/WIDESEAWCS_Tasks/SerialPort/SerialPortJob.cs |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Tasks/SerialPort/SerialPortJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Tasks/SerialPort/SerialPortJob.cs"
index d4f798f..6b0b67d 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Tasks/SerialPort/SerialPortJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Tasks/SerialPort/SerialPortJob.cs"
@@ -8,6 +8,7 @@
 using System.Threading.Tasks;
 using HslCommunication.WebSocket;
 using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using Quartz;
 using SqlSugar;
 using StackExchange.Profiling.Internal;
@@ -82,7 +83,9 @@
                                 #endregion
                                 item.DeviceProParamName = CommandType.Set.ToString();
 
-
+                                //鍘熶唬鐮�
+                                //serialPortDevice.Communicator.Write(item.DeviceChildCode + deviceProtocolDetail.ProtocalDetailValue.Replace("[setNum]", (4.5 * 1000).ToString().PadLeft(7, '0')) + "\r");//鎵撳紑涓插彛鏃跺厛璁惧��
+                                //item.DeviceProParamName = CommandType.Set.ToString();
                             }
                         }
 
@@ -121,10 +124,6 @@
                                     if (deviceProtocolDetail != null && receiveData.Contains(item.DeviceChildCode + deviceProtocolDetail.ProtocalDetailValue))
                                     {
                                         item.DeviceProParamName = CommandType.Get.ToString();
-
-
-
-
                                     }
                                 }
                                 else if (item.DeviceProParamName == CommandType.Get.ToString())
@@ -140,27 +139,26 @@
 
                                             item.DeviceProParamName = CommandType.Set.ToString();
                                         }
-                                        else if (item.DeviceProParamName == CommandType.Get.ToString())
-                                        {
-                                            //DeviceProtocolDetailDTO? deviceProtocolDetail = serialPortDevice.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(CommandResult) && x.ProtocolDetailType == nameof(CommandResult.GetError));
-                                            //if (deviceProtocolDetail != null && receiveData.Contains(item.DeviceChildCode + deviceProtocolDetail.ProtocalDetailValue))
-                                            //{
-                                            //    item.DeviceProParamName = CommandType.Set.ToString();
 
-
-
-                                            //}
-                                        }
+                                        //鍘熶唬鐮�
+                                        //item.DeviceProParamName = CommandType.Set.ToString();
                                     }
                                 }
+                                else if (item.DeviceProParamName == CommandType.Get.ToString())
+                                {
+                                    DeviceProtocolDetailDTO? deviceProtocolDetail = serialPortDevice.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(CommandResult) && x.ProtocolDetailType == nameof(CommandResult.GetError));
+                                    if (deviceProtocolDetail != null && receiveData.Contains(item.DeviceChildCode + deviceProtocolDetail.ProtocalDetailValue))
+                                    {
+                                        item.DeviceProParamName = CommandType.Set.ToString();
+                                    }
+                                }
+
+
+                                //寤轰竴涓璞″皢鍏朵紶缁欏墠绔�
+                                string data = JsonConvert.SerializeObject(serialPortDevice);//杩欓噷serialPortDevice鏄亣璁炬湁杩欎釜瀵硅薄
+                                _webSocketContext.PublishAllClientPayload(data);
                             }
-
-
-                            //寤轰竴涓璞″皢鍏朵紶缁欏墠绔�
-                            string data = JsonConvert.SerializeObject(serialPortDevice);//杩欓噷serialPortDevice鏄亣璁炬湁杩欎釜瀵硅薄
-                            _webSocketContext.PublishAllClientPayload(data);
                         }
-
                     }
                 }
             }

--
Gitblit v1.9.3