diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs index b6e29db..0c418cb 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs @@ -747,7 +747,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services #endregion - //添加 工艺_{商品名称} + //添加 功能_{商品名称} var tableName = ExcelToShtteName(file.OpenReadStream(), Path.GetExtension(file.FileName)); #region 添加 工艺_{商品名称} @@ -780,11 +780,11 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var thisName = goodTechnologyModel[i].Name == null ? cName : goodTechnologyModel[i].Name; - var data = await _db.Queryable() - .Where(x => x.Name == thisName && x.DeviceVersionKey == device.DeviceVersionKey).FirstAsync(); + var data = await _db.Queryable() + .Where(x => x.Name == thisName && x.DeviceVersionKey == device.ProductVersionId).FirstAsync(); - var data2 = await _db.Queryable() - .Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.DevicetechnologyId == data.Id).FirstAsync(); + var data2 = await _db.Queryable() + .Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.ProductFunctionId == data.Id).FirstAsync(); var batching = new BPA_Batching(); @@ -849,8 +849,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services { var v1 = json.FirstOrDefault(x => x.actionName == "主料名称"); var v2 = deviceGoodsPosition.FirstOrDefault(x => x.GoodsName == name2 && x.DeviceName == name1); - var jsondb = await _db.Queryable() - .Where(x => x.DevicetechnologyId == thisItem.ChnologyId) + var jsondb = await _db.Queryable() + .Where(x => x.ProductFunctionId == thisItem.ChnologyId) .ToListAsync(); foreach (var item in from item in jsondb let insertableJsondb = json.FirstOrDefault(x => x.technologyactionId == item.Id) where insertableJsondb == null select item) @@ -859,7 +859,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services { actionName = item.ActionName, actionValue = item.ActionName == "主料重量" ? "0" : item.ActionValue, - chnologyId = item.DevicetechnologyId, + chnologyId = item.ProductFunctionId, index = thisItem.Index, technologyactionId = item.Id @@ -943,7 +943,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var device = await _db.Queryable().FirstAsync(x => x.Id == deviceId); //设备类型 - var dictData = await _db.Queryable().FirstAsync(x => x.Id == device.DeviceVersionKey); + var dictData = await _db.Queryable().FirstAsync(x => x.Id == device.ProductVersionId); return dictData?.TemplatePath ?? ""; } @@ -972,14 +972,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var source = file.OpenReadStream(); var mapper = new Mapper(source); - var deviceVersion = await _db.Queryable().FirstAsync(x => x.DeviceTypeKey == inputDto.DeviceClientType && x.Vesion == inputDto.Version); + var deviceVersion = await _db.Queryable().FirstAsync(x => x.ProductId == inputDto.DeviceClientType && x.Vesion == inputDto.Version); //添加 设备_烹饪工序模型 #region 添加 设备_烹饪工序模型 ReadExcel readGoodstechnologyExcel = new(); var GoodstechnologyModellist = readGoodstechnologyExcel.ExcelToList(source, mapper); - List GoodsTechnologyList = new(); - List GoodsTechnologyActionList = new(); - var GoodsTechnologyListDB = await _db.Queryable() + List GoodsTechnologyList = new(); + List GoodsTechnologyActionList = new(); + var GoodsTechnologyListDB = await _db.Queryable() .Where(x => x.DeviceVersionKey == deviceVersion.Id).ToListAsync(); string currennaid = ""; string currennaname = ""; @@ -990,7 +990,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services if (!string.IsNullOrWhiteSpace(GoodstechnologyModellist[i].Name)) { - BPA_DeviceTechnology item = new BPA_DeviceTechnology() + BPA_ProductFunction item = new BPA_ProductFunction() { Id = goodsTechnologyId == null ? Guid.NewGuid().ToString() : goodsTechnologyId.Id, Name = GoodstechnologyModellist[i].Name, @@ -1007,10 +1007,10 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services { throw Oops.Oh($"类型错误"); } - BPA_DeviceTechnologyAction technologyAction = new() + BPA_ProductFunctionAction technologyAction = new() { Id = Guid.NewGuid().ToString(), - DevicetechnologyId = currennaid, + ProductFunctionId = currennaid, ActionName = GoodstechnologyModellist[i].ActionName, ActionType = CharacterConversion(GoodstechnologyModellist[i].ActionType), Sort = i, @@ -1048,12 +1048,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services //修改添从表 GoodsTechnologyActionList = GoodsTechnologyActionList.Where(x => !string.IsNullOrEmpty(x.ActionName)).ToList(); var goodstechnologyIds = GoodsTechnologyList.Select(x => x.Id).ToList(); - var GoodsTechnologyActionListDb = await _db.Queryable() - .Where(x => goodstechnologyIds.Contains(x.DevicetechnologyId)).ToListAsync(); + var GoodsTechnologyActionListDb = await _db.Queryable() + .Where(x => goodstechnologyIds.Contains(x.ProductFunctionId)).ToListAsync(); foreach (var item in GoodsTechnologyActionList) { - var thisitem = GoodsTechnologyActionListDb.FirstOrDefault(x => item.DevicetechnologyId == x.DevicetechnologyId && item.ActionName == x.ActionName); + var thisitem = GoodsTechnologyActionListDb.FirstOrDefault(x => item.ProductFunctionId == x.ProductFunctionId && item.ActionName == x.ActionName); if (thisitem != null) { item.Id = thisitem.Id; diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs index 4ac909a..c6f6d19 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs @@ -456,7 +456,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services Id = x.Id.SelectAll(), }).Mapper(a => { - a.GoodsTechnologyInfo = _db.Queryable().Where(d => d.DeviceVersionKey == a.DeviceVersionKey).Select(d => new GoodsTechnologyInfo() + a.GoodsTechnologyInfo = _db.Queryable().Where(d => d.DeviceVersionKey == a.ProductVersionId).Select(d => new GoodsTechnologyInfo() { DeviceTechnologyId = d.Id, DeviceVersionKey = d.DeviceVersionKey, diff --git a/BPA.SAAS.Manage.Application/Device/DeviceTechnologyServices.cs b/BPA.SAAS.Manage.Application/Device/DeviceTechnologyServices.cs deleted file mode 100644 index 0de4c87..0000000 --- a/BPA.SAAS.Manage.Application/Device/DeviceTechnologyServices.cs +++ /dev/null @@ -1,120 +0,0 @@ -using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; -using BPA.SAAS.Manage.Application.Device.Interface; -using BPA.SAAS.Manage.Core.Base; -using BPA.SAAS.Manage.Core.Device; -using Microsoft.AspNetCore.Components.Forms; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPA.SAAS.Manage.Application.Device -{ - [ApiDescriptionSettings("Device", Tag = "设备基础工艺信息管理")] - public class DeviceTechnologyServices: IDynamicApiController, ITransient - { - IDeviceTechnologyService _deviceTechnologyService; - public DeviceTechnologyServices(IDeviceTechnologyService deviceTechnologyService) - { - _deviceTechnologyService= deviceTechnologyService; - } - /// - /// 获取工艺基础信息列表 - /// - /// - /// - [HttpPost("/api/devicetechnology/page")] - public async Task GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) - { - return await _deviceTechnologyService.GetDeviceTechnologyPage(inputDto); - } - /// - /// 查询所有工艺信息 - /// - /// - [HttpGet("/api/devicetechnology/getdevicetechnology")] - public async Task> GetDeviceTechnology() - { - return await _deviceTechnologyService.GetDeviceTechnology(); - } - /// - /// 添加工艺 - /// - /// - /// - [HttpPost("/api/devicetechnology/add")] - public async Task AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) - { - return await _deviceTechnologyService.AddDeviceTechnology(inputDto); - } - /// - /// 修改工艺 - /// - /// - /// - [HttpPost("/api/devicetechnology/update")] - public async Task UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) - { - return await _deviceTechnologyService.UpdateDeviceTechnology(inputDto); - } - /// - /// 删除配方工艺 - /// - /// - /// - [HttpPost("/api/devicetechnology/delete")] - public async Task DeleteDeviceTechnology(List ids) - { - return await _deviceTechnologyService.DeleteDeviceTechnology(ids); - } - /// - /// 根据工艺id查询工艺模型 - /// - /// - [HttpGet("/api/devicetechnology/gettechnologyaction")] - public async Task> GetTechnologyActionList(string devicetechnologyId) - { - return await _deviceTechnologyService.GetTechnologyActionList(devicetechnologyId); - } - /// - /// 查询所有工艺模型 - /// - /// - [HttpGet("/api/devicetechnology/gettechnologyactionlist")] - public async Task> GetTechnologyActionList() - { - return await _deviceTechnologyService.GetTechnologyActionList(); - } - /// - /// 添加工艺模型 - /// - /// - /// - [HttpPost("/api/devicetechnology/adddevicetechnologyaction")] - public async Task AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) - { - return await _deviceTechnologyService.AddDeviceTechnologyAction(inputDto); - } - /// - /// 修改工艺模型 - /// - /// - /// - [HttpPost("/api/devicetechnology/updatedevicetechnologyaction")] - public async Task UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) - { - return await _deviceTechnologyService.UpdateBomTechnology(inputDto); - } - /// - /// 删除工艺模型 - /// - /// - /// - [HttpPost("/api/devicetechnology/deldevicetechnologyaction")] - public async Task DeleteTechnologyAction(List ids) - { - return await _deviceTechnologyService.DeleteTechnologyAction(ids); - } - } -} diff --git a/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs b/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs index 5bf8561..d4cdb42 100644 --- a/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs +++ b/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs @@ -74,9 +74,9 @@ namespace BPA.SAAS.Manage.Application.Device /// /// [HttpGet("/api/devicevesion/getdevicevesion")] - public async Task> GetDeviceVesion(string code) + public async Task> GetDeviceVesion(string productId) { - return await _deviceVesionService.GetDeviceVesion(code); + return await _deviceVesionService.GetDeviceVesion(productId); } /// /// 查询版本列表 diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs index 722f636..689b58f 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs @@ -1,4 +1,5 @@ -using System; +using BPA.SAAS.Manage.Comm.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -23,12 +24,18 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device /// public string OrgId { get; set; } /// - /// 设备类型 + /// 所属产品 /// - public string DeviceTypeKey { get; set; } + public string ProductId { get; set; } /// - /// 设备版本 + /// 产品标签 /// - public string DeviceVersionKey { get; set; } + public string ProductCode { get; set; } + /// + /// 产品版本 + /// + public string ProductVersionId { get; set; } + public CommonStatus Status { get; set; } + public int TechnologyOrBom { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs index 4c06535..aaea1cf 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoQueryDto.cs @@ -1,4 +1,5 @@ -using System; +using BPA.SAAS.Manage.Comm.Enum; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -23,9 +24,17 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device /// public string OrgId { get; set; } /// - /// 设备类型 + /// 所属产品 /// - public string DeviceTypeKey { get; set; } + public string ProductId { get; set; } + /// + /// 所属产品名称 + /// + public string ProductName { get; set; } + /// + /// 所属产品标签 + /// + public string ProductCode { get; set; } /// /// 设备AutoKey 唯一用于mqtt消息推送标识 /// @@ -34,8 +43,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device /// /// 设备版本 /// - public string DeviceVersionKey { get; set; } + public string ProductVersionId { get; set; } + public CommonStatus Status { get; set; } public string OrgKey { get; set; } - public string DeviceVersionName { get; set; } + public string ProductVersionName { get; set; } + public int TechnologyOrBom { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs index 7c70c7b..8938ad9 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs @@ -10,6 +10,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device { public string Id { get; set; } public string Name { get; set; } + public string Code { get; set; } public string Key { get; set; } public string Remark { get; set; } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyBaseDto.cs deleted file mode 100644 index fd597b3..0000000 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyBaseDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology -{ - public class DeviceTechnologyBaseDto - { - public string Id { get; set; } - public string Name { get; set; } - /// - /// 状态 0启用 1禁用 - /// - public int Status { get; set; } - public string ForeignKeyRe { get; set; } - public string DeviceVersionKey { get; set; } - } -} diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs index 4d806b6..9847b8b 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs @@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion { public string Id { get; set; } public string Vesion { get; set; } - public string DeviceTypeKey { get; set; } + public string ProductId { get; set; } /// /// 模版路径 diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionModel.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionModel.cs new file mode 100644 index 0000000..d91755c --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionModel.cs @@ -0,0 +1,35 @@ +using BPA.SAAS.Manage.Comm.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion +{ + public class DeviceVesionModel + { + public string Id { get; set; } + public string Vesion { get; set; } + /// + /// 所属产品 + /// + public string ProductId { get; set; } + /// + /// 产品名称 + /// + public string ProductName { get; set; } + /// + /// 产品标签 + /// + public string ProductCode { get; set; } + /// + /// 模版路径 + /// + public string TemplatePath { get; set; } + /// + /// 状态 0启用 1禁用 + /// + public CommonStatus Status { get; set; } = CommonStatus.ENABLE; + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs index 0fc2a7c..10e4a15 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs @@ -9,6 +9,6 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion { public class DeviceVesionQueryInputDto : PageInputBase { - public string DeviceTypeKey { get; set; } + public string ProductId { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyActionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionActionBaseDto.cs similarity index 83% rename from BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyActionBaseDto.cs rename to BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionActionBaseDto.cs index 8b6152e..21da2c6 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyActionBaseDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionActionBaseDto.cs @@ -4,15 +4,15 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction { - public class DeviceTechnologyActionBaseDto + public class ProductFunctionActionBaseDto { public string Id { get; set; } /// - /// 工艺id + /// 功能id /// - public string DevicetechnologyId { get; set; } + public string ProductFunctionId { get; set; } /// /// 动作名称 /// diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs new file mode 100644 index 0000000..ed58b71 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs @@ -0,0 +1,45 @@ +using BPA.SAAS.Manage.Comm.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction +{ + public class ProductFunctionBaseDto + { + public string Id { get; set; } + public string Name { get; set; } + /// + /// 状态 0启用 1禁用 + /// + public int Status { get; set; } + public string ForeignKeyRe { get; set; } + public string DeviceVersionKey { get; set; } + /// + /// 功能类型 0属性1服务2事件 + /// + public int Type { get; set; } + /// + /// 数据类型 + /// + public string DataType { get; set; } + /// + /// 取值范围 + /// + public string DataRange { get; set; } + /// + /// 单位 + /// + public string Unit { get; set; } + /// + /// 步长 + /// + public int StepSize { get; set; } + /// + /// 枚举值 + /// + public string EnumValue { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionDto.cs similarity index 76% rename from BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyDto.cs rename to BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionDto.cs index 77ed604..0697558 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyDto.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionDto.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction { - public class DeviceTechnologyDto + public class ProductFunctionDto { public string Id { get; set; } public string Name { get; set; } diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyPageBase.cs b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs similarity index 58% rename from BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyPageBase.cs rename to BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs index 1561369..4ababf4 100644 --- a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceTechnology/DeviceTechnologyPageBase.cs +++ b/BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionPageBase.cs @@ -5,13 +5,16 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology +namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction { - public class DeviceTechnologyPageBase + public class ProductFunctionPageBase { public int Current { get; set; } public int PageSize { get; set; } public string Name { get; set; } + public string Type { get; set; } + public string Vesion { get; set; } + public string DeviceTypeKey { get; set; } public CommonStatus? Status { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs index 5c69121..ec9ed74 100644 --- a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs @@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Interface Task DelDeviceVesionAsync(List inputList); Task UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto); Task UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto); - Task> GetDeviceVesion(string Code); + Task> GetDeviceVesion(string ProductId); Task> GetDeviceVesionList(); } } diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceTechnologyService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs similarity index 52% rename from BPA.SAAS.Manage.Application/Device/Interface/IDeviceTechnologyService.cs rename to BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs index d78a3b6..b5715a2 100644 --- a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceTechnologyService.cs +++ b/BPA.SAAS.Manage.Application/Device/Interface/IProductFunctionService.cs @@ -1,4 +1,4 @@ -using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; +using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.Device; using System; @@ -9,64 +9,64 @@ using System.Threading.Tasks; namespace BPA.SAAS.Manage.Application.Device.Interface { - public interface IDeviceTechnologyService + public interface IProductFunctionService { /// - /// 获取工艺基础信息列表 + /// 获取功能基础信息列表 /// /// /// - Task GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto); + Task GetProductFunctionPage(ProductFunctionPageBase inputDto); /// - /// 查询所有工艺信息 + /// 查询所有功能信息 /// /// - Task> GetDeviceTechnology(); + Task> GetProductFunction(); /// - /// 添加工艺 + /// 添加功能 /// /// /// - Task AddDeviceTechnology(DeviceTechnologyBaseDto inputDto); + Task AddProductFunction(ProductFunctionBaseDto inputDto); /// - /// 修改工艺 + /// 修改功能 /// /// /// - Task UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto); + Task UpdateProductFunction(ProductFunctionBaseDto inputDto); /// - /// 删除工艺 + /// 删除功能 /// /// /// - Task DeleteDeviceTechnology(List ids); + Task DeleteProductFunction(List ids); /// - /// 根据工艺id查询工艺模型 + /// 根据功能id查询功能参数 /// /// - Task> GetTechnologyActionList(string devicetechnologyId); + Task> GetProductFunctionActionList(string productFunctionId); /// - /// 查询所有工艺模型 + /// 查询所有功能参数 /// /// - Task> GetTechnologyActionList(); + Task> GetProductFunctionActionList(); /// - /// 添加工艺模型 + /// 添加功能参数 /// /// /// - Task AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto); + Task AddProductFunctionAction(ProductFunctionActionBaseDto inputDto); /// - /// 修改工艺模型 + /// 修改功能参数 /// /// /// - Task UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto); + Task UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto); /// - /// 删除工艺模型 + /// 删除功能参数 /// /// /// - Task DeleteTechnologyAction(List ids); + Task DeleteProductFunctionAction(List ids); } } diff --git a/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs b/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs new file mode 100644 index 0000000..aa210e1 --- /dev/null +++ b/BPA.SAAS.Manage.Application/Device/ProductFunctionServices.cs @@ -0,0 +1,120 @@ +using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction; +using BPA.SAAS.Manage.Application.Device.Interface; +using BPA.SAAS.Manage.Core.Base; +using BPA.SAAS.Manage.Core.Device; +using Microsoft.AspNetCore.Components.Forms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.Device +{ + [ApiDescriptionSettings("Device", Tag = "设备基础工艺信息管理")] + public class ProductFunctionServices: IDynamicApiController, ITransient + { + IProductFunctionService _deviceTechnologyService; + public ProductFunctionServices(IProductFunctionService deviceTechnologyService) + { + _deviceTechnologyService= deviceTechnologyService; + } + /// + /// 获取功能基础信息列表 + /// + /// + /// + [HttpPost("/api/productfunction/page")] + public async Task GetProductFunctionPage(ProductFunctionPageBase inputDto) + { + return await _deviceTechnologyService.GetProductFunctionPage(inputDto); + } + /// + /// 查询所有功能信息 + /// + /// + [HttpGet("/api/productfunction/getdevicetechnology")] + public async Task> GetProductFunction() + { + return await _deviceTechnologyService.GetProductFunction(); + } + /// + /// 添加功能 + /// + /// + /// + [HttpPost("/api/productfunction/add")] + public async Task AddProductFunction(ProductFunctionBaseDto inputDto) + { + return await _deviceTechnologyService.AddProductFunction(inputDto); + } + /// + /// 修改功能 + /// + /// + /// + [HttpPost("/api/productfunction/update")] + public async Task UpdateProductFunction(ProductFunctionBaseDto inputDto) + { + return await _deviceTechnologyService.UpdateProductFunction(inputDto); + } + /// + /// 删除功能 + /// + /// + /// + [HttpPost("/api/productfunction/delete")] + public async Task DeleteProductFunction(List ids) + { + return await _deviceTechnologyService.DeleteProductFunction(ids); + } + /// + /// 根据功能id查询功能参数 + /// + /// + [HttpGet("/api/productfunction/getproductfunctionaction")] + public async Task> GetProductFunctionActionList(string productFunctionId) + { + return await _deviceTechnologyService.GetProductFunctionActionList(productFunctionId); + } + /// + /// 查询所有功能参数 + /// + /// + [HttpGet("/api/productfunction/getproductfunctionactionlist")] + public async Task> GetProductFunctionActionList() + { + return await _deviceTechnologyService.GetProductFunctionActionList(); + } + /// + /// 添加功能参数 + /// + /// + /// + [HttpPost("/api/productfunction/addproductfunctionaction")] + public async Task AddProductFunctionAction(ProductFunctionActionBaseDto inputDto) + { + return await _deviceTechnologyService.AddProductFunctionAction(inputDto); + } + /// + /// 修改功能参数 + /// + /// + /// + [HttpPost("/api/productfunction/updateproductfunctionaction")] + public async Task UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto) + { + return await _deviceTechnologyService.UpdateProductFunctionAction(inputDto); + } + /// + /// 删除功能参数 + /// + /// + /// + [HttpPost("/api/productfunction/delproductfunctionaction")] + public async Task DeleteProductFunctionAction(List ids) + { + return await _deviceTechnologyService.DeleteProductFunctionAction(ids); + } + } +} diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs index ae154f8..a33403e 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs @@ -32,22 +32,23 @@ namespace BPA.SAAS.Manage.Application.Device.Services public async Task GetDeviceInfoPage(DeviceQueryInputDto inputDto) { RefAsync total =0; - var data = await _db.Queryable((a, b) => - new JoinQueryInfos(JoinType.Inner, a.OrgId == b.Id)) - .WhereIF(!string.IsNullOrWhiteSpace(inputDto.StoreId), a => a.OrgId == inputDto.StoreId) - .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceName), a => a.DeviceName.Contains(inputDto.DeviceName)) - .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceTypeId), a => a.DeviceTypeId == inputDto.DeviceTypeId) + var data = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId)) + + .WhereIF(!string.IsNullOrWhiteSpace(inputDto.StoreId), (a, b) => a.OrgId == inputDto.StoreId) + .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceName), (a, b) => a.DeviceName.Contains(inputDto.DeviceName)) + .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceTypeId), (a, b) => a.DeviceTypeId == inputDto.DeviceTypeId) .OrderBy((a, b) => a.CreateAt, OrderByType.Desc) .Select((a, b) => new DeviceInfoQueryDto { Id = a.Id.SelectAll(), - OrgKey = b.AutoKey, - DeviceVersionName = "" + ProductName=b.Name, + ProductCode=b.Code, + ProductVersionName = "" }) .Mapper(x => { - var Vesion = _db.Queryable().Where(c => c.Id == x.DeviceVersionKey).First(); - x.DeviceVersionName = Vesion?.Vesion; + var Vesion = _db.Queryable().Where(c => c.Id == x.ProductVersionId).First(); + x.ProductVersionName = Vesion?.Vesion; }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -79,9 +80,11 @@ namespace BPA.SAAS.Manage.Application.Device.Services public async Task AddDevice(DeviceInfoBaseDto inputDto) { BPA_DeviceInfo bPA_DeviceInfo = inputDto.Adapt(); + var product=_db.Queryable().Where(x => x.Id == inputDto.ProductId).First(); bPA_DeviceInfo.Status = CommonStatus.ENABLE; + bPA_DeviceInfo.ProductCode= product?.Code; var res =await _db.Insertable(bPA_DeviceInfo) .CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); - mqttsub(res.AutoKey, res.DeviceTypeKey); + mqttsub(res.AutoKey, res.ProductCode); return res != null; } /// @@ -95,18 +98,21 @@ namespace BPA.SAAS.Manage.Application.Device.Services if (data != null) { - mqttsub(data.AutoKey, data.DeviceTypeKey); + mqttsub(data.AutoKey, data.ProductCode); + var product = _db.Queryable().Where(x => x.Id == inputDto.ProductId).First(); var inputData = inputDto.Adapt(); - inputData.CreateBy = data.CreateBy; + inputData.ProductCode = product?.Code; var res = await _db.Updateable(inputData) .UpdateColumns(x => new { x.DeviceName, x.DeviceTypeId, x.OrgId, - x.DeviceTypeKey, + x.ProductId, + x.ProductCode, x.Status, - x.DeviceVersionKey + x.ProductVersionId, + x.TechnologyOrBom }) .Where(x => x.Id == inputDto.Id).ExecuteCommandAsync(); diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs index cd220d9..2c4c2ba 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs @@ -27,9 +27,15 @@ namespace BPA.SAAS.Manage.Application.Device.Services public async Task GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto) { var total = new RefAsync(); - var data = await _db.Queryable().Where((x) => x.IsDeleted == 0) - .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceTypeKey), x => x.DeviceTypeKey.Contains(inputDto.DeviceTypeKey)) - .OrderBy(x => x.CreateAt, OrderByType.Desc) + var data = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId)) + .WhereIF(!string.IsNullOrWhiteSpace(inputDto.ProductId), x => x.ProductId.Contains(inputDto.ProductId)) + .OrderBy(a => a.CreateAt, OrderByType.Desc) + .Select((a,b)=>new DeviceVesionModel() + { + Id=a.Id.SelectAll(), + ProductName=b.Name, + ProductCode=b.Code, + }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -50,7 +56,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services var res = await _db.Insertable(new BPA_DeviceVesion { Vesion = inputDto.Vesion, - DeviceTypeKey = inputDto.DeviceTypeKey, + ProductId = inputDto.ProductId, TemplatePath = inputDto.TemplatePath, Status = CommonStatus.ENABLE }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); @@ -63,7 +69,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services /// public async Task DelDeviceVesionAsync(List inputList) { - var data = await _db.Queryable().Where(x => inputList.Contains(x.DeviceVersionKey)).ToListAsync(); + var data = await _db.Queryable().Where(x => inputList.Contains(x.ProductVersionId)).ToListAsync(); if (data.Count > 0) { throw Oops.Oh("当前设备类型已使用,无法删除"); @@ -86,7 +92,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services { var res = _db.Updateable().SetColumns(t => t.Vesion == inputDto.Vesion) .SetColumns(t => t.TemplatePath == inputDto.TemplatePath) - .SetColumns(t => t.DeviceTypeKey == inputDto.DeviceTypeKey) + .SetColumns(t => t.ProductId == inputDto.ProductId) .SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) .ExecuteCommandHasChange(); @@ -116,13 +122,13 @@ namespace BPA.SAAS.Manage.Application.Device.Services return false; } /// - /// 根据设备编码查询版本 + /// 根据产品查询版本 /// /// /// - public async Task> GetDeviceVesion(string Code) + public async Task> GetDeviceVesion(string ProductId) { - var resEntity =await _db.Queryable().Where(a => a.DeviceTypeKey == Code).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync(); + var resEntity =await _db.Queryable().Where(a => a.ProductId == ProductId && a.Status==0).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync(); return resEntity; } /// diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceTechnologyService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs similarity index 50% rename from BPA.SAAS.Manage.Application/Device/Services/DeviceTechnologyService.cs rename to BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs index a3442f3..d40306d 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/DeviceTechnologyService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs @@ -1,9 +1,10 @@ -using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; +using BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction; using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Comm.Enum; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.Device; +using NPOI.Util; using System; using System.Collections.Generic; using System.Linq; @@ -13,27 +14,29 @@ using System.Threading.Tasks; namespace BPA.SAAS.Manage.Application.Device.Services { - public class DeviceTechnologyService: IDeviceTechnologyService, ITransient + public class ProductFunctionService: IProductFunctionService, ITransient { ISqlSugarClient _db; - public DeviceTechnologyService(ISqlSugarClient db) + public ProductFunctionService(ISqlSugarClient db) { _db = db; } - #region 工艺基础信息 + #region 产品功能 /// - /// 获取工艺基础信息列表 + /// 获取功能基础信息列表 /// /// /// - public async Task GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) + public async Task GetProductFunctionPage(ProductFunctionPageBase inputDto) { RefAsync total = 0; - var res = await _db.Queryable((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey)) - - .OrderBy((x, b) => x.CreateAt, OrderByType.Desc) + var res = await _db.Queryable((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey)) + .Where((x,b)=>b.ProductId == inputDto.DeviceTypeKey) .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.Status != null, (x, b) => x.Status == inputDto.Status) + .OrderBy((x, b) => x.CreateAt, OrderByType.Desc) .Select((x, b) => new { Name = x.Name, @@ -42,9 +45,15 @@ namespace BPA.SAAS.Manage.Application.Device.Services x.GroupId, x.ForeignKeyRe, x.DeviceVersionKey, - DeviceTypeKey = b.DeviceTypeKey, - Vesion = b.Vesion - + DeviceTypeKey = b.ProductId, + Vesion = b.Vesion, + CreateAt=x.CreateAt, + Type= x.Type, + DataType= x.DataType, + DataRange= x.DataRange, + Unit= x.Unit, + StepSize= x.StepSize, + EnumValue= x.EnumValue, }) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); return new PageUtil() @@ -54,75 +63,87 @@ namespace BPA.SAAS.Manage.Application.Device.Services }; } /// - /// 查询所有工艺信息 + /// 查询所有功能信息 /// /// - public async Task> GetDeviceTechnology() + public async Task> GetProductFunction() { - var res =await _db.Queryable().Where(x => x.Status == 0) + var res =await _db.Queryable().Where(x => x.Status == 0) .OrderBy(i => i.CreateAt, OrderByType.Desc) - .Select(x => new DeviceTechnologyDto() + .Select(x => new ProductFunctionDto() { Id = x.Id, Name = x.Name, - IsBatch = SqlFunc.Subqueryable().Where(p => p.DevicetechnologyId == x.Id).Any() + IsBatch = SqlFunc.Subqueryable().Where(p => p.ProductFunctionId == x.Id).Any() }) .ToListAsync(); return res; } /// - /// 添加工艺 + /// 添加功能 /// /// /// - public async Task AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) + public async Task AddProductFunction(ProductFunctionBaseDto inputDto) { - var data = _db.Queryable() + var data = _db.Queryable() .Where(a => a.Name == inputDto.Name).ToList(); if (data.Count > 0) { - throw Oops.Oh("工艺名称已存在"); + throw Oops.Oh("功能名称已存在"); } else { - var res =await _db.Insertable(new BPA_DeviceTechnology() + var res =await _db.Insertable(new BPA_ProductFunction() { Id = Guid.NewGuid().ToString(), Name = inputDto.Name, Status = CommonStatus.ENABLE, CreateAt = DateTime.Now, IsDeleted = 0, + Type= inputDto.Type, ForeignKeyRe = inputDto.ForeignKeyRe, - DeviceVersionKey = inputDto.DeviceVersionKey + DeviceVersionKey = inputDto.DeviceVersionKey, + DataType = inputDto.DataType, + DataRange = inputDto.DataRange, + Unit =inputDto.Unit, + StepSize = inputDto.StepSize, + EnumValue = inputDto.EnumValue, }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); return res > 0; } } /// - /// 修改工艺 + /// 修改功能 /// /// /// - public async Task UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) + public async Task UpdateProductFunction(ProductFunctionBaseDto inputDto) { - var check = _db.Queryable().Any(a => a.Id != inputDto.Id && a.Name == inputDto.Name); - if (check) throw Oops.Oh("工艺名称已存在"); - var data = _db.Queryable().Where(a => a.Id == inputDto.Id).First(); + var check = _db.Queryable().Any(a => a.Id != inputDto.Id && a.Name == inputDto.Name); + if (check) throw Oops.Oh("功能名称已存在"); + var data = _db.Queryable().Where(a => a.Id == inputDto.Id).First(); data.Name = inputDto.Name; data.DeviceVersionKey = inputDto.DeviceVersionKey; data.ForeignKeyRe = inputDto.ForeignKeyRe; + data.DataType = inputDto.DataType; + data.DataRange = inputDto.DataRange; + data.Unit = inputDto.Unit; + data.StepSize = inputDto.StepSize; + data.EnumValue = inputDto.EnumValue; + data.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), inputDto.Status); var res =await _db.Updateable(data).ExecuteCommandAsync(); return res > 0; } /// - /// 删除配方工艺 + /// 删除功能 /// /// /// - public async Task DeleteDeviceTechnology(List ids) + public async Task DeleteProductFunction(List ids) { - var resEntity = _db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); + var resEntity = _db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); foreach (var item in resEntity) { item.IsDeleted = 1; @@ -131,49 +152,49 @@ namespace BPA.SAAS.Manage.Application.Device.Services return res > 0; } #endregion - #region 工艺模型 + #region 功能参数 /// - /// 根据工艺id查询工艺模型 + /// 根据功能id查询功能参数 /// /// - public async Task> GetTechnologyActionList(string devicetechnologyId) + public async Task> GetProductFunctionActionList(string productFunctionId) { - var res = await _db.Queryable().Where(x => x.IsDeleted == 0 && x.DevicetechnologyId == devicetechnologyId ) + var res = await _db.Queryable().Where(x => x.IsDeleted == 0 && x.ProductFunctionId == productFunctionId) .OrderBy(i => i.Sort, OrderByType.Asc) .ToListAsync(); return res; } /// - /// 查询所有工艺模型 + /// 查询所功能参数 /// /// - public async Task> GetTechnologyActionList() + public async Task> GetProductFunctionActionList() { - var res = await _db.Queryable().Where(x => x.IsDeleted == 0) + var res = await _db.Queryable().Where(x => x.IsDeleted == 0) .OrderBy(i => i.Sort, OrderByType.Asc) .ToListAsync(); return res; } /// - /// 添加工艺模型 + /// 添加功能参数 /// /// /// - public async Task AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) + public async Task AddProductFunctionAction(ProductFunctionActionBaseDto inputDto) { - var check = _db.Queryable() - .Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.IsDeleted == 0 && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType); + var check = _db.Queryable() + .Any(a => a.ProductFunctionId == inputDto.ProductFunctionId && a.IsDeleted == 0 && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType); if (check) { - throw Oops.Oh("工艺流程动作已存在"); + throw Oops.Oh("功能参数已存在"); } else { - var res = await _db.Insertable(new BPA_DeviceTechnologyAction() + var res = await _db.Insertable(new BPA_ProductFunctionAction() { - DevicetechnologyId = inputDto.DevicetechnologyId, + ProductFunctionId = inputDto.ProductFunctionId, ActionName = inputDto.ActionName, ActionType = inputDto.ActionType, ActionValue = inputDto.ActionValue, @@ -186,16 +207,16 @@ namespace BPA.SAAS.Manage.Application.Device.Services } } /// - /// 修改工艺模型 + /// 修改功能参数 /// /// /// - public async Task UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) + public async Task UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto) { - var check = _db.Queryable().Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType && a.Id != inputDto.Id); - if (check) throw Oops.Oh("工艺流程动作已存在"); - var data = _db.Queryable().Where(a => a.Id == inputDto.Id).First(); - if (data == null) throw Oops.Oh("工艺流程动作不存在"); + var check = _db.Queryable().Any(a => a.ProductFunctionId == inputDto.ProductFunctionId && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType && a.Id != inputDto.Id); + if (check) throw Oops.Oh("功能参数已存在"); + var data = _db.Queryable().Where(a => a.Id == inputDto.Id).First(); + if (data == null) throw Oops.Oh("功能参数不存在"); data.ActionName = inputDto.ActionName; data.ActionType = inputDto.ActionType; data.ActionValue = inputDto.ActionValue; @@ -206,13 +227,13 @@ namespace BPA.SAAS.Manage.Application.Device.Services return res > 0; } /// - /// 删除工艺模型 + /// 删除功能参数 /// /// /// - public async Task DeleteTechnologyAction(List ids) + public async Task DeleteProductFunctionAction(List ids) { - var resEntity = _db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); + var resEntity = _db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); foreach (var item in resEntity) { item.IsDeleted = 1; diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs index 5423038..d3ef588 100644 --- a/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs +++ b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs @@ -47,7 +47,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services /// public async Task> GetProductList() { - var data = await _db.Queryable() .ToListAsync(); + var data = await _db.Queryable().Where(x=>x.Status==0) .ToListAsync(); return data; } /// @@ -63,6 +63,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services Name = inputDto.Name, Key = GetNumber2(count), Remark=inputDto.Remark, + Code= inputDto.Code, Status = CommonStatus.ENABLE }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); return res > 0; @@ -92,6 +93,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services { var res = _db.Updateable() .SetColumns(t => t.Name == inputDto.Name) + .SetColumns(t => t.Code == inputDto.Code) .SetColumns(t => t.Remark == inputDto.Remark).Where(t => t.Id == inputDto.Id) .ExecuteCommandHasChange(); diff --git a/BPA.SAAS.Manage.Core/Base/IStatus.cs b/BPA.SAAS.Manage.Core/Base/IStatus.cs new file mode 100644 index 0000000..cdbb2f3 --- /dev/null +++ b/BPA.SAAS.Manage.Core/Base/IStatus.cs @@ -0,0 +1,17 @@ +using BPA.SAAS.Manage.Comm.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Core.Base +{ + public interface IStatus + { + /// + /// 状态 0启用 1禁用 + /// + public CommonStatus Status { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Core/DbContext.cs b/BPA.SAAS.Manage.Core/DbContext.cs index 96422db..a6bec26 100644 --- a/BPA.SAAS.Manage.Core/DbContext.cs +++ b/BPA.SAAS.Manage.Core/DbContext.cs @@ -53,6 +53,7 @@ namespace BPA.SAAS.Manage.Core { //过滤已删除数据 db.QueryFilter.AddTableFilter(it => it.IsDeleted == 0); + //db.QueryFilter.AddTableFilter(it => it.Status == 0); if (!IsSuperAdmin()) { //非管理员账户过滤加盟商数据 diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs index a382c40..da38115 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs +++ b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs @@ -28,9 +28,13 @@ namespace BPA.SAAS.Manage.Core.Device /// public string OrgId { get; set; } /// - /// 设备类型 + /// 所属产品 /// - public string DeviceTypeKey { get; set; } + public string ProductId { get; set; } + /// + /// 产品标签 + /// + public string ProductCode { get; set; } /// /// 状态 【正常 停用】默认 正常 /// @@ -42,9 +46,9 @@ namespace BPA.SAAS.Manage.Core.Device [SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)] public int AutoKey { get; set; } /// - /// 设备版本 + /// 产品版本 /// - public string DeviceVersionKey { get; set; } + public string ProductVersionId { get; set; } public string GroupId { get; set; } /// /// 支持工艺还是配方 0工艺 1配方 diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnology.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnology.cs deleted file mode 100644 index 9f5dc72..0000000 --- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnology.cs +++ /dev/null @@ -1,31 +0,0 @@ -using BPA.SAAS.Manage.Comm.Enum; -using BPA.SAAS.Manage.Core.Base; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPA.SAAS.Manage.Core.Device -{ - [SugarTable("bpa_devicetechnology")] - public class BPA_DeviceTechnology : IBaseEntity, IGroupId - { - /// - /// 工艺名称 - /// - public string Name { get; set; } - /// - /// 状态 0启用 1禁用 - /// - public CommonStatus Status { get; set; } = CommonStatus.ENABLE; - public string GroupId { get; set; } - [SugarColumn(ColumnDataType = "Nvarchar(255)", IsNullable = true)] - public string ForeignKeyRe { get; set; } - /// - /// 设备版本 - /// - public string DeviceVersionKey { get; set; } - } -} diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceVesion.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceVesion.cs index 5c3470f..50a05af 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceVesion.cs +++ b/BPA.SAAS.Manage.Core/Device/BPA_DeviceVesion.cs @@ -13,7 +13,10 @@ namespace BPA.SAAS.Manage.Core.Device public class BPA_DeviceVesion : IBaseEntity, IGroupId { public string Vesion { get; set; } - public string DeviceTypeKey { get; set; } + /// + /// 所属产品 + /// + public string ProductId { get; set; } /// /// 模版路径 /// diff --git a/BPA.SAAS.Manage.Core/Device/BPA_Product.cs b/BPA.SAAS.Manage.Core/Device/BPA_Product.cs index c1eed3c..fd4ac47 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_Product.cs +++ b/BPA.SAAS.Manage.Core/Device/BPA_Product.cs @@ -19,6 +19,7 @@ namespace BPA.SAAS.Manage.Core.Device /// public CommonStatus Status { get; set; } = CommonStatus.ENABLE; public string GroupId { get; set; } + public string Code { get; set; } /// /// 备注 /// diff --git a/BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs b/BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs new file mode 100644 index 0000000..90c25f0 --- /dev/null +++ b/BPA.SAAS.Manage.Core/Device/BPA_ProductFunction.cs @@ -0,0 +1,63 @@ +using BPA.SAAS.Manage.Comm.Enum; +using BPA.SAAS.Manage.Core.Base; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Core.Device +{ + /// + ///产品功能 + /// + [SugarTable("bpa_productfunction")] + public class BPA_ProductFunction : IBaseEntity, IGroupId + { + /// + /// 功能名称 + /// + public string Name { get; set; } + /// + /// 状态 0启用 1禁用 + /// + public CommonStatus Status { get; set; } = CommonStatus.ENABLE; + /// + /// 加盟商id + /// + public string GroupId { get; set; } + /// + /// 外键 + /// + public string ForeignKeyRe { get; set; } + /// + /// 设备版本 + /// + public string DeviceVersionKey { get; set; } + /// + /// 功能类型 0属性1服务2事件 + /// + public int Type { get; set; } + /// + /// 数据类型 + /// + public string DataType { get; set; } + /// + /// 取值范围 + /// + public string DataRange { get; set; } + /// + /// 单位 + /// + public string Unit { get; set; } + /// + /// 步长 + /// + public int StepSize { get; set; } + /// + /// 枚举值 + /// + public string EnumValue { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnologyAction.cs b/BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs similarity index 87% rename from BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnologyAction.cs rename to BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs index 70dfa29..de17693 100644 --- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceTechnologyAction.cs +++ b/BPA.SAAS.Manage.Core/Device/BPA_ProductFunctionAction.cs @@ -7,12 +7,12 @@ using System.Threading.Tasks; namespace BPA.SAAS.Manage.Core.Device { - public class BPA_DeviceTechnologyAction: IBaseEntity, IGroupId + public class BPA_ProductFunctionAction: IBaseEntity, IGroupId { /// - /// 工艺id + /// 功能id /// - public string DevicetechnologyId { get; set; } + public string ProductFunctionId { get; set; } /// /// 动作名称 ///