¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// LogicDma |
| | | /// </summary> |
| | | [Route("SZJT/Logic/Dma")] |
| | | [ApiDescriptionSettings("SZJT", Name = "ååº", Order = 50000)] |
| | | public class LogicDma_Controller : IDynamicApiController |
| | | { |
| | | |
| | | private readonly Service.LogicDma _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | | [Route("GetAll@V1.0")] |
| | | [HttpGet] |
| | | public List<LogicDmaDto> GetAll() |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vmList = list?.Select(x => new LogicDmaDto(x)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | [Route("GetByID@V1.0")] |
| | | [HttpGet] |
| | | public LogicDmaDto GetByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | return model == null ? null : new LogicDmaDto(model); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ Ids è·å |
| | | /// </summary> |
| | | [Route("GetByIds@V1.0")] |
| | | [HttpGet] |
| | | public List<LogicDmaDto> GetByIds([FromQuery][Required] IdsInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.Ids); |
| | | var list = _service.GetByIds(ids); |
| | | var vmList = list?.Select(x => new LogicDmaDto(x)).ToList(); |
| | | return vmList; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡ |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert([Required] AddLogicDmaInput input) |
| | | { |
| | | if (!string.IsNullOrEmpty(input.Code)) |
| | | { |
| | | if (_service.IsExistCode(input.Code)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code}", "ç¼ç å·²åå¨"); |
| | | } |
| | | } |
| | | if (!string.IsNullOrEmpty(input.TagName)) |
| | | { |
| | | if (_service.IsExistTagName(input.TagName)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"TagName:{input.TagName}", "æ è®°å·²åå¨"); |
| | | } |
| | | } |
| | | var model = input.Adapt<AddLogicDmaInput, Model.LogicDma>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update([Required] UpdateLogicDmaInput input) |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, $"ID:{input.ID} æ°æ®ä¸åå¨"); |
| | | } |
| | | if (!string.IsNullOrEmpty(input.Code)) |
| | | { |
| | | if (_service.IsExistCodeExceptID(input.Code, input.ID)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"Code:{input.Code}", "ç¼ç å·²åå¨"); |
| | | } |
| | | } |
| | | if (!string.IsNullOrEmpty(input.TagName)) |
| | | { |
| | | if (_service.IsExistTagNameExceptID(input.TagName, input.ID)) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.V001, $"TagName:{input.TagName}", "æ è®°å·²åå¨"); |
| | | } |
| | | } |
| | | var rhs = new Model.LogicDma(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåºç |
| | | /// </summary> |
| | | [Route("UpdateSortCode@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateSortCode([Required] UpdateSortCodeInput input) |
| | | { |
| | | var bol = _service.UpdateSortCode(input.ID, input.SortCode); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåº |
| | | /// </summary> |
| | | [Route("UpdateSorter@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateSorter([Required] List<UpdateSortCodeInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<Yw.Model.Sorter>()).ToList(); |
| | | var bol = _service.UpdateSorter(list); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° Paras |
| | | /// </summary> |
| | | [Route("UpdateParas@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateParas([Required] UpdateParasInput input) |
| | | { |
| | | var bol = _service.UpdateParas(input.ID, input.Paras); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° Flags |
| | | /// </summary> |
| | | [Route("UpdateFlags@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateFlags([Required] UpdateFlagsInput input) |
| | | { |
| | | var bol = _service.UpdateFlags(input.ID, input.Flags); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°TagName |
| | | /// </summary> |
| | | [Route("UpdateTagName@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateTagName([Required] UpdateTagNameInput input) |
| | | { |
| | | if (!string.IsNullOrEmpty(input.TagName)) |
| | | { |
| | | if (_service.IsExistTagNameExceptID(input.TagName, input.ID)) |
| | | { |
| | | throw Oops.Oh(ErrorCodes.V001, $"TagName:{input.TagName}", "æ è®°åç§°å·²åå¨"); |
| | | } |
| | | } |
| | | var bol = _service.UpdateTagName(input.ID, input.TagName); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° UseStatus |
| | | /// </summary> |
| | | [Route("UpdateUseStatus@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateUseStatus([Required] UpdateUseStatusInput input) |
| | | { |
| | | var bol = _service.UpdateUseStatus(input.ID, (Yw.Model.eUseStatus)input.UseStatus); |
| | | return bol; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region Exist |
| | | |
| | | /// <summary> |
| | | /// 夿 Code æ¯å¦åå¨ |
| | | /// </summary> |
| | | [Route("IsExistCode@V1.0")] |
| | | [HttpGet] |
| | | public bool IsExistCode([FromQuery][Required] CodeInput input) |
| | | { |
| | | var bol = _service.IsExistCode(input.Code); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿 Code æ¯å¦åå¨ ExceptID |
| | | /// </summary> |
| | | [Route("IsExistCodeExceptID@V1.0")] |
| | | [HttpGet] |
| | | public bool IsExistCodeExceptID([FromQuery][Required] CodeExceptInput input) |
| | | { |
| | | var bol = _service.IsExistCodeExceptID(input.Code, input.ExceptID); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿TagNameæ¯å¦åå¨ |
| | | /// </summary> |
| | | [Route("IsExistTagName@V1.0")] |
| | | [HttpGet] |
| | | public bool IsExistTagName([FromQuery][Required] TagNameInput input) |
| | | { |
| | | var bol = _service.IsExistTagName(input.TagName); |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿TagNameæ¯å¦åå¨ ExceptID |
| | | /// </summary> |
| | | [Route("IsExistTagNameExceptID@V1.0")] |
| | | [HttpGet] |
| | | public bool IsExistTagNameExceptID([FromQuery][Required] TagNameExceptInput input) |
| | | { |
| | | var bol = _service.IsExistTagNameExceptID(input.TagName, input.ExceptID); |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Delete |
| | | |
| | | /// <summary> |
| | | /// å é¤ |
| | | /// </summary> |
| | | [Route("DeleteByID@V1.0")] |
| | | [HttpDelete] |
| | | public bool DeleteByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var bol = _service.DeleteByID(input.ID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, ErrorCodes.D001, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class AddLogicDmaInput |
| | | { |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | [Required] |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public Dictionary<string, string> Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public List<string> Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class LogicDmaDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDmaDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDmaDto(Model.LogicDma rhs) |
| | | { |
| | | this.ID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.Code = rhs.Code; |
| | | this.Paras = rhs.Paras; |
| | | this.Flags = rhs.Flags; |
| | | this.TagName = rhs.TagName; |
| | | this.UseStatus = rhs.UseStatus; |
| | | this.SortCode = rhs.SortCode; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// id |
| | | /// </summary> |
| | | public long ID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public Dictionary<string, string> Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public List<string> Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 使ç¨ç¶æ |
| | | /// </summary> |
| | | public Yw.Model.eUseStatus UseStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåºç |
| | | /// </summary> |
| | | public int SortCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class UpdateLogicDmaInput |
| | | { |
| | | /// <summary> |
| | | /// id |
| | | /// </summary> |
| | | [Required, Range(1, long.MaxValue, ErrorMessage = "ID å¿
须大äº0")] |
| | | public long ID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | [Required] |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public Dictionary<string, string> Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public List<string> Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// LogicDma |
| | | /// </summary> |
| | | [Route("SZJT/Logic/Dma/Std")] |
| | | [ApiDescriptionSettings("SZJT", Name = "ååº(Std)", Order = 49900)] |
| | | public class LogicDma_StdController : IDynamicApiController |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | | [Route("GetAll@V1.0")] |
| | | [HttpGet] |
| | | public List<LogicDmaStdDto> GetAll() |
| | | { |
| | | var keyContent = $"SZJT_Logic_Dma_Std_GetAll"; |
| | | var cacheKey = MemoryCacheKeyHelper.GetKey(MemoryCacheKey.WebApiLevel, MemoryCacheKey.Module, keyContent); |
| | | |
| | | var vm_list = MemoryCacheHelper.GetSet(cacheKey, () => |
| | | { |
| | | var all = new Service.LogicDma().GetAll(); |
| | | Service.LogicDma.PublishCache(cacheKey); |
| | | var vmList = all?.Select(x => new LogicDmaStdDto(x)).ToList(); |
| | | return vmList; |
| | | }, CacheHelper.CacheLevel1); |
| | | return vm_list; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class LogicDmaStdDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDmaStdDto() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDmaStdDto(Model.LogicDma rhs) |
| | | { |
| | | this.ID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.Code = rhs.Code; |
| | | this.Paras = rhs.Paras; |
| | | this.Flags = rhs.Flags; |
| | | this.TagName = rhs.TagName; |
| | | this.SortCode = rhs.SortCode; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// id |
| | | /// </summary> |
| | | public long ID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public Dictionary<string, string> Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public List<string> Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåºç |
| | | /// </summary> |
| | | public int SortCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// StationPanel |
| | | /// </summary> |
| | | [Route("SZJT/Station/Panel")] |
| | | [ApiDescriptionSettings("SZJT", Name = "æ³µç«é¢æ¿(Logic)", Order = 8000)] |
| | | public class StationPanel_LogicController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// è·åçæµKPIå表 |
| | | /// </summary> |
| | | [Route("GetMonitorKpiList@V1.0")] |
| | | [HttpGet] |
| | | public List<StationPanelMonitorKpiInfoDto> GetMonitorKpiList(int Count = 4) |
| | | { |
| | | var allStationList = new Service.LogicSite().GetAll(); |
| | | if (allStationList == null || allStationList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var serviceMonitor = new Yw.Service.MonitorPoint(); |
| | | var serviceMonitorRecord = new Yw.Service.MonitorRealRecord(); |
| | | var serviceEquipment = new Yw.Service.Equipment(); |
| | | var serviceRunRecord = new Yw.Service.RunRealRecord(); |
| | | var vmList = new List<StationPanelMonitorKpiInfoDto>(); |
| | | foreach (var station in allStationList) |
| | | { |
| | | var vm = new StationPanelMonitorKpiInfoDto(station); |
| | | vmList.Add(vm); |
| | | var allMonitorList = serviceMonitor.GetExSignalWithSignalTypeByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allMonitorList = allMonitorList?.Where(x => x.CronType == Yw.Monitor.eCronType.Real).ToList(); |
| | | if (allMonitorList != null && allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Where(x => x.Flags.Contains(Flags.KPI)).OrderByDescending(X => X.Importance).ToList(); |
| | | if (allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Take(Count).ToList(); |
| | | foreach (var monitor in allMonitorList) |
| | | { |
| | | var monitorRecord = serviceMonitorRecord.GetLastRecord(monitor.SignalList.First().ID); |
| | | vm.LastRecordList.Add(new StationPanelMonitorKpiLastRecordDto(monitor, monitorRecord)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | var allEquipmentList = serviceEquipment.GetByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allEquipmentList = allEquipmentList?.Where(x => x.ParentIds.Count < 1).ToList(); |
| | | if (allEquipmentList != null && allEquipmentList.Count > 0) |
| | | { |
| | | foreach (var equipment in allEquipmentList) |
| | | { |
| | | var runRecord = serviceRunRecord.GetLastRecord(Yw.Assets.DataType.Equipment, equipment.ID); |
| | | vm.LastStatusList.Add(new StationPanelMonitorKpiLastStatusDto(equipment, runRecord)); |
| | | } |
| | | } |
| | | } |
| | | return vmList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// çæµé¢æ¿KPIä¿¡æ¯ |
| | | /// </summary> |
| | | public class StationPanelMonitorKpiInfoDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationPanelMonitorKpiInfoDto(Model.LogicSite rhs) |
| | | { |
| | | this.StationID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.LastRecordList = new List<StationPanelMonitorKpiLastRecordDto>(); |
| | | this.LastStatusList = new List<StationPanelMonitorKpiLastStatusDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ³µç«id |
| | | /// </summary> |
| | | public long StationID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåè®°å½å表 |
| | | /// </summary> |
| | | public List<StationPanelMonitorKpiLastRecordDto> LastRecordList { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåç¶æå表 |
| | | /// </summary> |
| | | public List<StationPanelMonitorKpiLastStatusDto> LastStatusList { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// æ³µç«é¢æ¿çæµkpiæè¿è®°å½dto |
| | | /// </summary> |
| | | public class StationPanelMonitorKpiLastRecordDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | |
| | | public StationPanelMonitorKpiLastRecordDto(Yw.Model.MonitorPoint_Signal_SignalType monitor, Yw.Model.MonitorRealRecord record) |
| | | { |
| | | this.SignalID = monitor.SignalList.First().ID; |
| | | this.Name = monitor.Name; |
| | | this.Code = monitor.SignalList.First().SignalType.Code; |
| | | this.DataTime = record?.DataTime; |
| | | this.DataValue = monitor.SignalList.First().GetDisplayValue(record?.DataValue); |
| | | this.UnitName = monitor.SignalList.First().GetDisplayUnitName(); |
| | | this.DataStatus = record?.DataStatus; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡å·id |
| | | /// </summary> |
| | | public long SignalID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®å¼ |
| | | /// </summary> |
| | | public string DataValue { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | public string UnitName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ç¶æ |
| | | /// </summary> |
| | | public List<string> DataStatus { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class StationPanelMonitorKpiLastStatusDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationPanelMonitorKpiLastStatusDto(Yw.Model.Equipment equipment, Yw.Model.RunRealRecord record) |
| | | { |
| | | this.EquipmentID = equipment.ID; |
| | | this.Name = equipment.Name; |
| | | this.DataTime = record?.DataTime; |
| | | this.RunStatus = record == null ? Yw.Run.RunStatus.Stop : record.RSa; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设å¤id |
| | | /// </summary> |
| | | public long EquipmentID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¿è¡ç¶æ |
| | | /// </summary> |
| | | public int RunStatus { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// StationList |
| | | /// </summary> |
| | | [Route("SZJT/Station/List")] |
| | | [ApiDescriptionSettings("SZJT", Name = "æ³µç«å表(Logic)", Order = 7000)] |
| | | public class StationList_LogicController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// è·åçæµKPIå表 |
| | | /// </summary> |
| | | [Route("GetMonitorKpiList@V1.0")] |
| | | [HttpGet] |
| | | public List<StationListMonitorKpiInfoDto> GetMonitorKpiList(int Count = 4) |
| | | { |
| | | var allStationList = new Service.LogicSite().GetAll(); |
| | | if (allStationList == null || allStationList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var serviceMonitor = new Yw.Service.MonitorPoint(); |
| | | var serviceMonitorRecord = new Yw.Service.MonitorRealRecord(); |
| | | var serviceEquipment = new Yw.Service.Equipment(); |
| | | var serviceRunRecord = new Yw.Service.RunRealRecord(); |
| | | var vmList = new List<StationListMonitorKpiInfoDto>(); |
| | | foreach (var station in allStationList) |
| | | { |
| | | var vm = new StationListMonitorKpiInfoDto(station); |
| | | vmList.Add(vm); |
| | | var allMonitorList = serviceMonitor.GetExSignalWithSignalTypeByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allMonitorList = allMonitorList?.Where(x => x.CronType == Yw.Monitor.eCronType.Real).ToList(); |
| | | if (allMonitorList != null && allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Where(x => x.Flags.Contains(Flags.KPI)).OrderByDescending(X => X.Importance).ToList(); |
| | | if (allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Take(Count).ToList(); |
| | | foreach (var monitor in allMonitorList) |
| | | { |
| | | var monitorRecord = serviceMonitorRecord.GetLastRecord(monitor.SignalList.First().ID); |
| | | vm.LastRecordList.Add(new StationListMonitorKpiLastRecordDto(monitor, monitorRecord)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | var allEquipmentList = serviceEquipment.GetByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allEquipmentList = allEquipmentList?.Where(x => x.ParentIds.Count < 1).ToList(); |
| | | if (allEquipmentList != null && allEquipmentList.Count > 0) |
| | | { |
| | | foreach (var equipment in allEquipmentList) |
| | | { |
| | | var runRecord = serviceRunRecord.GetLastRecord(Yw.Assets.DataType.Equipment, equipment.ID); |
| | | vm.LastStatusList.Add(new StationListMonitorKpiLastStatusDto(equipment, runRecord)); |
| | | } |
| | | } |
| | | } |
| | | return vmList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// çæµå表KPIä¿¡æ¯ |
| | | /// </summary> |
| | | public class StationListMonitorKpiInfoDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationListMonitorKpiInfoDto(Model.LogicSite rhs) |
| | | { |
| | | this.StationID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.LastRecordList = new List<StationListMonitorKpiLastRecordDto>(); |
| | | this.LastStatusList = new List<StationListMonitorKpiLastStatusDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ³µç«id |
| | | /// </summary> |
| | | public long StationID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåè®°å½å表 |
| | | /// </summary> |
| | | public List<StationListMonitorKpiLastRecordDto> LastRecordList { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåç¶æå表 |
| | | /// </summary> |
| | | public List<StationListMonitorKpiLastStatusDto> LastStatusList { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// æ³µç«åè¡¨çæµkpiæè¿è®°å½dto |
| | | /// </summary> |
| | | public class StationListMonitorKpiLastRecordDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | |
| | | public StationListMonitorKpiLastRecordDto(Yw.Model.MonitorPoint_Signal_SignalType monitor, Yw.Model.MonitorRealRecord record) |
| | | { |
| | | this.SignalID = monitor.SignalList.First().ID; |
| | | this.Name = monitor.Name; |
| | | this.Code = monitor.SignalList.First().SignalType.Code; |
| | | this.DataTime = record?.DataTime; |
| | | this.DataValue = monitor.SignalList.First().GetDisplayValue(record?.DataValue); |
| | | this.UnitName = monitor.SignalList.First().GetDisplayUnitName(); |
| | | this.DataStatus = record?.DataStatus; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡å·id |
| | | /// </summary> |
| | | public long SignalID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®å¼ |
| | | /// </summary> |
| | | public string DataValue { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | public string UnitName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ç¶æ |
| | | /// </summary> |
| | | public List<string> DataStatus { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class StationListMonitorKpiLastStatusDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationListMonitorKpiLastStatusDto(Yw.Model.Equipment equipment, Yw.Model.RunRealRecord record) |
| | | { |
| | | this.EquipmentID = equipment.ID; |
| | | this.Name = equipment.Name; |
| | | this.DataTime = record?.DataTime; |
| | | this.RunStatus = record == null ? Yw.Run.RunStatus.Stop : record.RSa; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设å¤id |
| | | /// </summary> |
| | | public long EquipmentID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¿è¡ç¶æ |
| | | /// </summary> |
| | | public int RunStatus { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// StationMap |
| | | /// </summary> |
| | | [Route("SZJT/Station/Map")] |
| | | [ApiDescriptionSettings("SZJT", Name = "æ³µç«å°å¾(Logic)", Order = 6000)] |
| | | public class StationMap_LogicController : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// è·åçæµKPIå表 |
| | | /// </summary> |
| | | [Route("GetMonitorKpiList@V1.0")] |
| | | [HttpGet] |
| | | public List<StationMapMonitorKpiInfoDto> GetMonitorKpiList(int Count = 4) |
| | | { |
| | | var allStationList = new Service.LogicSite().GetAll(); |
| | | if (allStationList == null || allStationList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var serviceMonitor = new Yw.Service.MonitorPoint(); |
| | | var serviceMonitorRecord = new Yw.Service.MonitorRealRecord(); |
| | | var serviceEquipment = new Yw.Service.Equipment(); |
| | | var serviceRunRecord = new Yw.Service.RunRealRecord(); |
| | | var serviceMap = new Yw.Service.MapInfo(); |
| | | var vmList = new List<StationMapMonitorKpiInfoDto>(); |
| | | foreach (var station in allStationList) |
| | | { |
| | | var vm = new StationMapMonitorKpiInfoDto(station); |
| | | vmList.Add(vm); |
| | | var map = serviceMap.Get(IStation.DataType.LogicSite, station.ID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | if (map != null) |
| | | { |
| | | var position = Yw.Model.Map.Marker.ToModel(map.Position); |
| | | vm.Position = position; |
| | | } |
| | | var allMonitorList = serviceMonitor.GetExSignalWithSignalTypeByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allMonitorList = allMonitorList?.Where(x => x.CronType == Yw.Monitor.eCronType.Real).ToList(); |
| | | if (allMonitorList != null && allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Where(x => x.Flags.Contains(Flags.KPI)).OrderByDescending(X => X.Importance).ToList(); |
| | | if (allMonitorList.Count > 0) |
| | | { |
| | | allMonitorList = allMonitorList.Take(Count).ToList(); |
| | | foreach (var monitor in allMonitorList) |
| | | { |
| | | var monitorRecord = serviceMonitorRecord.GetLastRecord(monitor.SignalList.First().ID); |
| | | vm.LastRecordList.Add(new StationMapMonitorKpiLastRecordDto(monitor, monitorRecord)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | var allEquipmentList = serviceEquipment.GetByBelongTypeAndBelongID(IStation.DataType.LogicSite, station.ID); |
| | | allEquipmentList = allEquipmentList?.Where(x => x.ParentIds.Count < 1).ToList(); |
| | | if (allEquipmentList != null && allEquipmentList.Count > 0) |
| | | { |
| | | foreach (var equipment in allEquipmentList) |
| | | { |
| | | var runRecord = serviceRunRecord.GetLastRecord(Yw.Assets.DataType.Equipment, equipment.ID); |
| | | vm.LastStatusList.Add(new StationMapMonitorKpiLastStatusDto(equipment, runRecord)); |
| | | } |
| | | } |
| | | } |
| | | return vmList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// çæµå°å¾KPIä¿¡æ¯ |
| | | /// </summary> |
| | | public class StationMapMonitorKpiInfoDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationMapMonitorKpiInfoDto(Model.LogicSite rhs) |
| | | { |
| | | this.StationID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.LastRecordList = new List<StationMapMonitorKpiLastRecordDto>(); |
| | | this.LastStatusList = new List<StationMapMonitorKpiLastStatusDto>(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ³µç«id |
| | | /// </summary> |
| | | public long StationID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä½ç½® |
| | | /// </summary> |
| | | public Yw.Model.Map.Marker Position { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåè®°å½å表 |
| | | /// </summary> |
| | | public List<StationMapMonitorKpiLastRecordDto> LastRecordList { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåç¶æå表 |
| | | /// </summary> |
| | | public List<StationMapMonitorKpiLastStatusDto> LastStatusList { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// æ³µç«åè¡¨çæµkpiæè¿è®°å½dto |
| | | /// </summary> |
| | | public class StationMapMonitorKpiLastRecordDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | |
| | | public StationMapMonitorKpiLastRecordDto(Yw.Model.MonitorPoint_Signal_SignalType monitor, Yw.Model.MonitorRealRecord record) |
| | | { |
| | | this.SignalID = monitor.SignalList.First().ID; |
| | | this.Name = monitor.Name; |
| | | this.Code = monitor.SignalList.First().SignalType.Code; |
| | | this.DataTime = record?.DataTime; |
| | | this.DataValue = monitor.SignalList.First().GetDisplayValue(record?.DataValue); |
| | | this.UnitName = monitor.SignalList.First().GetDisplayUnitName(); |
| | | this.DataStatus = record?.DataStatus; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¿¡å·id |
| | | /// </summary> |
| | | public long SignalID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®å¼ |
| | | /// </summary> |
| | | public string DataValue { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | public string UnitName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ç¶æ |
| | | /// </summary> |
| | | public List<string> DataStatus { get; set; } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Application |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class StationMapMonitorKpiLastStatusDto |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public StationMapMonitorKpiLastStatusDto(Yw.Model.Equipment equipment, Yw.Model.RunRealRecord record) |
| | | { |
| | | this.EquipmentID = equipment.ID; |
| | | this.Name = equipment.Name; |
| | | this.DataTime = record?.DataTime; |
| | | this.RunStatus = record == null ? Yw.Run.RunStatus.Stop : record.RSa; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设å¤id |
| | | /// </summary> |
| | | public long EquipmentID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®æ¶é´ |
| | | /// </summary> |
| | | public DateTime? DataTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¿è¡ç¶æ |
| | | /// </summary> |
| | | public int RunStatus { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.Application.Core" Version="1.2.9" /> |
| | | <PackageReference Include="Yw.Service.Assets.Core" Version="1.1.4" /> |
| | | <PackageReference Include="Yw.Service.Map.Core" Version="1.0.2" /> |
| | | <PackageReference Include="Yw.Service.Monitor.Core" Version="1.3.4" /> |
| | | <PackageReference Include="Yw.Service.Run.Core" Version="1.0.1" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | <PackageReference Include="Yw.Application.Dict.Core" Version="1.1.0" /> |
| | | <PackageReference Include="Yw.Application.DMA.Core" Version="1.0.0" /> |
| | | <PackageReference Include="Yw.Application.DOCS.Core" Version="1.0.1" /> |
| | | <PackageReference Include="Yw.Application.Map.Core" Version="1.0.2" /> |
| | | <PackageReference Include="Yw.Application.Monitor.Core" Version="1.5.6" /> |
| | | <PackageReference Include="Yw.Application.Repair.Core" Version="1.0.0" /> |
| | | <PackageReference Include="Yw.Application.Map.Core" Version="1.0.3" /> |
| | | <PackageReference Include="Yw.Application.Monitor.Core" Version="1.5.7" /> |
| | | <PackageReference Include="Yw.Application.Repair.Core" Version="1.0.1" /> |
| | | <PackageReference Include="Yw.Application.Unit.Core" Version="1.1.1" /> |
| | | </ItemGroup> |
| | | |
| | |
| | | <Project> |
| | | <PropertyGroup> |
| | | <_PublishTargetUrl>D:\WorkData\git\istation\szjt\IStation.Entry.SZJT\bin\Release\net6.0\publish\</_PublishTargetUrl> |
| | | <History>True|2023-12-05T09:35:46.7846869Z;True|2023-12-05T17:29:36.5936716+08:00;True|2023-12-04T19:50:38.7216121+08:00;True|2023-12-02T14:06:28.8643257+08:00;True|2023-11-30T16:54:56.0879009+08:00;True|2023-11-30T15:49:27.5213126+08:00;True|2023-11-30T13:42:14.9061099+08:00;False|2023-11-30T13:41:50.2796105+08:00;False|2023-11-30T13:41:42.4700953+08:00;True|2023-11-30T10:23:50.6226599+08:00;True|2023-11-30T09:22:54.2133326+08:00;True|2023-11-29T16:32:53.3651373+08:00;True|2023-11-29T09:19:39.1127566+08:00;True|2023-11-28T17:25:14.9642204+08:00;True|2023-11-28T16:53:30.7550754+08:00;True|2023-11-28T09:57:02.3264015+08:00;True|2023-11-27T14:26:33.6153027+08:00;True|2023-11-27T13:33:46.1964012+08:00;True|2023-11-27T13:21:38.2133314+08:00;True|2023-11-24T14:12:06.2053905+08:00;True|2023-11-23T15:38:30.0872291+08:00;True|2023-11-15T19:27:36.4861114+08:00;True|2023-11-15T14:16:33.6004541+08:00;True|2023-11-15T14:02:06.1224051+08:00;True|2023-11-15T09:35:35.1770813+08:00;True|2023-11-10T14:06:46.1528992+08:00;True|2023-11-08T14:07:13.3792249+08:00;True|2023-11-08T13:58:21.2455396+08:00;True|2023-11-08T13:34:05.8131818+08:00;True|2023-11-08T11:58:01.9187650+08:00;True|2023-11-07T14:11:15.6278203+08:00;True|2023-11-07T14:05:43.3330586+08:00;True|2023-10-27T08:30:17.2959726+08:00;True|2023-10-27T08:23:59.8360129+08:00;True|2023-10-25T20:36:54.7517897+08:00;True|2023-10-24T23:27:01.1980187+08:00;True|2023-10-24T22:57:21.3872591+08:00;True|2023-10-17T09:26:15.4157626+08:00;True|2023-10-16T16:44:05.1411215+08:00;True|2023-10-10T14:24:00.3649304+08:00;True|2023-10-10T14:12:16.4050462+08:00;True|2023-10-10T13:43:17.4397783+08:00;True|2023-10-08T16:16:16.4721892+08:00;True|2023-10-08T14:27:40.6092129+08:00;True|2023-10-08T13:36:44.2969175+08:00;True|2023-10-08T13:21:21.1105671+08:00;True|2023-10-08T11:41:25.6876188+08:00;True|2023-10-08T09:39:46.1146411+08:00;True|2023-09-26T14:26:57.6168193+08:00;True|2023-09-21T13:54:19.1780900+08:00;True|2023-09-21T13:16:00.2957740+08:00;True|2023-09-21T11:28:36.3091944+08:00;True|2023-09-21T11:18:20.1060798+08:00;True|2023-09-13T16:00:49.4080881+08:00;True|2023-09-11T13:53:38.8582724+08:00;True|2023-09-01T10:32:37.4923361+08:00;True|2023-08-30T16:52:43.1952609+08:00;True|2023-08-30T13:41:35.0430741+08:00;True|2023-08-28T14:53:24.2454140+08:00;True|2023-08-28T13:50:55.9362462+08:00;True|2023-08-28T10:00:17.0366755+08:00;True|2023-08-25T15:41:23.8727088+08:00;True|2023-08-24T16:47:54.1391198+08:00;True|2023-08-24T16:40:29.0473991+08:00;True|2023-08-22T15:02:27.5312918+08:00;True|2023-08-22T11:18:43.6918732+08:00;True|2023-08-21T15:10:42.9223597+08:00;True|2023-08-21T14:21:08.1887373+08:00;True|2023-08-21T11:56:07.5304445+08:00;True|2023-08-18T16:57:57.0506312+08:00;True|2023-08-18T13:51:54.9145260+08:00;True|2023-08-17T14:52:44.6557301+08:00;True|2023-08-17T14:15:19.8255432+08:00;True|2023-08-17T14:03:01.1586247+08:00;True|2023-08-17T11:46:51.6685579+08:00;True|2023-08-16T11:12:27.1684542+08:00;True|2023-08-15T16:59:09.4901359+08:00;True|2023-08-10T14:08:04.8032876+08:00;True|2023-08-10T13:55:01.9698355+08:00;True|2023-08-10T10:43:44.0440039+08:00;True|2023-08-10T10:12:03.9359243+08:00;True|2023-08-09T15:07:46.6906781+08:00;True|2023-08-09T13:12:06.7912004+08:00;True|2023-08-09T10:23:24.5864225+08:00;True|2023-08-08T17:38:10.4753030+08:00;True|2023-08-08T12:56:08.9783211+08:00;True|2023-08-06T09:18:33.3703637+08:00;True|2023-08-03T11:01:58.9814864+08:00;True|2023-08-03T10:26:08.4681748+08:00;True|2023-08-02T20:33:35.0425049+08:00;True|2023-08-02T17:31:18.4675932+08:00;True|2023-08-02T16:04:16.8761862+08:00;True|2023-08-02T13:48:38.9129192+08:00;True|2023-08-02T13:45:00.6546267+08:00;True|2023-08-01T15:26:25.0389689+08:00;True|2023-08-01T14:08:10.9121758+08:00;True|2023-07-31T13:35:10.1220213+08:00;True|2023-07-31T09:20:11.2607880+08:00;True|2023-07-28T13:44:35.4317136+08:00;True|2023-07-27T10:40:46.5453757+08:00;True|2023-07-27T09:16:57.7421426+08:00;True|2023-07-26T17:10:56.0976913+08:00;True|2023-07-26T12:01:33.5766311+08:00;True|2023-07-25T18:07:38.5726960+08:00;True|2023-07-25T17:42:39.3625959+08:00;True|2023-07-25T17:04:09.8723273+08:00;True|2023-07-25T16:28:14.1819137+08:00;True|2023-07-24T14:11:28.2113907+08:00;True|2023-07-24T12:05:09.0376032+08:00;True|2023-07-24T09:36:39.6541522+08:00;True|2023-07-19T12:25:56.9887829+08:00;True|2023-07-17T13:00:04.0123733+08:00;True|2023-07-13T12:13:14.7927242+08:00;True|2023-07-13T11:46:24.1368807+08:00;True|2023-07-13T10:24:33.1684712+08:00;True|2023-06-26T11:38:29.6648988+08:00;True|2023-06-21T16:17:40.6226554+08:00;True|2023-06-21T13:30:18.8163322+08:00;True|2023-06-21T13:19:43.9290154+08:00;True|2023-06-21T11:35:28.3376504+08:00;</History> |
| | | <History>True|2023-12-12T03:49:25.2723311Z;True|2023-12-11T14:05:58.1086840+08:00;True|2023-12-11T09:31:35.0365077+08:00;True|2023-12-05T18:00:29.7005601+08:00;True|2023-12-05T17:35:46.7846869+08:00;True|2023-12-05T17:29:36.5936716+08:00;True|2023-12-04T19:50:38.7216121+08:00;True|2023-12-02T14:06:28.8643257+08:00;True|2023-11-30T16:54:56.0879009+08:00;True|2023-11-30T15:49:27.5213126+08:00;True|2023-11-30T13:42:14.9061099+08:00;False|2023-11-30T13:41:50.2796105+08:00;False|2023-11-30T13:41:42.4700953+08:00;True|2023-11-30T10:23:50.6226599+08:00;True|2023-11-30T09:22:54.2133326+08:00;True|2023-11-29T16:32:53.3651373+08:00;True|2023-11-29T09:19:39.1127566+08:00;True|2023-11-28T17:25:14.9642204+08:00;True|2023-11-28T16:53:30.7550754+08:00;True|2023-11-28T09:57:02.3264015+08:00;True|2023-11-27T14:26:33.6153027+08:00;True|2023-11-27T13:33:46.1964012+08:00;True|2023-11-27T13:21:38.2133314+08:00;True|2023-11-24T14:12:06.2053905+08:00;True|2023-11-23T15:38:30.0872291+08:00;True|2023-11-15T19:27:36.4861114+08:00;True|2023-11-15T14:16:33.6004541+08:00;True|2023-11-15T14:02:06.1224051+08:00;True|2023-11-15T09:35:35.1770813+08:00;True|2023-11-10T14:06:46.1528992+08:00;True|2023-11-08T14:07:13.3792249+08:00;True|2023-11-08T13:58:21.2455396+08:00;True|2023-11-08T13:34:05.8131818+08:00;True|2023-11-08T11:58:01.9187650+08:00;True|2023-11-07T14:11:15.6278203+08:00;True|2023-11-07T14:05:43.3330586+08:00;True|2023-10-27T08:30:17.2959726+08:00;True|2023-10-27T08:23:59.8360129+08:00;True|2023-10-25T20:36:54.7517897+08:00;True|2023-10-24T23:27:01.1980187+08:00;True|2023-10-24T22:57:21.3872591+08:00;True|2023-10-17T09:26:15.4157626+08:00;True|2023-10-16T16:44:05.1411215+08:00;True|2023-10-10T14:24:00.3649304+08:00;True|2023-10-10T14:12:16.4050462+08:00;True|2023-10-10T13:43:17.4397783+08:00;True|2023-10-08T16:16:16.4721892+08:00;True|2023-10-08T14:27:40.6092129+08:00;True|2023-10-08T13:36:44.2969175+08:00;True|2023-10-08T13:21:21.1105671+08:00;True|2023-10-08T11:41:25.6876188+08:00;True|2023-10-08T09:39:46.1146411+08:00;True|2023-09-26T14:26:57.6168193+08:00;True|2023-09-21T13:54:19.1780900+08:00;True|2023-09-21T13:16:00.2957740+08:00;True|2023-09-21T11:28:36.3091944+08:00;True|2023-09-21T11:18:20.1060798+08:00;True|2023-09-13T16:00:49.4080881+08:00;True|2023-09-11T13:53:38.8582724+08:00;True|2023-09-01T10:32:37.4923361+08:00;True|2023-08-30T16:52:43.1952609+08:00;True|2023-08-30T13:41:35.0430741+08:00;True|2023-08-28T14:53:24.2454140+08:00;True|2023-08-28T13:50:55.9362462+08:00;True|2023-08-28T10:00:17.0366755+08:00;True|2023-08-25T15:41:23.8727088+08:00;True|2023-08-24T16:47:54.1391198+08:00;True|2023-08-24T16:40:29.0473991+08:00;True|2023-08-22T15:02:27.5312918+08:00;True|2023-08-22T11:18:43.6918732+08:00;True|2023-08-21T15:10:42.9223597+08:00;True|2023-08-21T14:21:08.1887373+08:00;True|2023-08-21T11:56:07.5304445+08:00;True|2023-08-18T16:57:57.0506312+08:00;True|2023-08-18T13:51:54.9145260+08:00;True|2023-08-17T14:52:44.6557301+08:00;True|2023-08-17T14:15:19.8255432+08:00;True|2023-08-17T14:03:01.1586247+08:00;True|2023-08-17T11:46:51.6685579+08:00;True|2023-08-16T11:12:27.1684542+08:00;True|2023-08-15T16:59:09.4901359+08:00;True|2023-08-10T14:08:04.8032876+08:00;True|2023-08-10T13:55:01.9698355+08:00;True|2023-08-10T10:43:44.0440039+08:00;True|2023-08-10T10:12:03.9359243+08:00;True|2023-08-09T15:07:46.6906781+08:00;True|2023-08-09T13:12:06.7912004+08:00;True|2023-08-09T10:23:24.5864225+08:00;True|2023-08-08T17:38:10.4753030+08:00;True|2023-08-08T12:56:08.9783211+08:00;True|2023-08-06T09:18:33.3703637+08:00;True|2023-08-03T11:01:58.9814864+08:00;True|2023-08-03T10:26:08.4681748+08:00;True|2023-08-02T20:33:35.0425049+08:00;True|2023-08-02T17:31:18.4675932+08:00;True|2023-08-02T16:04:16.8761862+08:00;True|2023-08-02T13:48:38.9129192+08:00;True|2023-08-02T13:45:00.6546267+08:00;True|2023-08-01T15:26:25.0389689+08:00;True|2023-08-01T14:08:10.9121758+08:00;True|2023-07-31T13:35:10.1220213+08:00;True|2023-07-31T09:20:11.2607880+08:00;True|2023-07-28T13:44:35.4317136+08:00;True|2023-07-27T10:40:46.5453757+08:00;True|2023-07-27T09:16:57.7421426+08:00;True|2023-07-26T17:10:56.0976913+08:00;True|2023-07-26T12:01:33.5766311+08:00;True|2023-07-25T18:07:38.5726960+08:00;True|2023-07-25T17:42:39.3625959+08:00;True|2023-07-25T17:04:09.8723273+08:00;True|2023-07-25T16:28:14.1819137+08:00;True|2023-07-24T14:11:28.2113907+08:00;True|2023-07-24T12:05:09.0376032+08:00;True|2023-07-24T09:36:39.6541522+08:00;True|2023-07-19T12:25:56.9887829+08:00;True|2023-07-17T13:00:04.0123733+08:00;True|2023-07-13T12:13:14.7927242+08:00;True|2023-07-13T11:46:24.1368807+08:00;True|2023-07-13T10:24:33.1684712+08:00;True|2023-06-26T11:38:29.6648988+08:00;True|2023-06-21T16:17:40.6226554+08:00;True|2023-06-21T13:30:18.8163322+08:00;True|2023-06-21T13:19:43.9290154+08:00;True|2023-06-21T11:35:28.3376504+08:00;</History> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | /// |
| | | /// </summary> |
| | | public const string é»è®¤ = "é»è®¤"; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public const string KPI = "KPI"; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Entity |
| | | { |
| | | /// <summary> |
| | | /// ä¸å¡dma |
| | | /// </summary> |
| | | [SugarTable("logic_dma")] |
| | | public class LogicDma : Yw.Entity.BaseEntity, Yw.Entity.ICode, Yw.Entity.ISorter, Yw.Entity.IFlags, Yw.Entity.IParas, Yw.Entity.ITagName, Yw.Entity.IUseStatus, System.ICloneable |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma(LogicDma rhs) : base(rhs) |
| | | { |
| | | this.Name = rhs.Name; |
| | | this.Code = rhs.Code; |
| | | this.Paras = rhs.Paras; |
| | | this.Flags = rhs.Flags; |
| | | this.TagName = rhs.TagName; |
| | | this.UseStatus = rhs.UseStatus; |
| | | this.SortCode = rhs.SortCode; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public string Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public string Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 使ç¨ç¶æ |
| | | /// </summary> |
| | | public int UseStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåºç |
| | | /// </summary> |
| | | public int SortCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma Clone() |
| | | { |
| | | return (LogicDma)this.MemberwiseClone(); |
| | | } |
| | | |
| | | object ICloneable.Clone() |
| | | { |
| | | return this.MemberwiseClone(); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Model |
| | | { |
| | | /// <summary> |
| | | /// ä¸å¡dma |
| | | /// </summary> |
| | | public partial class LogicDma : Yw.Model.BaseModel, System.ICloneable |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma() { } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma(LogicDma rhs) : base(rhs) |
| | | { |
| | | this.Name = rhs.Name; |
| | | this.Code = rhs.Code; |
| | | this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(rhs.Paras); |
| | | this.Flags = rhs.Flags?.ToList(); |
| | | this.TagName = rhs.TagName; |
| | | this.UseStatus = rhs.UseStatus; |
| | | this.SortCode = rhs.SortCode; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void Reset(LogicDma rhs) |
| | | { |
| | | this.ID = rhs.ID; |
| | | this.Name = rhs.Name; |
| | | this.Code = rhs.Code; |
| | | this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(rhs.Paras); |
| | | this.Flags = rhs.Flags?.ToList(); |
| | | this.TagName = rhs.TagName; |
| | | this.UseStatus = rhs.UseStatus; |
| | | this.SortCode = rhs.SortCode; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åç§° |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ°åå
¸ |
| | | /// </summary> |
| | | public Dictionary<string, string> Paras { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ ç¾ |
| | | /// </summary> |
| | | public List<string> Flags { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ å¿ |
| | | /// </summary> |
| | | public string TagName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 使ç¨ç¶æ |
| | | /// </summary> |
| | | public Yw.Model.eUseStatus UseStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æåºç |
| | | /// </summary> |
| | | public int SortCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public LogicDma Clone() |
| | | { |
| | | return new LogicDma(this); |
| | | } |
| | | |
| | | object ICloneable.Clone() |
| | | { |
| | | return Clone(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.DAL |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public partial class LogicDma : Yw.DAL.BaseDAL_Sorter_Paras_Flags_TagName_UseStatus<Entity.LogicDma> |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public override ConnectionConfig ConnectionConfig |
| | | { |
| | | get { return ConfigHelper.DefaultConnectionConfig; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° Code |
| | | /// </summary> |
| | | public bool UpdateCode(long ID, string Code) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Updateable<Entity.LogicDma>() |
| | | .SetColumns(x => x.Code == Code) |
| | | .Where(x => x.ID == ID) |
| | | .ExecuteCommandHasChange(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Service |
| | | { |
| | | /// <summary> |
| | | /// LogicDma |
| | | /// ç¼åè¾
å©ç±» |
| | | /// </summary> |
| | | internal class LogicDmaCacheHelper |
| | | { |
| | | private const string _contentKey = "LogicDmaList"; |
| | | |
| | | internal static string GetCacheKey() |
| | | { |
| | | return CacheHelper.GetCacheKey(_contentKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置ç¼å |
| | | /// </summary> |
| | | public static void Set(List<Model.LogicDma> list, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åç¼å |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<Model.LogicDma> Get() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.Get<List<Model.LogicDma>>(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·å设置ç¼å |
| | | /// </summary> |
| | | public static List<Model.LogicDma> GetSet(Func<List<Model.LogicDma>> func, int Minites = 30, int RandomSeconds = 0) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç§»é¤ç¼å |
| | | /// </summary> |
| | | public static void Remove() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheHelper.Remove(cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå¸ |
| | | /// </summary> |
| | | public static void Publish(string key) |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Set(key, cacheKey); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 触å |
| | | /// </summary> |
| | | public static void Trigger() |
| | | { |
| | | var cacheKey = GetCacheKey(); |
| | | MemoryCacheWipeRelationHelper.Trigger(cacheKey); |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Service |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public partial class LogicDma |
| | | { |
| | | #region Cache |
| | | |
| | | //è·åç¼å |
| | | private static List<Model.LogicDma> GetCache() |
| | | { |
| | | var all = LogicDmaCacheHelper.GetSet(() => |
| | | { |
| | | var dal = new DAL.LogicDma(); |
| | | var entity_list = dal.GetAll(); |
| | | var model_list = Entity2Models(entity_list); |
| | | if (model_list == null) |
| | | { |
| | | model_list = new List<Model.LogicDma>(); |
| | | } |
| | | return model_list; |
| | | }, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime); |
| | | return all; |
| | | } |
| | | |
| | | //éè¿ ID æ´æ°ç¼å |
| | | private static void UpdateCache(long ID) |
| | | { |
| | | var dal = new DAL.LogicDma(); |
| | | var entity_ds = dal.GetByID(ID); |
| | | var model_ds = Entity2Model(entity_ds); |
| | | var all = GetCache(); |
| | | var model = all.Find(x => x.ID == ID); |
| | | if (model == null) |
| | | { |
| | | all.Add(model_ds); |
| | | } |
| | | else |
| | | { |
| | | model.Reset(model_ds); |
| | | } |
| | | LogicDmaCacheHelper.Trigger(); |
| | | } |
| | | |
| | | //éè¿ Ids æ´æ°ç¼å |
| | | private static void UpdateCache(List<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var dal = new DAL.LogicDma(); |
| | | var entity_list = dal.GetByIds(Ids); |
| | | var model_list = Entity2Models(entity_list); |
| | | var all = GetCache(); |
| | | all.RemoveAll(x => Ids.Contains(x.ID)); |
| | | if (model_list != null && model_list.Count > 0) |
| | | { |
| | | all.AddRange(model_list); |
| | | } |
| | | LogicDmaCacheHelper.Trigger(); |
| | | } |
| | | |
| | | //ç§»é¤ç¼å |
| | | private static void RemoveCache(long ID) |
| | | { |
| | | var all = GetCache(); |
| | | all.RemoveAll(x => x.ID == ID); |
| | | LogicDmaCacheHelper.Trigger(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå¸ç¼å |
| | | /// </summary> |
| | | public static void PublishCache(string key) |
| | | { |
| | | LogicDmaCacheHelper.Publish(key); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | | public List<Model.LogicDma> GetAll() |
| | | { |
| | | var all = GetCache(); |
| | | return all.OrderBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public Model.LogicDma GetByID(long ID) |
| | | { |
| | | var all = GetAll(); |
| | | return all.Find(x => x.ID == ID); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public List<Model.LogicDma> GetByIds(List<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count < 1) |
| | | return default; |
| | | var all = GetAll(); |
| | | return all.Where(x => Ids.Contains(x.ID)).OrderBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæå¤§æåºç |
| | | /// </summary> |
| | | public int GetMaxSortCode() |
| | | { |
| | | var all = GetAll(); |
| | | if (all.Count < 1) |
| | | return 0; |
| | | return all.Max(x => x.SortCode); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡æ°æ® |
| | | /// </summary> |
| | | public long Insert(Model.LogicDma model) |
| | | { |
| | | if (model == null) |
| | | { |
| | | return default; |
| | | } |
| | | var dal = new DAL.LogicDma(); |
| | | var entity = Model2Entity(model); |
| | | var id = dal.Insert(entity); |
| | | if (id > 0) |
| | | { |
| | | UpdateCache(id); |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå
¥å¤æ¡ |
| | | /// </summary> |
| | | public bool Inserts(List<Model.LogicDma> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var dal = new DAL.LogicDma(); |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var ids = dal.InsertsR(entity_list); |
| | | if (ids != null && ids.Count > 0) |
| | | { |
| | | UpdateCache(ids); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public bool Update(Model.LogicDma model) |
| | | { |
| | | if (model == null) |
| | | { |
| | | return default; |
| | | } |
| | | var entity = Model2Entity(model); |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.Update(entity); |
| | | if (bol) |
| | | { |
| | | UpdateCache(model.ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¹éæ´æ° |
| | | /// </summary> |
| | | public bool Updates(List<Model.LogicDma> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.Updates(entity_list); |
| | | if (bol) |
| | | { |
| | | UpdateCache(list.Select(x => x.ID).ToList()); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåºç |
| | | /// </summary> |
| | | public bool UpdateSortCode(long ID, int SortCode) |
| | | { |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateSortCode(ID, SortCode); |
| | | if (bol) |
| | | { |
| | | UpdateCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåº |
| | | /// </summary> |
| | | public bool UpdateSorter(List<Yw.Model.Sorter> sorters) |
| | | { |
| | | if (sorters == null || sorters.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateSorter(sorters.ToEntityList()); |
| | | if (bol) |
| | | { |
| | | UpdateCache(sorters.Select(x => x.ID).ToList()); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° Paras |
| | | /// </summary> |
| | | public bool UpdateParas(long ID, Dictionary<string, string> Paras) |
| | | { |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateParas(ID, ParasHelper.ToString(Paras)); |
| | | if (bol) |
| | | { |
| | | UpdateCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° Flags |
| | | /// </summary> |
| | | public bool UpdateFlags(long ID, List<string> Flags) |
| | | { |
| | | if (ID < 1) |
| | | return default; |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateFlags(ID, FlagsHelper.ToString(Flags)); |
| | | if (bol) |
| | | { |
| | | UpdateCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° TagName |
| | | /// </summary> |
| | | public bool UpdateTagName(long ID, string TagName) |
| | | { |
| | | if (ID < 1) |
| | | return default; |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateTagName(ID, TagName); |
| | | if (bol) |
| | | { |
| | | UpdateCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ° UseStatus |
| | | /// </summary> |
| | | public bool UpdateUseStatus(long ID, Yw.Model.eUseStatus UseStatus) |
| | | { |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.UpdateUseStatus(ID, (int)UseStatus); |
| | | if (bol) |
| | | { |
| | | UpdateCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Exist |
| | | |
| | | /// <summary> |
| | | /// 夿 Code æ¯å¦åå¨ |
| | | /// </summary> |
| | | public bool IsExistCode(string Code) |
| | | { |
| | | if (string.IsNullOrEmpty(Code)) |
| | | { |
| | | return false; |
| | | } |
| | | var all = GetAll(); |
| | | return all.Exists(x => x.Code == Code); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿 Code æ¯å¦åå¨ ExceptID |
| | | /// </summary> |
| | | public bool IsExistCodeExceptID(string Code, long ExceptID) |
| | | { |
| | | if (string.IsNullOrEmpty(Code)) |
| | | { |
| | | return false; |
| | | } |
| | | var all = GetAll(); |
| | | return all.Exists(x => x.Code == Code && x.ID != ExceptID); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿 TagName æ¯å¦åå¨ |
| | | /// </summary> |
| | | public bool IsExistTagName(string TagName) |
| | | { |
| | | if (string.IsNullOrEmpty(TagName)) |
| | | { |
| | | return false; |
| | | } |
| | | var all = GetAll(); |
| | | return all.Exists(x => x.TagName == TagName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿 TagName æ¯å¦åå¨ ExceptID |
| | | /// </summary> |
| | | public bool IsExistTagNameExceptID(string TagName, long ExceptID) |
| | | { |
| | | if (string.IsNullOrEmpty(TagName)) |
| | | { |
| | | return false; |
| | | } |
| | | var all = GetAll(); |
| | | return all.Exists(x => x.TagName == TagName && x.ID != ExceptID); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region Delete |
| | | |
| | | /// <summary> |
| | | /// éè¿ ID å é¤ |
| | | /// </summary> |
| | | public bool DeleteByID(long ID, out string Msg) |
| | | { |
| | | Msg = string.Empty; |
| | | var dal = new DAL.LogicDma(); |
| | | var bol = dal.DeleteByID(ID); |
| | | if (bol) |
| | | { |
| | | RemoveCache(ID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace IStation.Service |
| | | { |
| | | public partial class LogicDma |
| | | { |
| | | //Entity to GetModel |
| | | private static Model.LogicDma Entity2Model(Entity.LogicDma entity) |
| | | { |
| | | if (entity == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.LogicDma, Model.LogicDma>() |
| | | .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) |
| | | ).CreateMapper(); |
| | | var model = mapper.Map<Entity.LogicDma, Model.LogicDma>(entity); |
| | | return model; |
| | | } |
| | | //Entities to GetModels |
| | | private static List<Model.LogicDma> Entity2Models(List<Entity.LogicDma> entities) |
| | | { |
| | | if (entities == null || entities.Count() < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.LogicDma, Model.LogicDma>() |
| | | .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) |
| | | ).CreateMapper(); |
| | | var models = mapper.Map<List<Entity.LogicDma>, List<Model.LogicDma>>(entities); |
| | | return models; |
| | | } |
| | | |
| | | //Model to Entity |
| | | private static Entity.LogicDma Model2Entity(Model.LogicDma model) |
| | | { |
| | | if (model == null) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LogicDma, Entity.LogicDma>() |
| | | .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) |
| | | ).CreateMapper(); |
| | | var entity = mapper.Map<Model.LogicDma, Entity.LogicDma>(model); |
| | | return entity; |
| | | } |
| | | |
| | | //Models to Entities |
| | | private static List<Entity.LogicDma> Model2Entities(List<Model.LogicDma> models) |
| | | { |
| | | if (models == null || models.Count < 1) |
| | | return default; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LogicDma, Entity.LogicDma>() |
| | | .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) |
| | | ).CreateMapper(); |
| | | var entities = mapper.Map<List<Model.LogicDma>, List<Entity.LogicDma>>(models); |
| | | return entities; |
| | | } |
| | | |
| | | //Model to Entity |
| | | private static void Model2Entity(Model.LogicDma model, Entity.LogicDma entity) |
| | | { |
| | | if (model == null || entity == null) |
| | | return; |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.LogicDma, Entity.LogicDma>() |
| | | .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) |
| | | .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) |
| | | ).CreateMapper(); |
| | | mapper.Map(model, entity); |
| | | } |
| | | } |
| | | } |