123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using Application.VaporRecoveryOnlineWatchHubApp;
- using Application.VaporRecoveryOnlineWatchHubApp.UnversalApiModels;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using VaporRecoveryOnlineWatchHubApp.Config;
- using static Application.VaporRecoveryOnlineWatchHubApp.App;
- namespace VaporRecoveryOnlineWatchHubApp.UnversalApiModels
- {
- /// <summary>
- /// VR Board will watch on each nozzels, and for user side, they care about the nozzles, thus here bring in a logical vr nozzle concept.
- /// </summary>
- public class VRBoardNozzle
- {
- public int SiteLevelNozzleId { get; set; }
- //public int SiteLevelDispenserId { get; set; }
- /// <summary>
- /// inidcates if this nozzle's vapor recovery facility works good or not.
- /// this state is caculated from a period of time.
- /// </summary>
- public VRBoardNozzleTrxHealthStateEnum HealthState { get; set; }
- //public int PayableTrxes { get; set; }
- //public double LastTrxVaporVolume { get; set; }
- //public double LastTrxLiquidVolume { get; set; }
- //public double LastTrxVaporLiquidRatio { get; set; }
- public VRBoardNozzleTrxFlowData LatestTrxFlowData { get; set; }
- //public bool StatusOk { get; set; }
- public VRBoardNozzleFuelingStateEnum FuelingState { get; set; }
- public string PerNozzleVRGroupQualificationDefinitionGroupName { get; set; }
- public override string ToString()
- {
- return GetType().GetProperties().Aggregate(string.Empty,
- (result, next) => result + $"{next.Name} : {(next.GetValue(this)?.ToString()) ?? string.Empty} ");
- }
- }
- public enum VRBoardNozzleTrxHealthStateEnum
- {
- NORMAL,
- WARNING,
- ALARM,
- NOT_SET
- }
- public enum VRBoardNozzleFuelingStateEnum
- {
- IDLE,
- FUELING
- }
- //public class Nozzles
- //{
- // public List<LogicalVRNozzle> data { get; set; } = new List<LogicalVRNozzle>();
- // public Nozzles Add(LogicalVRNozzle nozzle)
- // {
- // data.Add(nozzle);
- // return this;
- // }
- // public static Nozzles Build(NozzleConfigs config)
- // {
- // var nozzleStatus = new Nozzles();
- // config.data.ForEach( i =>
- // nozzleStatus.Add(new LogicalVRNozzle
- // {
- // SiteLevelNozzleId = i.SiteLevelNozzleId,
- // SiteLevelDispenserId = i.SiteLevelDispenserId,
- // OverallVRState = i.DataCollectorDeviceId == 0 ? NozzleOverallVRStateEnum.NO_VR : NozzleOverallVRStateEnum.DISCONNETED,
- // PayableTrxes = 0,
- // VaporVolume = 0,
- // LiquidVolume = 0,
- // VaporLiquidRatio = 0,
- // FuelingStatus = FuelingStatus.IDLE
- // })
- // );
- // return nozzleStatus;
- // }
- // public LogicalVRNozzle GetNozzleById(int nozzleId)
- // {
- // return data.Where(i => i.SiteLevelNozzleId == nozzleId).FirstOrDefault();
- // }
- //}
- //public static class NozzlesExtension
- //{
- // public static Nozzles Sort(this Nozzles self)
- // {
- // self.data = self.data.OrderBy(x => x.SiteLevelNozzleId).ToList();
- // return self;
- // }
- // public static Nozzles Update(this Nozzles nozzles, LogicalVRNozzle nozzle)
- // {
- // nozzles.data.RemoveAll(i => i.SiteLevelNozzleId == nozzle.SiteLevelNozzleId);
- // nozzles.Add(nozzle).Sort();
- // return nozzles;
- // }
- // public static Nozzles UpdateVrState(this Nozzles nozzles, List<int> siteLevelNozzleIdList, NozzleOverallVRStateEnum vRState)
- // {
- // nozzles.data.ForEach(i => {
- // if (siteLevelNozzleIdList.Contains(i.SiteLevelNozzleId))
- // {
- // i.OverallVRState = vRState;
- // }
- // });
- // return nozzles;
- // }
- //}
- }
|