lixiaojun
2023-12-12 8e97fa97a429e4587e7922724f633ccbd95e17a1
新增业务接口
已修改4个文件
已添加24个文件
1932 ■■■■■ 文件已修改
IStation.Application.SZJT/05-logic-dma/1-mgr/LogicDma_Controller.cs 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/AddLogicDmaInput.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/LogicDmaDto.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/UpdateLogicDmaInput.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/2-std/LogicDma_StdController.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/2-std/dto/LogicDmaStdDto.cs 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/03-station-panel/StationPanel_LogicController.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiInfoDto.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiLastRecordDto.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiLastStatusDto.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/04-station-list/StationList_LogicController.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiInfoDto.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiLastRecordDto.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiLastStatusDto.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/05-station-map/StationList_LogicController.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiInfoDto.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiLastRecordDto.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiLastStatusDto.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/IStation.Application.SZJT.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Entry.SZJT/IStation.Entry.SZJT.csproj 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Entry.SZJT/Properties/PublishProfiles/FolderProfile.pubxml.user 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/0-core/Flags.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/1-entity/5-dma/LogicDma.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/2-model/5-dma/LogicDma.cs 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/4-dal/5-dma/LogicDma.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/5-service/5-dma/Cache/LogicDmaCacheHelper.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/5-service/5-dma/LogicDma.cs 382 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Service.SZJT/5-service/5-dma/LogicDma_Instance.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
IStation.Application.SZJT/05-logic-dma/1-mgr/LogicDma_Controller.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,269 @@
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
    }
}
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/AddLogicDmaInput.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
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; }
    }
}
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/LogicDmaDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
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; }
    }
}
IStation.Application.SZJT/05-logic-dma/1-mgr/dto/UpdateLogicDmaInput.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
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; }
    }
}
IStation.Application.SZJT/05-logic-dma/2-std/LogicDma_StdController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
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;
        }
    }
}
IStation.Application.SZJT/05-logic-dma/2-std/dto/LogicDmaStdDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/03-station-panel/StationPanel_LogicController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
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;
        }
    }
}
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiInfoDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiLastRecordDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/03-station-panel/dto/StationPanelMonitorKpiLastStatusDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/04-station-list/StationList_LogicController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
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;
        }
    }
}
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiInfoDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiLastRecordDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/04-station-list/dto/StationListMonitorKpiLastStatusDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/05-station-map/StationList_LogicController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,77 @@
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;
        }
    }
}
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiInfoDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiLastRecordDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
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; }
    }
}
IStation.Application.SZJT/99-logic/05-station-map/dto/StationMapMonitorKpiLastStatusDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
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; }
    }
}
IStation.Application.SZJT/IStation.Application.SZJT.csproj
@@ -33,7 +33,9 @@
  <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>
IStation.Entry.SZJT/IStation.Entry.SZJT.csproj
@@ -20,9 +20,9 @@
    <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>
IStation.Entry.SZJT/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -5,6 +5,6 @@
<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>
IStation.Service.SZJT/0-core/Flags.cs
@@ -9,5 +9,10 @@
        /// 
        /// </summary>
        public const string é»˜è®¤ = "默认";
        /// <summary>
        ///
        /// </summary>
        public const string KPI = "KPI";
    }
}
IStation.Service.SZJT/1-entity/5-dma/LogicDma.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
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();
        }
    }
}
IStation.Service.SZJT/2-model/5-dma/LogicDma.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,100 @@
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();
        }
    }
}
IStation.Service.SZJT/4-dal/5-dma/LogicDma.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
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();
            }
        }
    }
}
IStation.Service.SZJT/5-service/5-dma/Cache/LogicDmaCacheHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
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);
        }
    }
}
IStation.Service.SZJT/5-service/5-dma/LogicDma.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,382 @@
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
    }
}
IStation.Service.SZJT/5-service/5-dma/LogicDma_Instance.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
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);
        }
    }
}