From 2b6eeda2c91f0e570b58b2799758475b46c1ad61 Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 27 十月 2022 14:22:03 +0800 Subject: [PATCH] 修改南通接口 --- Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs | 67 +++++++++------------------------ 1 files changed, 18 insertions(+), 49 deletions(-) diff --git a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs index 931ab34..b68768a 100644 --- a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs @@ -1,4 +1,5 @@ -锘縰sing IStation.Untity; +锘縰sing IStation.DataDockingSocket.MsgHandle; +using IStation.Untity; using System; using System.Collections.Generic; using System.Linq; @@ -12,6 +13,9 @@ /// </summary> public class SendControlJobHelper { + /// <summary> + /// 浠嶮Q閲岄潰鑾峰彇鎺у埗鎸囦护 杈呭姪绫� + /// </summary> private static RabbitMqExChangeHelper _queueHelper = null; /// <summary> @@ -48,58 +52,21 @@ NtLogHelper.Info("鍗楅�氭帶鍒跺懡浠わ紝鏁版嵁搴忓垪鍖栧け璐�"); return true; } - byte[] bts = null; - switch (paras.ControlType) - { + + switch (paras.Type) + {//0浠h〃鍏虫満 1浠h〃寮�鏈� case 0: - bts = MsgDataHelper.GetControlMsg鍏虫満(); - NtLogHelper.Info("鍏虫満"); - break;//浠庤緟鍔╃被涓幏鍙� 鍏抽棴 - case 1: - bts = MsgDataHelper.GetControlMsg寮�鏈�(); - NtLogHelper.Info("寮�鏈�"); + ShunDownMsgHelper.StartJob(session); + break;//浠庤緟鍔╃被涓幏鍙� 鍏抽棴 + case 1: + if (string.IsNullOrEmpty(paras.Paras)) + return false; + StartUpMsgHelper.StartJob(session); break;//浠庤緟鍔╃被涓幏鍙� 寮�鍚� - case -1: - { - if (string.IsNullOrEmpty(paras.Context)) - { - NtLogHelper.Error($"[璋冮]鍙傛暟: null"); - return false; - } - if (!double.TryParse(paras.Context, out double value)) - { - NtLogHelper.Error($"[璋冮]鍙傛暟寮傚父:{paras.Context}"); - return false; - } - - bts = MsgDataHelper.GetControlMsg璋冮(value); - NtLogHelper.Info($"[璋冮]鍙傛暟:{paras.Context}"); - } - break;//浠庤緟鍔╃被涓幏鍙� 鍙橀 default: return false; } - if (bts != null) - { - if (session != null) - { - if (session.IsConnected) - { - session.Send(bts, 0, bts.Length); - NtLogHelper.Info(session.SessionName + ":" + BitTransfer.ToString(bts) + ", 鍙戦�佷竴鏉¤姹傛帶鍒舵寚浠�"); - } - else - { - NtLogHelper.Error($"session:Not connected"); - return false; - } - } - else - { - NtLogHelper.Error($"session:Close"); - return false; - } - } + return true; } catch (Exception ex) @@ -109,8 +76,10 @@ } }); }); - } + + + } } -- Gitblit v1.9.3