From 2f30d9dfe474db862e1b409065a7ba5280bed92b Mon Sep 17 00:00:00 2001 From: tangxu <76880903@qq.com> Date: 星期一, 31 十月 2022 14:18:44 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/IStation/Service.V4.1 --- TopShelf/IStation.TopShelf.DataDocking4Socket/Properties/PublishProfiles/FolderProfile.pubxml.user | 2 Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs | 5 Model/IStation.Model.Monitor/Control/MonitorTestControlParas_Enum.cs | 11 ++ Application/IStation.Application.Monitor/monitor_control/dto/NTTestChangeInput.cs | 12 ++ Socket/IStation.DataDockingSocket4NT/Log/LogHelper.cs | 6 Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs | 53 +++++++++--- Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs | 26 ++++- Socket/IStation.DataDockingSocket4NT/instruction/SendInstructionJob.cs | 2 Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs | 6 Socket/IStation.DataDockingSocket4NT/HandleHelper.cs | 24 ++++-- Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs | 46 +++++++--- Server/IStation.DataDocking.Socket/Job/PackageHandleHelper.cs | 10 ++ Entry/IStation.WebApi.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user | 2 13 files changed, 143 insertions(+), 62 deletions(-) diff --git a/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs b/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs index 92e312d..1a4473f 100644 --- a/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs +++ b/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs @@ -29,8 +29,21 @@ { throw Oops.Oh("瀵嗙爜閿欒!"); } - var context = new Model.MonitorTestControlParas.StartContext(input.HZ, input.OperatingMode, input.OperatingValue); - + double operatingValue = 0; + /* switch (input.OperatingMode) + { + case Model.MonitorTestControlParas.eOperatingMode.Timing: + { + operatingValue = input.OperatingValue * 3600; + } + break; + case Model.MonitorTestControlParas.eOperatingMode.ConstantFlow: + break; + default: + break; + }*/ + operatingValue = input.OperatingValue * 3600; + var context = new Model.MonitorTestControlParas.StartContext(input.HZ, input.OperatingMode, operatingValue); var paras = new Model.MonitorTestControlParas(); paras.ControlType = Model.MonitorTestControlParas.eControlType.Start; paras.Context = context.ToJson(); @@ -61,23 +74,22 @@ } -/* /// <summary> - /// 娴嬭瘯鍙橀 + /// 娴嬭瘯杩炴帴妯″紡 /// </summary> [Route("TestChange@V1.0")] [HttpPost] public string TestChange(NTTestChangeInput input) { var paras = new Model.MonitorTestControlParas(); - paras.ControlType = -1; - paras.Context = input.HZ.ToString(); + paras.ControlType = Model.MonitorTestControlParas.eControlType.Stop; + paras.Context = string.Empty; var runQueue = new RabbitMqExChangeHelper(); runQueue.Push("NTTEST", paras); return "OK"; } -*/ + diff --git a/Application/IStation.Application.Monitor/monitor_control/dto/NTTestChangeInput.cs b/Application/IStation.Application.Monitor/monitor_control/dto/NTTestChangeInput.cs index 7d5e968..a643a78 100644 --- a/Application/IStation.Application.Monitor/monitor_control/dto/NTTestChangeInput.cs +++ b/Application/IStation.Application.Monitor/monitor_control/dto/NTTestChangeInput.cs @@ -7,13 +7,19 @@ namespace IStation.Application { /// <summary> - /// 鍗楅�氭祴璇曞彉棰戣緭鍏� + /// 鍗楅�氭祴璇曞彉妯″紡杈撳叆 /// </summary> public class NTTestChangeInput { /// <summary> - /// 棰戠巼 + /// 鏄惁鍙 /// </summary> - public double HZ { get; set; } + public bool ReadOnly { get; set; } + + /// <summary> + /// 鏄惁杩滅▼ + /// </summary> + public bool IsRemote { get; set; } + } } diff --git a/Entry/IStation.WebApi.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user b/Entry/IStation.WebApi.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user index b6c5b11..b7821a6 100644 --- a/Entry/IStation.WebApi.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Entry/IStation.WebApi.Entry/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -5,7 +5,7 @@ <Project> <PropertyGroup> <_PublishTargetUrl>D:\WorkData\IStation\IStationV4.1\Core\Service.V4.1\Entry\IStation.WebApi.Entry\bin\Release\net6.0\publish\</_PublishTargetUrl> - <History>True|2022-10-27T06:51:12.0416021Z;True|2022-10-27T14:46:01.8195700+08:00;True|2022-10-27T14:38:00.5077582+08:00;True|2022-10-27T14:28:16.2348825+08:00;False|2022-10-27T14:27:49.2720060+08:00;False|2022-10-27T14:27:25.1445739+08:00;True|2022-10-26T11:27:54.4483138+08:00;True|2022-10-26T11:19:37.6322046+08:00;True|2022-10-26T11:10:05.4129456+08:00;True|2022-10-25T16:33:32.7872520+08:00;True|2022-10-24T16:12:49.4291001+08:00;True|2022-10-24T16:10:25.3757944+08:00;True|2022-10-24T14:04:51.7783988+08:00;True|2022-10-21T18:51:32.0221235+08:00;True|2022-10-21T18:35:12.1463858+08:00;True|2022-10-21T09:54:19.2138550+08:00;True|2022-10-21T09:38:21.1672347+08:00;True|2022-10-19T12:04:59.9103579+08:00;True|2022-10-19T11:57:45.1000513+08:00;True|2022-10-19T11:49:03.6494799+08:00;True|2022-10-19T11:06:22.4198711+08:00;True|2022-10-18T11:17:20.1435537+08:00;True|2022-10-18T09:08:58.6802639+08:00;True|2022-10-17T16:33:12.8912333+08:00;True|2022-10-17T14:23:10.0264671+08:00;True|2022-10-17T14:16:07.3590282+08:00;True|2022-10-17T11:53:21.9425089+08:00;True|2022-10-17T11:45:51.9336429+08:00;True|2022-10-14T14:37:15.6323508+08:00;True|2022-10-11T09:01:44.5831439+08:00;True|2022-10-09T14:03:43.6568874+08:00;True|2022-10-09T11:15:56.2934983+08:00;True|2022-10-09T09:39:28.1074512+08:00;True|2022-10-08T18:45:23.9581502+08:00;True|2022-10-08T18:35:18.5574217+08:00;True|2022-10-08T16:12:04.2903137+08:00;True|2022-10-08T15:59:54.5588351+08:00;True|2022-10-08T15:55:01.2711550+08:00;True|2022-10-08T15:19:08.5487617+08:00;True|2022-10-08T15:11:55.8626990+08:00;False|2022-10-08T15:02:33.5639703+08:00;True|2022-10-08T09:23:21.6592006+08:00;True|2022-10-07T15:35:37.7532304+08:00;True|2022-10-07T15:04:51.9161653+08:00;False|2022-10-07T14:58:32.8816319+08:00;False|2022-10-07T14:54:55.4175944+08:00;False|2022-10-07T14:52:46.7215376+08:00;False|2022-10-07T14:51:14.0508027+08:00;False|2022-10-07T14:49:57.6007572+08:00;False|2022-10-07T14:48:56.6085134+08:00;False|2022-10-07T14:47:54.7931315+08:00;True|2022-09-22T13:35:52.6495568+08:00;True|2022-09-22T13:19:28.3609130+08:00;True|2022-09-22T09:45:29.7312648+08:00;True|2022-09-21T17:11:30.6881814+08:00;True|2022-09-15T16:32:44.8582766+08:00;True|2022-09-04T14:21:59.9156800+08:00;True|2022-09-03T18:27:37.0001278+08:00;True|2022-08-29T10:26:27.0532192+08:00;True|2022-08-24T13:40:25.0333335+08:00;True|2022-08-23T10:20:23.3347504+08:00;True|2022-08-19T15:24:53.5488496+08:00;False|2022-08-19T15:24:15.4430294+08:00;True|2022-08-19T11:51:17.0556654+08:00;True|2022-08-19T11:45:03.9834334+08:00;True|2022-08-19T10:56:27.1184994+08:00;True|2022-08-18T16:31:26.4673400+08:00;True|2022-08-18T10:37:50.8776926+08:00;True|2022-08-17T17:10:09.3527873+08:00;True|2022-08-17T16:04:30.4487827+08:00;True|2022-08-15T13:35:48.4976973+08:00;True|2022-08-15T13:35:34.4046702+08:00;True|2022-08-15T13:31:44.3380038+08:00;True|2022-08-15T13:07:03.2183172+08:00;True|2022-07-25T15:14:36.3659352+08:00;True|2022-07-25T15:10:01.3426246+08:00;True|2022-07-25T13:20:08.1574461+08:00;True|2022-07-19T10:26:17.1257582+08:00;True|2022-07-14T10:30:13.1942620+08:00;True|2022-07-13T14:35:30.0524912+08:00;True|2022-07-08T14:32:42.4327635+08:00;True|2022-07-05T11:08:07.0982998+08:00;True|2022-07-04T10:33:11.4756479+08:00;True|2022-07-01T22:05:04.4907981+08:00;True|2022-07-01T15:57:41.6399584+08:00;True|2022-06-29T10:33:01.2518877+08:00;True|2022-06-29T09:35:04.8176716+08:00;True|2022-06-22T10:29:08.8189250+08:00;True|2022-06-21T20:20:26.7306581+08:00;True|2022-06-21T09:54:59.2174617+08:00;True|2022-06-20T16:05:34.5414017+08:00;True|2022-06-16T13:17:09.9717924+08:00;True|2022-06-16T09:40:45.1175998+08:00;True|2022-06-15T18:01:54.0267150+08:00;False|2022-06-15T18:00:46.8407587+08:00;True|2022-06-15T15:22:18.3048191+08:00;True|2022-06-15T14:10:37.0479735+08:00;False|2022-06-15T14:08:52.7287625+08:00;True|2022-06-15T11:52:36.3090013+08:00;True|2022-06-15T10:29:17.8467709+08:00;</History> + <History>True|2022-10-28T05:58:42.2473049Z;True|2022-10-28T13:42:58.7180735+08:00;True|2022-10-28T12:56:06.9517417+08:00;True|2022-10-28T09:37:04.8336241+08:00;True|2022-10-27T16:13:52.0290129+08:00;True|2022-10-27T14:51:12.0416021+08:00;True|2022-10-27T14:46:01.8195700+08:00;True|2022-10-27T14:38:00.5077582+08:00;True|2022-10-27T14:28:16.2348825+08:00;False|2022-10-27T14:27:49.2720060+08:00;False|2022-10-27T14:27:25.1445739+08:00;True|2022-10-26T11:27:54.4483138+08:00;True|2022-10-26T11:19:37.6322046+08:00;True|2022-10-26T11:10:05.4129456+08:00;True|2022-10-25T16:33:32.7872520+08:00;True|2022-10-24T16:12:49.4291001+08:00;True|2022-10-24T16:10:25.3757944+08:00;True|2022-10-24T14:04:51.7783988+08:00;True|2022-10-21T18:51:32.0221235+08:00;True|2022-10-21T18:35:12.1463858+08:00;True|2022-10-21T09:54:19.2138550+08:00;True|2022-10-21T09:38:21.1672347+08:00;True|2022-10-19T12:04:59.9103579+08:00;True|2022-10-19T11:57:45.1000513+08:00;True|2022-10-19T11:49:03.6494799+08:00;True|2022-10-19T11:06:22.4198711+08:00;True|2022-10-18T11:17:20.1435537+08:00;True|2022-10-18T09:08:58.6802639+08:00;True|2022-10-17T16:33:12.8912333+08:00;True|2022-10-17T14:23:10.0264671+08:00;True|2022-10-17T14:16:07.3590282+08:00;True|2022-10-17T11:53:21.9425089+08:00;True|2022-10-17T11:45:51.9336429+08:00;True|2022-10-14T14:37:15.6323508+08:00;True|2022-10-11T09:01:44.5831439+08:00;True|2022-10-09T14:03:43.6568874+08:00;True|2022-10-09T11:15:56.2934983+08:00;True|2022-10-09T09:39:28.1074512+08:00;True|2022-10-08T18:45:23.9581502+08:00;True|2022-10-08T18:35:18.5574217+08:00;True|2022-10-08T16:12:04.2903137+08:00;True|2022-10-08T15:59:54.5588351+08:00;True|2022-10-08T15:55:01.2711550+08:00;True|2022-10-08T15:19:08.5487617+08:00;True|2022-10-08T15:11:55.8626990+08:00;False|2022-10-08T15:02:33.5639703+08:00;True|2022-10-08T09:23:21.6592006+08:00;True|2022-10-07T15:35:37.7532304+08:00;True|2022-10-07T15:04:51.9161653+08:00;False|2022-10-07T14:58:32.8816319+08:00;False|2022-10-07T14:54:55.4175944+08:00;False|2022-10-07T14:52:46.7215376+08:00;False|2022-10-07T14:51:14.0508027+08:00;False|2022-10-07T14:49:57.6007572+08:00;False|2022-10-07T14:48:56.6085134+08:00;False|2022-10-07T14:47:54.7931315+08:00;True|2022-09-22T13:35:52.6495568+08:00;True|2022-09-22T13:19:28.3609130+08:00;True|2022-09-22T09:45:29.7312648+08:00;True|2022-09-21T17:11:30.6881814+08:00;True|2022-09-15T16:32:44.8582766+08:00;True|2022-09-04T14:21:59.9156800+08:00;True|2022-09-03T18:27:37.0001278+08:00;True|2022-08-29T10:26:27.0532192+08:00;True|2022-08-24T13:40:25.0333335+08:00;True|2022-08-23T10:20:23.3347504+08:00;True|2022-08-19T15:24:53.5488496+08:00;False|2022-08-19T15:24:15.4430294+08:00;True|2022-08-19T11:51:17.0556654+08:00;True|2022-08-19T11:45:03.9834334+08:00;True|2022-08-19T10:56:27.1184994+08:00;True|2022-08-18T16:31:26.4673400+08:00;True|2022-08-18T10:37:50.8776926+08:00;True|2022-08-17T17:10:09.3527873+08:00;True|2022-08-17T16:04:30.4487827+08:00;True|2022-08-15T13:35:48.4976973+08:00;True|2022-08-15T13:35:34.4046702+08:00;True|2022-08-15T13:31:44.3380038+08:00;True|2022-08-15T13:07:03.2183172+08:00;True|2022-07-25T15:14:36.3659352+08:00;True|2022-07-25T15:10:01.3426246+08:00;True|2022-07-25T13:20:08.1574461+08:00;True|2022-07-19T10:26:17.1257582+08:00;True|2022-07-14T10:30:13.1942620+08:00;True|2022-07-13T14:35:30.0524912+08:00;True|2022-07-08T14:32:42.4327635+08:00;True|2022-07-05T11:08:07.0982998+08:00;True|2022-07-04T10:33:11.4756479+08:00;True|2022-07-01T22:05:04.4907981+08:00;True|2022-07-01T15:57:41.6399584+08:00;True|2022-06-29T10:33:01.2518877+08:00;True|2022-06-29T09:35:04.8176716+08:00;True|2022-06-22T10:29:08.8189250+08:00;True|2022-06-21T20:20:26.7306581+08:00;True|2022-06-21T09:54:59.2174617+08:00;True|2022-06-20T16:05:34.5414017+08:00;True|2022-06-16T13:17:09.9717924+08:00;True|2022-06-16T09:40:45.1175998+08:00;True|2022-06-15T18:01:54.0267150+08:00;False|2022-06-15T18:00:46.8407587+08:00;</History> <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/Model/IStation.Model.Monitor/Control/MonitorTestControlParas_Enum.cs b/Model/IStation.Model.Monitor/Control/MonitorTestControlParas_Enum.cs index 2105521..e701757 100644 --- a/Model/IStation.Model.Monitor/Control/MonitorTestControlParas_Enum.cs +++ b/Model/IStation.Model.Monitor/Control/MonitorTestControlParas_Enum.cs @@ -26,6 +26,8 @@ /// 鍚姩 /// </summary> Start = 1, + + } /// <summary> @@ -36,12 +38,17 @@ /// <summary> /// 瀹氭椂 /// </summary> - Timing = 1, + Timing = 0, /// <summary> /// 瀹氭祦閲� /// </summary> - ConstantFlow = 2, + ConstantFlow = 1, + + /// <summary> + /// 瀹氬姛鐜� + /// </summary> + ConstantPa = 2, } } diff --git a/Server/IStation.DataDocking.Socket/Job/PackageHandleHelper.cs b/Server/IStation.DataDocking.Socket/Job/PackageHandleHelper.cs index d598db4..844ad97 100644 --- a/Server/IStation.DataDocking.Socket/Job/PackageHandleHelper.cs +++ b/Server/IStation.DataDocking.Socket/Job/PackageHandleHelper.cs @@ -35,6 +35,16 @@ : ConfigureList.Find(x => x.ConfigureParas.RegisterCode == mySession.RegisterCode); if (configure == null) { + configure = string.IsNullOrEmpty(mySession.Heartbeat) ? ConfigureList.Find(x => x.ConfigureParas.Heartbeat == message_str) + : ConfigureList.Find(x => x.ConfigureParas.Heartbeat == mySession.Heartbeat); + if (configure != null) + { + mySession.Close($"鍏抽棴:[{configure.Name}]杩炴帴,鏈娴嬪埌娉ㄥ唽鐮�!"); + return; + } + } + if (configure == null) + { LogHelper.Info($"Socket鏁版嵁瀵规帴浠诲姟涓�,绔彛锛歿mySession.Server.Options.Listeners.First().Port},鏀跺埌涓�鏉℃棤娉曡瘑鍒殑娑堟伅锛歿message_str}"); return; } diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs b/Socket/IStation.DataDockingSocket4NT/HandleHelper.cs similarity index 82% rename from Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs rename to Socket/IStation.DataDockingSocket4NT/HandleHelper.cs index 1ba5022..6918589 100644 --- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/HandleHelper.cs @@ -7,7 +7,7 @@ using IStation.Model; using IStation.Untity; -namespace IStation.DataDockingSocket.MsgHandle +namespace IStation.DataDockingSocket { public class HandleHelper : IDataDockingSocket.IHandleHelper { @@ -79,19 +79,18 @@ { return; } + NtLogHelper.Info("寮�濮嬪鐞嗘暟鎹�..."); _session = session; if (MonitorMsgHelper.IsNeedHandle(byteMessage)) - {//鐩戞帶鎸囦护 + { + NtLogHelper.Info("MonitorMsgHelper..."); + //鐩戞帶鎸囦护 var receList = MonitorMsgHelper.HandleReceive(byteMessage); if (receList == null || receList.Count == 0) return; - NtLogHelper.Src(byteMessage); - - // NtLogHelper.Debug(src_list); - //NtLogHelper.Info($"瑙f瀽鏁版嵁鏁伴噺:{receList.Count}\n\r" + - // $"{JsonHelper.Object2Json(receList)}"); - + NtLogHelper.Info("MonitorMsgHelper Over"); + NtLogHelper.Src(byteMessage); onReceive(receList); @@ -100,15 +99,24 @@ //涓嶈鍔爀lse if (ShutDownMsgHelper.IsNeedHandle(byteMessage)) { + NtLogHelper.Info("ShutDownMsgHelper..."); if (ShutDownMsgHelper.HandleReceive(session, byteMessage)) + { + NtLogHelper.Info("ShutDownMsgHelper Over"); return; + } } //涓嶈鍔爀lse if (StartUpMsgHelper.IsNeedHandle(byteMessage)) { + NtLogHelper.Info("StartUpMsgHelper... "); if (StartUpMsgHelper.HandleReceive(session, byteMessage)) + { + NtLogHelper.Info("StartUpMsgHelper Over"); return; + } } + NtLogHelper.Info("鏁版嵁澶勭悊缁撴潫..."); } diff --git a/Socket/IStation.DataDockingSocket4NT/Log/LogHelper.cs b/Socket/IStation.DataDockingSocket4NT/Log/LogHelper.cs index 32f1e86..abeb71a 100644 --- a/Socket/IStation.DataDockingSocket4NT/Log/LogHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/Log/LogHelper.cs @@ -12,7 +12,7 @@ /// </summary> internal class NtLogHelper { - private const string _logNameDebug = "socket-nt"; + private const string _logNameDebug = "socket-nt-debug"; /// <summary> /// 鐢熸垚璋冭瘯淇℃伅杈呭姪绫� @@ -24,9 +24,9 @@ var json = JsonHelper.Object2Json(rece_list); LogHelper.Custom(_logNameDebug, json); } + public static void Debug(string msg) - { - + { LogHelper.Custom(_logNameDebug, msg); } diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs index 7388d42..a3c3a6b 100644 --- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs @@ -66,7 +66,7 @@ return new byte[] { 0x01, 0x03, 0x00, 0x12, 0x00, 0x04, 0xE4, 0x0C }; } - + @@ -136,7 +136,7 @@ SysId = 1575030435430404096, RecordType = Model.eMonitorType.General, SrcTime = now, - SrcValue = (ByteMsgHelper.GetInt2Byte(byteMessage, 3 + (29 - start) * 2, out msg) * 0.001).ToString() + SrcValue = ((ByteMsgHelper.GetInt2Byte(byteMessage, 3 + (29 - start) * 2, out msg) * 0.001) * -1).ToString() }); //A鐩哥數鍘� @@ -297,7 +297,7 @@ SysId = 1584475756476633088, RecordType = Model.eMonitorType.General, SrcTime = now, - SrcValue = Math.Round(ByteMsgHelper.GetDouble1(byteMessage, 3 + (56 - start) * 2, out msg), 2).ToString() + SrcValue = Math.Round((ByteMsgHelper.GetDouble1(byteMessage, 3 + (56 - start) * 2, out msg) * 0.001), 2).ToString() }); } catch (Exception err) diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs index 4fb0a0f..7f07099 100644 --- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs @@ -1,5 +1,4 @@ -锘縰sing IStation.DataDockingSocket.MsgHandle; -using IStation.Untity; +锘縰sing IStation.Untity; using System; using System.Collections.Generic; using System.Linq; @@ -19,7 +18,7 @@ /// <returns></returns> public static bool StartJob(Model.IMonitorDataDockingSession session) { - if (session != null) + if (session == null) { NtLogHelper.Error($"鍏虫満 session:Close"); return false; @@ -50,23 +49,40 @@ static System.Timers.Timer _timeAutoClose; public static void StartAutoClose(double second) { - NtLogHelper.Info("寮�鍚嚜鍔ㄥ叧鏈烘ā寮� 鏃堕棿:" + second+"s"); - _timeAutoClose = new System.Timers.Timer(10000 * second);//瀹炰緥鍖朤imer绫伙紝璁剧疆闂撮殧鏃堕棿涓�10000姣锛� - _timeAutoClose.Elapsed += new System.Timers.ElapsedEventHandler(ExecuteAutoClose);//鍒拌揪鏃堕棿鐨勬椂鍊欐墽琛屼簨浠讹紱 - _timeAutoClose.AutoReset = false;//璁剧疆鏄墽琛屼竴娆★紙false锛夎繕鏄竴鐩存墽琛�(true)锛� - _timeAutoClose.Enabled = true;//鏄惁鎵цSystem.Timers.Timer.Elapsed浜嬩欢锛� - _timeAutoClose.Start(); //鍚姩瀹氭椂鍣� + try + { + NtLogHelper.Info("寮�鍚嚜鍔ㄥ叧鏈烘ā寮� 鏃堕棿:" + second + "s"); + _timeAutoClose = new System.Timers.Timer(1000 * second);//瀹炰緥鍖朤imer绫伙紝璁剧疆闂撮殧鏃堕棿涓�10000姣锛� + _timeAutoClose.Elapsed += new System.Timers.ElapsedEventHandler(ExecuteAutoClose);//鍒拌揪鏃堕棿鐨勬椂鍊欐墽琛屼簨浠讹紱 + _timeAutoClose.AutoReset = false;//璁剧疆鏄墽琛屼竴娆★紙false锛夎繕鏄竴鐩存墽琛�(true)锛� + _timeAutoClose.Enabled = true;//鏄惁鎵цSystem.Timers.Timer.Elapsed浜嬩欢锛� + _timeAutoClose.Start(); //鍚姩瀹氭椂鍣� + NtLogHelper.Info("_timeAutoClose.Start()"); + } + catch (Exception ex) + { + NtLogHelper.Error("_timeAutoClose:" + ex.Message); + } } + private static void ExecuteAutoClose(object source, System.Timers.ElapsedEventArgs e) { if (_timeAutoClose == null) return; - - _timeAutoClose.Stop(); //鍏堝叧闂畾鏃跺櫒 - _timeAutoClose = null; - //瑕佹墽琛岀殑涓氬姟浠g爜 - NtLogHelper.Info("姝e湪鑷姩鍏虫満...." ); - ShutDownMsgHelper.StartJob(HandleHelper.GetLastSession()); + try + { + NtLogHelper.Info("ExecuteAutoClose"); + _timeAutoClose.Stop(); //鍏堝叧闂畾鏃跺櫒 + NtLogHelper.Info(" _timeAutoClose.Stop()"); + _timeAutoClose = null; + //瑕佹墽琛岀殑涓氬姟浠g爜 + NtLogHelper.Info("姝e湪鑷姩鍏虫満...."); + StartJob(HandleHelper.GetLastSession()); + } + catch (Exception ex) + { + NtLogHelper.Error(ex.Message); + } // t.Start(); //鎵ц瀹屾瘯鍚庡啀寮�鍚櫒 } diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs index fd927e0..d20494b 100644 --- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs @@ -1,5 +1,4 @@ -锘縰sing IStation.DataDockingSocket.MsgHandle; -using IStation.Model; +锘縰sing IStation.Model; using IStation.Untity; using System; using System.Collections.Generic; @@ -24,7 +23,7 @@ /// <returns></returns> public static bool StartJob(Model.IMonitorDataDockingSession session, MonitorTestControlParas.StartContext paras) { - if (session != null) + if (session == null) { NtLogHelper.Error($"寮�鏈� session:Close"); return false; @@ -82,7 +81,7 @@ return false; } /// <summary> - /// 鍏虫満鎸囦护 + /// 寮�鏈烘寚浠� /// </summary> static string ControlMsgOpen = "01-06-00-0F-00-01-78-09"; /// <summary> @@ -92,30 +91,56 @@ public static bool HandleReceive(Model.IMonitorDataDockingSession session, byte[] byteMessage) { if (InstructionStatus == eStartUpInstructionStatus.鏈彂閫�) + { + NtLogHelper.Info("InstructionStatus==eStartUpInstructionStatus.鏈彂閫�"); return false; + } if (InstructionStatus == eStartUpInstructionStatus.寮�鏈烘寚浠ゅ彂閫�) { - if (byteMessage.Length >= ControlMsgOpen.Length) + NtLogHelper.Info("InstructionStatus==eStartUpInstructionStatus.寮�鏈烘寚浠ゅ彂閫�"); + var byteMsgOpen = Encoding.Unicode.GetBytes(ControlMsgOpen); + //if (byteMessage.Length >= byteMsgOpen.Length) + //{ + string strMessage = BitConverter.ToString(byteMessage, 0, byteMessage.Length); + if (strMessage == ControlMsgOpen) { - string strMessage = BitConverter.ToString(byteMessage, 0, byteMessage.Length); - if (strMessage == ControlMsgOpen) - {//01-06-00-0F-00-01-78-09 - InstructionStatus = eStartUpInstructionStatus.鏈彂閫�; + NtLogHelper.Info($"strMessage ({strMessage})== ControlMsgOpen ({ControlMsgOpen})"); + //01-06-00-0F-00-01-78-09 + InstructionStatus = eStartUpInstructionStatus.鏈彂閫�; - NtLogHelper.Debug("寮�鏈烘寚浠よ繑鍥�:" + BitTransfer.ToString(byteMessage)); + NtLogHelper.Info("寮�鏈烘寚浠よ繑鍥�:" + BitTransfer.ToString(byteMessage)); + if (_lastParas.OperatingValue > 0) + { //寮�鍚嚜鍔ㄥ叧闂� ShutDownMsgHelper.StartAutoClose(_lastParas.OperatingValue); - return true; } + else + { + NtLogHelper.Info("鏃堕棿灏忎簬绛変簬0,涓嶅紑鍚嚜鍔ㄥ叧闂�"); + } + return true; } + else + { + NtLogHelper.Info($"strMessage ({strMessage})!= ControlMsgOpen ({ControlMsgOpen})"); + } + //} + //else + //{ + // NtLogHelper.Info($"byteMessage.Length ({byteMessage.Length}) <= ControlMsgOpen.Length ({ControlMsgOpen.Length})"); + //} + //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓� if ((DateTime.Now - _lastOpenSendTime).TotalSeconds > 5) { + NtLogHelper.Info($"杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�"); SendOpenMsg(session); } } + if (InstructionStatus == eStartUpInstructionStatus.璋冮鎸囦护鍙戦��) { + NtLogHelper.Info($"InstructionStatus == eStartUpInstructionStatus.璋冮鎸囦护鍙戦��"); //闇�瑕佸垽鏂槸鍚︽槸璋冮鎸囦护:浠ュ悗鍐嶈ˉ鍏� { SendOpenMsg(session); @@ -125,6 +150,7 @@ //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓� if ((DateTime.Now - _lastHzSendTime).TotalSeconds > 5) { + NtLogHelper.Info($"杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�"); StartJob(session, _lastParas); } } @@ -132,10 +158,9 @@ return false; } - private static void SendOpenMsg(Model.IMonitorDataDockingSession session) + private static void SendOpenMsg(Model.IMonitorDataDockingSession session) { byte[] bts = GetControlMsg寮�鏈�(); - session.Send(bts, 0, bts.Length); InstructionStatus = eStartUpInstructionStatus.寮�鏈烘寚浠ゅ彂閫�; @@ -166,9 +191,7 @@ public static byte[] GetControlMsg璋冮(double frequece) { var iFrequece = (int)(frequece * 10); - byte[] commandSend = null; - ModBusRtuHelper.BuildSendMessage06(0x01, 20, 2, iFrequece, ref commandSend); diff --git a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs index 4eede9d..09fc411 100644 --- a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs +++ b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs @@ -1,5 +1,4 @@ -锘縰sing IStation.DataDockingSocket.MsgHandle; -using IStation.Untity; +锘縰sing IStation.Untity; using System; using System.Collections.Generic; using System.Linq; @@ -66,7 +65,7 @@ var context = Model.MonitorTestControlParas.StartContext.ToModel(paras.Context); if (context == null) return default; - + NtLogHelper.Debug(context.ToJson()); StartUpMsgHelper.StartJob(session, context); } break; diff --git a/Socket/IStation.DataDockingSocket4NT/instruction/SendInstructionJob.cs b/Socket/IStation.DataDockingSocket4NT/instruction/SendInstructionJob.cs index 438e026..2aa0b9b 100644 --- a/Socket/IStation.DataDockingSocket4NT/instruction/SendInstructionJob.cs +++ b/Socket/IStation.DataDockingSocket4NT/instruction/SendInstructionJob.cs @@ -33,7 +33,7 @@ if (session.IsConnected) { SessionHelper.Cache.Send(bytes, 0, bytes.Length); - NtLogHelper.Info(session.SessionName + ":" + BitConverter.ToString(bytes) + ", 鍙戦�佷竴鏉¤姹傛暟鎹寚浠�"); + NtLogHelper.Info(session.SessionName + ":" + BitConverter.ToString(bytes) + ", 鍙戦�佷竴鏉¤姹傛暟鎹寚浠�"); } }); diff --git a/TopShelf/IStation.TopShelf.DataDocking4Socket/Properties/PublishProfiles/FolderProfile.pubxml.user b/TopShelf/IStation.TopShelf.DataDocking4Socket/Properties/PublishProfiles/FolderProfile.pubxml.user index 9535df7..a16801e 100644 --- a/TopShelf/IStation.TopShelf.DataDocking4Socket/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/TopShelf/IStation.TopShelf.DataDocking4Socket/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ --> <Project> <PropertyGroup> - <History>True|2022-10-27T07:32:23.6326778Z;True|2022-10-27T15:31:21.2898598+08:00;True|2022-10-27T15:31:06.9752171+08:00;True|2022-10-27T15:30:12.3351290+08:00;True|2022-10-27T15:16:06.6376480+08:00;True|2022-10-27T15:04:16.6181644+08:00;True|2022-10-27T14:56:07.3371453+08:00;True|2022-10-27T14:55:40.9994920+08:00;True|2022-10-26T14:21:13.7358061+08:00;True|2022-10-26T13:58:17.8518712+08:00;True|2022-10-26T10:50:57.8305616+08:00;True|2022-10-26T10:41:24.0512951+08:00;True|2022-10-26T10:36:18.9669938+08:00;True|2022-10-26T10:23:42.5700603+08:00;True|2022-10-26T09:49:18.1242267+08:00;True|2022-10-24T17:44:25.5039390+08:00;True|2022-07-02T00:06:16.6338790+08:00;True|2022-07-02T00:02:49.1000053+08:00;True|2022-07-01T23:23:53.1924783+08:00;True|2022-07-01T14:02:38.1190102+08:00;True|2022-07-01T13:55:33.4591108+08:00;</History> + <History>True|2022-10-28T10:12:41.9095520Z;True|2022-10-28T15:43:16.2950292+08:00;True|2022-10-28T15:41:52.2233941+08:00;True|2022-10-28T15:30:14.2215199+08:00;True|2022-10-28T11:51:16.0785196+08:00;True|2022-10-28T11:44:51.8315664+08:00;True|2022-10-28T10:33:52.2698494+08:00;True|2022-10-28T09:35:47.1875028+08:00;True|2022-10-28T09:10:26.0008427+08:00;True|2022-10-27T18:39:24.9534804+08:00;True|2022-10-27T18:33:34.4681116+08:00;True|2022-10-27T18:13:21.7875951+08:00;True|2022-10-27T18:12:44.3890244+08:00;True|2022-10-27T18:07:26.1755739+08:00;True|2022-10-27T17:57:58.0347320+08:00;True|2022-10-27T17:34:58.8259465+08:00;True|2022-10-27T17:22:06.3154634+08:00;False|2022-10-27T17:20:19.9004059+08:00;True|2022-10-27T17:18:10.4716763+08:00;True|2022-10-27T17:05:00.4099257+08:00;True|2022-10-27T16:54:07.3727699+08:00;True|2022-10-27T16:42:08.7868428+08:00;True|2022-10-27T16:20:40.9187590+08:00;True|2022-10-27T16:15:48.8887876+08:00;True|2022-10-27T15:32:23.6326778+08:00;True|2022-10-27T15:31:21.2898598+08:00;True|2022-10-27T15:31:06.9752171+08:00;True|2022-10-27T15:30:12.3351290+08:00;True|2022-10-27T15:16:06.6376480+08:00;True|2022-10-27T15:04:16.6181644+08:00;True|2022-10-27T14:56:07.3371453+08:00;True|2022-10-27T14:55:40.9994920+08:00;True|2022-10-26T14:21:13.7358061+08:00;True|2022-10-26T13:58:17.8518712+08:00;True|2022-10-26T10:50:57.8305616+08:00;True|2022-10-26T10:41:24.0512951+08:00;True|2022-10-26T10:36:18.9669938+08:00;True|2022-10-26T10:23:42.5700603+08:00;True|2022-10-26T09:49:18.1242267+08:00;True|2022-10-24T17:44:25.5039390+08:00;True|2022-07-02T00:06:16.6338790+08:00;True|2022-07-02T00:02:49.1000053+08:00;True|2022-07-01T23:23:53.1924783+08:00;True|2022-07-01T14:02:38.1190102+08:00;True|2022-07-01T13:55:33.4591108+08:00;</History> <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file -- Gitblit v1.9.3