@@ -34,3 +34,4 @@ | |||
/BPA.SAAS.Manage.Core/obj | |||
/BPA.SAAS.Manage.Web.Core/obj | |||
/BPA.SAAS.Manage.Web.Entry | |||
/.vs/BPA.SAAS.Manage/FileContentIndex |
@@ -28,7 +28,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetBatchingList(BatchingListQuery dto) | |||
{ | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
#region 查询条件 | |||
List<IConditionalModel> conModels = new List<IConditionalModel>(); | |||
if (!string.IsNullOrEmpty(dto.Name))//物料名称 | |||
@@ -59,10 +58,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Status", ConditionalType = ConditionalType.Equal, FieldValue = dto.Status }); | |||
} | |||
if (!string.IsNullOrEmpty(groupId)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.GroupId", ConditionalType = ConditionalType.Equal, FieldValue = groupId }); | |||
} | |||
if (dto.Price != null) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Price", ConditionalType = ConditionalType.Equal, FieldValue = dto.Price.ToString() }); | |||
@@ -75,7 +70,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
RefAsync<int> total = 0; | |||
var res =await _db.Queryable<BPA_Batching, BPA_BatchingType, BPA_BatchingUint>((a, b, c) => | |||
new JoinQueryInfos(JoinType.Inner, a.TypeID == b.Id, JoinType.Inner, a.StockUint == c.Id)) | |||
.Where((a, b, c) => a.IsDeleted == 0 && b.IsDeleted == 0 && c.IsDeleted == 0) | |||
//.Where((a, b, c) => a.IsDeleted == 0 && b.IsDeleted == 0 && c.IsDeleted == 0) | |||
.Where(conModels) | |||
.WhereIF(dto.CreateAt.HasValue, a => SqlFunc.DateIsSame(a.CreateAt, Convert.ToDateTime(dto.CreateAt), DateType.Day)) | |||
.OrderBy((a, b, c) => a.CreateAt, OrderByType.Desc) | |||
@@ -259,7 +254,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
try | |||
{ | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites = _db.Queryable<BPA_Batching>().Where(x => x.IsDeleted == 0 && x.Id == dto.Id).First(); | |||
var resEntitites = _db.Queryable<BPA_Batching>().Where(x => x.Id == dto.Id).First(); | |||
if (resEntitites != null) | |||
{ | |||
@@ -302,8 +297,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
} | |||
public async Task<bool> AddBatchingType(BatchingTypeDto dto) | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var productCode = _db.Queryable<BPA_BatchingType>().Where(x => x.IsDeleted == 0 && x.GroupId == groupId && x.Name== dto.Name).ToList(); | |||
var productCode = _db.Queryable<BPA_BatchingType>().Where(x => x.Name== dto.Name).ToList(); | |||
if (productCode.Count() > 0) | |||
{ | |||
throw Oops.Oh("物料类型已存在"); | |||
@@ -348,8 +342,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
} | |||
public async Task<bool> AddBatchingUint(BatchingUintDto dto) | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var productCode = _db.Queryable<BPA_BatchingUint>().Where(x => x.IsDeleted == 0 && x.GroupId == groupId && x.Name == dto.Name).ToList(); | |||
var productCode = _db.Queryable<BPA_BatchingUint>().Where(x => x.Name == dto.Name).ToList(); | |||
if (productCode.Count() > 0) | |||
{ | |||
throw Oops.Oh("物料单位已存在"); | |||
@@ -12,6 +12,7 @@ using BPA.SAAS.Manage.Comm.Util; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using BPA.SAAS.Manage.Core.Product; | |||
using Newtonsoft.Json; | |||
using Npoi.Mapper; | |||
using NPOI.HSSF.UserModel; | |||
@@ -72,7 +73,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var res =await _db.Queryable<BPA_GoodsInfo, BPA_GoodsType>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.GoodsTypeId == b.Id | |||
)) | |||
.Where((a, b) => a.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrWhiteSpace(dto.Code), (a, b) => a.Code.Contains(dto.Code)) | |||
// .WhereIF(dto.CreateAt.HasValue, (a, b) => SqlFunc.DateIsSame(a.CreateAt, Convert.ToDateTime(dto.CreateAt), DateType.Day)) | |||
@@ -214,8 +214,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsUint(GoodsUintDto dto) | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var productCode = _db.Queryable<BPA_GoodsUint>().Where(x => x.GroupId == groupId && x.Name == dto.Name).ToList(); | |||
var productCode = _db.Queryable<BPA_GoodsUint>().Where(x =>x.Name == dto.Name).ToList(); | |||
if (productCode.Count() > 0) | |||
{ | |||
throw Oops.Oh("商品单位已存在"); | |||
@@ -282,7 +281,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
_db.Ado.BeginTran(); | |||
try | |||
{ | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
var sortMax = _db.Queryable<BPA_Bom>().Max(x => x.Sort); | |||
BPA_Bom newbPA_BOM = new BPA_Bom | |||
{ | |||
@@ -293,7 +291,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
Id = Guid.NewGuid().ToString(), | |||
CreateAt = DateTime.Now, | |||
Status = CommonStatus.ENABLE, | |||
GroupId = groupId | |||
}; | |||
//添加配方 | |||
var res = _db.Insertable(newbPA_BOM).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
@@ -747,7 +744,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
#endregion | |||
//添加 工艺_{商品名称} | |||
//添加 功能_{商品名称} | |||
var tableName = ExcelToShtteName(file.OpenReadStream(), Path.GetExtension(file.FileName)); | |||
#region 添加 工艺_{商品名称} | |||
@@ -780,11 +777,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 +846,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 +856,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 +940,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 +969,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 +987,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 +1004,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 +1045,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; | |||
@@ -4,6 +4,7 @@ using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using BPA.SAAS.Manage.Core.Product; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -456,7 +457,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 && d.Type==1).Select(d => new GoodsTechnologyInfo() | |||
{ | |||
DeviceTechnologyId = d.Id, | |||
DeviceVersionKey = d.DeviceVersionKey, | |||
@@ -14,6 +14,7 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
@@ -42,9 +43,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "Status", ConditionalType = ConditionalType.Equal, FieldValue = dto.Status }); | |||
} | |||
int total = new RefAsync<int>(); | |||
var res =await _db.Queryable<BPA_GoodsType>().Where(it => it.IsDeleted == 0) | |||
var res =await _db.Queryable<BPA_GoodsType>().Where(it => it.IsDeleted == 0 && it.GroupId== groupId) | |||
.Where(conModels) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(it => new GoodsTypeTree() { Id = it.Id, Name = it.Name, Pid = it.Pid,Sort=it.Sort,Remark=it.Remark,Status=it.Status }).ToTreeAsync(it => it.Children, it => it.Pid, 0); | |||
@@ -129,9 +130,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
public async Task<dynamic> GetGoodsTypeTree() | |||
{ | |||
var dataScopeList = new List<string>(); | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var orgs = await _db.Queryable<BPA_GoodsType>().WhereIF(dataScopeList.Count > 0, u => dataScopeList.Contains(u.Id)) | |||
.Where(u => u.Status == CommonStatus.ENABLE && u.IsDeleted==0).OrderBy(u => u.Sort) | |||
.Where(u => u.Status == CommonStatus.ENABLE && u.IsDeleted==0 && u.GroupId == groupId).OrderBy(u => u.Sort) | |||
.Select(u => new OrgTreeNode | |||
{ | |||
key = u.Id, | |||
@@ -1,7 +1,9 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Comm.Model; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using Microsoft.AspNetCore.Components.Forms; | |||
using NPOI.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -29,6 +31,15 @@ namespace BPA.SAAS.Manage.Application.Device | |||
return await _deviceService.GetDeviceInfoPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询设备列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/device/list")] | |||
public async Task<List<ListSelectQuery>> GetDeviceList() | |||
{ | |||
return await _deviceService.GetDeviceList(); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
@@ -58,5 +69,24 @@ namespace BPA.SAAS.Manage.Application.Device | |||
{ | |||
return await _deviceService.DelDeviceInfo(inputList); | |||
} | |||
/// <summary> | |||
/// 添加设备标签 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/device/adddevicetype")] | |||
public async Task<bool> AddDeviceTypeAsync(DeviceTypeBaseDto inputDto) | |||
{ | |||
return await _deviceService.AddDeviceTypeAsync(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询设备标签 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/device/getdevicetypelist")] | |||
public async Task<List<ListSelectQuery>> GetDeviceTypeList() | |||
{ | |||
return await _deviceService.GetDeviceTypeList(); | |||
} | |||
} | |||
} |
@@ -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); | |||
} | |||
} | |||
} |
@@ -0,0 +1,91 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion; | |||
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 DeviceVesionServices: IDynamicApiController, ITransient | |||
{ | |||
IDeviceVesionService _deviceVesionService; | |||
public DeviceVesionServices(IDeviceVesionService deviceVesionService) | |||
{ | |||
_deviceVesionService= deviceVesionService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicevesion/page")] | |||
public async Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto) | |||
{ | |||
return await _deviceVesionService.GetDeviceVesionPageAsync(inputDto); | |||
} | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicevesion/add")] | |||
public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto) | |||
{ | |||
return await _deviceVesionService.AddDeviceVesionAsync(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicevesion/delete")] | |||
public async Task<bool> DelDeviceVesionAsync(List<string> inputList) | |||
{ | |||
return await _deviceVesionService.DelDeviceVesionAsync(inputList); | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicevesion/update")] | |||
public async Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto) | |||
{ | |||
return await _deviceVesionService.UpdateDeviceVesionAsync(inputDto); | |||
} | |||
/// <summary> | |||
/// 更新状态 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/devicevesion/updatestatus")] | |||
public async Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto) | |||
{ | |||
return await _deviceVesionService.UpdateDeviceVesionSatatus(inputDto); | |||
} | |||
/// <summary> | |||
/// 根据设备编码查询版本 | |||
/// </summary> | |||
/// <param name="Code"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicevesion/getdevicevesion")] | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string productId) | |||
{ | |||
return await _deviceVesionService.GetDeviceVesion(productId); | |||
} | |||
/// <summary> | |||
/// 查询版本列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/devicevesion/getdevicevesionlist")] | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesionList() | |||
{ | |||
return await _deviceVesionService.GetDeviceVesionList(); | |||
} | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||
{ | |||
public class DeviceTypeBaseDto | |||
{ | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||
{ | |||
public class ProductBaseDto | |||
{ | |||
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; } | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||
{ | |||
public class ProductQueryInputDto: PageInputBase | |||
{ | |||
public string Name { get; set; } | |||
public string Key { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.Device | |||
{ | |||
public class ProductSatatusDto | |||
{ | |||
public string Id { get; set; } | |||
public int Status { 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; } | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
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 DeviceVesionBaseDto | |||
{ | |||
public string Id { get; set; } | |||
public string Vesion { get; set; } | |||
public string ProductId { get; set; } | |||
/// <summary> | |||
/// 模版路径 | |||
/// </summary> | |||
public string TemplatePath { get; set; } | |||
public int Status { get; set; } | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
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 DeviceVesionQueryInputDto : PageInputBase | |||
{ | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
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 DeviceVesionSatatusDto | |||
{ | |||
public string Id { get; set; } | |||
public int Status { 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,62 @@ | |||
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; } | |||
/// <summary> | |||
/// 数据长度 | |||
/// </summary> | |||
public string DataLength { get; set; } | |||
/// <summary> | |||
/// 数据类型bool的描述 | |||
/// </summary> | |||
public string BoolLabel { get; set; } | |||
/// <summary> | |||
/// 读写类型0读写 1只读 | |||
/// </summary> | |||
public int ReadWrite { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { 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; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics | |||
{ | |||
public class ProductTopicsBaseDto | |||
{ | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// Topics类 | |||
/// </summary> | |||
public string Topics { get; set; } | |||
/// <summary> | |||
/// TopicsType类型 0发布 1订阅 2发布和订阅 | |||
/// </summary> | |||
public int TopicsType { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics | |||
{ | |||
public class ProductTopicsQueryInputDto : PageInputBase | |||
{ | |||
public int? TopicsType { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Comm.Model; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -11,8 +12,11 @@ namespace BPA.SAAS.Manage.Application.Device.Interface | |||
public interface IDeviceService | |||
{ | |||
Task<PageUtil> GetDeviceInfoPage(DeviceQueryInputDto inputDto); | |||
Task<List<ListSelectQuery>> GetDeviceList(); | |||
Task<bool> AddDevice(DeviceInfoBaseDto inputDto); | |||
Task<bool> UpdateDevice(DeviceInfoBaseDto inputDto); | |||
Task<bool> DelDeviceInfo(List<string> inputList); | |||
Task<bool> AddDeviceTypeAsync(DeviceTypeBaseDto inputDto); | |||
Task<List<ListSelectQuery>> GetDeviceTypeList(); | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Interface | |||
{ | |||
public interface IDeviceVesionService | |||
{ | |||
Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto); | |||
Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto); | |||
Task<bool> DelDeviceVesionAsync(List<string> inputList); | |||
Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto); | |||
Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto); | |||
Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId); | |||
Task<List<BPA_DeviceVesion>> GetDeviceVesionList(); | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
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 BPA.SAAS.Manage.Core.Product; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -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,21 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Product; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Interface | |||
{ | |||
public interface IProductService | |||
{ | |||
Task<PageUtil> GetProductPage(ProductQueryInputDto inputDto); | |||
Task<List<BPA_Product>> GetProductList(); | |||
Task<bool> AddProduct(ProductBaseDto inputDto); | |||
Task<bool> DeProduct(List<string> inputList); | |||
Task<bool> UpdateProduct(ProductBaseDto inputDto); | |||
Task<bool> UpdateDeviceVesionSatatus(ProductSatatusDto inputDto); | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Interface | |||
{ | |||
public interface IProductTopicsService | |||
{ | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto); | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto); | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
Task<bool> DelProductTopics(List<string> inputList); | |||
} | |||
} |
@@ -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.Product; | |||
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); | |||
} | |||
} | |||
} |
@@ -0,0 +1,82 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Product; | |||
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 ProductServices: IDynamicApiController, ITransient | |||
{ | |||
IProductService _productService; | |||
public ProductServices(IProductService productService) | |||
{ | |||
_productService=productService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/product/page")] | |||
public async Task<PageUtil> GetProductPage(ProductQueryInputDto inputDto) | |||
{ | |||
return await _productService.GetProductPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/product/list")] | |||
public async Task<List<BPA_Product>> GetProductList() | |||
{ | |||
return await _productService.GetProductList(); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/product/add")] | |||
public async Task<bool> AddProduct(ProductBaseDto inputDto) | |||
{ | |||
return await _productService.AddProduct(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/product/delete")] | |||
public async Task<bool> DeProduct(List<string> inputList) | |||
{ | |||
return await _productService.DeProduct(inputList); | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/product/update")] | |||
public async Task<bool> UpdateProduct(ProductBaseDto inputDto) | |||
{ | |||
return await _productService.UpdateProduct(inputDto); | |||
} | |||
/// <summary> | |||
/// 更新状态 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/product/updatestatus")] | |||
public async Task<bool> UpdateDeviceVesionSatatus(ProductSatatusDto inputDto) | |||
{ | |||
return await _productService.UpdateDeviceVesionSatatus(inputDto); | |||
} | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Core.Base; | |||
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 = "产品Topics")] | |||
public class ProductTopicsServices: IDynamicApiController, ITransient | |||
{ | |||
IProductTopicsService _productTopicsService; | |||
public ProductTopicsServices(IProductTopicsService productTopicsService) | |||
{ | |||
_productTopicsService=productTopicsService; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/page")] | |||
public async Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) | |||
{ | |||
return await _productTopicsService.GetProductTopicsPage(inputDto); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/add")] | |||
public async Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
return await _productTopicsService.AddProductTopics(inputDto); | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/update")] | |||
public async Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
return await _productTopicsService.UpdateProductTopics(inputDto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/producttopics/delete")] | |||
public async Task<bool> DelProductTopics(List<string> inputList) | |||
{ | |||
return await _productTopicsService.DelProductTopics(inputList); | |||
} | |||
} | |||
} |
@@ -1,10 +1,13 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Comm.Model; | |||
using BPA.SAAS.Manage.Comm.Util; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using BPA.SAAS.Manage.Core.Org; | |||
using BPA.SAAS.Manage.Core.Product; | |||
using BPA.SAAS.Manage.Core.system; | |||
using Dm; | |||
using System; | |||
@@ -30,22 +33,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, a.ProductId == b.Id)) | |||
.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() | |||
@@ -55,6 +59,21 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询设备列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<ListSelectQuery>> GetDeviceList() | |||
{ | |||
RefAsync<int> total = 0; | |||
var data = await _db.Queryable<BPA_DeviceInfo>() | |||
.Select(a=> new ListSelectQuery | |||
{ | |||
Id = a.Id, | |||
Name = a.DeviceName | |||
}) .ToListAsync(); | |||
return data; | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
@@ -62,8 +81,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> | |||
@@ -77,18 +99,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(); | |||
@@ -112,6 +137,33 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 添加设备标签 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTypeAsync(DeviceTypeBaseDto inputDto) | |||
{ | |||
var res = await _db.Insertable(new BPA_DeviceType | |||
{ | |||
Name = inputDto.Name, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 查询设备标签 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<ListSelectQuery>> GetDeviceTypeList() | |||
{ | |||
var listquery = await _db.Queryable<BPA_DeviceType>().Where(a => a.IsDeleted == 0).Select(a => new ListSelectQuery | |||
{ | |||
Id = a.Id, | |||
Name = a.Name | |||
}).ToListAsync(); | |||
return listquery; | |||
} | |||
/// <summary> | |||
/// (调用订单服务) | |||
/// </summary> | |||
/// <param name="AutoKey"></param> | |||
@@ -1,225 +0,0 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceTechnology; | |||
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 System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class DeviceTechnologyService: IDeviceTechnologyService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public DeviceTechnologyService(ISqlSugarClient db) | |||
{ | |||
_db = db; | |||
} | |||
#region 工艺基础信息 | |||
/// <summary> | |||
/// 获取工艺基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetDeviceTechnologyPage(DeviceTechnologyPageBase 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) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), (x, b) => x.Name.Contains(inputDto.Name)) | |||
.WhereIF(inputDto.Status != null, (x, b) => x.Status == inputDto.Status) | |||
.Select((x, b) => new | |||
{ | |||
Name = x.Name, | |||
Status = x.Status, | |||
x.Id, | |||
x.GroupId, | |||
x.ForeignKeyRe, | |||
x.DeviceVersionKey, | |||
DeviceTypeKey = b.DeviceTypeKey, | |||
Vesion = b.Vesion | |||
}) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = res, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<DeviceTechnologyDto>> GetDeviceTechnology() | |||
{ | |||
var res =await _db.Queryable<BPA_DeviceTechnology>().Where(x => x.Status == 0) | |||
.OrderBy(i => i.CreateAt, OrderByType.Desc) | |||
.Select(x => new DeviceTechnologyDto() | |||
{ | |||
Id = x.Id, | |||
Name = x.Name, | |||
IsBatch = SqlFunc.Subqueryable<BPA_DeviceTechnologyAction>().Where(p => p.DevicetechnologyId == x.Id).Any() | |||
}) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 添加工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceTechnology(DeviceTechnologyBaseDto inputDto) | |||
{ | |||
var data = _db.Queryable<BPA_DeviceTechnology>() | |||
.Where(a => a.Name == inputDto.Name).ToList(); | |||
if (data.Count > 0) | |||
{ | |||
throw Oops.Oh("工艺名称已存在"); | |||
} | |||
else | |||
{ | |||
var res =await _db.Insertable(new BPA_DeviceTechnology() | |||
{ | |||
Id = Guid.NewGuid().ToString(), | |||
Name = inputDto.Name, | |||
Status = CommonStatus.ENABLE, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
ForeignKeyRe = inputDto.ForeignKeyRe, | |||
DeviceVersionKey = inputDto.DeviceVersionKey | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceTechnology(DeviceTechnologyBaseDto 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(); | |||
data.Name = inputDto.Name; | |||
data.DeviceVersionKey = inputDto.DeviceVersionKey; | |||
data.ForeignKeyRe = inputDto.ForeignKeyRe; | |||
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) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnology>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
#region 工艺模型 | |||
/// <summary> | |||
/// 根据工艺id查询工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList(string devicetechnologyId) | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => x.IsDeleted == 0 && x.DevicetechnologyId == devicetechnologyId ) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 查询所有工艺模型 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceTechnologyAction>> GetTechnologyActionList() | |||
{ | |||
var res = await _db.Queryable<BPA_DeviceTechnologyAction>().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) | |||
{ | |||
var check = _db.Queryable<BPA_DeviceTechnologyAction>() | |||
.Any(a => a.DevicetechnologyId == inputDto.DevicetechnologyId && a.IsDeleted == 0 && a.ActionName == inputDto.ActionName && a.ActionType == inputDto.ActionType); | |||
if (check) | |||
{ | |||
throw Oops.Oh("工艺流程动作已存在"); | |||
} | |||
else | |||
{ | |||
var res = await _db.Insertable(new BPA_DeviceTechnologyAction() | |||
{ | |||
DevicetechnologyId = inputDto.DevicetechnologyId, | |||
ActionName = inputDto.ActionName, | |||
ActionType = inputDto.ActionType, | |||
ActionValue = inputDto.ActionValue, | |||
Unit = inputDto.Unit, | |||
IsBatch = true,//inputDto.IsBatch, | |||
IsDeleted = 0, | |||
Sort = inputDto.Sort, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); ; | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改工艺模型 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateBomTechnology(DeviceTechnologyActionBaseDto 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("工艺流程动作不存在"); | |||
data.ActionName = inputDto.ActionName; | |||
data.ActionType = inputDto.ActionType; | |||
data.ActionValue = inputDto.ActionValue; | |||
data.Unit = inputDto.Unit; | |||
data.IsBatch = inputDto.IsBatch; | |||
data.Sort = inputDto.Sort; | |||
var res = await _db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除工艺模型 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteTechnologyAction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DeviceTechnologyAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res = await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,145 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion; | |||
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 BPA.SAAS.Manage.Core.Product; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class DeviceVesionService: IDeviceVesionService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public DeviceVesionService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
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() | |||
{ | |||
Data = data, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto) | |||
{ | |||
var res = await _db.Insertable(new BPA_DeviceVesion | |||
{ | |||
Vesion = inputDto.Vesion, | |||
ProductId = inputDto.ProductId, | |||
TemplatePath = inputDto.TemplatePath, | |||
Status = CommonStatus.ENABLE | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DelDeviceVesionAsync(List<string> inputList) | |||
{ | |||
var data = await _db.Queryable<BPA_DeviceInfo>().Where(x => inputList.Contains(x.ProductVersionId)).ToListAsync(); | |||
if (data.Count > 0) | |||
{ | |||
throw Oops.Oh("当前设备类型已使用,无法删除"); | |||
} | |||
var datas = await _db.Queryable<BPA_DeviceVesion>() | |||
.Where(x => inputList.Contains(x.Id)) | |||
.ToListAsync(); | |||
_db.Deleteable(datas).ExecuteCommand(); | |||
return true; | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_DeviceVesion>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
var res = _db.Updateable<BPA_DeviceVesion>().SetColumns(t => t.Vesion == inputDto.Vesion) | |||
.SetColumns(t => t.TemplatePath == inputDto.TemplatePath) | |||
.SetColumns(t => t.ProductId == inputDto.ProductId) | |||
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) | |||
.ExecuteCommandHasChange(); | |||
return res; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 更新状态 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_DeviceVesion>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
var res = _db.Updateable<BPA_DeviceVesion>() | |||
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) | |||
.ExecuteCommandHasChange(); | |||
return res; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 根据产品查询版本 | |||
/// </summary> | |||
/// <param name="Code"></param> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId) | |||
{ | |||
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> | |||
/// 查询版本列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_DeviceVesion>> GetDeviceVesionList() | |||
{ | |||
var resEntity =await _db.Queryable<BPA_DeviceVesion>().Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync(); | |||
return resEntity; | |||
} | |||
} | |||
} |
@@ -0,0 +1,260 @@ | |||
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 BPA.SAAS.Manage.Core.Product; | |||
using NPOI.POIFS.Crypt.Dsig; | |||
using NPOI.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Text.RegularExpressions; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class ProductFunctionService: IProductFunctionService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public ProductFunctionService(ISqlSugarClient db) | |||
{ | |||
_db = db; | |||
} | |||
#region 产品功能 | |||
/// <summary> | |||
/// 获取功能基础信息列表 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto) | |||
{ | |||
RefAsync<int> total = 0; | |||
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, | |||
Status = x.Status, | |||
x.Id, | |||
x.ForeignKeyRe, | |||
x.DeviceVersionKey, | |||
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, | |||
DataLength = x.DataLength, | |||
BoolLabel = x.BoolLabel, | |||
ReadWrite = x.ReadWrite, | |||
Description= x.Description, | |||
}) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = res, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询所有功能信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<ProductFunctionDto>> GetProductFunction() | |||
{ | |||
var res =await _db.Queryable<BPA_ProductFunction>().Where(x => x.Status == 0) | |||
.OrderBy(i => i.CreateAt, OrderByType.Desc) | |||
.Select(x => new ProductFunctionDto() | |||
{ | |||
Id = x.Id, | |||
Name = x.Name, | |||
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> AddProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
var data = _db.Queryable<BPA_ProductFunction>() | |||
.Where(a => a.Name == inputDto.Name).ToList(); | |||
if (data.Count > 0) | |||
{ | |||
throw Oops.Oh("功能名称已存在"); | |||
} | |||
else | |||
{ | |||
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, | |||
DataType = inputDto.DataType, | |||
DataRange = inputDto.DataRange, | |||
Unit =inputDto.Unit, | |||
StepSize = inputDto.StepSize, | |||
EnumValue = inputDto.EnumValue, | |||
DataLength = inputDto.DataLength, | |||
BoolLabel = inputDto.BoolLabel, | |||
ReadWrite = inputDto.ReadWrite, | |||
Description=inputDto.Description, | |||
ProductId= inputDto.ProductId, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改功能 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateProductFunction(ProductFunctionBaseDto inputDto) | |||
{ | |||
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.DataLength = inputDto.DataLength; | |||
data.BoolLabel = inputDto.BoolLabel; | |||
data.ReadWrite = inputDto.ReadWrite; | |||
data.Description= inputDto.Description; | |||
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> DeleteProductFunction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_ProductFunction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
#region 功能参数 | |||
/// <summary> | |||
/// 根据功能id查询功能参数 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId) | |||
{ | |||
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_ProductFunctionAction>> GetProductFunctionActionList() | |||
{ | |||
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> AddProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
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("功能参数已存在"); | |||
} | |||
else | |||
{ | |||
var res = await _db.Insertable(new BPA_ProductFunctionAction() | |||
{ | |||
ProductFunctionId = inputDto.ProductFunctionId, | |||
ActionName = inputDto.ActionName, | |||
ActionType = inputDto.ActionType, | |||
ActionValue = inputDto.ActionValue, | |||
Unit = inputDto.Unit, | |||
IsBatch = true,//inputDto.IsBatch, | |||
IsDeleted = 0, | |||
Sort = inputDto.Sort, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); ; | |||
return res > 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改功能参数 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateProductFunctionAction(ProductFunctionActionBaseDto inputDto) | |||
{ | |||
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; | |||
data.Unit = inputDto.Unit; | |||
data.IsBatch = inputDto.IsBatch; | |||
data.Sort = inputDto.Sort; | |||
var res = await _db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除功能参数 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteProductFunctionAction(List<string> ids) | |||
{ | |||
var resEntity = _db.Queryable<BPA_ProductFunctionAction>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in resEntity) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res = await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,133 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion; | |||
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.Product; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class ProductService : IProductService, ITransient | |||
{ | |||
ISqlSugarClient _db; | |||
public ProductService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetProductPage(ProductQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await _db.Queryable<BPA_Product>().Where((x) => x.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), x => x.Name.Contains(inputDto.Name)) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Key), x => x.Key.Contains(inputDto.Key)) | |||
.OrderBy(x => x.CreateAt, OrderByType.Desc) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = data, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 查询列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<BPA_Product>> GetProductList() | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var data = await _db.Queryable<BPA_Product>().Where(x=>x.Status==0) .ToListAsync(); | |||
return data; | |||
} | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> AddProduct(ProductBaseDto inputDto) | |||
{ | |||
var count=_db.Queryable<BPA_Product>().Count(); | |||
var res = await _db.Insertable(new BPA_Product | |||
{ | |||
Name = inputDto.Name, | |||
Key = GetNumber2(count), | |||
Remark=inputDto.Remark, | |||
Code= inputDto.Code, | |||
Status = CommonStatus.ENABLE | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeProduct(List<string> inputList) | |||
{ | |||
var datas = await _db.Queryable<BPA_Product>() | |||
.Where(x => inputList.Contains(x.Id)) | |||
.ToListAsync(); | |||
_db.Deleteable(datas).ExecuteCommand(); | |||
return true; | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateProduct(ProductBaseDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
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(); | |||
return res; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 更新状态 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDeviceVesionSatatus(ProductSatatusDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
var res = _db.Updateable<BPA_Product>() | |||
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id) | |||
.ExecuteCommandHasChange(); | |||
return res; | |||
} | |||
return false; | |||
} | |||
private string GetNumber2(int count) | |||
{ | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var res=MD5Encryption.Encrypt(groupId + DateTime.Now.ToString("yyyyMMddhhmmsss"), false,true)+ count; | |||
return res; | |||
} | |||
} | |||
} |
@@ -0,0 +1,97 @@ | |||
using BPA.SAAS.Manage.Application.Device.Dtos.Device; | |||
using BPA.SAAS.Manage.Application.Device.Dtos.ProductTopics; | |||
using BPA.SAAS.Manage.Application.Device.Interface; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Core.Base; | |||
using BPA.SAAS.Manage.Core.Device; | |||
using BPA.SAAS.Manage.Core.Product; | |||
using StackExchange.Profiling.Internal; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.Device.Services | |||
{ | |||
public class ProductTopicsService : IProductTopicsService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public ProductTopicsService(ISqlSugarClient db) | |||
{ | |||
_db= db; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetProductTopicsPage(ProductTopicsQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await _db.Queryable<BPA_ProductTopics>().Where(x=>x.ProductId== inputDto.ProductId) | |||
.WhereIF(inputDto.TopicsType!=null, x => x.TopicsType==Convert.ToInt32(inputDto.TopicsType)) | |||
.OrderBy(x => x.CreateAt, OrderByType.Desc) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = data, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
BPA_ProductTopics BPA_ProductTopics = inputDto.Adapt<BPA_ProductTopics>(); | |||
var res = await _db.Insertable(BPA_ProductTopics).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||
return res != null; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateProductTopics(ProductTopicsBaseDto inputDto) | |||
{ | |||
var data = await _db.Queryable<BPA_ProductTopics>().Where(x => x.Id == inputDto.Id).FirstAsync(); | |||
if (data != null) | |||
{ | |||
var product = _db.Queryable<BPA_ProductTopics>().Where(x => x.Id == inputDto.ProductId).First(); | |||
var inputData = inputDto.Adapt<BPA_ProductTopics>(); | |||
var res = await _db.Updateable(inputData) | |||
.UpdateColumns(x => new | |||
{ | |||
x.Topics, | |||
x.TopicsType, | |||
x.Description, | |||
}) | |||
.Where(x => x.Id == inputDto.Id).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="inputList"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DelProductTopics(List<string> inputList) | |||
{ | |||
var data = await _db.Queryable<BPA_ProductTopics>().Where(x => inputList.Contains(x.Id)).ToListAsync(); | |||
foreach (var item in data) | |||
{ | |||
item.IsDeleted = 1; | |||
} | |||
var res = await _db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
} |
@@ -40,5 +40,9 @@ namespace BPA.SAAS.Manage.Application.Org.Dtos.Company | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
public string SysRoleId { get; set; } | |||
/// <summary> | |||
/// 所属平台 0 团餐 1门店 2 后厨 3公共 | |||
/// </summary> | |||
public int Type { get; set; } | |||
} | |||
} |
@@ -124,7 +124,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> UpdateCompany(CompanyDtoInput input) | |||
{ | |||
var company = input.Adapt<BPA_Company>(); | |||
company.CreateAt= DateTime.Now; | |||
var check = _db.Queryable<BPA_Company>().Where(x => x.IsDeleted == 0).First(t => t.Id == company.Id); | |||
if (check == null) | |||
@@ -1,5 +1,6 @@ | |||
using BPA.SAAS.Manage.Application.Org.Dtos.Organize; | |||
using BPA.SAAS.Manage.Application.Org.Interface; | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using BPA.SAAS.Manage.Comm.Util; | |||
using BPA.SAAS.Manage.Core.Base; | |||
@@ -134,9 +135,9 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<dynamic> GetOrgTree() | |||
{ | |||
var dataScopeList = new List<string>(); | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
var orgs = await _db.Queryable<BPA_Organize>().WhereIF(dataScopeList.Count > 0, u => dataScopeList.Contains(u.Id)) | |||
.Where(u => u.Status == CommonStatus.ENABLE).OrderBy(u => u.Sort) | |||
.Where(u => u.Status == CommonStatus.ENABLE && u.GroupId== groupId).OrderBy(u => u.Sort) | |||
.Select(u => new OrgTreeNode | |||
{ | |||
key = u.Id, | |||
@@ -46,6 +46,14 @@ namespace BPA.SAAS.Manage.Application.System.Dtos | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 所属平台 0 团餐 1门店 2 后厨 | |||
/// </summary> | |||
public string Type { get; set; } | |||
/// <summary> | |||
/// 是否超管菜单 0否 1是 | |||
/// </summary> | |||
public int IsAdmin { get; set; } | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Comm.Enum; | |||
using NPOI.SS.Formula.Functions; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -46,6 +47,9 @@ namespace BPA.SAAS.Manage.Application.System.Dtos | |||
/// 组件 | |||
/// </summary> | |||
public string Component { get; set; } | |||
public string Type { get; set; } | |||
public string TypeName { get; set; } | |||
public int IsAdmin{ get; set; } | |||
private List<MenuTreeDtoOutput> _Children; | |||
public List<MenuTreeDtoOutput> Children | |||
@@ -13,8 +13,10 @@ namespace BPA.SAAS.Manage.Application.System.Interface | |||
Task<bool> Add(MenuDtoInput input); | |||
Task<bool> Update(MenuDtoInput input); | |||
Task<bool> Delete(List<string> input); | |||
Task<List<MenuTreeOutput>> MenuTree(string getType); | |||
Task<List<MenuRouteDtoOutput>> DymicMenuTree(); | |||
Task<List<MenuTreeOutput>> MenuTree(); | |||
Task<List<MenuTreeOutput>> MenuTree(string GetType); | |||
Task<List<MenuTreeOutput>> MenuParmyTree(string GetType, string type); | |||
Task<List<MenuRouteDtoOutput>> DymicMenuTree(int type); | |||
Task<bool> Enable(string Id); | |||
Task<bool> Disable(string Id); | |||
} | |||
@@ -2,6 +2,7 @@ | |||
using BPA.SAAS.Manage.Application.System.Interface; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Drawing.Drawing2D; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -57,14 +58,24 @@ namespace BPA.SAAS.Manage.Application.System | |||
/// <param name="getType"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/menu/menutrees")] | |||
public async Task<List<MenuTreeOutput>> MenuTree(string getType) | |||
public async Task<List<MenuTreeOutput>> MenuTree(string GetType) | |||
{ | |||
return await _menuService.MenuTree(getType); | |||
return await _menuService.MenuTree(GetType); | |||
} | |||
[HttpGet("/api/menu/menutreesall")] | |||
public async Task<List<MenuTreeOutput>> MenuTree() | |||
{ | |||
return await _menuService.MenuTree(); | |||
} | |||
[HttpGet("/api/menu/menuparmytrees")] | |||
public async Task<List<MenuTreeOutput>> MenuParmyTree(string GetType, string type) | |||
{ | |||
return await _menuService.MenuParmyTree(GetType, type); | |||
} | |||
[HttpGet("/api/menu/menutree")] | |||
public async Task<List<MenuRouteDtoOutput>> DymicMenuTree() | |||
public async Task<List<MenuRouteDtoOutput>> DymicMenuTree(int type) | |||
{ | |||
return await _menuService.DymicMenuTree(); | |||
return await _menuService.DymicMenuTree(type); | |||
} | |||
[HttpGet("/api/menu/enable")] | |||
public async Task<bool> Enable(string Id) | |||
@@ -6,9 +6,12 @@ using BPA.SAAS.Manage.Core.Org; | |||
using BPA.SAAS.Manage.Core.System; | |||
using Furion.LinqBuilder; | |||
using Mapster.Utils; | |||
using NPOI.SS.Formula.Functions; | |||
using NPOI.XSSF.UserModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -31,7 +34,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
if (App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value == null) | |||
return null; | |||
var AllMenus =await _db.Queryable<BPA_Menu>().Where(t => t.IsDeleted == 0).OrderBy(t => t.Sort).ToListAsync(); | |||
var AllMenus =await _db.Queryable<BPA_Menu>().OrderBy(t => t.Sort).ToListAsync(); | |||
var query = AllMenus.Where(t => t.Pid == "" || t.Pid == null); | |||
@@ -52,6 +55,9 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Sort = t.Sort, | |||
Component = t.Component, | |||
Status = t.Status, | |||
IsAdmin=t.IsAdmin, | |||
Type= t.Type, | |||
TypeName= GetTypeName(t.Type), | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeDtoOutput | |||
{ | |||
Id = x.Id, | |||
@@ -64,6 +70,9 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Sort = x.Sort, | |||
Component = x.Component, | |||
Status = x.Status, | |||
IsAdmin=x.IsAdmin, | |||
Type = x.Type, | |||
TypeName = GetTypeName(x.Type), | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeDtoOutput | |||
{ | |||
Id = y.Id.ToString(), | |||
@@ -76,12 +85,44 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Sort = y.Sort, | |||
Component = y.Component, | |||
Status = y.Status, | |||
IsAdmin=y.IsAdmin, | |||
Type = y.Type, | |||
TypeName = GetTypeName(y.Type), | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
return data; | |||
} | |||
public string GetTypeName(string type) | |||
{ | |||
var ary = type.Split(','); | |||
var name = ""; | |||
for (int i = 0; i < ary.Length; i++) | |||
{ | |||
if (ary[i] == "0") | |||
{ | |||
name += "团餐"; | |||
} | |||
if (ary[i] == "1") | |||
{ | |||
name += "门店"; | |||
} | |||
if (ary[i] == "2") | |||
{ | |||
name += "后厨"; | |||
} | |||
if (ary[i] == "3") | |||
{ | |||
name += "公共"; | |||
} | |||
if(i< ary.Length - 1) | |||
{ | |||
name += ","; | |||
} | |||
} | |||
return name; | |||
} | |||
/// <summary> | |||
/// 新增菜单 | |||
/// </summary> | |||
@@ -89,11 +130,11 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
/// <returns></returns> | |||
public async Task<bool> Add(MenuDtoInput input) | |||
{ | |||
var dicttypes = _db.Queryable<BPA_Menu>().Where(a => a.Code == input.Code && a.IsDeleted == 0).ToList(); | |||
if (dicttypes.Count() > 0) | |||
{ | |||
throw Oops.Oh("编码已存在"); | |||
} | |||
var dicttypes = _db.Queryable<BPA_Menu>().Where(a => a.Code == input.Code).ToList(); | |||
//if (dicttypes.Count() > 0) | |||
//{ | |||
// throw Oops.Oh("编码已存在"); | |||
//} | |||
if (input.Name.Length > 20) | |||
{ | |||
throw Oops.Oh("菜单名称过长"); | |||
@@ -119,6 +160,8 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
menu.Remark= input.Remark; | |||
menu.Sort = input.Sort; | |||
menu.Icon = input.Icon; | |||
menu.IsAdmin= input.IsAdmin; | |||
menu.Type = input.Type; | |||
return await _db.Updateable(menu).ExecuteCommandAsync()>0; | |||
} | |||
@@ -159,12 +202,12 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
{ | |||
var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var GroupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (string.IsNullOrWhiteSpace(GroupId) || string.IsNullOrWhiteSpace(userId)) | |||
// var GroupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if ( string.IsNullOrWhiteSpace(userId)) | |||
{ | |||
return null; | |||
} | |||
List<BPA_Roles> dataRoles =await _db.Queryable<BPA_Roles>().Where(a => a.GroupId == GroupId).ToListAsync(); | |||
List<BPA_Roles> dataRoles =await _db.Queryable<BPA_Roles>().ToListAsync(); | |||
if (dataRoles.Count() <= 0) | |||
{ | |||
return null; | |||
@@ -173,23 +216,23 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
var menus = _db.Queryable<BPA_RoleMenu>().Where(t => sysRoleId.Contains(t.SysRoleId)) | |||
.Select(x => x.SysMenuId).ToArray(); | |||
var AllMenus = _db.Queryable<BPA_Menu>().Where(t => t.IsDeleted == 0 && menus.Contains(t.Id)).OrderBy(t => t.Sort).ToList(); | |||
var AllMenus = _db.Queryable<BPA_Menu>().Where(t => menus.Contains(t.Id)).OrderBy(t => t.Sort).ToList(); | |||
var data = AllMenus.Where(t => t.Pid == null || t.Pid == "").Select(t => new MenuTreeOutput | |||
{ | |||
Key = t.Id, | |||
Title = t.Name, | |||
value = t.Name, | |||
value = t.Id, | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeOutput | |||
{ | |||
Key = x.Id, | |||
Title = x.Name, | |||
value = x.Name, | |||
value = x.Id, | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeOutput | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Name, | |||
value = y.Id, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
@@ -199,7 +242,62 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
} | |||
else | |||
{ | |||
var AllMenus = _db.Queryable<BPA_Menu>().Where(t => t.IsDeleted == 0).OrderBy(t => t.Sort).ToList(); | |||
var AllMenus = _db.Queryable<BPA_Menu>().OrderBy(t => t.Sort).ToList(); | |||
var data = AllMenus.Where((t => t.Pid == null || t.Pid == "")).Select(t => new MenuTreeOutput | |||
{ | |||
Key = t.Id, | |||
Title = t.Name, | |||
value = t.Id, | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeOutput | |||
{ | |||
Key = x.Id, | |||
Title = x.Name, | |||
value = x.Id, | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeOutput | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Name, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
var da = new List<MenuTreeOutput>(); | |||
data.ForEach(x => | |||
{ | |||
if (x.Children.Count() > 0) | |||
{ | |||
da.Add(x); | |||
} | |||
}); | |||
return da; | |||
} | |||
} | |||
public async Task<List<MenuTreeOutput>> MenuParmyTree(string GetType, string type) | |||
{ | |||
if (!string.IsNullOrWhiteSpace(GetType) && GetType.ToLower() == "user") | |||
{ | |||
var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
// var GroupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (string.IsNullOrWhiteSpace(userId)) | |||
{ | |||
return null; | |||
} | |||
List<BPA_Roles> dataRoles = await _db.Queryable<BPA_Roles>().ToListAsync(); | |||
if (dataRoles.Count() <= 0) | |||
{ | |||
return null; | |||
} | |||
var sysRoleId = dataRoles.Select(a => a.Id).ToArray(); | |||
var menus = _db.Queryable<BPA_RoleMenu>().Where(t => sysRoleId.Contains(t.SysRoleId)) | |||
.Select(x => x.SysMenuId).ToArray(); | |||
var AllMenus = _db.Queryable<BPA_Menu>().Where(t => menus.Contains(t.Id)).OrderBy(t => t.Sort).ToList(); | |||
var data = AllMenus.Where(t => t.Pid == null || t.Pid == "").Select(t => new MenuTreeOutput | |||
{ | |||
@@ -215,7 +313,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Name, | |||
value = y.Id, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
@@ -223,13 +321,71 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
return data; | |||
} | |||
else | |||
{ | |||
var AllMenus = _db.Queryable<BPA_Menu>().Where(t => (t.Type.Contains(type) || t.Type.Contains("3")) && t.IsAdmin == 0).OrderBy(t => t.Sort).ToList(); | |||
var data = AllMenus.Where((t => t.Pid == null || t.Pid == "")).Select(t => new MenuTreeOutput | |||
{ | |||
Key = t.Id, | |||
Title = t.Name, | |||
value = t.Id, | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeOutput | |||
{ | |||
Key = x.Id, | |||
Title = x.Name, | |||
value = x.Id, | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeOutput | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Name, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
var da = new List<MenuTreeOutput>(); | |||
data.ForEach(x => | |||
{ | |||
if (x.Children.Count() > 0) | |||
{ | |||
da.Add(x); | |||
} | |||
}); | |||
return da; | |||
} | |||
} | |||
public async Task<List<MenuTreeOutput>> MenuTree() | |||
{ | |||
var AllMenus = _db.Queryable<BPA_Menu>().OrderBy(t => t.Sort).ToList(); | |||
var data = AllMenus.Where(t => t.Pid == null || t.Pid == "").Select(t => new MenuTreeOutput | |||
{ | |||
Key = t.Id, | |||
Title = t.Name, | |||
value = t.Id, | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeOutput | |||
{ | |||
Key = x.Id, | |||
Title = x.Name, | |||
value = x.Id, | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeOutput | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Id, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
return data; | |||
} | |||
/// <summary> | |||
/// 动态菜单(菜单树) | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<MenuRouteDtoOutput>> DymicMenuTree() | |||
public async Task<List<MenuRouteDtoOutput>> DymicMenuTree(int type) | |||
{ | |||
var UserId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var IsAdmin = App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value; | |||
@@ -237,37 +393,99 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
if (UserId == null) | |||
return null; | |||
List<BPA_Menu> AllMenus = new List<BPA_Menu>(); | |||
List<BPA_Menu> AllMenus = await _db.Queryable<BPA_Menu>().OrderBy(t => t.Sort).ToListAsync(); | |||
List<BPA_Menu> ParnMenus = new(); | |||
if (IsAdmin == "1" && account == "admin") | |||
AllMenus =await _db.Queryable<BPA_Menu>().Where(t => t.IsDeleted == 0 && t.Status == 0).OrderBy(t => t.Sort).ToListAsync(); | |||
{ | |||
var adminmenu = await _db.Queryable<BPA_Menu>().Where(t =>t.IsAdmin==1).OrderBy(t => t.Sort).ToListAsync(); | |||
var pids= adminmenu.Select(t => t.Pid).ToList(); | |||
var pidmenu=await _db.Queryable<BPA_Menu>().Where(t => pids.Contains(t.Id)).ToListAsync(); | |||
adminmenu.AddRange(pidmenu); | |||
//去重 | |||
adminmenu = adminmenu.Where((x, i) => adminmenu.FindIndex(z => z.Id == x.Id) == i).ToList(); | |||
var data = adminmenu.Where(t => t.Pid == null || t.Pid == "").OrderBy(t => t.Sort).Select(t => new MenuRouteDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = t.Component, | |||
Icon = t.Icon, | |||
Name = t.Name, | |||
Path = t.Router, | |||
Routes = adminmenu.Where(y => y.Pid == t.Id).Select(x => new MenuRouteChildDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = x.Component, | |||
Name = x.Name, | |||
Path = x.Router, | |||
Routes = adminmenu.Where(y => y.Pid == x.Id).Select(y => new MenuRouteChildDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = y.Component, | |||
Name = y.Name, | |||
Path = y.Router | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
return data; | |||
} | |||
else | |||
AllMenus =await _db.Queryable<BPA_Menu>().LeftJoin<BPA_RoleMenu>((t, x) => t.Id == x.SysMenuId).LeftJoin<BPA_UserRole>((t, x, y) => x.SysRoleId == y.SysRoleId) | |||
.Where((t, x, y) => y.SysUserId == UserId && t.Status == 0).Select(t => t).ToListAsync(); | |||
//菜单去重 | |||
AllMenus = AllMenus.Where((x, i) => AllMenus.FindIndex(z => z.Id == x.Id) == i).ToList(); | |||
var data = AllMenus.Where(t => t.Pid == null || t.Pid == "").OrderBy(t => t.Sort).Select(t => new MenuRouteDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = t.Component, | |||
Icon = t.Icon, | |||
Name = t.Name, | |||
Path = t.Router, | |||
Routes = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuRouteChildDtoOutput | |||
AllMenus= AllMenus.Where(t=> t.IsAdmin == 0).ToList(); | |||
ParnMenus = await _db.Queryable<BPA_Menu>().LeftJoin<BPA_RoleMenu>((t, x) => t.Id == x.SysMenuId).LeftJoin<BPA_UserRole>((t, x, y) => x.SysRoleId == y.SysRoleId) | |||
.Where((t, x, y) => y.SysUserId == UserId && t.Status == 0 && t.IsAdmin==0).Select(t => t).ToListAsync(); | |||
var data = ParnMenus.Where(t => t.Pid == null || t.Pid == "").OrderBy(t => t.Sort).Select(t => new MenuRouteDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = x.Component, | |||
Name = x.Name, | |||
Path = x.Router, | |||
Routes = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuRouteChildDtoOutput | |||
Component = t.Component, | |||
Icon = t.Icon, | |||
Name = t.Name, | |||
Path = t.Router, | |||
Routes = AllMenus.Where(y => y.Pid == t.Id).Select(x => new MenuRouteChildDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = y.Component, | |||
Name = y.Name, | |||
Path = y.Router | |||
Component = x.Component, | |||
Name = x.Name, | |||
Path = x.Router, | |||
Routes = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuRouteChildDtoOutput | |||
{ | |||
Id = t.Id, | |||
Component = y.Component, | |||
Name = y.Name, | |||
Path = y.Router | |||
}).ToList() | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
return data; | |||
}).ToList(); | |||
return data; | |||
} | |||
// ParnMenus = await _db.Queryable<BPA_Menu>().Where(t => (t.Name == "系统管理" || t.Name == "加盟商管理" || t.Name == "设备管理")).OrderBy(t => t.Sort).ToListAsync(); | |||
//else | |||
// ParnMenus = await _db.Queryable<BPA_Menu>().LeftJoin<BPA_RoleMenu>((t, x) => t.Id == x.SysMenuId).LeftJoin<BPA_UserRole>((t, x, y) => x.SysRoleId == y.SysRoleId) | |||
// .Where((t, x, y) => y.SysUserId == UserId && t.Status == 0 && (t.Type== type || t.Type==3) && (t.Name!= "产品管理" || t.Name != "版本管理")).Select(t => t).ToListAsync(); | |||
//菜单去重 | |||
// ParnMenus = AllMenus.Where((x, i) => AllMenus.FindIndex(z => z.Id == x.Id) == i).ToList(); | |||
//var data = ParnMenus.Where(t => t.Pid == null || t.Pid == "").OrderBy(t => t.Sort).Select(t => new MenuRouteDtoOutput | |||
//{ | |||
// Id = t.Id, | |||
// Component = t.Component, | |||
// Icon = t.Icon, | |||
// Name = t.Name, | |||
// Path = t.Router, | |||
// Routes = AllMenus.Where(x => x.Pid == t.Id) .WhereIF(IsAdmin == "1" && account == "admin", x =>x.Name!="设备信息" && x.Name != "设备数据同步").Select(x => new MenuRouteChildDtoOutput | |||
// { | |||
// Id = t.Id, | |||
// Component = x.Component, | |||
// Name = x.Name, | |||
// Path = x.Router, | |||
// Routes = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuRouteChildDtoOutput | |||
// { | |||
// Id = t.Id, | |||
// Component = y.Component, | |||
// Name = y.Name, | |||
// Path = y.Router | |||
// }).ToList() | |||
// }).ToList() | |||
//}).ToList(); | |||
// return data; | |||
} | |||
/// <summary> | |||
/// 启用 | |||
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Comm.Model | |||
{ | |||
public class ListSelectQuery | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -8,7 +8,7 @@ using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.DataBase | |||
{ | |||
[SugarTable("BPA_batchinguint")] | |||
[SugarTable("bpa_batchinguint")] | |||
public class BPA_BatchingUint : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
@@ -35,6 +35,14 @@ namespace BPA.SAAS.Manage.Core | |||
SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, | |||
db => | |||
{ | |||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
//db.QueryFilter.AddTableFilter<IStatus>(it => it.Status == 0); | |||
if (!IsSuperAdmin() && App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value != null) | |||
{ | |||
//非管理员账户过滤加盟商数据 | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
db.QueryFilter.AddTableFilter<IGroupId>(it => it.GroupId == groupId); | |||
} | |||
db.Aop.DataExecuting = (oldValue, entityInfo) => | |||
{ | |||
//新增添加加盟商id赋值 | |||
@@ -52,13 +60,14 @@ namespace BPA.SAAS.Manage.Core | |||
db.Aop.OnLogExecuting = (sql, pars) => | |||
{ | |||
//过滤已删除数据 | |||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
if (!IsSuperAdmin()) | |||
{ | |||
//非管理员账户过滤加盟商数据 | |||
var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
db.QueryFilter.AddTableFilter<IGroupId>(it => it.GroupId == groupId); | |||
} | |||
//db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
////db.QueryFilter.AddTableFilter<IStatus>(it => it.Status == 0); | |||
//if (!IsSuperAdmin()) | |||
//{ | |||
// //非管理员账户过滤加盟商数据 | |||
// var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
// db.QueryFilter.AddTableFilter<IGroupId>(it => it.GroupId == groupId); | |||
//} | |||
//Console.WriteLine(sql);//输出sql | |||
Console.WriteLine($"当前SQL语句:【{sql}】,参数:【{string.Join(",", pars.Select(t => t.Value))}】"); | |||
@@ -74,6 +83,7 @@ namespace BPA.SAAS.Manage.Core | |||
private static bool IsSuperAdmin() | |||
{ | |||
if (App.User == null) return false; | |||
var sd = App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value; | |||
return App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == "1"; | |||
} | |||
} |
@@ -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,13 @@ 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配方 | |||
/// </summary> | |||
public int TechnologyOrBom { get; set; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
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_devicetype")] | |||
public class BPA_DeviceType : IBaseEntity, IGroupId | |||
{ | |||
public string Name { get; set; } | |||
public string GroupId { 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> | |||
@@ -43,5 +43,9 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
/// <summary> | |||
/// 所属平台 0 团餐 1门店 2 后厨 3公共 | |||
/// </summary> | |||
public int Type { get; set; } | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
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.Product | |||
{ | |||
[SugarTable("bpa_product")] | |||
public class BPA_Product : IBaseEntity | |||
{ | |||
public string Name { get; set; } | |||
public string Key { get; set; } | |||
/// <summary> | |||
/// 状态 0启用 1禁用 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
//public string GroupId { get; set; } | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
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.Product | |||
{ | |||
/// <summary> | |||
///产品功能 | |||
/// </summary> | |||
[SugarTable("bpa_productfunction")] | |||
public class BPA_ProductFunction : IBaseEntity | |||
{ | |||
/// <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; } | |||
/// <summary> | |||
/// 数据长度 | |||
/// </summary> | |||
public string DataLength { get; set; } | |||
/// <summary> | |||
/// 数据类型bool的描述 | |||
/// </summary> | |||
public string BoolLabel { get; set; } | |||
/// <summary> | |||
/// 读写类型0读写 1只读 | |||
/// </summary> | |||
public int ReadWrite { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
} | |||
} |
@@ -5,14 +5,14 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Device | |||
namespace BPA.SAAS.Manage.Core.Product | |||
{ | |||
public class BPA_DeviceTechnologyAction: IBaseEntity, IGroupId | |||
public class BPA_ProductFunctionAction : IBaseEntity | |||
{ | |||
/// <summary> | |||
/// 工艺id | |||
/// 功能id | |||
/// </summary> | |||
public string DevicetechnologyId { get; set; } | |||
public string ProductFunctionId { get; set; } | |||
/// <summary> | |||
/// 动作名称 | |||
/// </summary> | |||
@@ -37,6 +37,6 @@ namespace BPA.SAAS.Manage.Core.Device | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
public string GroupId { get; set; } | |||
// public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
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.Product | |||
{ | |||
[SugarTable("bpa_producttopics")] | |||
public class BPA_ProductTopics : IBaseEntity | |||
{ | |||
/// <summary> | |||
/// Topics类 | |||
/// </summary> | |||
public string Topics { get; set; } | |||
/// <summary> | |||
/// TopicsType类型 0发布 1订阅 2发布和订阅 | |||
/// </summary> | |||
public int TopicsType { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Description { get; set; } | |||
public string ProductId { get; set; } | |||
//public string GroupId { get; set; } | |||
} | |||
} |
@@ -49,6 +49,14 @@ namespace BPA.SAAS.Manage.Core.System | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 所属平台 0 团餐 1门店 2 后厨 3公共 | |||
/// </summary> | |||
public string Type { get; set; } | |||
/// <summary> | |||
/// 是否超管菜单 0否 1是 | |||
/// </summary> | |||
public int IsAdmin { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
@@ -16,6 +16,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.MQTTClient" Version="1.0.11" /> | |||
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" /> | |||
</ItemGroup> | |||
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.Manage.Application.System.Dtos; | |||
using BPA.MQTTClient; | |||
using BPA.SAAS.Manage.Application.System.Dtos; | |||
using BPA.SAAS.Manage.Core; | |||
using FluentValidation.AspNetCore; | |||
using Furion; | |||
@@ -6,7 +7,11 @@ using Microsoft.AspNetCore.Builder; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using Microsoft.Extensions.Hosting; | |||
using MQTTnet.Client.Connecting; | |||
using MQTTnet.Client.Disconnecting; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Web.Core | |||
{ | |||
@@ -29,6 +34,36 @@ namespace BPA.SAAS.Manage.Web.Core | |||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; | |||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; | |||
}); | |||
services.AddMqttClientHostedService(op => | |||
{ | |||
op.Port = int.Parse(App.Configuration["dev1_brokerHostSettings:Port"]); | |||
op.Server = App.Configuration["dev1_brokerHostSettings:Host"]; | |||
op.UserName = App.Configuration["MqttClientSettings:UserName"]; | |||
op.Password = App.Configuration["MqttClientSettings:Password"]; | |||
op.mqttClientConnectedHandlerDelegate = new MqttClientConnectedHandlerDelegate(async e => | |||
{ | |||
Console.WriteLine("MQTT连接成功"); | |||
}); | |||
op.mqttClientDisconnectedHandlerDelegate = new MqttClientDisconnectedHandlerDelegate(async e => | |||
{ | |||
Console.WriteLine("MQTT断开连接"); | |||
await Task.Delay(TimeSpan.FromSeconds(5)); | |||
try | |||
{ | |||
//var options = op.Server.GetService<IMqttClientOptions>(); | |||
//await op.Server.GetService<IMqttClient>().ConnectAsync(options); | |||
} | |||
catch (global::System.Exception) | |||
{ | |||
} | |||
}); | |||
op.MqttApplicationMessageReceivedHandler = new MQTTnet.Client.Receiving.MqttApplicationMessageReceivedHandlerDelegate(async e => | |||
{ | |||
}); | |||
}); | |||
services.AddCorsAccessor(); | |||
services.AddSqlsugarSetup(App.Configuration); | |||
services.AddControllers() | |||
@@ -16,13 +16,20 @@ | |||
} | |||
], | |||
"cos_config": { | |||
"AppId": "1305371387", | |||
"Region": "ap-chengdu", | |||
"Bucket": "hbl-test-1305371387", | |||
"SecretId": "AKIDa4KQIvKUP6bw4ye6JI3a8lCPN7cswnV3", | |||
"SecretKey": "ObaLtCH9nCNPFrFQO7ex2sTqyxlLgnfJ" | |||
}, | |||
"dev1_brokerHostSettings": { | |||
"Port": 8083, | |||
"Host": "10.2.1.21" | |||
}, | |||
"MqttClientSettings": { | |||
"UserName": "emqx_u_block", | |||
"Password": "emqx_p_admin8765490789" | |||
}, | |||
"order_url": "http://order", | |||
"wechat_url": "http://wechat" | |||
} |