新增重新分析 实时、时、日、月、年等常规分析测点接口
| | |
| | | /// <summary> |
| | | /// å符串ä¸è½ä¸ºç©º |
| | | /// </summary> |
| | | [ErrorCodeItemMetadata("{0} å符串ä¸è½ä¸ºç©º")] |
| | | S001, |
| | | [ErrorCodeItemMetadata("{0} ä¸è½ä¸ºç©º")] |
| | | S001, |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ä¸åå¨ |
| | | /// </summary> |
| | | [ErrorCodeItemMetadata("{0} æ°æ®ä¸åå¨")] |
| | | D001, |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ ¼å¼é误 |
| | | /// </summary> |
| | | [ErrorCodeItemMetadata("{0} æ°æ®æ ¼å¼é误ï¼ä¿¡æ¯ï¼{1}")] |
| | | D002, |
| | | } |
| | | |
| | | } |
| | |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\..\Calculation\IStation.Calculation4Analy\IStation.Calculation4Analy.csproj" /> |
| | | <ProjectReference Include="..\..\Calculation\IStation.Calculation4Handle\IStation.Calculation4Handle.csproj" /> |
| | | <ProjectReference Include="..\..\Service\IStation.Service4Main\IStation.Service4Main.csproj" /> |
| | | <ProjectReference Include="..\..\Service\IStation.Service4Monitor\IStation.Service4Monitor.csproj" /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Net; |
| | | using System.Net.Http.Headers; |
| | | using Microsoft.Extensions.Hosting.Internal; |
| | | using Microsoft.AspNetCore.Http.Extensions; |
| | | using IStation.Untity; |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | using IStation.Calculation; |
| | | using IStation.Model; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// MonitorGeneralDayRecord |
| | | /// </summary> |
| | | [Route("Run/MonitorGeneralDayRecord/Mgr")] |
| | | [ApiDescriptionSettings("Run", Name = "çæµå¸¸è§æ¥è®°å½(管ç)", Order = 930)] |
| | | public class MonitorGeneralDayRecord_MgrController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// éæ°åææä¸ªæ¥æåºé´ï¼ä»
é对ä¸ä¸ªå¸¸è§æ¥åææµç¹çåæï¼ä¼å é¤å·²æè®°å½ï¼ |
| | | /// </summary> |
| | | [Route("AnalyAgainOfDayRange@V1.0")] |
| | | [HttpPost] |
| | | public AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto AnalyAgainOfDayRange([Required] AnalyAgainMonitorGeneralDayRecordOfDayRangeInput input) |
| | | { |
| | | var corpId = input.CorpID; |
| | | var monitorId = input.MonitorPointID; |
| | | var startDay = input.StartDay.Date; |
| | | var endDay = input.EndDay.Date; |
| | | var monitor = new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, monitorId); |
| | | if (monitor == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"æµç¹:{monitorId}"); |
| | | } |
| | | if (monitor.CronType != Model.Monitor.eCronType.EachDay) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯æ¥æµç¹"); |
| | | } |
| | | if (monitor.SourceType != Model.Monitor.eSourceType.Analyse) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯åææµç¹"); |
| | | } |
| | | if (string.IsNullOrEmpty(monitor.SourceParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®åæåæ°"); |
| | | } |
| | | var analyModel = Model.Monitor.AnalyseParameters.ToModel(monitor.SourceParas); |
| | | if (analyModel == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "åæåæ°é
ç½®é误"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaType)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼ç±»å"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼åæ°"); |
| | | } |
| | | |
| | | var getMonitorPoint = new Func<long, Model.MonitorPoint_Signal_SignalType>(x => { |
| | | return new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, x); |
| | | }); |
| | | var getLastRecord = new Func<long, long, Model.MonitorBasicRecord>((x, y) => { |
| | | return new Service.MonitorDayRecord().GetBySignalIDOfDay(corpId, x, y, startDay.AddDays(-1)); |
| | | }); |
| | | var getRecordList = new Func<long, long,Model.Monitor.eCronType, DateTime,DateTime, List<Model.MonitorBasicRecord>>((x, y,cy, st,et) => { |
| | | switch (cy) |
| | | { |
| | | case Model.Monitor.eCronType.Real: |
| | | { |
| | | return new Service.MonitorRealRecord() |
| | | .GetBySignalIDOfTimeRange(corpId,x,y,st,et)?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | case Model.Monitor.eCronType.EachHour: |
| | | { |
| | | return new Service.MonitorHourRecord().GetBySignalIDOfHourRange |
| | | (monitor.CorpID, x, y, st.Date, st.Hour + 1, et.AddHours(-1).Date, et.AddHours(-1).Hour + 1)?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | default:return default; |
| | | } |
| | | }); |
| | | |
| | | List<Model.MonitorDayRecordPure> recordList = null; |
| | | string msg = string.Empty; |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Statistics_Max://æå¤§å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalDayMaxValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Min://æå°å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalDayMinValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Avg://å¹³åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalDayAvgValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Diff://å·®å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalDayDiffValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Sum://åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalDaySumValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | default: msg = $"䏿¯æçå
¬å¼ç±»å:{analyModel.FormulaType}"; break; |
| | | } |
| | | |
| | | if (recordList == null || recordList.Count < 1) |
| | | { |
| | | return new AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto(false, msg); |
| | | } |
| | | var bol = new Service.MonitorDayRecord().InsertsAgain(recordList); |
| | | return new AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto(bol, msg); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// éæ°åææ¥æåºé´å
ç常è§çæµæ¥è®°å½Input |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralDayRecordOfDayRangeInput : IValidatableObject |
| | | { |
| | | /// <summary> |
| | | /// 客æ·id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常è§å®æ¶æµç¹id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID å¿
须大äº0")] |
| | | public long MonitorPointID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å§æ¥æ |
| | | /// </summary> |
| | | public DateTime StartDay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ææ¥æ |
| | | /// </summary> |
| | | public DateTime EndDay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
| | | { |
| | | if(StartDay.Date>EndDay.Date) |
| | | { |
| | | yield return new ValidationResult( |
| | | "æ¥æåæ°é误" |
| | | , new[] { nameof(StartDay) } |
| | | ); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralDayRecordOfDayRangeResultDto(bool succeed,string msg) |
| | | { |
| | | this.Succeed = succeed; |
| | | this.Message = msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æå |
| | | /// </summary> |
| | | public bool Succeed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Net; |
| | | using System.Net.Http.Headers; |
| | | using Microsoft.Extensions.Hosting.Internal; |
| | | using Microsoft.AspNetCore.Http.Extensions; |
| | | using IStation.Untity; |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | using IStation.Calculation; |
| | | using IStation.Model; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// MonitorGeneralHourRecord |
| | | /// </summary> |
| | | [Route("Run/MonitorGeneralHourRecord/Mgr")] |
| | | [ApiDescriptionSettings("Run", Name = "çæµå¸¸è§æ¶è®°å½(管ç)", Order = 930)] |
| | | public class MonitorGeneralHourRecord_MgrController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// éæ°åææä¸ªæ¥æåºé´ï¼ä»
é对ä¸ä¸ªå¸¸è§æ¶åææµç¹çåæï¼ä¼å é¤å·²æè®°å½ï¼ |
| | | /// </summary> |
| | | [Route("AnalyAgainOfDayRange@V1.0")] |
| | | [HttpPost] |
| | | public AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto AnalyAgainOfDayRange([Required] AnalyAgainMonitorGeneralHourRecordOfDayRangeInput input) |
| | | { |
| | | var corpId = input.CorpID; |
| | | var monitorId = input.MonitorPointID; |
| | | var startDay = input.StartDay.Date; |
| | | var endDay = input.EndDay.Date; |
| | | var monitor = new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, monitorId); |
| | | if (monitor == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"æµç¹:{monitorId}"); |
| | | } |
| | | if (monitor.CronType != Model.Monitor.eCronType.EachHour) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯æ¶æµç¹"); |
| | | } |
| | | if (monitor.SourceType != Model.Monitor.eSourceType.Analyse) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯åææµç¹"); |
| | | } |
| | | if (string.IsNullOrEmpty(monitor.SourceParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®åæåæ°"); |
| | | } |
| | | var analyModel = Model.Monitor.AnalyseParameters.ToModel(monitor.SourceParas); |
| | | if (analyModel == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "åæåæ°é
ç½®é误"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaType)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼ç±»å"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼åæ°"); |
| | | } |
| | | |
| | | var getMonitorPoint = new Func<long, Model.MonitorPoint_Signal_SignalType>(x => { |
| | | return new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, x); |
| | | }); |
| | | var getLastRecord = new Func<long, long, Model.MonitorBasicRecord>((x, y) => { |
| | | return new Service.MonitorHourRecord().GetBySignalIDOfHour(corpId, x, y, startDay.AddDays(-1),24); |
| | | }); |
| | | var getRecordList = new Func<long, long,DateTime,DateTime, List<Model.MonitorBasicRecord>>((x, y,st,et) => { |
| | | return new Service.MonitorRealRecord().GetBySignalIDOfTimeRange(corpId, x, y,st,et )?.Select(t => t as Model.MonitorBasicRecord).ToList(); |
| | | }); |
| | | |
| | | List<Model.MonitorHourRecordPure> recordList = null; |
| | | string msg = string.Empty; |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Statistics_Max://æå¤§å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalHourMaxValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Min://æå°å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalHourMinValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Avg://å¹³åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalHourAvgValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Diff://å·®å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalHourDiffValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Sum://åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalHourSumValue |
| | | (startDay, endDay, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | default: msg = $"䏿¯æçå
¬å¼ç±»å:{analyModel.FormulaType}"; break; |
| | | } |
| | | |
| | | if (recordList == null || recordList.Count < 1) |
| | | { |
| | | return new AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto(false, msg); |
| | | } |
| | | var bol = new Service.MonitorHourRecord().InsertsAgain(recordList); |
| | | return new AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto(bol, msg); |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// éæ°åææ¥æåºé´å
ç常è§çæµæ¶è®°å½Input |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralHourRecordOfDayRangeInput : IValidatableObject |
| | | { |
| | | /// <summary> |
| | | /// 客æ·id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常è§å®æ¶æµç¹id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID å¿
须大äº0")] |
| | | public long MonitorPointID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å§æ¥æ |
| | | /// </summary> |
| | | public DateTime StartDay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ææ¥æ |
| | | /// </summary> |
| | | public DateTime EndDay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
| | | { |
| | | if(StartDay.Date>EndDay.Date) |
| | | { |
| | | yield return new ValidationResult( |
| | | "æ¥æåæ°é误" |
| | | , new[] { nameof(StartDay) } |
| | | ); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralHourRecordOfDayRangeResultDto(bool succeed,string msg) |
| | | { |
| | | this.Succeed = succeed; |
| | | this.Message = msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æå |
| | | /// </summary> |
| | | public bool Succeed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Net; |
| | | using System.Net.Http.Headers; |
| | | using Microsoft.Extensions.Hosting.Internal; |
| | | using Microsoft.AspNetCore.Http.Extensions; |
| | | using IStation.Untity; |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | using IStation.Calculation; |
| | | using IStation.Model; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// MonitorGeneralMonthRecord |
| | | /// </summary> |
| | | [Route("Run/MonitorGeneralMonthRecord/Mgr")] |
| | | [ApiDescriptionSettings("Run", Name = "çæµå¸¸è§æè®°å½(管ç)", Order = 930)] |
| | | public class MonitorGeneralMonthRecord_MgrController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// éæ°åææä¸ªæä»½åºé´ï¼ä»
é对ä¸ä¸ªå¸¸è§æåææµç¹çåæï¼ä¼å é¤å·²æè®°å½ï¼ |
| | | /// </summary> |
| | | [Route("AnalyAgainOfMonthRange@V1.0")] |
| | | [HttpPost] |
| | | public AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto AnalyAgainOfMonthRange |
| | | ([Required] AnalyAgainMonitorGeneralMonthRecordOfMonthRangeInput input) |
| | | { |
| | | var corpId = input.CorpID; |
| | | var monitorId = input.MonitorPointID; |
| | | var startYear=input.StartYear; |
| | | var endYear=input.EndYear; |
| | | var startMonth=input.StartMonth; |
| | | var endMonth=input.EndMonth; |
| | | var monitor = new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, monitorId); |
| | | if (monitor == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"æµç¹:{monitorId}"); |
| | | } |
| | | if (monitor.CronType != Model.Monitor.eCronType.EachMonth) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯ææµç¹"); |
| | | } |
| | | if (monitor.SourceType != Model.Monitor.eSourceType.Analyse) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯åææµç¹"); |
| | | } |
| | | if (string.IsNullOrEmpty(monitor.SourceParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®åæåæ°"); |
| | | } |
| | | var analyModel = Model.Monitor.AnalyseParameters.ToModel(monitor.SourceParas); |
| | | if (analyModel == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "åæåæ°é
ç½®é误"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaType)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼ç±»å"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼åæ°"); |
| | | } |
| | | |
| | | var getMonitorPoint = new Func<long, Model.MonitorPoint_Signal_SignalType>(x => { |
| | | return new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, x); |
| | | }); |
| | | var getLastRecord = new Func<long, long, Model.MonitorBasicRecord>((x, y) => { |
| | | var dtLast = new DateTime(startYear, startMonth, 1); |
| | | dtLast = dtLast.AddMonths(-1); |
| | | return new Service.MonitorMonthRecord().GetBySignalIDOfMonth(corpId, x, y, dtLast.Year,dtLast.Month); |
| | | }); |
| | | var getRecordList = new Func<long, long,Model.Monitor.eCronType, DateTime,DateTime, List<Model.MonitorBasicRecord>>((x, y,cy, st,et) => { |
| | | switch (cy) |
| | | { |
| | | case Model.Monitor.eCronType.Real: |
| | | { |
| | | return new Service.MonitorRealRecord() |
| | | .GetFixedBySignalIDOfTimeRange(corpId,x,y,10000,st,et)?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | case Model.Monitor.eCronType.EachDay: |
| | | { |
| | | return new Service.MonitorDayRecord().GetBySignalIDOfDayRange |
| | | (monitor.CorpID, x, y,st.Date,et.Date.AddDays(-1))?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | default:return default; |
| | | } |
| | | }); |
| | | |
| | | List<Model.MonitorMonthRecordPure> recordList = null; |
| | | string msg = string.Empty; |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Statistics_Max://æå¤§å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalMonthMaxValue |
| | | (startYear,startMonth,endYear,endMonth, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Min://æå°å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalMonthMinValue |
| | | (startYear, startMonth, endYear, endMonth, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Avg://å¹³åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalMonthAvgValue |
| | | (startYear, startMonth, endYear, endMonth, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Diff://å·®å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalMonthDiffValue |
| | | (startYear, startMonth, endYear, endMonth, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Sum://åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalMonthSumValue |
| | | (startYear, startMonth, endYear, endMonth, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | default: msg = $"䏿¯æçå
¬å¼ç±»å:{analyModel.FormulaType}"; break; |
| | | } |
| | | |
| | | if (recordList == null || recordList.Count < 1) |
| | | { |
| | | return new AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto(false, msg); |
| | | } |
| | | var bol = new Service.MonitorMonthRecord().InsertsAgain(recordList); |
| | | return new AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto(bol, msg); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// éæ°åææåºé´å
ç常è§çæµæè®°å½Input |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralMonthRecordOfMonthRangeInput : IValidatableObject |
| | | { |
| | | /// <summary> |
| | | /// 客æ·id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常è§å®æ¶æµç¹id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID å¿
须大äº0")] |
| | | public long MonitorPointID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å§å¹´ä»½ |
| | | /// </summary> |
| | | public int StartYear { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å§æä»½ |
| | | /// </summary> |
| | | public int StartMonth { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ææä»½ |
| | | /// </summary> |
| | | public int EndYear { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ææä»½ |
| | | /// </summary> |
| | | public int EndMonth { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
| | | { |
| | | var startDay = new DateTime(StartYear,StartMonth,1); |
| | | var endDay = new DateTime(EndYear,EndMonth,1); |
| | | if(startDay>endDay) |
| | | { |
| | | yield return new ValidationResult( |
| | | "æä»½åºé´åæ°é误" |
| | | , new[] { nameof(StartYear) } |
| | | ); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralMonthRecordOfMonthRangeResultDto(bool succeed,string msg) |
| | | { |
| | | this.Succeed = succeed; |
| | | this.Message = msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æå |
| | | /// </summary> |
| | | public bool Succeed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Net; |
| | | using System.Net.Http.Headers; |
| | | using Microsoft.Extensions.Hosting.Internal; |
| | | using Microsoft.AspNetCore.Http.Extensions; |
| | | using IStation.Untity; |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | using IStation.Calculation; |
| | | using IStation.Model; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// MonitorGeneralRealRecord |
| | | /// </summary> |
| | | [Route("Run/MonitorGeneralRealRecord/Mgr")] |
| | | [ApiDescriptionSettings("Run", Name = "çæµå¸¸è§å®æ¶è®°å½(管ç)", Order = 930)] |
| | | public class MonitorGeneralRealRecord_MgrController : IDynamicApiController |
| | | { |
| | | /// <summary> |
| | | /// 鿰忿天ï¼ä»
é对ä¸ä¸ªå¸¸è§å®æ¶åææµç¹ä¸å¤©çåæï¼ä¼å é¤å·²æè®°å½ï¼ |
| | | /// </summary> |
| | | [Route("AnalyAgainOfDay@V1.0")] |
| | | [HttpPost] |
| | | public AnalyAgainMonitorGeneralRealRecordOfDayResultDto AnalyAgainOfDay([Required] AnalyAgainMonitorGeneralRealRecordOfDayInput input) |
| | | { |
| | | var corpId = input.CorpID; |
| | | var monitorId = input.MonitorPointID; |
| | | var day = input.Day; |
| | | var monitor = new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId,monitorId); |
| | | if (monitor == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"æµç¹:{monitorId}"); |
| | | } |
| | | if (monitor.CronType != Model.Monitor.eCronType.Real) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}","䏿¯å®æ¶æµç¹"); |
| | | } |
| | | if (monitor.SourceType != Model.Monitor.eSourceType.Analyse) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯åææµç¹"); |
| | | } |
| | | if (string.IsNullOrEmpty(monitor.SourceParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®åæåæ°"); |
| | | } |
| | | var analyModel = Model.Monitor.AnalyseParameters.ToModel(monitor.SourceParas); |
| | | if (analyModel == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "åæåæ°é
ç½®é误"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaType)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼ç±»å"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼åæ°"); |
| | | } |
| | | |
| | | var startTime = day.Date;//å¼å§æ¶é´ |
| | | var endTime = day.AddDays(1).Date.AddSeconds(-1);//ç»ææ¶é´ |
| | | var getMonitorPoint = new Func<long, Model.MonitorPoint_Signal_SignalType>(x => { |
| | | return new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, x); |
| | | }); |
| | | var getLastRecord = new Func<long,long, Model.MonitorBasicRecord>((x,y) => { |
| | | return new Service.MonitorRealRecord().GetLastBySignalIDOfDay(corpId, x, y, day.AddDays(-1)); |
| | | }); |
| | | var getRecordList = new Func<long, long, List<Model.MonitorBasicRecord>>((x, y) => { |
| | | return new Service.MonitorRealRecord().GetBySignalIDOfDay(corpId, x, y, day)?.Select(t=>t as Model.MonitorBasicRecord).ToList(); |
| | | }); |
| | | |
| | | List<Model.MonitorRealRecordPure> recordList = null; |
| | | string msg = string.Empty; |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Calculation_SingleMapping://å䏿 å°è½¬æ¢ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuSingleMapping |
| | | (startTime,endTime,monitor,analyModel.FormulaParas,getMonitorPoint,getRecordList,getLastRecord,out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_CompareMapping://æ¯è¾æ å°è½¬æ¢ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuCompareMapping |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_RangeMapping://åºé´æ å°è½¬æ¢ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuRangeMapping |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_OnceRatio://ä¸å
ç³»æ°æ¢ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuOnceRatio |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_TwiceRatio://äºå
ç³»æ°æ¢ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuTwiceRatio |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_RunStatus://è¿è¡ç¶æè®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuRunStatus |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_Sum://åå¼è®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuSum |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_Diff://å·®å¼è®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuDiff |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_NumericAccumulate://æ°å¼ç´¯ç§¯è®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuNumberAccumulate |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_EnumAccumulate://æä¸¾ç´¯ç§¯è®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuEnumAccumulate |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_E://æçè®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuE |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_WP://åå¨è½èè®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuWP |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Calculation_UWP://åä½è½èè®¡ç® |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.CalcuUWP |
| | | (startTime, endTime, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | default:msg = $"䏿¯æçå
¬å¼ç±»å:{analyModel.FormulaType}";break; |
| | | } |
| | | |
| | | if (recordList == null || recordList.Count < 1) |
| | | { |
| | | return new AnalyAgainMonitorGeneralRealRecordOfDayResultDto(false, msg); |
| | | } |
| | | var bol = new Service.MonitorRealRecord().InsertsAgain(recordList); |
| | | return new AnalyAgainMonitorGeneralRealRecordOfDayResultDto(bol, msg); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// 鿰忿天ç常è§çæµå®æ¶è®°å½Input |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralRealRecordOfDayInput |
| | | { |
| | | /// <summary> |
| | | /// 客æ·id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常è§å®æ¶æµç¹id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID å¿
须大äº0")] |
| | | public long MonitorPointID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åææ¥æ |
| | | /// </summary> |
| | | public DateTime Day { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// 鿰忿天ç常è§çæµå®æ¶è®°å½ç»æç±» |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralRealRecordOfDayResultDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralRealRecordOfDayResultDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralRealRecordOfDayResultDto(bool succeed, string msg) |
| | | { |
| | | this.Succeed = succeed; |
| | | this.Message = msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æå |
| | | /// </summary> |
| | | public bool Succeed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¸å
³ä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Net; |
| | | using System.Net.Http.Headers; |
| | | using Microsoft.Extensions.Hosting.Internal; |
| | | using Microsoft.AspNetCore.Http.Extensions; |
| | | using IStation.Untity; |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | using IStation.Calculation; |
| | | using IStation.Model; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// MonitorGeneralYearRecord |
| | | /// </summary> |
| | | [Route("Run/MonitorGeneralYearRecord/Mgr")] |
| | | [ApiDescriptionSettings("Run", Name = "çæµå¸¸è§å¹´è®°å½(管ç)", Order = 930)] |
| | | public class MonitorGeneralYearRecord_MgrController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// éæ°åææä¸ªå¹´ä»½ä»½åºé´ï¼ä»
é对ä¸ä¸ªå¸¸è§å¹´åææµç¹çåæï¼ä¼å é¤å·²æè®°å½ï¼ |
| | | /// </summary> |
| | | [Route("AnalyAgainOfYearRange@V1.0")] |
| | | [HttpPost] |
| | | public AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto AnalyAgainOfYearRange |
| | | ([Required] AnalyAgainMonitorGeneralYearRecordOfYearRangeInput input) |
| | | { |
| | | var corpId = input.CorpID; |
| | | var monitorId = input.MonitorPointID; |
| | | var startYear=input.StartYear; |
| | | var endYear=input.EndYear; |
| | | var monitor = new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, monitorId); |
| | | if (monitor == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D001, $"æµç¹:{monitorId}"); |
| | | } |
| | | if (monitor.CronType != Model.Monitor.eCronType.EachYear) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯å¹´æµç¹"); |
| | | } |
| | | if (monitor.SourceType != Model.Monitor.eSourceType.Analyse) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "䏿¯åææµç¹"); |
| | | } |
| | | if (string.IsNullOrEmpty(monitor.SourceParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®åæåæ°"); |
| | | } |
| | | var analyModel = Model.Monitor.AnalyseParameters.ToModel(monitor.SourceParas); |
| | | if (analyModel == null) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "åæåæ°é
ç½®é误"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaType)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼ç±»å"); |
| | | } |
| | | if (string.IsNullOrEmpty(analyModel.FormulaParas)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.D002, $"æµç¹:{monitorId}", "æªé
ç½®å
¬å¼åæ°"); |
| | | } |
| | | |
| | | var getMonitorPoint = new Func<long, Model.MonitorPoint_Signal_SignalType>(x => { |
| | | return new Service.MonitorPoint().GetExSignalWithSignalTypeByID(corpId, x); |
| | | }); |
| | | var getLastRecord = new Func<long, long, Model.MonitorBasicRecord>((x, y) => { |
| | | return new Service.MonitorYearRecord().GetBySignalIDOfYear(corpId, x, y, startYear-1); |
| | | }); |
| | | var getRecordList = new Func<long, long,Model.Monitor.eCronType, DateTime,DateTime, List<Model.MonitorBasicRecord>>((x, y,cy, st,et) => { |
| | | switch (cy) |
| | | { |
| | | case Model.Monitor.eCronType.Real: |
| | | { |
| | | return new Service.MonitorRealRecord() |
| | | .GetFixedBySignalIDOfTimeRange(corpId,x,y,10000,st,et)?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | case Model.Monitor.eCronType.EachDay: |
| | | { |
| | | return new Service.MonitorDayRecord().GetBySignalIDOfDayRange |
| | | (monitor.CorpID, x, y,st.Date,et.Date.AddDays(-1))?.Select(x=>x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | case Model.Monitor.eCronType.EachMonth: |
| | | { |
| | | return new Service.MonitorMonthRecord().GetBySignalIDOfMonthRange |
| | | (monitor.CorpID, x, y, st.Year, st.Month, et.AddDays(-1).Year, et.AddDays(-1).Month)?.Select(x => x as Model.MonitorBasicRecord).ToList(); |
| | | } |
| | | default:return default; |
| | | } |
| | | }); |
| | | |
| | | List<Model.MonitorYearRecordPure> recordList = null; |
| | | string msg = string.Empty; |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Statistics_Max://æå¤§å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalYearMaxValue |
| | | (startYear,endYear, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Min://æå°å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalYearMinValue |
| | | (startYear, endYear, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Avg://å¹³åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalYearAvgValue |
| | | (startYear, endYear, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Diff://å·®å¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalYearDiffValue |
| | | (startYear, endYear, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | case Model.Monitor.FormulaType.Statistics_Sum://åå¼ç»è®¡ |
| | | { |
| | | recordList = MonitorFormulaHistoryCalcuHelper.StatisticalYearSumValue |
| | | (startYear, endYear, monitor, analyModel.FormulaParas, getMonitorPoint, getRecordList, getLastRecord, out msg); |
| | | } |
| | | break; |
| | | default: msg = $"䏿¯æçå
¬å¼ç±»å:{analyModel.FormulaType}"; break; |
| | | } |
| | | |
| | | if (recordList == null || recordList.Count < 1) |
| | | { |
| | | return new AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto(false, msg); |
| | | } |
| | | var bol = new Service.MonitorYearRecord().InsertsAgain(recordList); |
| | | return new AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto(bol, msg); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// éæ°åæå¹´åºé´å
ç常è§çæµå¹´è®°å½Input |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralYearRecordOfYearRangeInput : IValidatableObject |
| | | { |
| | | /// <summary> |
| | | /// 客æ·id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID å¿
须大äº0")] |
| | | public long CorpID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 常è§å®æ¶æµç¹id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID å¿
须大äº0")] |
| | | public long MonitorPointID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å§å¹´ä»½ |
| | | /// </summary> |
| | | public int StartYear { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ææä»½ |
| | | /// </summary> |
| | | public int EndYear { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
| | | { |
| | | if(StartYear>EndYear) |
| | | { |
| | | yield return new ValidationResult( |
| | | "年份åºé´åæ°é误" |
| | | , new[] { nameof(StartYear) } |
| | | ); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public AnalyAgainMonitorGeneralYearRecordOfYearRangeResultDto(bool succeed,string msg) |
| | | { |
| | | this.Succeed = succeed; |
| | | this.Message = msg; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦æå |
| | | /// </summary> |
| | | public bool Succeed { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»è®¡å·®å¼ |
| | | /// ç»è®¡åå¼ |
| | | /// </summary> |
| | | public static double StatisticalSumValue |
| | | ( |
| | |
| | | return srcValue; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return srcValue; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return srcValue; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return srcValue; |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | public const string Status_DataFormatError = "SZGSCW"; |
| | | |
| | | /// <summary> |
| | | /// 计ç®å¤±è´¥ |
| | | /// </summary> |
| | | public const string Status_CalculateFailed = "JSSB"; |
| | | |
| | | /// <summary> |
| | | /// 转æ¢å¤±è´¥ |
| | | /// </summary> |
| | | public const string Status_ConvertFailed = "ZHSB"; |
| | |
| | | |
| | | namespace IStation.DAL |
| | | { |
| | | /// <summary> |
| | | /// æ¶çæµè®°å½ |
| | | /// </summary> |
| | | public partial class MonitorHourRecord : CorpDAL<Entity.MonitorHourRecord> |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public override ConnectionConfig ConnectionConfig |
| | | { |
| | | get { return ConfigHelper.MonitorRecordConnectionConfig; } |
| | | } |
| | | /// <summary> |
| | | /// æ¶çæµè®°å½ |
| | | /// </summary> |
| | | public partial class MonitorHourRecord : CorpDAL<Entity.MonitorHourRecord> |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public override ConnectionConfig ConnectionConfig |
| | | { |
| | | get { return ConfigHelper.MonitorRecordConnectionConfig; } |
| | | } |
| | | |
| | | #region éè¿ MonitorPointID è·å |
| | | |
| | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.MonitorHourRecord>() |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID&&x.SignalID==SignalID) |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID && x.SignalID == SignalID) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc).ToList(); |
| | | } |
| | | } |
| | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.MonitorHourRecord>() |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID&&x.SignalID==SignalID && x.DataDay == Day.Date) |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID && x.SignalID == SignalID && x.DataDay == Day.Date) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc).ToList(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åææ¶çæ°æ® |
| | | /// </summary> |
| | | public Entity.MonitorHourRecord GetBySignalIDOfHour(long CorpID, long MonitorPointID, long SignalID, DateTime DataDay, int DataHour) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.MonitorHourRecord>() |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID && x.SignalID == SignalID) |
| | | .Where(x => x.DataDay == DataDay.Date && x.DataHour == DataHour) |
| | | .First(); |
| | | } |
| | | } |
| | | |
| | |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.MonitorHourRecord>() |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID&&x.SignalID==SignalID && x.DataDay >= StartDay.Date && x.DataDay <= EndDay.Date) |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID && x.SignalID == SignalID && x.DataDay >= StartDay.Date && x.DataDay <= EndDay.Date) |
| | | .OrderBy(x => x.DataTime, OrderByType.Asc).ToList(); |
| | | } |
| | | } |
| | |
| | | { |
| | | return db.Deleteable<Entity.MonitorHourRecord>() |
| | | .Where(x => x.CorpID == CorpID && x.MonitorPointID == MonitorPointID && x.SignalID == SignalID) |
| | | .Where(x => x.DataDay==DataDay.Date&&x.DataHour==DataHour) |
| | | .Where(x => x.DataDay == DataDay.Date && x.DataHour == DataHour) |
| | | .ExecuteCommand() > 0; |
| | | } |
| | | } |
| | |
| | | || (x.DataDay == StartDay.Date && x.DataDay < EndDay.Date && x.DataHour >= StartHour) |
| | | || (x.DataDay == EndDay.Date && x.DataDay > StartDay.Date && x.DataHour <= EndHour) |
| | | || (x.DataDay == StartDay.Date && x.DataDay == EndDay.Date && x.DataHour >= StartHour && x.DataHour <= EndHour)) |
| | | .ExecuteCommand()>0; |
| | | .ExecuteCommand() > 0; |
| | | } |
| | | } |
| | | |
| | |
| | | EndProject |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Application4LargeScreen", "Application\IStation.Application4LargeScreen\IStation.Application4LargeScreen.csproj", "{C18E7387-5CFA-4BC4-9886-ED25DE6DCFAE}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Entity4Job", "Entity\IStation.Entity4Job\IStation.Entity4Job.csproj", "{3A241303-BECA-4D81-B01E-8F75A6D70304}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Entity4Job", "Entity\IStation.Entity4Job\IStation.Entity4Job.csproj", "{3A241303-BECA-4D81-B01E-8F75A6D70304}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Model4Job", "Model\IStation.Model4Job\IStation.Model4Job.csproj", "{EE323F42-77EC-4AE4-B39C-F922DA61945D}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Model4Job", "Model\IStation.Model4Job\IStation.Model4Job.csproj", "{EE323F42-77EC-4AE4-B39C-F922DA61945D}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.DAL4Job", "DAL\IStation.DAL4Job\IStation.DAL4Job.csproj", "{C7C288AF-B39C-4E4A-9E0D-9D9943693E85}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.DAL4Job", "DAL\IStation.DAL4Job\IStation.DAL4Job.csproj", "{C7C288AF-B39C-4E4A-9E0D-9D9943693E85}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Service4Job", "Service\IStation.Service4Job\IStation.Service4Job.csproj", "{71B73D1F-56ED-44D3-A3E3-B409A2DF88F4}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Service4Job", "Service\IStation.Service4Job\IStation.Service4Job.csproj", "{71B73D1F-56ED-44D3-A3E3-B409A2DF88F4}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Application4Job", "Application\IStation.Application4Job\IStation.Application4Job.csproj", "{398CD0EE-C62E-4E44-85FB-AC04A0DE30CE}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Application4Job", "Application\IStation.Application4Job\IStation.Application4Job.csproj", "{398CD0EE-C62E-4E44-85FB-AC04A0DE30CE}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Entity4Epanet", "Entity\IStation.Entity4Epanet\IStation.Entity4Epanet.csproj", "{F851F9AA-7267-4AF8-B60C-C62FB21F5A3A}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Entity4Epanet", "Entity\IStation.Entity4Epanet\IStation.Entity4Epanet.csproj", "{F851F9AA-7267-4AF8-B60C-C62FB21F5A3A}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Model4Epanet", "Model\IStation.Model4Epanet\IStation.Model4Epanet.csproj", "{B9D5D2DA-09E9-4853-AD30-1D2717F21B90}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Model4Epanet", "Model\IStation.Model4Epanet\IStation.Model4Epanet.csproj", "{B9D5D2DA-09E9-4853-AD30-1D2717F21B90}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.DAL4Epanet", "DAL\IStation.DAL4Epanet\IStation.DAL4Epanet.csproj", "{85CDAFFC-F0BE-4328-ADC3-CA54C44CB411}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.DAL4Epanet", "DAL\IStation.DAL4Epanet\IStation.DAL4Epanet.csproj", "{85CDAFFC-F0BE-4328-ADC3-CA54C44CB411}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Service4Epanet", "Service\IStation.Service4Epanet\IStation.Service4Epanet.csproj", "{18557443-7507-41F7-93CD-156104EA164E}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Service4Epanet", "Service\IStation.Service4Epanet\IStation.Service4Epanet.csproj", "{18557443-7507-41F7-93CD-156104EA164E}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IStation.Application4Epanet", "Application\IStation.Application4Epanet\IStation.Application4Epanet.csproj", "{0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3}" |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Application4Epanet", "Application\IStation.Application4Epanet\IStation.Application4Epanet.csproj", "{0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3}" |
| | | EndProject |
| | | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Calculation4Analy", "Calculation\IStation.Calculation4Analy\IStation.Calculation4Analy.csproj", "{06A261AF-DF88-411A-BC4F-318CF38DA62D}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | |
| | | {0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {06A261AF-DF88-411A-BC4F-318CF38DA62D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {06A261AF-DF88-411A-BC4F-318CF38DA62D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {06A261AF-DF88-411A-BC4F-318CF38DA62D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {06A261AF-DF88-411A-BC4F-318CF38DA62D}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
| | |
| | | {85CDAFFC-F0BE-4328-ADC3-CA54C44CB411} = {49E7CA43-7FD9-48A3-B0DB-6D99FA93F393} |
| | | {18557443-7507-41F7-93CD-156104EA164E} = {3BE2BA1A-B93F-4EDE-BC37-915663317C33} |
| | | {0E635F6A-71C0-4BC4-AE69-6ABCFC902BA3} = {C7614DA2-0679-407D-B9E3-66D448DD7488} |
| | | {06A261AF-DF88-411A-BC4F-318CF38DA62D} = {B1548C2C-C3C2-47C0-8F6E-B265D0603099} |
| | | EndGlobalSection |
| | | GlobalSection(ExtensibilityGlobals) = postSolution |
| | | SolutionGuid = {18D1EA07-81E5-4443-8512-F303BC79DCF4} |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | switch (analyModel.FormulaType) |
| | | { |
| | | case Model.Monitor.FormulaType.Calculation_SingleMapping: |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæå¤©çæ°æ® |
| | | /// </summary> |
| | | public Model.MonitorDayRecord GetBySignalIDOfDay(long CorpID, long MonitorPointID, long SignalID, DateTime Day) |
| | | { |
| | | var dal = new DAL.MonitorDayRecord(); |
| | | var entity = dal.GetBySignalIDOfDay(CorpID, MonitorPointID,SignalID, Day.Date); |
| | | var model = Entity2Model(entity); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¥æåºé´å
çæ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorDayRecord> GetBySignalIDOfDayRange(long CorpID, long MonitorPointID, long SignalID, DateTime StartDay, DateTime EndDay) |
| | | { |
| | | if (StartDay.Date > EndDay.Date) |
| | | return default; |
| | | var dal = new DAL.MonitorDayRecord(); |
| | | var entityList = dal.GetBySignalIDOfDayRange(CorpID, MonitorPointID, SignalID, StartDay.Date, EndDay.Date); |
| | | var modelList = Entity2Models(entityList); |
| | | return modelList; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¥æåºé´å
çåºç¡å
å®¹æ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorBasicRecordContent> GetBasicContentBySignalIDOfDayRange(long CorpID, long MonitorPointID,long SignalID, DateTime StartDay, DateTime EndDay) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åææ¶çæ°æ® |
| | | /// </summary> |
| | | public Model.MonitorHourRecord GetBySignalIDOfHour(long CorpID, long MonitorPointID, long SignalID, DateTime DataDay, int DataHour) |
| | | { |
| | | var dal = new DAL.MonitorHourRecord(); |
| | | var entity = dal.GetBySignalIDOfHour(CorpID,MonitorPointID,SignalID,DataDay,DataHour); |
| | | var model=Entity2Model(entity); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¶é´åºé´å
çæ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorHourRecord> GetBySignalIDOfHourRange(long CorpID, long MonitorPointID, long SignalID, DateTime StartDay, int StartHour, DateTime EndDay, int EndHour) |
| | | { |
| | | if (EndDay.Date < StartDay.Date) |
| | | return default; |
| | | var dal = new DAL.MonitorHourRecord(); |
| | | var entityList = dal.GetBySignalIDOfHourRange(CorpID, MonitorPointID, SignalID, StartDay.Date, StartHour, EndDay.Date, EndHour); |
| | | var modelList = Entity2Models(entityList); |
| | | return modelList; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¶é´åºé´å
çåºç¡å
å®¹æ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorBasicRecordContent> GetBasicContentBySignalIDOfHourRange(long CorpID, long MonitorPointID,long SignalID, DateTime StartDay, int StartHour, DateTime EndDay, int EndHour) |
| | | { |
| | | if (EndDay.Date < StartDay.Date) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åææçæ°æ® |
| | | /// </summary> |
| | | public Model.MonitorMonthRecord GetBySignalIDOfMonth(long CorpID, long MonitorPointID, long SignalID, int DataYear, int DataMonth) |
| | | { |
| | | var dal = new DAL.MonitorMonthRecord(); |
| | | var entity = dal.GetBySignalIDOfMonth(CorpID, MonitorPointID, SignalID, DataYear, DataMonth); |
| | | var model = Entity2Model(entity); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæåºé´å
çæ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorMonthRecord> GetBySignalIDOfMonthRange(long CorpID, long MonitorPointID, long SignalID, int StartYear, int StartMonth, int EndYear, int EndMonth) |
| | | { |
| | | var dal = new DAL.MonitorMonthRecord(); |
| | | var entityList = dal.GetBySignalIDOfMonthRange(CorpID, MonitorPointID, SignalID, StartYear, StartMonth, EndYear, EndMonth); |
| | | var modelList = Entity2Models(entityList); |
| | | return modelList; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæåºé´å
çåºç¡å
å®¹æ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorBasicRecordContent> GetBasicContentBySignalIDOfMonthRange(long CorpID, long MonitorPointID,long SignalID, int StartYear, int StartMonth, int EndYear, int EndMonth) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¶é´åºé´å
çæ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorRealRecord> GetBySignalIDOfTimeRange(long CorpID, long MonitorPointID, long SignalID, DateTime StartTime, DateTime EndTime) |
| | | { |
| | | if (StartTime > EndTime) |
| | | return default; |
| | | var dal = new DAL.MonitorRealRecord(); |
| | | var entityList = dal.GetBySignalIDOfTimeRange(CorpID, MonitorPointID, SignalID, StartTime, EndTime); |
| | | var modelList= Entity2Models(entityList); |
| | | return modelList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¶é´åºé´å
çåºå®æ°éçæ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorRealRecord> GetFixedBySignalIDOfTimeRange(long CorpID, long MonitorPointID, long SignalID, int Fixed, DateTime StartTime, DateTime EndTime) |
| | | { |
| | | if (StartTime > EndTime) |
| | | return default; |
| | | var dal = new DAL.MonitorRealRecord(); |
| | | var entityList = dal.GetFixedBySignalIDOfTimeRange(CorpID, MonitorPointID, SignalID, Fixed, StartTime, EndTime); |
| | | var modelList=Entity2Models(entityList); |
| | | return modelList; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæ¶é´åºé´å
çå
å®¹æ°æ® |
| | | /// </summary> |
| | | public List<Model.MonitorRealRecordContent> GetContentBySignalIDOfTimeRange(long CorpID, long MonitorPointID, long SignalID, DateTime StartTime, DateTime EndTime) |
| | |
| | | return model_list?.OrderBy(x => x.DataYear).ThenBy(x => x.DataTime).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ SignalID è·åæå¹´çæ°æ® |
| | | /// </summary> |
| | | public Model.MonitorYearRecord GetBySignalIDOfYear(long CorpID, long MonitorPointID, long SignalID, int Year) |
| | | { |
| | | var dal = new DAL.MonitorYearRecord(); |
| | | var entity = dal.GetBySignalIDOfYear(CorpID, MonitorPointID,SignalID, Year); |
| | | var model = Entity2Model(entity); |
| | | return model; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Insert |