From b4db153d2e28d451592811fea29c6d1bab71887b Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 30 四月 2024 13:52:53 +0800 Subject: [PATCH] 优化运行分析,运行记录结构更改,运行服务新增监测中断判断 --- Yw.Service.Run.Core/Yw.Service.Run.Core.csproj | 2 Yw.Service.Run.Core/03-settings/01-paras/00-core/Paras_Run.cs | 10 Yw.Dto.Run.Core/Yw.Dto.Run.Core.csproj | 4 Yw.Service.Run.Core/03-settings/01-paras/06-run/Paras_Run_Run.cs | 0 Yw.Application.Run.Core/Yw.Application.Run.Core.csproj | 4 Yw.Service.Run.Core/02-model/RunAnalyConfigure.cs | 2 Yw.Server.Run/02-emws/02-single/EMWSRunAnalySingleJob.cs | 136 ++++++---- Yw.Dto.Run.Core/01-configure/AddRunAnalyConfigureInput.cs | 2 Yw.Service.Run.Core/03-settings/00-core/RunParasHelper.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/07-task/Paras_Run_Task.cs | 0 Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs | 36 ++ Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_SQLite.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue.cs | 0 Yw.Service.Run.Core/00-core/SysParas.cs | 14 + Yw.Service.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user | 2 Yw.Service.Run.Core/00-core/DataType.cs | 5 Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalySingleJob.cs | 132 ++++++---- Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_Factory.cs | 0 Yw.Service.Run.Core/04-dal/03-sqlite/RunRealRecord.cs | 58 ++-- Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_HttpClient.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange_Factory.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL.cs | 0 Yw.Service.Run.Core/07-service/00-core/03-extensions/Extensions.cs | 0 Yw.Dto.Run.Core/02-record/RunRealRecordStdDto.cs | 12 Yw.Service.Run.Core/00-core/Flags.cs | 13 + Yw.Service.Run.Core/06-exchange/00-core/RunExchangeNameHelper.cs | 0 Yw.Server.Run/Yw.Server.Run.csproj | 5 Yw.Dto.Run.Core/01-configure/RunAnalyConfigureStdDto.cs | 2 Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_LocalClient.cs | 0 Yw.Application.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user | 2 Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_PostgreSql.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache_Factory.cs | 0 Yw.Dto.Run.Core/01-configure/UpdateRunAnalyConfigureInput.cs | 2 Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange.cs | 0 Yw.Service.Run.Core/00-core/RunStatus.cs | 2 Yw.Service.Run.Core/01-entity/RunRealRecord.cs | 14 Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalyChangeTimesHelper.cs | 36 ++ Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache.cs | 0 Yw.Dto.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user | 2 Yw.Service.Run.Core/02-model/RunRealRecord.cs | 17 + Yw.Service.Run.Core/07-service/00-core/01-create/QueueCreateHelper.cs | 0 Yw.Service.Run.Core/00-core/AnalyStatus.cs | 5 Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs | 2 Yw.Application.Run.Core/00-core/Mapper.cs | 1 Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue_Factory.cs | 0 Yw.Service.Run.Core/03-settings/01-paras/00-core/RunParas.cs | 0 Yw.Service.Run.Core/05-lcache/00-core/CacheKeyHelper.cs | 0 Yw.Service.Run.Core/07-service/00-core/02-cache/CacheHelper.cs | 0 Yw.Dto.Run.Core/01-configure/SetRunAnalyConfigureInput.cs | 2 Yw.Dto.Run.Core/02-record/AddRunRealLastRecordInput.cs | 12 Yw.Service.Run.Core/07-service/00-core/01-create/LCacheCreateHelper.cs | 0 Yw.Server.Run/01-equipment/01-service/EquipmentRunAnalyServiceJob.cs | 34 +- Yw.Server.Run/02-emws/01-service/EMWSRunAnalyServiceJob.cs | 37 +- Yw.Service.Run.Core/07-service/00-core/01-create/ExchangeCreateHelper.cs | 0 Yw.Service.Run.Core/03-settings/00-core/RunFileHelper.cs | 2 Yw.Service.Run.Core/04-dal/02-postgresql/RunRealRecord.cs | 58 ++-- Yw.Service.Run.Core/07-service/00-core/01-create/DALCreateHelper.cs | 0 58 files changed, 412 insertions(+), 255 deletions(-) diff --git a/Yw.Application.Run.Core/00-core/Mapper.cs b/Yw.Application.Run.Core/00-core/Mapper.cs index f537355..5aafb3a 100644 --- a/Yw.Application.Run.Core/00-core/Mapper.cs +++ b/Yw.Application.Run.Core/00-core/Mapper.cs @@ -26,6 +26,7 @@ config.ForType<AddRunRealLastRecordInput, Model.RunRealRecord>() .Map(dest => dest.DataTime, src => DateTime.Now) .Map(dest => dest.AnalyStatus, src => AnalyStatus.Normal); + #endregion } diff --git a/Yw.Application.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user b/Yw.Application.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user index 4548a14..ab8183c 100644 --- a/Yw.Application.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Yw.Application.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ --> <Project> <PropertyGroup> - <History>True|2024-04-26T03:52:38.6381832Z;True|2024-04-01T11:40:26.8126073+08:00;True|2024-03-26T09:54:08.7672773+08:00;True|2024-02-01T15:13:33.2518157+08:00;True|2024-01-27T11:05:20.5193198+08:00;True|2024-01-21T14:54:51.3939785+08:00;True|2024-01-08T17:00:51.0941947+08:00;True|2023-12-16T15:43:21.8065953+08:00;True|2023-12-11T11:56:46.3121435+08:00;True|2023-12-11T11:27:23.3317604+08:00;True|2023-12-11T11:27:14.6709240+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> + <History>True|2024-04-30T05:48:09.3970916Z;True|2024-04-26T11:52:38.6381832+08:00;True|2024-04-01T11:40:26.8126073+08:00;True|2024-03-26T09:54:08.7672773+08:00;True|2024-02-01T15:13:33.2518157+08:00;True|2024-01-27T11:05:20.5193198+08:00;True|2024-01-21T14:54:51.3939785+08:00;True|2024-01-08T17:00:51.0941947+08:00;True|2023-12-16T15:43:21.8065953+08:00;True|2023-12-11T11:56:46.3121435+08:00;True|2023-12-11T11:27:23.3317604+08:00;True|2023-12-11T11:27:14.6709240+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/Yw.Application.Run.Core/Yw.Application.Run.Core.csproj b/Yw.Application.Run.Core/Yw.Application.Run.Core.csproj index a6fe75a..83b707e 100644 --- a/Yw.Application.Run.Core/Yw.Application.Run.Core.csproj +++ b/Yw.Application.Run.Core/Yw.Application.Run.Core.csproj @@ -7,7 +7,7 @@ <RootNamespace>Yw.Application</RootNamespace> <GenerateDocumentationFile>True</GenerateDocumentationFile> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> - <Version>3.0.2</Version> + <Version>3.0.6</Version> </PropertyGroup> <ItemGroup> @@ -27,7 +27,7 @@ <ItemGroup> <PackageReference Include="Yw.Application.Core" Version="3.0.5" /> - <PackageReference Include="Yw.Dto.Run.Core" Version="3.0.2" /> + <PackageReference Include="Yw.Dto.Run.Core" Version="3.0.6" /> </ItemGroup> </Project> diff --git a/Yw.Dto.Run.Core/01-configure/AddRunAnalyConfigureInput.cs b/Yw.Dto.Run.Core/01-configure/AddRunAnalyConfigureInput.cs index af9ff95..7180ff2 100644 --- a/Yw.Dto.Run.Core/01-configure/AddRunAnalyConfigureInput.cs +++ b/Yw.Dto.Run.Core/01-configure/AddRunAnalyConfigureInput.cs @@ -18,7 +18,7 @@ public long ObjectID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼(绉�) /// </summary> [Required] public int Frequency { get; set; } diff --git a/Yw.Dto.Run.Core/01-configure/RunAnalyConfigureStdDto.cs b/Yw.Dto.Run.Core/01-configure/RunAnalyConfigureStdDto.cs index e8f4657..693eb18 100644 --- a/Yw.Dto.Run.Core/01-configure/RunAnalyConfigureStdDto.cs +++ b/Yw.Dto.Run.Core/01-configure/RunAnalyConfigureStdDto.cs @@ -39,7 +39,7 @@ public long ObjectID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼(绉�) /// </summary> public int Frequency { get; set; } diff --git a/Yw.Dto.Run.Core/01-configure/SetRunAnalyConfigureInput.cs b/Yw.Dto.Run.Core/01-configure/SetRunAnalyConfigureInput.cs index 1b25082..c0cd927 100644 --- a/Yw.Dto.Run.Core/01-configure/SetRunAnalyConfigureInput.cs +++ b/Yw.Dto.Run.Core/01-configure/SetRunAnalyConfigureInput.cs @@ -24,7 +24,7 @@ public long ObjectID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼(绉�) /// </summary> [Required] public int Frequency { get; set; } diff --git a/Yw.Dto.Run.Core/01-configure/UpdateRunAnalyConfigureInput.cs b/Yw.Dto.Run.Core/01-configure/UpdateRunAnalyConfigureInput.cs index 4ade31d..8de005a 100644 --- a/Yw.Dto.Run.Core/01-configure/UpdateRunAnalyConfigureInput.cs +++ b/Yw.Dto.Run.Core/01-configure/UpdateRunAnalyConfigureInput.cs @@ -13,7 +13,7 @@ public long ID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼(绉�) /// </summary> [Required] public int Frequency { get; set; } diff --git a/Yw.Dto.Run.Core/02-record/AddRunRealLastRecordInput.cs b/Yw.Dto.Run.Core/02-record/AddRunRealLastRecordInput.cs index 9aa4d42..614b963 100644 --- a/Yw.Dto.Run.Core/02-record/AddRunRealLastRecordInput.cs +++ b/Yw.Dto.Run.Core/02-record/AddRunRealLastRecordInput.cs @@ -24,10 +24,16 @@ public int RSa { get; set; } /// <summary> - /// 杩炵画杩愯鏃堕棿 + /// 杩炵画鏃堕棿 /// </summary> - [Required, Range(0, int.MaxValue, ErrorMessage = "ContinueRunTime 涓嶈兘涓鸿礋鏁�")] - public int ContinueRunTime { get; set; } + [Required, Range(0, int.MaxValue, ErrorMessage = "ContinueTime 涓嶈兘涓鸿礋鏁�")] + public int ContinueTime { get; set; } + + /// <summary> + /// 鎬诲仠鏈烘椂闂� + /// </summary> + [Required, Range(0, int.MaxValue, ErrorMessage = "TotalShutTime 涓嶈兘涓鸿礋鏁�")] + public int TotalShutTime { get; set; } /// <summary> /// 鎬昏繍琛屾椂闂� diff --git a/Yw.Dto.Run.Core/02-record/RunRealRecordStdDto.cs b/Yw.Dto.Run.Core/02-record/RunRealRecordStdDto.cs index 8693b07..c4d5f5a 100644 --- a/Yw.Dto.Run.Core/02-record/RunRealRecordStdDto.cs +++ b/Yw.Dto.Run.Core/02-record/RunRealRecordStdDto.cs @@ -19,7 +19,8 @@ this.ObjectID = rhs.ObjectID; this.DataTime = rhs.DataTime; this.RSa = rhs.RSa; - this.ContinueRunTime = rhs.ContinueRunTime; + this.ContinueTime = rhs.ContinueTime; + this.TotalShutTime = rhs.TotalShutTime; this.TotalRunTime = rhs.TotalRunTime; this.BootTimes = rhs.BootTimes; this.AnalyStatus = rhs.AnalyStatus; @@ -47,9 +48,14 @@ public int RSa { get; set; } /// <summary> - /// 杩炵画杩愯鏃堕棿 + /// 杩炵画鏃堕棿 /// </summary> - public int ContinueRunTime { get; set; } + public int ContinueTime { get; set; } + + /// <summary> + /// 鎬诲仠鏈烘椂闂� + /// </summary> + public int TotalShutTime { get; set; } /// <summary> /// 鎬昏繍琛屾椂闂� diff --git a/Yw.Dto.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user b/Yw.Dto.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user index 4c671f5..2dbd2dc 100644 --- a/Yw.Dto.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Yw.Dto.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ --> <Project> <PropertyGroup> - <History>True|2024-04-26T03:51:11.4880401Z;True|2024-04-26T11:50:49.7392651+08:00;True|2024-04-26T11:50:39.7372723+08:00;True|2024-04-01T11:39:12.7290526+08:00;True|2024-03-26T09:51:34.4055575+08:00;</History> + <History>True|2024-04-30T05:46:18.9575803Z;True|2024-04-30T11:29:49.6927256+08:00;True|2024-04-26T11:51:11.4880401+08:00;True|2024-04-26T11:50:49.7392651+08:00;True|2024-04-26T11:50:39.7372723+08:00;True|2024-04-01T11:39:12.7290526+08:00;True|2024-03-26T09:51:34.4055575+08:00;</History> <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/Yw.Dto.Run.Core/Yw.Dto.Run.Core.csproj b/Yw.Dto.Run.Core/Yw.Dto.Run.Core.csproj index 9922b84..0455356 100644 --- a/Yw.Dto.Run.Core/Yw.Dto.Run.Core.csproj +++ b/Yw.Dto.Run.Core/Yw.Dto.Run.Core.csproj @@ -4,13 +4,13 @@ <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>disable</Nullable> - <Version>3.0.2</Version> + <Version>3.0.6</Version> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> </PropertyGroup> <ItemGroup> <PackageReference Include="Yw.Dto.Core" Version="3.0.5" /> - <PackageReference Include="Yw.Service.Run.Core" Version="3.0.2" /> + <PackageReference Include="Yw.Service.Run.Core" Version="3.0.6" /> </ItemGroup> </Project> diff --git a/Yw.Server.Run/01-equipment/01-service/EquipmentRunAnalyServiceJob.cs b/Yw.Server.Run/01-equipment/01-service/EquipmentRunAnalyServiceJob.cs index a832711..144897c 100644 --- a/Yw.Server.Run/01-equipment/01-service/EquipmentRunAnalyServiceJob.cs +++ b/Yw.Server.Run/01-equipment/01-service/EquipmentRunAnalyServiceJob.cs @@ -31,6 +31,24 @@ #endregion + #region 鍏抽棴浠诲姟 + + foreach (var jobHelper in _jobHelpers.ToList()) + { + var configure = configureList.Find(x => x.ObjectType == jobHelper.Configure.ObjectType + && x.ObjectID == jobHelper.Configure.ObjectID + && x.ChangeTimes == jobHelper.Configure.ChangeTimes + && x.Frequency == jobHelper.Configure.Frequency); + if (configure == null) + { + await jobHelper.CancelJob(); + _jobHelpers.Remove(jobHelper); + LogHelper.Info($"璁惧杩愯鍒嗘瀽鏈嶅姟浠诲姟涓紝,鏁版嵁id:{jobHelper.Configure.ObjectID},鏀瑰彉娆℃暟:{jobHelper.Configure.ChangeTimes},鍒嗘瀽棰戠巼:{jobHelper.Configure.Frequency},璁″垝浠诲姟鍏抽棴锛�"); + } + } + + #endregion + #region 寮�鍚换鍔� foreach (var configure in configureList) @@ -50,23 +68,7 @@ #endregion - #region 鍏抽棴浠诲姟 - foreach (var jobHelper in _jobHelpers.ToList()) - { - var configure = configureList.Find(x => x.ObjectType == jobHelper.Configure.ObjectType - && x.ObjectID == jobHelper.Configure.ObjectID - && x.ChangeTimes == jobHelper.Configure.ChangeTimes - && x.Frequency == jobHelper.Configure.Frequency); - if (configure == null) - { - await jobHelper.CancelJob(); - _jobHelpers.Remove(jobHelper); - LogHelper.Info($"璁惧杩愯鍒嗘瀽鏈嶅姟浠诲姟涓紝,鏁版嵁id:{jobHelper.Configure.ObjectID},鏀瑰彉娆℃暟:{jobHelper.Configure.ChangeTimes},鍒嗘瀽棰戠巼:{jobHelper.Configure.Frequency},璁″垝浠诲姟鍏抽棴锛�"); - } - } - - #endregion LogHelper.Info($"璁惧杩愯鍒嗘瀽鏈嶅姟浠诲姟涓紝寮�鍚换鍔℃暟閲忎负{_jobHelpers.Count}锛�"); } diff --git a/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalyChangeTimesHelper.cs b/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalyChangeTimesHelper.cs index e5b5b38..51dc347 100644 --- a/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalyChangeTimesHelper.cs +++ b/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalyChangeTimesHelper.cs @@ -1,26 +1,48 @@ -锘縩amespace Yw.Server +锘縰sing Yw.Service.Basic; +using Yw.Service.Monitor; + +namespace Yw.Server { /// <summary> /// /// </summary> public class EquipmentRunAnalyChangeTimesHelper { - private static ConcurrentDictionary<long, List<Yw.Model.MonitorRealRecord>> _dict = new();//缂撳瓨 + private static readonly ConcurrentDictionary<long, List<int>> _dict = new();//缂撳瓨 /// <summary> /// 璁剧疆 /// </summary> - public static void Set(long configureId, int changeTimes, Yw.Model.MonitorRealRecord record) + public static void Set(long configureId, int changeTimes, Yw.Model.MonitorPoint monitor, Yw.Model.MonitorRealRecord record) { - _dict.TryAdd(configureId, new List<Yw.Model.MonitorRealRecord>()); + _dict.TryAdd(configureId, new List<int>()); if (_dict[configureId].Count >= changeTimes) { _dict[configureId].RemoveAt(0); } - if (record != null) + var rsa = Yw.Run.RunStatus.Shut; + if (monitor != null) { - _dict[configureId].Add(record); + if (record != null) + { + if (int.TryParse(record.DataValue, out int intDataValue)) + { + if (intDataValue > Yw.Monitor.RunStatus.Shut) + { + rsa = Yw.Run.RunStatus.Run; + } + } + } + var config_interrupt = Yw.Run.SysParas.EnableMonitorInterruptJudgement.GetPValue<bool?>(); + if (config_interrupt.HasValue && config_interrupt.Value) + { + if (monitor.IsInterrupt(record)) + { + rsa = Yw.Run.RunStatus.Shut; + } + } } + _dict[configureId].Add(rsa); } /// <summary> @@ -36,7 +58,7 @@ { return false; } - if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1) + if (_dict[configureId].Distinct().Count() > 1) { return false; } diff --git a/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalySingleJob.cs b/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalySingleJob.cs index ca16e42..968ffa3 100644 --- a/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalySingleJob.cs +++ b/Yw.Server.Run/01-equipment/02-single/EquipmentRunAnalySingleJob.cs @@ -1,4 +1,7 @@ -锘縩amespace Yw.Server +锘縰sing Yw.Service.Basic; +using Yw.Service.Monitor; + +namespace Yw.Server { /// <summary> /// 璁惧杩愯鍒嗘瀽鍗曚换鍔� @@ -68,37 +71,37 @@ #region 杩愯娴嬬偣 - var monitorList = allMonitorList.Where(x => x.SignalList.Exists(t => t.SignalType.Code == Yw.Monitor.SignalType.杩愯鐘舵��)).ToList(); - if (monitorList == null || monitorList.Count < 1) + var signal = allMonitorList.Matching(Yw.Monitor.SignalType.杩愯鐘舵��, new List<string>() { Yw.Run.Flags.榛樿 }); + if (signal == null) + { + signal = allMonitorList.Matching(Yw.Monitor.SignalType.杩愯鐘舵��, null); + } + if (signal == null) { LogHelper.Info($"璁惧杩愯鍒嗘瀽鍗曚换鍔′腑锛岃澶噄d:{configure.ObjectID} 妫�绱㈣繍琛岀姸鎬佹祴鐐瑰け璐ワ紒"); return; } - var monitor = monitorList.Find(x => x.Flags.Contains(Yw.Monitor.Flags.榛樿)); - if (monitor == null) - { - monitor = monitorList.First(); - } - + var monitor = allMonitorList.Find(x => x.ID == signal.MonitorPointID); #endregion #region 杩炵画缂撳瓨 - var lastRecord = new Yw.Service.MonitorRealRecord().GetLastRecord(monitor.SignalList.First().ID); - EquipmentRunAnalyChangeTimesHelper.Set(configure.ID, configure.ChangeTimes, lastRecord); + var lastRecord = new Yw.Service.MonitorRealRecord().GetLastRecord(signal.ID); + EquipmentRunAnalyChangeTimesHelper.Set(configure.ID, configure.ChangeTimes, monitor, lastRecord); #endregion - #region 鏁版嵁鍒嗘瀽 + #region 杩愯鍒嗘瀽 - var run_record = new Yw.Model.RunRealRecord() + var runRecord = new Yw.Model.RunRealRecord() { ObjectType = configure.ObjectType, ObjectID = configure.ObjectID, DataTime = DateTime.Now, - RSa = Yw.Run.RunStatus.Stop, - ContinueRunTime = 0, + RSa = Yw.Run.RunStatus.Shut, + ContinueTime = configure.Frequency, + TotalShutTime = configure.Frequency, TotalRunTime = 0, BootTimes = 0, AnalyStatus = Yw.Run.AnalyStatus.Normal, @@ -108,69 +111,84 @@ var lastRunRecord = new Yw.Service.RunRealRecord().GetLastRecord(configure.ObjectType, configure.ObjectID); if (lastRunRecord == null) { - run_record.AnalyInfo = "棣栨鍒嗘瀽"; + runRecord.AnalyInfo = "棣栨鍒嗘瀽"; if (lastRecord == null) { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Missing; + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; } else { - if (double.TryParse(lastRecord.DataValue, out double outDataValue)) + if (Yw.Monitor.DataStatus.HasError(lastRecord.DataStatus)) { - if (outDataValue > 0) - { - run_record.RSa = Yw.Run.RunStatus.Run; - run_record.ContinueRunTime += configure.Frequency; - run_record.TotalRunTime += configure.Frequency; - run_record.BootTimes += 1; - } + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; } else { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; + if (int.TryParse(lastRecord.DataValue, out int intDataValue)) + { + if (intDataValue > Yw.Monitor.RunStatus.Shut) + { + runRecord.RSa = Yw.Run.RunStatus.Run; + runRecord.BootTimes += 1; + runRecord.TotalRunTime += configure.Frequency; + } + } + else + { + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Error; + } } } } else { - run_record.RSa = lastRunRecord.RSa; - run_record.ContinueRunTime = lastRunRecord.ContinueRunTime; - run_record.TotalRunTime = lastRunRecord.TotalRunTime; - run_record.BootTimes = lastRunRecord.BootTimes; - if (lastRecord == null) + runRecord.RSa = lastRunRecord.RSa; + runRecord.ContinueTime = lastRunRecord.ContinueTime; + runRecord.TotalShutTime = lastRunRecord.TotalShutTime; + runRecord.TotalRunTime = lastRunRecord.TotalRunTime; + runRecord.BootTimes = lastRunRecord.BootTimes; + + if (EquipmentRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Missing; + runRecord.RSa = runRecord.RSa == Yw.Run.RunStatus.Run ? Yw.Run.RunStatus.Shut : Yw.Run.RunStatus.Run; + runRecord.ContinueTime = configure.Frequency; + if (runRecord.RSa == Yw.Run.RunStatus.Run) + { + runRecord.BootTimes += 1; + } } else { - if (double.TryParse(lastRecord.DataValue, out double outDataValue)) + runRecord.ContinueTime += configure.Frequency; + } + + if (runRecord.RSa == Yw.Run.RunStatus.Shut) + { + runRecord.TotalShutTime += configure.Frequency; + } + else + { + runRecord.TotalRunTime += configure.Frequency; + } + + if (lastRecord == null) + { + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; + } + else + { + if (Yw.Monitor.DataStatus.HasError(lastRecord.DataStatus)) { - var run_status = outDataValue > 0 ? Yw.Run.RunStatus.Run : Yw.Run.RunStatus.Stop; - if (run_status != run_record.RSa) + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; + } + var enable_interrupt = Yw.Run.SysParas.EnableMonitorInterruptJudgement.GetPValue<bool?>(); + if (enable_interrupt.HasValue && enable_interrupt.Value) + { + if (monitor.IsInterrupt(lastRecord)) { - if (EquipmentRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) - { - run_record.RSa = run_status; - if (run_status == Yw.Run.RunStatus.Run) - { - run_record.BootTimes += 1; - } - if (run_record.RSa == Yw.Run.RunStatus.Stop) - { - run_record.ContinueRunTime = 0; - } - } + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Interrupt; } } - else - { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; - } - } - if (run_record.RSa == Yw.Run.RunStatus.Run) - { - run_record.TotalRunTime += configure.Frequency; - run_record.ContinueRunTime += configure.Frequency; } } @@ -178,7 +196,7 @@ #region 鏁版嵁瀛樺偍 - var bol = new Yw.Service.RunRealRecord().InsertLastRecord(run_record); + var bol = new Yw.Service.RunRealRecord().InsertLastRecord(runRecord); if (bol) { LogHelper.Info($"璁惧杩愯鍒嗘瀽鍗曚换鍔′腑锛岃澶噄d:{configure.ObjectID} 杩愯璁板綍鍒嗘瀽鎴愬姛锛�"); diff --git a/Yw.Server.Run/02-emws/01-service/EMWSRunAnalyServiceJob.cs b/Yw.Server.Run/02-emws/01-service/EMWSRunAnalyServiceJob.cs index c6660d2..e9dc777 100644 --- a/Yw.Server.Run/02-emws/01-service/EMWSRunAnalyServiceJob.cs +++ b/Yw.Server.Run/02-emws/01-service/EMWSRunAnalyServiceJob.cs @@ -31,25 +31,6 @@ #endregion - #region 寮�鍚换鍔� - - foreach (var configure in configureList) - { - var jobHelper = _jobHelpers.Find(x => x.Configure.ObjectType == configure.ObjectType - && x.Configure.ObjectID == configure.ObjectID - && x.Configure.ChangeTimes == configure.ChangeTimes - && x.Configure.Frequency == configure.Frequency); - if (jobHelper == null) - { - jobHelper = new EMWSRunAnalySingleJobHelper(); - await jobHelper.StartJob(configure); - _jobHelpers.Add(jobHelper); - LogHelper.Info($"宸ヤ綅杩愯鍒嗘瀽鏈嶅姟浠诲姟涓�,鏁版嵁id:{configure.ObjectID},鏀瑰彉娆℃暟:{configure.ChangeTimes},鍒嗘瀽棰戠巼:{configure.Frequency},璁″垝浠诲姟寮�鍚紒"); - } - } - - #endregion - #region 鍏抽棴浠诲姟 foreach (var jobHelper in _jobHelpers.ToList()) @@ -68,6 +49,24 @@ #endregion + #region 寮�鍚换鍔� + + foreach (var configure in configureList) + { + var jobHelper = _jobHelpers.Find(x => x.Configure.ObjectType == configure.ObjectType + && x.Configure.ObjectID == configure.ObjectID + && x.Configure.ChangeTimes == configure.ChangeTimes + && x.Configure.Frequency == configure.Frequency); + if (jobHelper == null) + { + jobHelper = new EMWSRunAnalySingleJobHelper(); + await jobHelper.StartJob(configure); + _jobHelpers.Add(jobHelper); + LogHelper.Info($"宸ヤ綅杩愯鍒嗘瀽鏈嶅姟浠诲姟涓�,鏁版嵁id:{configure.ObjectID},鏀瑰彉娆℃暟:{configure.ChangeTimes},鍒嗘瀽棰戠巼:{configure.Frequency},璁″垝浠诲姟寮�鍚紒"); + } + } + + #endregion LogHelper.Info($"宸ヤ綅杩愯鍒嗘瀽鏈嶅姟浠诲姟涓紝寮�鍚换鍔℃暟閲忎负{_jobHelpers.Count}锛�"); } diff --git a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs index 5bc149b..20b8119 100644 --- a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs +++ b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs @@ -1,26 +1,48 @@ -锘縩amespace Yw.Server +锘縰sing Yw.Service.Basic; +using Yw.Service.Monitor; + +namespace Yw.Server { /// <summary> /// /// </summary> public class EMWSRunAnalyChangeTimesHelper { - private static ConcurrentDictionary<long, List<Yw.Model.MonitorRealRecord>> _dict = new();//缂撳瓨 + private static readonly ConcurrentDictionary<long, List<int>> _dict = new();//缂撳瓨 /// <summary> /// 璁剧疆 /// </summary> - public static void Set(long configureId, int changeTimes, Yw.Model.MonitorRealRecord record) + public static void Set(long configureId, int changeTimes, Yw.Model.MonitorPoint monitor, Yw.Model.MonitorRealRecord record) { - _dict.TryAdd(configureId, new List<Yw.Model.MonitorRealRecord>()); + _dict.TryAdd(configureId, new List<int>()); if (_dict[configureId].Count >= changeTimes) { _dict[configureId].RemoveAt(0); } - if (record != null) + var rsa = Yw.Run.RunStatus.Shut; + if (monitor != null) { - _dict[configureId].Add(record); + if (record != null) + { + if (int.TryParse(record.DataValue, out int intDataValue)) + { + if (intDataValue > Yw.Monitor.RunStatus.Shut) + { + rsa = Yw.Run.RunStatus.Run; + } + } + } + var config_interrupt = Yw.Run.SysParas.EnableMonitorInterruptJudgement.GetPValue<bool?>(); + if (config_interrupt.HasValue && config_interrupt.Value) + { + if (monitor.IsInterrupt(record)) + { + rsa = Yw.Run.RunStatus.Shut; + } + } } + _dict[configureId].Add(rsa); } /// <summary> @@ -36,7 +58,7 @@ { return false; } - if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1) + if (_dict[configureId].Distinct().Count() > 1) { return false; } diff --git a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalySingleJob.cs b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalySingleJob.cs index ff15ca8..d0bb5d7 100644 --- a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalySingleJob.cs +++ b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalySingleJob.cs @@ -1,4 +1,8 @@ -锘縩amespace Yw.Server +锘縰sing Yw.LCache.Medis; +using Yw.Service.Basic; +using Yw.Service.Monitor; + +namespace Yw.Server { /// <summary> /// 宸ヤ綅杩愯鍒嗘瀽鍗曚换鍔� @@ -80,108 +84,124 @@ #region 杩愯娴嬬偣 - var monitorList = allMonitorList.Where(x => x.SignalList.Exists(t => t.SignalType.Code == Yw.Monitor.SignalType.杩愯鐘舵��)).ToList(); - if (monitorList == null || monitorList.Count < 1) + var signal = allMonitorList.Matching(Yw.Monitor.SignalType.杩愯鐘舵��, new List<string>() { Yw.Run.Flags.榛樿 }); + if (signal == null) + { + signal = allMonitorList.Matching(Yw.Monitor.SignalType.杩愯鐘舵��, null); + } + if (signal == null) { LogHelper.Info($"宸ヤ綅杩愯鍒嗘瀽鍗曚换鍔′腑锛岃澶噄d:{configure.ObjectID} 妫�绱㈣繍琛岀姸鎬佹祴鐐瑰け璐ワ紒"); return; } - var monitor = monitorList.Find(x => x.Flags.Contains(Yw.Monitor.Flags.榛樿)); - if (monitor == null) - { - monitor = monitorList.First(); - } + var monitor = allMonitorList.Find(x => x.ID == signal.MonitorPointID); #endregion #region 杩炵画缂撳瓨 - var lastMonitorRecord = service_monitor_record.Value.GetLastRecord(monitor.SignalList.First().ID); - EMWSRunAnalyChangeTimesHelper.Set(configure.ID, configure.ChangeTimes, lastMonitorRecord); + var lastRecord = new Yw.Service.MonitorRealRecord().GetLastRecord(signal.ID); + EMWSRunAnalyChangeTimesHelper.Set(configure.ID, configure.ChangeTimes, monitor, lastRecord); #endregion - #region 鏁版嵁鍒嗘瀽 + #region 杩愯鍒嗘瀽 - var run_record = new Yw.Model.RunRealRecord() + var runRecord = new Yw.Model.RunRealRecord() { ObjectType = configure.ObjectType, ObjectID = configure.ObjectID, DataTime = DateTime.Now, - RSa = Yw.Run.RunStatus.Stop, - ContinueRunTime = 0, + RSa = Yw.Run.RunStatus.Shut, + ContinueTime = configure.Frequency, + TotalShutTime = configure.Frequency, TotalRunTime = 0, BootTimes = 0, AnalyStatus = Yw.Run.AnalyStatus.Normal, AnalyInfo = null }; - var lastRunRecord = service_run_record.Value.GetLastRecord(configure.ObjectType, configure.ObjectID); + var lastRunRecord = new Yw.Service.RunRealRecord().GetLastRecord(configure.ObjectType, configure.ObjectID); if (lastRunRecord == null) { - run_record.AnalyInfo = "棣栨鍒嗘瀽"; - if (lastMonitorRecord == null) + runRecord.AnalyInfo = "棣栨鍒嗘瀽"; + if (lastRecord == null) { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Missing; + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; } else { - if (double.TryParse(lastMonitorRecord.DataValue, out double outDataValue)) + if (Yw.Monitor.DataStatus.HasError(lastRecord.DataStatus)) { - if (outDataValue > 0) - { - run_record.RSa = Yw.Run.RunStatus.Run; - run_record.ContinueRunTime += configure.Frequency; - run_record.TotalRunTime += configure.Frequency; - run_record.BootTimes += 1; - } + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; } else { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; + if (int.TryParse(lastRecord.DataValue, out int intDataValue)) + { + if (intDataValue > Yw.Monitor.RunStatus.Shut) + { + runRecord.RSa = Yw.Run.RunStatus.Run; + runRecord.BootTimes += 1; + runRecord.TotalRunTime += configure.Frequency; + } + } + else + { + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Error; + } } } } else { - run_record.RSa = lastRunRecord.RSa; - run_record.ContinueRunTime = lastRunRecord.ContinueRunTime; - run_record.TotalRunTime = lastRunRecord.TotalRunTime; - run_record.BootTimes = lastRunRecord.BootTimes; - if (lastMonitorRecord == null) + runRecord.RSa = lastRunRecord.RSa; + runRecord.ContinueTime = lastRunRecord.ContinueTime; + runRecord.TotalShutTime = lastRunRecord.TotalShutTime; + runRecord.TotalRunTime = lastRunRecord.TotalRunTime; + runRecord.BootTimes = lastRunRecord.BootTimes; + + if (EMWSRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Missing; + runRecord.RSa = runRecord.RSa == Yw.Run.RunStatus.Run ? Yw.Run.RunStatus.Shut : Yw.Run.RunStatus.Run; + runRecord.ContinueTime = configure.Frequency; + if (runRecord.RSa == Yw.Run.RunStatus.Run) + { + runRecord.BootTimes += 1; + } } else { - if (double.TryParse(lastMonitorRecord.DataValue, out double outDataValue)) + runRecord.ContinueTime += configure.Frequency; + } + + if (runRecord.RSa == Yw.Run.RunStatus.Shut) + { + runRecord.TotalShutTime += configure.Frequency; + } + else + { + runRecord.TotalRunTime += configure.Frequency; + } + + if (lastRecord == null) + { + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; + } + else + { + if (Yw.Monitor.DataStatus.HasError(lastRecord.DataStatus)) { - var run_status = outDataValue > 0 ? Yw.Run.RunStatus.Run : Yw.Run.RunStatus.Stop; - if (run_status != run_record.RSa) + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; + } + var enable_interrupt = Yw.Run.SysParas.EnableMonitorInterruptJudgement.GetPValue<bool?>(); + if (enable_interrupt.HasValue && enable_interrupt.Value) + { + if (monitor.IsInterrupt(lastRecord)) { - if (EMWSRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) - { - run_record.RSa = run_status; - if (run_status == Yw.Run.RunStatus.Run) - { - run_record.BootTimes += 1; - } - if (run_record.RSa == Yw.Run.RunStatus.Stop) - { - run_record.ContinueRunTime = 0; - } - } + runRecord.AnalyStatus = Yw.Run.AnalyStatus.Interrupt; } } - else - { - run_record.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; - } - } - if (run_record.RSa == Yw.Run.RunStatus.Run) - { - run_record.TotalRunTime += configure.Frequency; - run_record.ContinueRunTime += configure.Frequency; } } @@ -189,7 +209,7 @@ #region 鏁版嵁瀛樺偍 - var bol = service_run_record.Value.InsertLastRecord(run_record); + var bol = service_run_record.Value.InsertLastRecord(runRecord); if (bol) { LogHelper.Info($"宸ヤ綅杩愯鍒嗘瀽鍗曚换鍔′腑锛屽伐浣嶅悕绉�:{currentWorkSite.Name}锛屽伐浣峣d:{currentWorkSite.ID}, 杩愯璁板綍鍒嗘瀽鎴愬姛锛�"); diff --git a/Yw.Server.Run/Yw.Server.Run.csproj b/Yw.Server.Run/Yw.Server.Run.csproj index ecd8902..a0846f3 100644 --- a/Yw.Server.Run/Yw.Server.Run.csproj +++ b/Yw.Server.Run/Yw.Server.Run.csproj @@ -10,9 +10,10 @@ <ItemGroup> <PackageReference Include="Yw.Quartz.Core" Version="3.0.0" /> <PackageReference Include="Yw.Service.Assets.Core" Version="3.1.2" /> + <PackageReference Include="Yw.Service.Basic.Core" Version="3.0.7" /> <PackageReference Include="Yw.Service.EMWS.Core" Version="3.0.2" /> - <PackageReference Include="Yw.Service.Monitor.Core" Version="3.2.0" /> - <PackageReference Include="Yw.Service.MonitorRelation.Core" Version="3.0.3" /> + <PackageReference Include="Yw.Service.Monitor.Core" Version="3.2.7" /> + <PackageReference Include="Yw.Service.MonitorRelation.Core" Version="3.0.5" /> </ItemGroup> <ItemGroup> diff --git a/Yw.Service.Run.Core/00-core/AnalyStatus.cs b/Yw.Service.Run.Core/00-core/AnalyStatus.cs index d4ef9f5..854357f 100644 --- a/Yw.Service.Run.Core/00-core/AnalyStatus.cs +++ b/Yw.Service.Run.Core/00-core/AnalyStatus.cs @@ -11,6 +11,11 @@ public const int Unknow = -99; /// <summary> + /// 鏁版嵁涓柇 + /// </summary> + public const int Interrupt = -4; + + /// <summary> /// 鏁版嵁寮傚父 /// </summary> public const int Abnormal = -3; diff --git a/Yw.Service.Run.Core/00-core/DataType.cs b/Yw.Service.Run.Core/00-core/DataType.cs index 91004dd..689b1d1 100644 --- a/Yw.Service.Run.Core/00-core/DataType.cs +++ b/Yw.Service.Run.Core/00-core/DataType.cs @@ -5,8 +5,11 @@ /// </summary> public class DataType { + /// <summary> + /// 杩愯鍒嗘瀽閰嶇疆 + /// </summary> - + public const string RunAnalyConfigure = "run-analy-configure"; } diff --git a/Yw.Service.Run.Core/00-core/Flags.cs b/Yw.Service.Run.Core/00-core/Flags.cs new file mode 100644 index 0000000..9e316dd --- /dev/null +++ b/Yw.Service.Run.Core/00-core/Flags.cs @@ -0,0 +1,13 @@ +锘縩amespace Yw.Run +{ + /// <summary> + /// + /// </summary> + public class Flags + { + /// <summary> + /// 榛樿 + /// </summary> + public const string 榛樿 = "榛樿"; + } +} diff --git a/Yw.Service.Run.Core/00-core/RunStatus.cs b/Yw.Service.Run.Core/00-core/RunStatus.cs index a1cf4ab..0c34e93 100644 --- a/Yw.Service.Run.Core/00-core/RunStatus.cs +++ b/Yw.Service.Run.Core/00-core/RunStatus.cs @@ -8,7 +8,7 @@ /// <summary> /// 鍋滄満 /// </summary> - public const int Stop = 0; + public const int Shut = 0; /// <summary> /// 寮�鏈� diff --git a/Yw.Service.Run.Core/00-core/SysParas.cs b/Yw.Service.Run.Core/00-core/SysParas.cs new file mode 100644 index 0000000..73e94b0 --- /dev/null +++ b/Yw.Service.Run.Core/00-core/SysParas.cs @@ -0,0 +1,14 @@ +锘縩amespace Yw.Run +{ + /// <summary> + /// + /// </summary> + public class SysParas + { + /// <summary> + /// 鍚敤鐩戞祴涓柇鍒ゆ柇 + /// </summary> + public const string EnableMonitorInterruptJudgement = "run-enable-monitor-interrupt-judgement"; + + } +} diff --git a/Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs b/Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs index 1a0fc12..f7912a4 100644 --- a/Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs +++ b/Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs @@ -34,7 +34,7 @@ public long ObjectID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼 锛堢锛� /// </summary> public int Frequency { get; set; } diff --git a/Yw.Service.Run.Core/01-entity/RunRealRecord.cs b/Yw.Service.Run.Core/01-entity/RunRealRecord.cs index 9b4419b..56c03a3 100644 --- a/Yw.Service.Run.Core/01-entity/RunRealRecord.cs +++ b/Yw.Service.Run.Core/01-entity/RunRealRecord.cs @@ -20,7 +20,8 @@ this.ObjectID = rhs.ObjectID; this.DataTime = rhs.DataTime; this.RSa = rhs.RSa; - this.ContinueRunTime = rhs.ContinueRunTime; + this.ContinueTime = rhs.ContinueTime; + this.TotalShutTime = rhs.TotalShutTime; this.TotalRunTime = rhs.TotalRunTime; this.BootTimes = rhs.BootTimes; this.AnalyStatus = rhs.AnalyStatus; @@ -48,12 +49,17 @@ public int RSa { get; set; } /// <summary> - /// 杩炵画杩愯鏃堕棿 + /// 杩炵画鏃堕棿锛堢锛� /// </summary> - public int ContinueRunTime { get; set; } + public int ContinueTime { get; set; } /// <summary> - /// 鎬昏繍琛屾椂闂� + /// 鎬诲仠鏈烘椂闂达紙绉掞級 + /// </summary> + public int TotalShutTime { get; set; } + + /// <summary> + /// 鎬昏繍琛屾椂闂达紙绉掞級 /// </summary> public int TotalRunTime { get; set; } diff --git a/Yw.Service.Run.Core/02-model/RunAnalyConfigure.cs b/Yw.Service.Run.Core/02-model/RunAnalyConfigure.cs index 9aeae17..0b532b9 100644 --- a/Yw.Service.Run.Core/02-model/RunAnalyConfigure.cs +++ b/Yw.Service.Run.Core/02-model/RunAnalyConfigure.cs @@ -46,7 +46,7 @@ public long ObjectID { get; set; } /// <summary> - /// 鍒嗘瀽棰戠巼 + /// 鍒嗘瀽棰戠巼 (绉�) /// </summary> public int Frequency { get; set; } diff --git a/Yw.Service.Run.Core/02-model/RunRealRecord.cs b/Yw.Service.Run.Core/02-model/RunRealRecord.cs index f901bdd..bee37c3 100644 --- a/Yw.Service.Run.Core/02-model/RunRealRecord.cs +++ b/Yw.Service.Run.Core/02-model/RunRealRecord.cs @@ -19,7 +19,8 @@ this.ObjectID = rhs.ObjectID; this.DataTime = rhs.DataTime; this.RSa = rhs.RSa; - this.ContinueRunTime = rhs.ContinueRunTime; + this.ContinueTime = rhs.ContinueTime; + this.TotalShutTime = rhs.TotalShutTime; this.TotalRunTime = rhs.TotalRunTime; this.BootTimes = rhs.BootTimes; this.AnalyStatus = rhs.AnalyStatus; @@ -35,7 +36,8 @@ this.ObjectID = rhs.ObjectID; this.DataTime = rhs.DataTime; this.RSa = rhs.RSa; - this.ContinueRunTime = rhs.ContinueRunTime; + this.ContinueTime = rhs.ContinueTime; + this.TotalShutTime = rhs.TotalShutTime; this.TotalRunTime = rhs.TotalRunTime; this.BootTimes = rhs.BootTimes; this.AnalyStatus = rhs.AnalyStatus; @@ -63,12 +65,17 @@ public int RSa { get; set; } /// <summary> - /// 杩炵画杩愯鏃堕棿 + /// 杩炵画鏃堕棿锛堢锛� /// </summary> - public int ContinueRunTime { get; set; } + public int ContinueTime { get; set; } /// <summary> - /// 鎬昏繍琛屾椂闂� + /// 鎬诲仠鏈烘椂闂达紙绉掞級 + /// </summary> + public int TotalShutTime { get; set; } + + /// <summary> + /// 鎬昏繍琛屾椂闂达紙绉掞級 /// </summary> public int TotalRunTime { get; set; } diff --git a/Yw.Service.Run.Core/03-settings/helper/RunFileHelper.cs b/Yw.Service.Run.Core/03-settings/00-core/RunFileHelper.cs similarity index 98% rename from Yw.Service.Run.Core/03-settings/helper/RunFileHelper.cs rename to Yw.Service.Run.Core/03-settings/00-core/RunFileHelper.cs index 11f1570..19bc524 100644 --- a/Yw.Service.Run.Core/03-settings/helper/RunFileHelper.cs +++ b/Yw.Service.Run.Core/03-settings/00-core/RunFileHelper.cs @@ -50,7 +50,9 @@ internal static bool Save() { if (_appparas == null) + { return default; + } var json = JsonHelper.Object2FormatJson(_appparas); File.WriteAllText(JsonFileName, json, Encoding.UTF8); return true; diff --git a/Yw.Service.Run.Core/03-settings/helper/RunParasHelper.cs b/Yw.Service.Run.Core/03-settings/00-core/RunParasHelper.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/helper/RunParasHelper.cs rename to Yw.Service.Run.Core/03-settings/00-core/RunParasHelper.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run.cs b/Yw.Service.Run.Core/03-settings/01-paras/00-core/Paras_Run.cs similarity index 99% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run.cs rename to Yw.Service.Run.Core/03-settings/01-paras/00-core/Paras_Run.cs index b0361a6..8d353e4 100644 --- a/Yw.Service.Run.Core/03-settings/paras/Paras_Run.cs +++ b/Yw.Service.Run.Core/03-settings/01-paras/00-core/Paras_Run.cs @@ -27,6 +27,11 @@ public Paras_Run_Exchange Exchange { get; set; } /// <summary> + /// CAL + /// </summary> + public Paras_Run_CAL CAL { get; set; } + + /// <summary> /// 杩愯 /// </summary> public Paras_Run_Run Run { get; set; } @@ -36,9 +41,6 @@ /// </summary> public Paras_Run_Task Task { get; set; } - /// <summary> - /// CAL - /// </summary> - public Paras_Run_CAL CAL { get; set; } + } } diff --git a/Yw.Service.Run.Core/03-settings/paras/RunParas.cs b/Yw.Service.Run.Core/03-settings/01-paras/00-core/RunParas.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/RunParas.cs rename to Yw.Service.Run.Core/03-settings/01-paras/00-core/RunParas.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase.cs b/Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase.cs rename to Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_Factory.cs b/Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_Factory.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_Factory.cs rename to Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_Factory.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_PostgreSql.cs b/Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_PostgreSql.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_PostgreSql.cs rename to Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_PostgreSql.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_SQLite.cs b/Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_SQLite.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_DataBase_SQLite.cs rename to Yw.Service.Run.Core/03-settings/01-paras/01-database/Paras_Run_DataBase_SQLite.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_LCache.cs b/Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_LCache.cs rename to Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_LCache_Factory.cs b/Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache_Factory.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_LCache_Factory.cs rename to Yw.Service.Run.Core/03-settings/01-paras/02-lcache/Paras_Run_LCache_Factory.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Queue.cs b/Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Queue.cs rename to Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Queue_Factory.cs b/Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue_Factory.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Queue_Factory.cs rename to Yw.Service.Run.Core/03-settings/01-paras/03-queue/Paras_Run_Queue_Factory.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Exchange.cs b/Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Exchange.cs rename to Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Exchange_Factory.cs b/Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange_Factory.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Exchange_Factory.cs rename to Yw.Service.Run.Core/03-settings/01-paras/04-exchange/Paras_Run_Exchange_Factory.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL.cs b/Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL.cs rename to Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL_HttpClient.cs b/Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_HttpClient.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL_HttpClient.cs rename to Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_HttpClient.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL_LocalClient.cs b/Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_LocalClient.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_CAL_LocalClient.cs rename to Yw.Service.Run.Core/03-settings/01-paras/05-cal/Paras_Run_CAL_LocalClient.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Run.cs b/Yw.Service.Run.Core/03-settings/01-paras/06-run/Paras_Run_Run.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Run.cs rename to Yw.Service.Run.Core/03-settings/01-paras/06-run/Paras_Run_Run.cs diff --git a/Yw.Service.Run.Core/03-settings/paras/Paras_Run_Task.cs b/Yw.Service.Run.Core/03-settings/01-paras/07-task/Paras_Run_Task.cs similarity index 100% rename from Yw.Service.Run.Core/03-settings/paras/Paras_Run_Task.cs rename to Yw.Service.Run.Core/03-settings/01-paras/07-task/Paras_Run_Task.cs diff --git a/Yw.Service.Run.Core/04-dal/02-postgresql/RunRealRecord.cs b/Yw.Service.Run.Core/04-dal/02-postgresql/RunRealRecord.cs index 454f2fc..ecd4a77 100644 --- a/Yw.Service.Run.Core/04-dal/02-postgresql/RunRealRecord.cs +++ b/Yw.Service.Run.Core/04-dal/02-postgresql/RunRealRecord.cs @@ -35,7 +35,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -58,7 +58,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -85,7 +85,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -112,7 +112,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -139,7 +139,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -158,7 +158,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -182,7 +182,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -205,7 +205,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -232,7 +232,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -260,7 +260,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -289,7 +289,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -310,7 +310,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -335,7 +335,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -360,7 +360,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -389,7 +389,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -460,10 +460,11 @@ { var sb = new StringBuilder(); sb.AppendLine("INSERT INTO run_real_record"); - sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continueruntime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); + sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continuetime,@totalshuttime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); sb.AppendLine("ON CONFLICT(objecttype, objectid, datatime) DO UPDATE"); sb.AppendLine("SET rsa = excluded.rsa,"); - sb.AppendLine("continueruntime = excluded.continueruntime,"); + sb.AppendLine("continuetime = excluded.continuetime,"); + sb.AppendLine("totalshuttime = excluded.totalshuttime,"); sb.AppendLine("totalruntime = excluded.totalruntime,"); sb.AppendLine("boottimes = excluded.boottimes,"); sb.AppendLine("analystatus = excluded.analystatus,"); @@ -474,16 +475,19 @@ //鍒涘缓鍙傛暟 private List<SugarParameter> CreateParameters(Entity.RunRealRecord entity) { - var list = new List<SugarParameter>(); - list.Add(new SugarParameter("@objecttype", entity.ObjectType)); - list.Add(new SugarParameter("@objectid", entity.ObjectID)); - list.Add(new SugarParameter("@datatime", entity.DataTime)); - list.Add(new SugarParameter("@rsa", entity.RSa)); - list.Add(new SugarParameter("@continueruntime", entity.ContinueRunTime)); - list.Add(new SugarParameter("@totalruntime", entity.TotalRunTime)); - list.Add(new SugarParameter("@boottimes", entity.BootTimes)); - list.Add(new SugarParameter("@analystatus", entity.AnalyStatus)); - list.Add(new SugarParameter("@analyinfo", entity.AnalyInfo)); + var list = new List<SugarParameter> + { + new SugarParameter("@objecttype", entity.ObjectType), + new SugarParameter("@objectid", entity.ObjectID), + new SugarParameter("@datatime", entity.DataTime), + new SugarParameter("@rsa", entity.RSa), + new SugarParameter("@continuetime", entity.ContinueTime), + new SugarParameter("@totalshuttime", entity.TotalShutTime), + new SugarParameter("@totalruntime", entity.TotalRunTime), + new SugarParameter("@boottimes", entity.BootTimes), + new SugarParameter("@analystatus", entity.AnalyStatus), + new SugarParameter("@analyinfo", entity.AnalyInfo) + }; return list; } diff --git a/Yw.Service.Run.Core/04-dal/03-sqlite/RunRealRecord.cs b/Yw.Service.Run.Core/04-dal/03-sqlite/RunRealRecord.cs index e2e3199..aefefff 100644 --- a/Yw.Service.Run.Core/04-dal/03-sqlite/RunRealRecord.cs +++ b/Yw.Service.Run.Core/04-dal/03-sqlite/RunRealRecord.cs @@ -35,7 +35,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -58,7 +58,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -85,7 +85,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -112,7 +112,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -139,7 +139,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -158,7 +158,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= Day.Date && x.DataTime < Day.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -182,7 +182,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartDay.Date && x.DataTime < EndDay.AddDays(1).Date); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -205,7 +205,7 @@ var exp = Expressionable.Create<Entity.RunRealRecord>(); exp.And(x => x.DataTime >= StartTime && x.DataTime <= EndTime); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -232,7 +232,7 @@ exp.AndIF(StartTime.HasValue, x => x.DataTime >= StartTime.Value); exp.AndIF(EndTime.HasValue, x => x.DataTime <= EndTime.Value); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -260,7 +260,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -289,7 +289,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -310,7 +310,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -335,7 +335,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -360,7 +360,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -389,7 +389,7 @@ exp.And(x => x.ObjectType == ObjectType); exp.And(x => x.ObjectID == ObjectID); exp.AndIF(Run.HasValue && Run.Value, x => x.RSa == RunStatus.Run); - exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Stop); + exp.AndIF(Run.HasValue && !Run.Value, x => x.RSa == RunStatus.Shut); using (var db = new SqlSugarClient(ConnectionConfig)) { @@ -460,10 +460,11 @@ { var sb = new StringBuilder(); sb.AppendLine("INSERT INTO run_real_record"); - sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continueruntime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); + sb.AppendLine($" VALUES(@objecttype,@objectid,@datatime,@rsa,@continuetime,@totalshuttime,@totalruntime,@boottimes,@analystatus,@analyinfo)"); sb.AppendLine("ON CONFLICT(objecttype, objectid, datatime) DO UPDATE"); sb.AppendLine("SET rsa = excluded.rsa,"); - sb.AppendLine("continueruntime = excluded.continueruntime,"); + sb.AppendLine("continuetime = excluded.continuetime,"); + sb.AppendLine("totalshuttime = excluded.totalshuttime,"); sb.AppendLine("totalruntime = excluded.totalruntime,"); sb.AppendLine("boottimes = excluded.boottimes,"); sb.AppendLine("analystatus = excluded.analystatus,"); @@ -474,16 +475,19 @@ //鍒涘缓鍙傛暟 private List<SugarParameter> CreateParameters(Entity.RunRealRecord entity) { - var list = new List<SugarParameter>(); - list.Add(new SugarParameter("@objecttype", entity.ObjectType)); - list.Add(new SugarParameter("@objectid", entity.ObjectID)); - list.Add(new SugarParameter("@datatime", entity.DataTime)); - list.Add(new SugarParameter("@rsa", entity.RSa)); - list.Add(new SugarParameter("@continueruntime", entity.ContinueRunTime)); - list.Add(new SugarParameter("@totalruntime", entity.TotalRunTime)); - list.Add(new SugarParameter("@boottimes", entity.BootTimes)); - list.Add(new SugarParameter("@analystatus", entity.AnalyStatus)); - list.Add(new SugarParameter("@analyinfo", entity.AnalyInfo)); + var list = new List<SugarParameter> + { + new SugarParameter("@objecttype", entity.ObjectType), + new SugarParameter("@objectid", entity.ObjectID), + new SugarParameter("@datatime", entity.DataTime), + new SugarParameter("@rsa", entity.RSa), + new SugarParameter("@continuetime", entity.ContinueTime), + new SugarParameter("@totalshuttime", entity.TotalShutTime), + new SugarParameter("@totalruntime", entity.TotalRunTime), + new SugarParameter("@boottimes", entity.BootTimes), + new SugarParameter("@analystatus", entity.AnalyStatus), + new SugarParameter("@analyinfo", entity.AnalyInfo) + }; return list; } diff --git a/Yw.Service.Run.Core/05-lcache/00-helper/CacheKeyHelper.cs b/Yw.Service.Run.Core/05-lcache/00-core/CacheKeyHelper.cs similarity index 100% rename from Yw.Service.Run.Core/05-lcache/00-helper/CacheKeyHelper.cs rename to Yw.Service.Run.Core/05-lcache/00-core/CacheKeyHelper.cs diff --git a/Yw.Service.Run.Core/06-exchange/00-helper/RunExchangeNameHelper.cs b/Yw.Service.Run.Core/06-exchange/00-core/RunExchangeNameHelper.cs similarity index 100% rename from Yw.Service.Run.Core/06-exchange/00-helper/RunExchangeNameHelper.cs rename to Yw.Service.Run.Core/06-exchange/00-core/RunExchangeNameHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/01-create/DALCreateHelper.cs b/Yw.Service.Run.Core/07-service/00-core/01-create/DALCreateHelper.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/01-create/DALCreateHelper.cs rename to Yw.Service.Run.Core/07-service/00-core/01-create/DALCreateHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/01-create/ExchangeCreateHelper.cs b/Yw.Service.Run.Core/07-service/00-core/01-create/ExchangeCreateHelper.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/01-create/ExchangeCreateHelper.cs rename to Yw.Service.Run.Core/07-service/00-core/01-create/ExchangeCreateHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/01-create/LCacheCreateHelper.cs b/Yw.Service.Run.Core/07-service/00-core/01-create/LCacheCreateHelper.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/01-create/LCacheCreateHelper.cs rename to Yw.Service.Run.Core/07-service/00-core/01-create/LCacheCreateHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/01-create/QueueCreateHelper.cs b/Yw.Service.Run.Core/07-service/00-core/01-create/QueueCreateHelper.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/01-create/QueueCreateHelper.cs rename to Yw.Service.Run.Core/07-service/00-core/01-create/QueueCreateHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/02-cache/CacheHelper.cs b/Yw.Service.Run.Core/07-service/00-core/02-cache/CacheHelper.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/02-cache/CacheHelper.cs rename to Yw.Service.Run.Core/07-service/00-core/02-cache/CacheHelper.cs diff --git a/Yw.Service.Run.Core/07-service/00-helper/03-extensions/Extensions.cs b/Yw.Service.Run.Core/07-service/00-core/03-extensions/Extensions.cs similarity index 100% rename from Yw.Service.Run.Core/07-service/00-helper/03-extensions/Extensions.cs rename to Yw.Service.Run.Core/07-service/00-core/03-extensions/Extensions.cs diff --git a/Yw.Service.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user b/Yw.Service.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user index fc7b8f7..5a921c6 100644 --- a/Yw.Service.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Yw.Service.Run.Core/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ --> <Project> <PropertyGroup> - <History>True|2024-04-26T03:47:42.9605330Z;True|2024-04-01T11:38:17.4702370+08:00;True|2024-03-26T09:45:14.8395625+08:00;True|2024-01-21T14:51:15.9123805+08:00;True|2024-01-08T16:59:10.2219250+08:00;True|2023-12-16T15:42:50.6196932+08:00;True|2023-12-11T11:51:25.0044564+08:00;True|2023-12-11T11:25:16.9392998+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> + <History>True|2024-04-30T05:45:44.5067765Z;True|2024-04-30T11:25:45.6839060+08:00;True|2024-04-30T11:25:41.5354173+08:00;True|2024-04-26T11:47:42.9605330+08:00;True|2024-04-01T11:38:17.4702370+08:00;True|2024-03-26T09:45:14.8395625+08:00;True|2024-01-21T14:51:15.9123805+08:00;True|2024-01-08T16:59:10.2219250+08:00;True|2023-12-16T15:42:50.6196932+08:00;True|2023-12-11T11:51:25.0044564+08:00;True|2023-12-11T11:25:16.9392998+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/Yw.Service.Run.Core/Yw.Service.Run.Core.csproj b/Yw.Service.Run.Core/Yw.Service.Run.Core.csproj index e233cd8..2c44527 100644 --- a/Yw.Service.Run.Core/Yw.Service.Run.Core.csproj +++ b/Yw.Service.Run.Core/Yw.Service.Run.Core.csproj @@ -7,7 +7,7 @@ <RootNamespace>Yw</RootNamespace> <GenerateDocumentationFile>True</GenerateDocumentationFile> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> - <Version>3.0.2</Version> + <Version>3.0.6</Version> <Description>寮曠敤鍗囩骇</Description> </PropertyGroup> -- Gitblit v1.9.3