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 +++++++++++++++++++---------------------
项目代码/WIDESEAWCS_Server 正式/SerialPortService/ProcessServer.cs | 3 ++-
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/ProcessServer.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/ProcessServer.cs"
index f50bfb3..2962900 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/ProcessServer.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/SerialPortService/ProcessServer.cs"
@@ -478,7 +478,8 @@
var maxproce = process.Max(x => x.SetpNum);
int num = setpDTO.setnum - 1;
var nex = process.Where(x => x.CraftType == setpDTO.group && x.SetpNum == num).FirstOrDefault();
- return new WebResponseContent { Status = true, Message = $"涓婁竴姝setpDTO.setnum}", Data = new { nex, maxproce } };
+ var finish = process.Where(x => x.SetpNum < num).ToList();
+ return new WebResponseContent { Status = true, Message = $"涓婁竴姝setpDTO.setnum}", Data = new { nex, maxproce, finish } };
}
catch (Exception ex)
{
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