优化运行分析,运行记录结构更改,运行服务新增监测中断判断
已重命名27个文件
已修改29个文件
已添加2个文件
| | |
| | | config.ForType<AddRunRealLastRecordInput, Model.RunRealRecord>() |
| | | .Map(dest => dest.DataTime, src => DateTime.Now) |
| | | .Map(dest => dest.AnalyStatus, src => AnalyStatus.Normal); |
| | | |
| | | #endregion |
| | | |
| | | } |
| | |
| | | --> |
| | | <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> |
| | |
| | | <RootNamespace>Yw.Application</RootNamespace> |
| | | <GenerateDocumentationFile>True</GenerateDocumentationFile> |
| | | <GeneratePackageOnBuild>True</GeneratePackageOnBuild> |
| | | <Version>3.0.2</Version> |
| | | <Version>3.0.6</Version> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | |
| | | <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> |
| | |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç(ç§) |
| | | /// </summary> |
| | | [Required] |
| | | public int Frequency { get; set; } |
| | |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç(ç§) |
| | | /// </summary> |
| | | public int Frequency { get; set; } |
| | | |
| | |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç(ç§) |
| | | /// </summary> |
| | | [Required] |
| | | public int Frequency { get; set; } |
| | |
| | | public long ID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç(ç§) |
| | | /// </summary> |
| | | [Required] |
| | | public int Frequency { get; set; } |
| | |
| | | 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> |
| | | /// æ»è¿è¡æ¶é´ |
| | |
| | | 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; |
| | |
| | | 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> |
| | | /// æ»è¿è¡æ¶é´ |
| | |
| | | --> |
| | | <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> |
| | |
| | | <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> |
| | |
| | | |
| | | #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) |
| | |
| | | |
| | | #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}ï¼"); |
| | | } |
| | |
| | | namespace Yw.Server |
| | | using 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> |
| | |
| | | { |
| | | return false; |
| | | } |
| | | if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1) |
| | | if (_dict[configureId].Distinct().Count() > 1) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | namespace Yw.Server |
| | | using Yw.Service.Basic; |
| | | using Yw.Service.Monitor; |
| | | |
| | | namespace Yw.Server |
| | | { |
| | | /// <summary> |
| | | /// 设å¤è¿è¡åæåä»»å¡ |
| | |
| | | |
| | | #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($"设å¤è¿è¡åæåä»»å¡ä¸ï¼è®¾å¤id:{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, |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #region æ°æ®åå¨ |
| | | |
| | | var bol = new Yw.Service.RunRealRecord().InsertLastRecord(run_record); |
| | | var bol = new Yw.Service.RunRealRecord().InsertLastRecord(runRecord); |
| | | if (bol) |
| | | { |
| | | LogHelper.Info($"设å¤è¿è¡åæåä»»å¡ä¸ï¼è®¾å¤id:{configure.ObjectID} è¿è¡è®°å½åææåï¼"); |
| | |
| | | |
| | | #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()) |
| | |
| | | |
| | | #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}ï¼"); |
| | | } |
| | |
| | | namespace Yw.Server |
| | | using 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> |
| | |
| | | { |
| | | return false; |
| | | } |
| | | if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1) |
| | | if (_dict[configureId].Distinct().Count() > 1) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | namespace Yw.Server |
| | | using Yw.LCache.Medis; |
| | | using Yw.Service.Basic; |
| | | using Yw.Service.Monitor; |
| | | |
| | | namespace Yw.Server |
| | | { |
| | | /// <summary> |
| | | /// å·¥ä½è¿è¡åæåä»»å¡ |
| | |
| | | |
| | | #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($"å·¥ä½è¿è¡åæåä»»å¡ä¸ï¼è®¾å¤id:{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; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #region æ°æ®åå¨ |
| | | |
| | | var bol = service_run_record.Value.InsertLastRecord(run_record); |
| | | var bol = service_run_record.Value.InsertLastRecord(runRecord); |
| | | if (bol) |
| | | { |
| | | LogHelper.Info($"å·¥ä½è¿è¡åæåä»»å¡ä¸ï¼å·¥ä½åç§°:{currentWorkSite.Name}ï¼å·¥ä½id:{currentWorkSite.ID}, è¿è¡è®°å½åææåï¼"); |
| | |
| | | <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> |
| | |
| | | public const int Unknow = -99; |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ä¸æ |
| | | /// </summary> |
| | | public const int Interrupt = -4; |
| | | |
| | | /// <summary> |
| | | /// æ°æ®å¼å¸¸ |
| | | /// </summary> |
| | | public const int Abnormal = -3; |
| | |
| | | /// </summary> |
| | | public class DataType |
| | | { |
| | | /// <summary> |
| | | /// è¿è¡åæé
ç½® |
| | | /// </summary> |
| | | |
| | | |
| | | public const string RunAnalyConfigure = "run-analy-configure"; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Run |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class Flags |
| | | { |
| | | /// <summary> |
| | | /// é»è®¤ |
| | | /// </summary> |
| | | public const string é»è®¤ = "é»è®¤"; |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// åæº |
| | | /// </summary> |
| | | public const int Stop = 0; |
| | | public const int Shut = 0; |
| | | |
| | | /// <summary> |
| | | /// 弿º |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Run |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class SysParas |
| | | { |
| | | /// <summary> |
| | | /// å¯ç¨çæµä¸æå¤æ |
| | | /// </summary> |
| | | public const string EnableMonitorInterruptJudgement = "run-enable-monitor-interrupt-judgement"; |
| | | |
| | | } |
| | | } |
| | |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç ï¼ç§ï¼ |
| | | /// </summary> |
| | | public int Frequency { get; set; } |
| | | |
| | |
| | | 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; |
| | |
| | | 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; } |
| | | |
| | |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç |
| | | /// åæé¢ç (ç§) |
| | | /// </summary> |
| | | public int Frequency { get; set; } |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; } |
| | | |
ÎļþÃû´Ó Yw.Service.Run.Core/03-settings/helper/RunFileHelper.cs ÐÞ¸Ä |
| | |
| | | internal static bool Save() |
| | | { |
| | | if (_appparas == null) |
| | | { |
| | | return default; |
| | | } |
| | | var json = JsonHelper.Object2FormatJson(_appparas); |
| | | File.WriteAllText(JsonFileName, json, Encoding.UTF8); |
| | | return true; |
ÎļþÃû´Ó Yw.Service.Run.Core/03-settings/paras/Paras_Run.cs ÐÞ¸Ä |
| | |
| | | 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; } |
| | |
| | | /// </summary> |
| | | public Paras_Run_Task Task { get; set; } |
| | | |
| | | /// <summary> |
| | | /// CAL |
| | | /// </summary> |
| | | public Paras_Run_CAL CAL { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | { |
| | | 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,"); |
| | |
| | | //åå»ºåæ° |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | { |
| | | 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,"); |
| | |
| | | //åå»ºåæ° |
| | | 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; |
| | | } |
| | | |
| | |
| | | --> |
| | | <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> |
| | |
| | | <RootNamespace>Yw</RootNamespace> |
| | | <GenerateDocumentationFile>True</GenerateDocumentationFile> |
| | | <GeneratePackageOnBuild>True</GeneratePackageOnBuild> |
| | | <Version>3.0.2</Version> |
| | | <Version>3.0.6</Version> |
| | | <Description>å¼ç¨å级</Description> |
| | | </PropertyGroup> |
| | | |