@@ -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<BPA_DeviceTechnology>() | |||
.Where(x => x.Name == thisName && x.DeviceVersionKey == device.DeviceVersionKey).FirstAsync(); | |||
var data = await _db.Queryable<BPA_ProductFunction>() | |||
.Where(x => x.Name == thisName && x.DeviceVersionKey == device.ProductVersionId).FirstAsync(); | |||
var data2 = await _db.Queryable<BPA_DeviceTechnologyAction>() | |||
.Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.DevicetechnologyId == data.Id).FirstAsync(); | |||
var data2 = await _db.Queryable<BPA_ProductFunctionAction>() | |||
.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<BPA_DeviceTechnologyAction>() | |||
.Where(x => x.DevicetechnologyId == thisItem.ChnologyId) | |||
var jsondb = await _db.Queryable<BPA_ProductFunctionAction>() | |||
.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<BPA_DeviceInfo>().FirstAsync(x => x.Id == deviceId); | |||
//设备类型 | |||
var dictData = await _db.Queryable<BPA_DeviceVesion>().FirstAsync(x => x.Id == device.DeviceVersionKey); | |||
var dictData = await _db.Queryable<BPA_DeviceVesion>().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<BPA_DeviceVesion>().FirstAsync(x => x.DeviceTypeKey == inputDto.DeviceClientType && x.Vesion == inputDto.Version); | |||
var deviceVersion = await _db.Queryable<BPA_DeviceVesion>().FirstAsync(x => x.ProductId == inputDto.DeviceClientType && x.Vesion == inputDto.Version); | |||
//添加 设备_烹饪工序模型 | |||
#region 添加 设备_烹饪工序模型 | |||
ReadExcel<GoodstechnologyModel> readGoodstechnologyExcel = new(); | |||
var GoodstechnologyModellist = readGoodstechnologyExcel.ExcelToList(source, mapper); | |||
List<BPA_DeviceTechnology> GoodsTechnologyList = new(); | |||
List<BPA_DeviceTechnologyAction> GoodsTechnologyActionList = new(); | |||
var GoodsTechnologyListDB = await _db.Queryable<BPA_DeviceTechnology>() | |||
List<BPA_ProductFunction> GoodsTechnologyList = new(); | |||
List<BPA_ProductFunctionAction> GoodsTechnologyActionList = new(); | |||
var GoodsTechnologyListDB = await _db.Queryable<BPA_ProductFunction>() | |||
.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<BPA_DeviceTechnologyAction>() | |||
.Where(x => goodstechnologyIds.Contains(x.DevicetechnologyId)).ToListAsync(); | |||
var GoodsTechnologyActionListDb = await _db.Queryable<BPA_ProductFunctionAction>() | |||
.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; | |||
@@ -456,7 +456,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
Id = x.Id.SelectAll(), | |||
}).Mapper(a => | |||
{ | |||
a.GoodsTechnologyInfo = _db.Queryable<BPA_DeviceTechnology>().Where(d => d.DeviceVersionKey == a.DeviceVersionKey).Select(d => new GoodsTechnologyInfo() | |||
a.GoodsTechnologyInfo = _db.Queryable<BPA_ProductFunction>().Where(d => d.DeviceVersionKey == a.ProductVersionId).Select(d => new GoodsTechnologyInfo() | |||
{ | |||
DeviceTechnologyId = d.Id, | |||
DeviceVersionKey = d.DeviceVersionKey, | |||
@@ -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; | |||
} | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/page")] | |||
public async Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) | |||
{ | |||
return await _deviceTechnologyService.GetDeviceTechnologyPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/getdevicetechnology")] | |||
public async Task<List<DeviceTechnologyDto>> GetDeviceTechnology() | |||
{ | |||
return await _deviceTechnologyService.GetDeviceTechnology(); | |||
} | |||
/// <summary> | |||
/// 添加工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/add")] | |||
public async Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddDeviceTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/update")] | |||
public async Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateDeviceTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除配方工艺 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/delete")] | |||
public async Task<bool> DeleteDeviceTechnology(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteDeviceTechnology(ids); | |||
} | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/gettechnologyaction")] | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId) | |||
{ | |||
return await _deviceTechnologyService.GetTechnologyActionList(devicetechnologyId); | |||
} | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicetechnology/gettechnologyactionlist")] | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList() | |||
{ | |||
return await _deviceTechnologyService.GetTechnologyActionList(); | |||
} | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/adddevicetechnologyaction")] | |||
public async Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddDeviceTechnologyAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/updatedevicetechnologyaction")] | |||
public async Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateBomTechnology(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicetechnology/deldevicetechnologyaction")] | |||
public async Task<bool> DeleteTechnologyAction(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteTechnologyAction(ids); | |||
} | |||
} | |||
} |
@@ -74,9 +74,9 @@ namespace BPA.SAAS.Manage.Application.Device | |||
/// <param name="Code"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicevesion/getdevicevesion")] | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string code) | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string productId) | |||
{ | |||
return await _deviceVesionService.GetDeviceVesion(code); | |||
return await _deviceVesionService.GetDeviceVesion(productId); | |||
} | |||
/// <summary> | |||
/// 查询版本列表 | |||
@@ -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 | |||
/// </summary> | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 设备类型 | |||
/// 所属产品 | |||
/// </summary> | |||
public string DeviceTypeKey { get; set; } | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// 产品标签 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
public string ProductCode { get; set; } | |||
/// <summary> | |||
/// 产品版本 | |||
/// </summary> | |||
public string ProductVersionId { get; set; } | |||
public CommonStatus Status { get; set; } | |||
public int TechnologyOrBom { get; set; } | |||
} | |||
} |
@@ -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 | |||
/// </summary> | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 设备类型 | |||
/// 所属产品 | |||
/// </summary> | |||
public string DeviceTypeKey { get; set; } | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 所属产品名称 | |||
/// </summary> | |||
public string ProductName { get; set; } | |||
/// <summary> | |||
/// 所属产品标签 | |||
/// </summary> | |||
public string ProductCode { get; set; } | |||
/// <summary> | |||
/// 设备AutoKey 唯一用于mqtt消息推送标识 | |||
/// </summary> | |||
@@ -34,8 +43,10 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
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; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
@@ -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; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public int Status { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public string DeviceVersionKey { get; set; } | |||
} | |||
} |
@@ -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; } | |||
/// <summary> | |||
/// 模版路径 | |||
@@ -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; } | |||
/// <summary> | |||
/// 所属产品 | |||
/// </summary> | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string ProductName { get; set; } | |||
/// <summary> | |||
/// 产品标签 | |||
/// </summary> | |||
public string ProductCode { get; set; } | |||
/// <summary> | |||
/// 模版路径 | |||
/// </summary> | |||
public string TemplatePath { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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; } | |||
/// <summary> | |||
/// 工艺id | |||
/// 功能id | |||
/// </summary> | |||
public string DevicetechnologyId { get; set; } | |||
public string ProductFunctionId { get; set; } | |||
/// <summary> | |||
/// 动作名称 | |||
/// </summary> |
@@ -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; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public int Status { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public string DeviceVersionKey { get; set; } | |||
/// <summary> | |||
/// 功能类型 0属性1服务2事件 | |||
/// </summary> | |||
public int Type { get; set; } | |||
/// <summary> | |||
/// 数据类型 | |||
/// </summary> | |||
public string DataType { get; set; } | |||
/// <summary> | |||
/// 取值范围 | |||
/// </summary> | |||
public string DataRange { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string Unit { get; set; } | |||
/// <summary> | |||
/// 步长 | |||
/// </summary> | |||
public int StepSize { get; set; } | |||
/// <summary> | |||
/// 枚举值 | |||
/// </summary> | |||
public string EnumValue { get; set; } | |||
} | |||
} |
@@ -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; } |
@@ -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; } | |||
} | |||
} |
@@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Interface | |||
Task<bool> DelDeviceVesionAsync(List<string> inputList); | |||
Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto); | |||
Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto); | |||
Task<List<BPA_DeviceVesion>> GetDeviceVesion(string Code); | |||
Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId); | |||
Task<List<BPA_DeviceVesion>> GetDeviceVesionList(); | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// 获取功能基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto); | |||
Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto); | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// 查询所有功能信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<DeviceTechnologyDto>> GetDeviceTechnology(); | |||
Task<List<ProductFunctionDto>> GetProductFunction(); | |||
/// <summary> | |||
/// 添加工艺 | |||
/// 添加功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto); | |||
Task<bool> AddProductFunction(ProductFunctionBaseDto inputDto); | |||
/// <summary> | |||
/// 修改工艺 | |||
/// 修改功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto); | |||
Task<bool> UpdateProductFunction(ProductFunctionBaseDto inputDto); | |||
/// <summary> | |||
/// 删除工艺 | |||
/// 删除功能 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteDeviceTechnology(List<string> ids); | |||
Task<bool> DeleteProductFunction(List<string> ids); | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// 根据功能id查询功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId); | |||
Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId); | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// 查询所有功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(); | |||
Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(); | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// 添加功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto); | |||
Task<bool> AddProductFunctionAction(ProductFunctionActionBaseDto inputDto); | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// 修改功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto); | |||
Task<bool> UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto); | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// 删除功能参数 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteTechnologyAction(List<string> ids); | |||
Task<bool> DeleteProductFunctionAction(List<string> ids); | |||
} | |||
} |
@@ -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; | |||
} | |||
/// <summary> | |||
/// 获取功能基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/page")] | |||
public async Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto) | |||
{ | |||
return await _deviceTechnologyService.GetProductFunctionPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询所有功能信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/productfunction/getdevicetechnology")] | |||
public async Task<List<ProductFunctionDto>> GetProductFunction() | |||
{ | |||
return await _deviceTechnologyService.GetProductFunction(); | |||
} | |||
/// <summary> | |||
/// 添加功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/add")] | |||
public async Task<bool> AddProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddProductFunction(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/update")] | |||
public async Task<bool> UpdateProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateProductFunction(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除功能 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/delete")] | |||
public async Task<bool> DeleteProductFunction(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteProductFunction(ids); | |||
} | |||
/// <summary> | |||
/// 根据功能id查询功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/productfunction/getproductfunctionaction")] | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId) | |||
{ | |||
return await _deviceTechnologyService.GetProductFunctionActionList(productFunctionId); | |||
} | |||
/// <summary> | |||
/// 查询所有功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/productfunction/getproductfunctionactionlist")] | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList() | |||
{ | |||
return await _deviceTechnologyService.GetProductFunctionActionList(); | |||
} | |||
/// <summary> | |||
/// 添加功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/addproductfunctionaction")] | |||
public async Task<bool> AddProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.AddProductFunctionAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/updateproductfunctionaction")] | |||
public async Task<bool> UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
return await _deviceTechnologyService.UpdateProductFunctionAction(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除功能参数 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/productfunction/delproductfunctionaction")] | |||
public async Task<bool> DeleteProductFunctionAction(List<string> ids) | |||
{ | |||
return await _deviceTechnologyService.DeleteProductFunctionAction(ids); | |||
} | |||
} | |||
} |
@@ -32,22 +32,23 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
public async Task<PageUtil> GetDeviceInfoPage(DeviceQueryInputDto inputDto) | |||
{ | |||
RefAsync<int> total =0; | |||
var data = await _db.Queryable<BPA_DeviceInfo, BPA_Organize>((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<BPA_DeviceInfo, BPA_Product>((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<BPA_DeviceVesion>().Where(c => c.Id == x.DeviceVersionKey).First(); | |||
x.DeviceVersionName = Vesion?.Vesion; | |||
var Vesion = _db.Queryable<BPA_DeviceVesion>().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<bool> AddDevice(DeviceInfoBaseDto inputDto) | |||
{ | |||
BPA_DeviceInfo bPA_DeviceInfo = inputDto.Adapt<BPA_DeviceInfo>(); | |||
var product=_db.Queryable<BPA_Product>().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; | |||
} | |||
/// <summary> | |||
@@ -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<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First(); | |||
var inputData = inputDto.Adapt<BPA_DeviceInfo>(); | |||
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(); | |||
@@ -27,9 +27,15 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
public async Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await _db.Queryable<BPA_DeviceVesion>().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<BPA_DeviceVesion,BPA_Product>((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 | |||
/// <returns></returns> | |||
public async Task<bool> DelDeviceVesionAsync(List<string> inputList) | |||
{ | |||
var data = await _db.Queryable<BPA_DeviceInfo>().Where(x => inputList.Contains(x.DeviceVersionKey)).ToListAsync(); | |||
var data = await _db.Queryable<BPA_DeviceInfo>().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<BPA_DeviceVesion>().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; | |||
} | |||
/// <summary> | |||
/// 根据设备编码查询版本 | |||
/// 根据产品查询版本 | |||
/// </summary> | |||
/// <param name="Code"></param> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string Code) | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId) | |||
{ | |||
var resEntity =await _db.Queryable<BPA_DeviceVesion>().Where(a => a.DeviceTypeKey == Code).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync(); | |||
var resEntity =await _db.Queryable<BPA_DeviceVesion>().Where(a => a.ProductId == ProductId && a.Status==0).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync(); | |||
return resEntity; | |||
} | |||
/// <summary> | |||
@@ -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 产品功能 | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// 获取功能基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase inputDto) | |||
public async Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto) | |||
{ | |||
RefAsync<int> total = 0; | |||
var res = await _db.Queryable<BPA_DeviceTechnology, BPA_DeviceVesion>((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey)) | |||
.OrderBy((x, b) => x.CreateAt, OrderByType.Desc) | |||
var res = await _db.Queryable<BPA_ProductFunction, BPA_DeviceVesion>((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 | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// 查询所有功能信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<DeviceTechnologyDto>> GetDeviceTechnology() | |||
public async Task<List<ProductFunctionDto>> GetProductFunction() | |||
{ | |||
var res =await _db.Queryable<BPA_DeviceTechnology>().Where(x => x.Status == 0) | |||
var res =await _db.Queryable<BPA_ProductFunction>().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<BPA_DeviceTechnologyAction>().Where(p => p.DevicetechnologyId == x.Id).Any() | |||
IsBatch = SqlFunc.Subqueryable<BPA_ProductFunctionAction>().Where(p => p.ProductFunctionId == x.Id).Any() | |||
}) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加工艺 | |||
/// 添加功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
public async Task<bool> AddProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
var data = _db.Queryable<BPA_DeviceTechnology>() | |||
var data = _db.Queryable<BPA_ProductFunction>() | |||
.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; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺 | |||
/// 修改功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
public async Task<bool> UpdateProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnology>().Any(a => a.Id != inputDto.Id && a.Name == inputDto.Name); | |||
if (check) throw Oops.Oh("工艺名称已存在"); | |||
var data = _db.Queryable<BPA_DeviceTechnology>().Where(a => a.Id == inputDto.Id).First(); | |||
var check = _db.Queryable<BPA_ProductFunction>().Any(a => a.Id != inputDto.Id && a.Name == inputDto.Name); | |||
if (check) throw Oops.Oh("功能名称已存在"); | |||
var data = _db.Queryable<BPA_ProductFunction>().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; | |||
} | |||
/// <summary> | |||
/// 删除配方工艺 | |||
/// 删除功能 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteDeviceTechnology(List<string> ids) | |||
public async Task<bool> DeleteProductFunction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnology>().Where(x => ids.Contains(x.Id)).ToList(); | |||
var resEntity = _db.Queryable<BPA_ProductFunction>().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 功能参数 | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// 根据功能id查询功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId) | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId) | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => x.IsDeleted == 0 && x.DevicetechnologyId == devicetechnologyId ) | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>().Where(x => x.IsDeleted == 0 && x.ProductFunctionId == productFunctionId) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// 查询所功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList() | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList() | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => x.IsDeleted == 0) | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>().Where(x => x.IsDeleted == 0) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加工艺模型 | |||
/// 添加功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTechnologyAction(DeviceTechnologyActionBaseDto inputDto) | |||
public async Task<bool> AddProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnologyAction>() | |||
.Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.IsDeleted == 0 && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType); | |||
var check = _db.Queryable<BPA_ProductFunctionAction>() | |||
.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 | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// 修改功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto inputDto) | |||
public async Task<bool> UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnologyAction>().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<BPA_DeviceTechnologyAction>().Where(a => a.Id == inputDto.Id).First(); | |||
if (data == null) throw Oops.Oh("工艺流程动作不存在"); | |||
var check = _db.Queryable<BPA_ProductFunctionAction>().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<BPA_ProductFunctionAction>().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; | |||
} | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// 删除功能参数 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteTechnologyAction(List<string> ids) | |||
public async Task<bool> DeleteProductFunctionAction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
var resEntity = _db.Queryable<BPA_ProductFunctionAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; |
@@ -47,7 +47,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
/// <returns></returns> | |||
public async Task<List<BPA_Product>> GetProductList() | |||
{ | |||
var data = await _db.Queryable<BPA_Product>() .ToListAsync(); | |||
var data = await _db.Queryable<BPA_Product>().Where(x=>x.Status==0) .ToListAsync(); | |||
return data; | |||
} | |||
/// <summary> | |||
@@ -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<BPA_Product>() | |||
.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(); | |||
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } | |||
} | |||
} |
@@ -53,6 +53,7 @@ namespace BPA.SAAS.Manage.Core | |||
{ | |||
//过滤已删除数据 | |||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
//db.QueryFilter.AddTableFilter<IStatus>(it => it.Status == 0); | |||
if (!IsSuperAdmin()) | |||
{ | |||
//非管理员账户过滤加盟商数据 | |||
@@ -28,9 +28,13 @@ namespace BPA.SAAS.Manage.Core.Device | |||
/// </summary> | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 设备类型 | |||
/// 所属产品 | |||
/// </summary> | |||
public string DeviceTypeKey { get; set; } | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 产品标签 | |||
/// </summary> | |||
public string ProductCode { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
@@ -42,9 +46,9 @@ namespace BPA.SAAS.Manage.Core.Device | |||
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)] | |||
public int AutoKey { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// 产品版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
public string ProductVersionId { get; set; } | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 支持工艺还是配方 0工艺 1配方 | |||
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 工艺名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
[SugarColumn(ColumnDataType = "Nvarchar(255)", IsNullable = true)] | |||
public string ForeignKeyRe { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
} | |||
} |
@@ -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; } | |||
/// <summary> | |||
/// 所属产品 | |||
/// </summary> | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 模版路径 | |||
/// </summary> | |||
@@ -19,6 +19,7 @@ namespace BPA.SAAS.Manage.Core.Device | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string GroupId { get; set; } | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
@@ -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 | |||
{ | |||
/// <summary> | |||
///产品功能 | |||
/// </summary> | |||
[SugarTable("bpa_productfunction")] | |||
public class BPA_ProductFunction : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 功能名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 外键 | |||
/// </summary> | |||
public string ForeignKeyRe { get; set; } | |||
/// <summary> | |||
/// 设备版本 | |||
/// </summary> | |||
public string DeviceVersionKey { get; set; } | |||
/// <summary> | |||
/// 功能类型 0属性1服务2事件 | |||
/// </summary> | |||
public int Type { get; set; } | |||
/// <summary> | |||
/// 数据类型 | |||
/// </summary> | |||
public string DataType { get; set; } | |||
/// <summary> | |||
/// 取值范围 | |||
/// </summary> | |||
public string DataRange { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string Unit { get; set; } | |||
/// <summary> | |||
/// 步长 | |||
/// </summary> | |||
public int StepSize { get; set; } | |||
/// <summary> | |||
/// 枚举值 | |||
/// </summary> | |||
public string EnumValue { get; set; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 工艺id | |||
/// 功能id | |||
/// </summary> | |||
public string DevicetechnologyId { get; set; } | |||
public string ProductFunctionId { get; set; } | |||
/// <summary> | |||
/// 动作名称 | |||
/// </summary> |