From 2cbc514a972fe95a1a9d83b3301a9512e998147c Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Tue, 27 Feb 2024 15:01:52 +0800 Subject: [PATCH] z --- .../GoodsTechnology/GoodsTechnologDelete.cs | 1 + .../Services/GoodsTechnologyService.cs | 4 +-- .../ProductFunction/ProductFunctionBaseDto.cs | 4 +++ .../ProductFunctionPageBase.cs | 1 + .../Device/Services/ProductFunctionService.cs | 4 +++ BPA.SAAS.Manage.Comm/Enum/EventTypeEnum.cs | 31 +++++++++++++++++++ .../Product/BPA_ProductFunction.cs | 4 +++ 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 BPA.SAAS.Manage.Comm/Enum/EventTypeEnum.cs diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs index d438e26..f17ffbd 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsTechnology/GoodsTechnologDelete.cs @@ -10,5 +10,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology { public string devideId { get; set; } public string goodsId { get; set; } + public string goodsAttributeId { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs index f9daf7f..8bc0eff 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs @@ -31,7 +31,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services try { var addlist = new List(); - var list = _db.Queryable().Where(x => x.DeviceId == inputDto[0].DeviceId && x.GoodsId == inputDto[0].GoodsId).ToList(); + var list = _db.Queryable().Where(x => x.DeviceId == inputDto[0].DeviceId && x.GoodsId == inputDto[0].GoodsId && x.GoodsAttributeId == inputDto[0].GoodsAttributeId).ToList(); _db.Ado.BeginTran(); _db.Deleteable(list).ExecuteCommand(); //var list = _db.Queryable().Where(x => x.GroupId == groupId && x.IsDeleted == 0).ToList(); @@ -175,7 +175,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services } public async Task DeleteGoodsTechnologyAction(GoodsTechnologDelete dto) { - var item = await _db.Queryable().Where(x => x.DeviceId == dto.devideId && x.GoodsId == dto.goodsId).ToListAsync(); + var item = await _db.Queryable().Where(x => x.DeviceId == dto.devideId && x.GoodsId == dto.goodsId && x.GoodsAttributeId== dto.goodsAttributeId).ToListAsync(); if (item.Count > 0) { return await _db.Deleteable(item).ExecuteCommandAsync() > 0; diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs index 4f9ed45..d9a4d28 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs @@ -59,5 +59,9 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction public string Description { get; set; } public string ProductId { get; set; } public string DataJson { get; set; } + /// + /// 事件类型 0信息 1告警 2故障 + /// + public EventTypeEnum EventType { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs index 52766b4..95b676e 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs @@ -16,6 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction public string Vesion { get; set; } public string ProductVesionId { get; set; } public string ProductId { get; set; } + public bool? IsDefault { get; set; } public CommonStatus? Status { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs index 954bfff..4f7377b 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs @@ -39,6 +39,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), (x, b) => x.Name.Contains(inputDto.Name)) .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Type), (x, b) => x.Type==Convert.ToInt32(inputDto.Type)) .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Vesion), (x, b) => x.DeviceVersionKey == inputDto.Vesion) + //.WhereIF(inputDto.IsDefault!=null, (x, b) => x.IsDefault == inputDto.IsDefault) .WhereIF(inputDto.Status != null, (x, b) => x.Status == inputDto.Status) .OrderBy((x, b) => x.CreateAt, OrderByType.Desc) .Select((x, b) => new @@ -63,6 +64,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services ReadWrite = x.ReadWrite, Description= x.Description, IsDefault= x.IsDefault, + EventType= x.EventType, }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -164,6 +166,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services ReadWrite = inputDto.ReadWrite, Description=inputDto.Description, ProductId= inputDto.ProductId, + EventType= inputDto.EventType, DataJson= inputDto.DataJson?.Replace("\n",""), }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); return res > 0; @@ -195,6 +198,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services data.BoolLabel = inputDto.BoolLabel; data.ReadWrite = inputDto.ReadWrite; data.Description= inputDto.Description; + data.EventType = inputDto.EventType; data.DataJson= inputDto.DataJson?.Replace("\n", ""); data.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), inputDto.Status); var res =await _db.Updateable(data).ExecuteCommandAsync(); diff --git a/BPA.SAAS.Manage.Comm/Enum/EventTypeEnum.cs b/BPA.SAAS.Manage.Comm/Enum/EventTypeEnum.cs new file mode 100644 index 0000000..e5ed72b --- /dev/null +++ b/BPA.SAAS.Manage.Comm/Enum/EventTypeEnum.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Comm.Enum +{ + /// + /// 事件类型 + /// + public enum EventTypeEnum + { + /// + /// 信息 + /// + [Description("信息")] + Info =0, + /// + /// 告警 + /// + [Description("告警")] + Alarm = 1, + /// + /// 故障 + /// + [Description("故障")] + Breakdown = 2, + } +} diff --git a/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs index 0adfda8..52e5f29 100644 --- a/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs +++ b/BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs @@ -78,5 +78,9 @@ namespace BPA.SAAS.Manage.Core.Product public string ProductId { get; set; } public string DataJson { get; set; } public bool IsDefault { get; set; } + /// + /// 事件类型 0信息 1告警 2故障 + /// + public EventTypeEnum EventType { get; set; } } }