@@ -44,7 +44,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||
BomQty=a.BomQty, | |||
BomId=a.BomId, | |||
Sort=a.sort, | |||
BatchingName=b.Batching_Name | |||
BatchingName=b.Name | |||
}).ToList(); | |||
x.BomEntr = list; | |||
}) | |||
@@ -157,7 +157,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||
var list = new List<BPA_Bom>(); | |||
for (int i = 0; i < dto.DataInfo.Count; i++) | |||
{ | |||
var resEntity = SqlSugarDb.Db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.DataInfo[i].Id); | |||
var resEntity = SqlSugarDb.Db.Queryable<BPA_Bom>().First(it => it.Id == dto.DataInfo[i].Id); | |||
if (resEntity != null) | |||
{ | |||
resEntity.Name = dto.DataInfo[i].Name; | |||
@@ -212,7 +212,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||
BatchingId=a.BatchingId, | |||
BomQty=a.BomQty, | |||
Sort=a.sort, | |||
BatchingName=c.Batching_Name, | |||
BatchingName=c.Name, | |||
BomId = a.BomId, | |||
BomName=b.Name | |||
}).ToListAsync(); | |||
@@ -27,7 +27,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser | |||
//检查key | |||
await CheckKey(key); | |||
//await CheckKey(key); | |||
//var thisSign = signStr + "&key=" + key; | |||
//var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper(); | |||
@@ -103,7 +103,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services | |||
/// <returns></returns> | |||
public async Task<bool>UpdateDevice(DeviceUpateDto dto) | |||
{ | |||
var resEntity = SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
var resEntity = SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().First(it => it.Id == dto.Id); | |||
resEntity.DeviceName = dto.DeviceName; | |||
//resEntity.StopId = dto.StopId; | |||
//resEntity.ProductId = dto.ProductId; | |||
@@ -40,7 +40,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
var data = await SqlSugarDb.Db.Queryable<BPA_GoodsInfo, BPA_GoodsType, BPA_GoodsUint>((a, b, c) => | |||
new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, | |||
JoinType.Left, a.GoodsUintId == c.Id)) | |||
.Where((a, b, c) => a.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.GoodsTypeName), (a, b, c) => b.Name.Contains(inputDto.GoodsTypeName)) | |||
.Select((a, b, c) => new GoodsDto() | |||
{ | |||
@@ -567,7 +566,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
GoodsAttributeId = action.GoodsAttributeId, | |||
Sort = action.Sort, | |||
CreateBy = userId, | |||
IsDeleted = 0, | |||
ActionJson = JsonConvert.SerializeObject(action.ActionJson), | |||
IsBatch = false, | |||
GoodsId = item.GoodsId, | |||
@@ -41,20 +41,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||
int total = new RefAsync<int>(); | |||
var data = await SqlSugarDb.Db.Queryable<BPA_Batching, BPA_BatchingType, BPA_BatchingUint>((a, b, c) => | |||
new JoinQueryInfos(JoinType.Left, a.Batching_Type == b.Id, | |||
JoinType.Left, a.StockUint == c.Id)) | |||
.Where((a, b, c) => a.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.Name), (a, b, c) => a.Batching_Name.Contains(inputDto.Name)) | |||
.Select((a, b, c) => new MaterialDto() | |||
var data = await SqlSugarDb.Db.Queryable<BPA_Batching>() | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.Name), a => a.Name.Contains(inputDto.Name)) | |||
.Select(a => new MaterialDto() | |||
{ | |||
Id = a.Id, | |||
Code = a.Code, | |||
Name = a.Batching_Name, | |||
TypeId = b.Id, | |||
TypeName = b.Name, | |||
UintId = c.Id, | |||
UintName = c.Name, | |||
Name = a.Name, | |||
}).ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
@@ -111,7 +104,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||
var batchingUpdateList = new List<BPA_Batching>(); | |||
foreach (var item in inputDto) | |||
{ | |||
var batchingData = batchingList.FirstOrDefault(t => t.Batching_Name == item.Name && t.Id != item.Id); | |||
var batchingData = batchingList.FirstOrDefault(t => t.Name == item.Name && t.Id != item.Id); | |||
if (batchingData != null) | |||
repeatList.Add(new ResponseMessageDto { Code = 30001, Message = "物料上传失败:重复物料数据", Id = item.Id, Name = item.Name }); | |||
var typeData = typeList.FirstOrDefault(t => t.Name == item.TypeName && t.Id != item.TypeId); | |||
@@ -181,27 +174,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||
batchingInfo = new BPA_Batching() | |||
{ | |||
Id = item.Id, | |||
Aittribute = 0, | |||
Batching_Name = item.Name, | |||
Batching_Type = item.TypeId, | |||
Name = item.Name, | |||
Code = code, | |||
Price = 0, | |||
Specs = "", | |||
outstockUint = item.UintId, | |||
Status = CommonStatus.ENABLE, | |||
StockUint = item.UintId, | |||
TypeID = item.TypeId, | |||
IsDeleted = 0, | |||
CreateBy = userId | |||
}; | |||
batchingAddList.Add(batchingInfo); | |||
} | |||
else | |||
{ | |||
batchingInfo.Batching_Name = item.Name; | |||
batchingInfo.Batching_Type = item.TypeId; | |||
batchingInfo.TypeID = item.TypeId; | |||
batchingInfo.outstockUint = item.UintId; | |||
batchingInfo.Name = item.Name; | |||
batchingInfo.StockUint = item.UintId; | |||
batchingUpdateList.Add(batchingInfo); | |||
} | |||
@@ -340,11 +322,8 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||
var bathingData = batchingList.FirstOrDefault(t => t.Id == item.Id); | |||
if (bathingData == null) | |||
throw Oops.Oh($"物料“{item.Name}”不存在"); | |||
bathingData.Batching_Name = item.Name; | |||
bathingData.Batching_Type = typeId; | |||
bathingData.outstockUint = uintId; | |||
bathingData.Name = item.Name; | |||
bathingData.StockUint = uintId; | |||
bathingData.TypeID = typeId; | |||
SqlSugarDb.Db.Updateable(bathingData).ExecuteCommand(); | |||
#region 下发数据到设备(后厨弃用) | |||
@@ -36,7 +36,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||
}) | |||
.Mapper(x => | |||
{ | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion,BPA_Batching>((a, b) => new JoinQueryInfos(JoinType.Left,a.BatchingId==b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id=a.Id.SelectAll(),BatchingName=b.Batching_Name}).ToList(); | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion,BPA_Batching>((a, b) => new JoinQueryInfos(JoinType.Left,a.BatchingId==b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id=a.Id.SelectAll(),BatchingName=b.Name}).ToList(); | |||
}) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
@@ -65,7 +65,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||
}) | |||
.Mapper(x => | |||
{ | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion, BPA_Batching>((a, b) => new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id = a.Id.SelectAll(), BatchingName = b.Batching_Name }).ToList(); | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion, BPA_Batching>((a, b) => new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id = a.Id.SelectAll(), BatchingName = b.Name }).ToList(); | |||
}) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.ToListAsync(); | |||
@@ -40,14 +40,11 @@ namespace BPA.SAAS.Manage.Application.Auth | |||
// 判断用户名和密码是否正确 忽略全局过滤器 | |||
var user = await _db.Queryable<BPA_Users>().Where(u => u.Account.Equals(input.Account) | |||
&& u.Password.Equals(encryptPasswod) | |||
&& u.IsDeleted == 0 | |||
).FirstAsync(); | |||
_ = user ?? throw Oops.Oh("用户名或密码不正确"); | |||
//获取权限 | |||
List<IConditionalModel> conModels = new List<IConditionalModel>(); | |||
conModels.Add(new ConditionalModel() { FieldName = "Id", ConditionalType = ConditionalType.Equal, FieldValue = user.GroupId }); | |||
conModels.Add(new ConditionalModel() { FieldName = "Status", ConditionalType = ConditionalType.Equal, FieldValue = CommonStatus.ENABLE.ToString() }); | |||
conModels.Add(new ConditionalModel() { FieldName = "IsDeleted", ConditionalType = ConditionalType.Equal, FieldValue ="0" }); | |||
//if (user.AdminType != 1) | |||
//{ | |||
// conModels.Add(new ConditionalModel() { FieldName = "Type", ConditionalType = ConditionalType.Equal, FieldValue = input.Type.ToString() }); | |||
@@ -68,7 +65,7 @@ namespace BPA.SAAS.Manage.Application.Auth | |||
{ ClaimConst.CLAINM_NAME, user.Name }, | |||
{ ClaimConst.CLAINM_SUPERADMIN, CLAINM_SUPERADMIN }, | |||
{ ClaimConst.GroupId, user.GroupId}, | |||
{ ClaimConst.OrgId,user.SysOrgId}, | |||
{ ClaimConst.OrgId,user.OrgId}, | |||
//{ ClaimConst.SupplyPlatformId,company?.SupplyPlatformId} | |||
}, 1440); | |||
@@ -22,10 +22,10 @@ namespace BPA.SAAS.Manage.Application.DataBase | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/batching/getpage")] | |||
public async Task<PageUtil> GetBatchingList(BatchingListQuery dto) | |||
[HttpPost("/api/batching/getBatchingPage")] | |||
public async Task<PageUtil> GetBatchingPage(BatchingListQuery dto) | |||
{ | |||
return await _batchingService.GetBatchingList(dto); | |||
return await _batchingService.GetBatchingPage(dto); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
@@ -19,64 +19,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Batching | |||
/// <summary> | |||
/// 物料编码 | |||
/// </summary> | |||
public string code { get; set; } | |||
/// <summary> | |||
/// 物料规格 | |||
/// </summary> | |||
public string specs { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 单位 | |||
/// </summary> | |||
public string StockUint { get; set; } | |||
/// <summary> | |||
/// 类型 | |||
/// </summary> | |||
public string TypeID { get; set; } | |||
/// <summary> | |||
/// itemName | |||
/// </summary> | |||
public string itemName { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
public string Status { get; set; } | |||
/// <summary> | |||
/// 原料属性 | |||
/// </summary> | |||
public string Aittribute { get; set; } | |||
/// <summary> | |||
/// 配料类型 | |||
/// </summary> | |||
public string batchingType { get; set; } | |||
/// <summary> | |||
/// 成本价 | |||
/// </summary> | |||
public decimal Price { get; set; } | |||
/// <summary> | |||
/// 出库单位 | |||
/// </summary> | |||
public string outstockUint { get; set; } | |||
/// <summary> | |||
/// 换算比例 | |||
/// </summary> | |||
public decimal proportion { get; set; } | |||
/// <summary> | |||
/// 净料率 | |||
/// </summary> | |||
public decimal netrecovery { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public List<BatchingDetailedDto> membersList { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public int Type { get; set; } | |||
} | |||
} |
@@ -18,76 +18,20 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Batching | |||
/// </summary> | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 商品属性 (0成品,1半成品,2,易耗品) | |||
/// </summary> | |||
public string Aittribute { get; set; } | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 原料类型 | |||
/// </summary> | |||
public string TypeID { get; set; } | |||
/// <summary> | |||
/// 原料类型名称 | |||
/// </summary> | |||
public string TypeName { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime? CreateAt { get; set; } | |||
/// <summary> | |||
/// 修改时间 | |||
/// </summary> | |||
public DateTime? UpdateAt { get; set; } | |||
/// <summary> | |||
/// 库存单位 | |||
/// </summary> | |||
public string StockUint { get; set; } | |||
/// <summary> | |||
/// 库存单位名称 | |||
/// </summary> | |||
public string StockUintName { get; set; } | |||
/// <summary> | |||
/// 规格属性 | |||
/// </summary> | |||
public string Specs { get; set; } | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
public string Status { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string batchingType { get; set; } | |||
/// <summary> | |||
/// 成本价 | |||
/// </summary> | |||
public decimal? Price { get; set; } | |||
/// <summary> | |||
/// 净料率 | |||
/// </summary> | |||
public decimal? netrecovery { get; set; } | |||
/// <summary> | |||
/// 出库单位 | |||
/// </summary> | |||
public string outstockUint { get; set; } | |||
/// <summary> | |||
/// 换算比例 | |||
/// </summary> | |||
public decimal proportion { get; set; } | |||
/// <summary> | |||
/// | |||
/// 原料类型 | |||
/// </summary> | |||
public List<BatchingDetailedDto> MembersList { get; set; } | |||
public DateTime? DeleteAt { get; set; } | |||
public string DeleteBy { get; set; } | |||
public string ForeignKeyRe { get; set; } | |||
public string Type { get; set; } | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Recipe | |||
{ | |||
public class RecipeGroupDto | |||
{ | |||
public string Id { get; set; } | |||
public string Name { get; set; } | |||
public int Sort { get; set; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Recipe | |||
{ | |||
public class RecipeInfoDto | |||
{ | |||
public string Id { get; set; } | |||
public string RecipeGroupId { get; set; } | |||
public string Name { get; set; } | |||
public int RecipeType { get; set; } | |||
public decimal BenchmarkGram { get; set; } | |||
public int Sort { get;set; } | |||
} | |||
} |
@@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IBatchingService | |||
{ | |||
Task<PageUtil> GetBatchingList(BatchingListQuery dto); | |||
Task<PageUtil> GetBatchingPage(BatchingListQuery dto); | |||
Task<bool> AddBatching(BatchingInfoDto dto); | |||
Task<bool> UpdateBatching(BatchingInfoDto dto); | |||
Task<bool> BatchDelBatching(List<string> Ids); | |||
@@ -0,0 +1,17 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Recipe; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Interface | |||
{ | |||
public interface IRecipeService | |||
{ | |||
Task<List<RecipeGroupDto>> GetRecipeGroupList(); | |||
Task<bool> UpdataRecipeGroup(RecipeGroupDto dto); | |||
Task<bool> DeleteRecipeGroup(string id); | |||
Task<List<RecipeInfoDto>> GetRecipeInfoList(string recipeGroupId); | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Recipe; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase | |||
{ | |||
[ApiDescriptionSettings("Recipe", Tag = "配方信息")] | |||
public class RecipeServices : IDynamicApiController | |||
{ | |||
IRecipeService _recipeService; | |||
public RecipeServices(IRecipeService recipeService) | |||
{ | |||
_recipeService = recipeService; | |||
} | |||
/// <summary> | |||
/// 获取配方分组 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet("/api/recipe/getRecipeGroupList")] | |||
public async Task<List<RecipeGroupDto>> GetRecipeGroupList() | |||
{ | |||
return await _recipeService.GetRecipeGroupList(); | |||
} | |||
/// <summary> | |||
/// 更新配方分组 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/recipe/updataRecipeGroup")] | |||
public async Task<bool> UpdataRecipeGroup(RecipeGroupDto dto) | |||
{ | |||
return await _recipeService.UpdataRecipeGroup(dto); | |||
} | |||
/// <summary> | |||
/// 删除配方分组 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/recipe/deleteRecipeGroup")] | |||
public async Task<bool> DeleteRecipeGroup(string id) | |||
{ | |||
return await _recipeService.DeleteRecipeGroup(id); | |||
} | |||
/// <summary> | |||
/// 通过配方分组获取配方信息 | |||
/// </summary> | |||
/// <param name="recipeGroupId"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/recipe/getRecipeInfoList")] | |||
public async Task<List<RecipeInfoDto>> GetRecipeInfoList(string recipeGroupId) | |||
{ | |||
return await _recipeService.GetRecipeInfoList(recipeGroupId); | |||
} | |||
} | |||
} |
@@ -19,7 +19,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
private readonly ISqlSugarClient _db; | |||
public BatchingService(ISqlSugarClient db) | |||
{ | |||
_db=db; | |||
_db = db; | |||
} | |||
#region 物料 | |||
/// <summary> | |||
@@ -27,102 +27,58 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetBatchingList(BatchingListQuery dto) | |||
public async Task<PageUtil> GetBatchingPage(BatchingListQuery dto) | |||
{ | |||
#region 查询条件 | |||
List<IConditionalModel> conModels = new List<IConditionalModel>(); | |||
if (!string.IsNullOrEmpty(dto.Name))//物料名称 | |||
if (!string.IsNullOrEmpty(dto.Name)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Batching_Name", ConditionalType = ConditionalType.Like, FieldValue = dto.Name }); | |||
conModels.Add(new ConditionalModel() { FieldName = "Name", ConditionalType = ConditionalType.Like, FieldValue = dto.Name }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Code))//物料编码 | |||
if (!string.IsNullOrEmpty(dto.Type)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Code", ConditionalType = ConditionalType.Like, FieldValue = dto.Code }); | |||
conModels.Add(new ConditionalModel() { FieldName = "Type", ConditionalType = ConditionalType.Equal, FieldValue = dto.Type }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.StockUint))//物料单位 | |||
if (!string.IsNullOrEmpty(dto.StockUint)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "c.Id", ConditionalType = ConditionalType.Equal, FieldValue = dto.StockUint }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Specs))//物料规格 | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Specs", ConditionalType = ConditionalType.Equal, FieldValue = dto.Specs }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Aittribute))//物料属性 | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Aittribute", ConditionalType = ConditionalType.Equal, FieldValue = dto.Aittribute.ToString() }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.TypeID))//物料类别 | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "b.Id", ConditionalType = ConditionalType.Equal, FieldValue = dto.TypeID }); | |||
} | |||
if (!string.IsNullOrEmpty(dto.Status)) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Status", ConditionalType = ConditionalType.Equal, FieldValue = dto.Status }); | |||
} | |||
if (dto.Price != null) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.Price", ConditionalType = ConditionalType.Equal, FieldValue = dto.Price.ToString() }); | |||
} | |||
if (dto.netrecovery != null) | |||
{ | |||
conModels.Add(new ConditionalModel() { FieldName = "a.netrecovery", ConditionalType = ConditionalType.Equal, FieldValue = dto.netrecovery.ToString() }); | |||
conModels.Add(new ConditionalModel() { FieldName = "StockUint", ConditionalType = ConditionalType.Equal, FieldValue = dto.StockUint }); | |||
} | |||
#endregion | |||
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) | |||
var res = await _db.Queryable<BPA_Batching>() | |||
.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) | |||
.Select((a, b, c) => new BatchingListQuery() | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(a => new BatchingListQuery() | |||
{ | |||
Id = a.Id, | |||
Name = a.Batching_Name, | |||
Name = a.Name, | |||
Code = a.Code, | |||
StockUint = a.StockUint, | |||
StockUintName = c.Name, | |||
Specs = a.Specs, | |||
Aittribute = a.Aittribute.ToString(), | |||
TypeID = b.Id, | |||
TypeName = b.Name, | |||
CreateAt = a.CreateAt, | |||
Status = a.Status.ToString(), | |||
batchingType = a.Batching_Type, | |||
Price = a.Price, | |||
netrecovery = a.netrecovery, | |||
outstockUint = a.outstockUint, | |||
proportion = a.proportion, | |||
ForeignKeyRe = a.ForeignKeyRe | |||
Type = a.Type.ToString(), | |||
}) | |||
.ToPageListAsync(dto.Current, dto.PageSize, total); | |||
res.ForEach(list => | |||
{ | |||
int total1 = 0; | |||
//var res1 = _db.Queryable<BPA_ProductCode>() | |||
// .Where(a => a.IsDeleted == 0 && a.ProductID == list.Id) | |||
// .OrderBy(a => a.CreateAt, OrderByType.Asc) | |||
// .Select(a => new ProductDetailedDto | |||
// { | |||
// Id = a.Id, | |||
// Code = a.Code, | |||
// PackUnit = a.PackUnit, | |||
// Proportion = a.Proportion | |||
// }) | |||
// .ToPageList(dto.Current, dto.PageSize, ref total1); | |||
list.MembersList = null; | |||
}); | |||
.ToPageListAsync(dto.Current, dto.PageSize, total); | |||
PageUtil util = new PageUtil() | |||
{ | |||
Total = total, | |||
Data = res | |||
}; | |||
return util; | |||
} | |||
public string BatchingTypeEnum(int typeId) | |||
{ | |||
switch (typeId) | |||
{ | |||
case 1: | |||
return "液体料"; | |||
case 2: | |||
return "主料"; | |||
default: | |||
return ""; | |||
} | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
@@ -130,34 +86,27 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// <returns></returns> | |||
public async Task<bool> AddBatching(BatchingInfoDto dto) | |||
{ | |||
var productCode = _db.Queryable<BPA_Batching>().First(x => x.Code == dto.code); | |||
var productCode = await _db.Queryable<BPA_Batching>().FirstAsync(x => x.Code == dto.Code); | |||
if (productCode != null) | |||
throw Oops.Oh("编码已存在"); | |||
var productName = _db.Queryable<BPA_Batching>().First(t => t.Batching_Name == dto.Name); | |||
var productName = await _db.Queryable<BPA_Batching>().FirstAsync(t => t.Name == dto.Name); | |||
if (productName != null) | |||
throw Oops.Oh($"{dto.Name}已存在"); | |||
try | |||
{ | |||
BPA_Batching bPA_Product = new BPA_Batching(); | |||
bPA_Product.StockUint = dto.StockUint; | |||
bPA_Product.TypeID = dto.TypeID; | |||
bPA_Product.Code = dto.code; | |||
bPA_Product.Batching_Name = dto.Name; | |||
bPA_Product.Specs = dto.specs; | |||
bPA_Product.Status = CommonStatus.ENABLE; | |||
bPA_Product.Aittribute = Convert.ToInt32(dto.Aittribute); | |||
bPA_Product.Batching_Type = dto.batchingType; | |||
bPA_Product.Price = dto.Price; | |||
bPA_Product.netrecovery = dto.netrecovery; | |||
bPA_Product.outstockUint = dto.outstockUint; | |||
bPA_Product.proportion = dto.proportion; | |||
bPA_Product.ForeignKeyRe = dto.ForeignKeyRe; | |||
var res=await _db.Insertable(bPA_Product).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res>0; | |||
var batching = new BPA_Batching | |||
{ | |||
StockUint = dto.StockUint, | |||
Code = dto.Code, | |||
Name = dto.Name, | |||
Type = dto.Type | |||
}; | |||
var res = await _db.Insertable(batching).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception ex) | |||
catch (Exception e) | |||
{ | |||
throw Oops.Oh("添加失败"); | |||
throw Oops.Oh(e.Message); | |||
} | |||
} | |||
/// <summary> | |||
@@ -167,38 +116,20 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// <returns></returns> | |||
public async Task<bool> UpdateBatching(BatchingInfoDto dto) | |||
{ | |||
var Code = _db.Queryable<BPA_Batching>().Where(x => x.Id == dto.Id).First(); | |||
if (Code.Code != dto.code) | |||
{ | |||
throw Oops.Oh("编码已存在"); | |||
} | |||
try | |||
{ | |||
BPA_Batching bPA_Product = new BPA_Batching(); | |||
bPA_Product.StockUint = dto.StockUint; | |||
bPA_Product.TypeID = dto.TypeID; | |||
bPA_Product.Code = dto.code; | |||
bPA_Product.Batching_Name = dto.Name; | |||
bPA_Product.Specs = dto.specs; | |||
bPA_Product.Id = dto.Id; | |||
bPA_Product.Aittribute = Convert.ToInt32(dto.Aittribute); | |||
bPA_Product.Batching_Type = dto.batchingType; | |||
bPA_Product.Price = dto.Price; | |||
bPA_Product.netrecovery = dto.netrecovery; | |||
bPA_Product.outstockUint = dto.outstockUint; | |||
bPA_Product.proportion = dto.proportion; | |||
bPA_Product.ForeignKeyRe = dto.ForeignKeyRe; | |||
if (!string.IsNullOrEmpty(dto.Status)) | |||
{ | |||
bPA_Product.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), int.Parse(dto.Status)); | |||
} | |||
var res=await _db.Updateable(bPA_Product).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |||
return res>0; | |||
var batching = await _db.Queryable<BPA_Batching>().FirstAsync(t => t.Id == dto.Id); | |||
if (batching == null) | |||
throw Oops.Oh($"{dto.Name}不存在或已删除"); | |||
batching.StockUint = dto.StockUint; | |||
batching.Name = dto.Name; | |||
batching.Type = dto.Type; | |||
var res = await _db.Updateable(batching).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception) | |||
catch (Exception e) | |||
{ | |||
throw Oops.Oh("更新失败"); | |||
throw Oops.Oh(e.Message); | |||
} | |||
} | |||
@@ -211,11 +142,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
try | |||
{ | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites = _db.Queryable<BPA_Batching>().In(Ids).ToList(); | |||
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
var res = await _db.Deleteable(resEntitites).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception) | |||
{ | |||
@@ -229,7 +158,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
public async Task<Dictionary<string, object>> GetBatchingList() | |||
{ | |||
var res = await _db.Queryable<BPA_Batching>() | |||
.ToDictionaryAsync(x => x.Id, x => x.Batching_Name); | |||
.ToDictionaryAsync(x => x.Id, x => x.Name); | |||
return res; | |||
} | |||
/// <summary> | |||
@@ -238,7 +167,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
/// <returns></returns> | |||
public async Task<List<BatchingList>> GetBatchingSelectList() | |||
{ | |||
var res = await _db.Queryable<BPA_Batching>().Select(x=>new BatchingList() { Id=x.Id,Name=x.Batching_Name}) | |||
var res = await _db.Queryable<BPA_Batching>().Select(x=>new BatchingList() { Id=x.Id,Name=x.Name}) | |||
.ToListAsync(); | |||
return res; | |||
} | |||
@@ -253,13 +182,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites = _db.Queryable<BPA_Batching>().Where(x => x.Id == dto.Id).First(); | |||
if (resEntitites != null) | |||
{ | |||
resEntitites.Status = (CommonStatus)Enum.ToObject(typeof(CommonStatus), dto.Status); | |||
} | |||
var res =await _db.Updateable(resEntitites).UpdateColumns(x => new { x.Status }).ExecuteCommandAsync(); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
@@ -276,9 +199,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
public async Task<List<BatchingView>> GetByTypeBatching() | |||
{ | |||
var item = await _db.Queryable<BPA_Batching, BPA_BatchingType>((a, b) => new JoinQueryInfos( | |||
JoinType.Left, a.TypeID == b.Id | |||
)).Select((a, b) => new BatchingView() { Id = a.Id, Name = a.Batching_Name, TypeName = b.Name }).ToListAsync(); | |||
var item = await _db.Queryable<BPA_Batching>().Select(a => new BatchingView() { Id = a.Id, Name = a.Name }).ToListAsync(); | |||
return item; | |||
} | |||
#endregion | |||
@@ -330,7 +251,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites =await _db.Queryable<BPA_Batching>().Where(x=>x.Id== id).FirstAsync(); | |||
resEntitites.IsDeleted= 1; | |||
var res = await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
@@ -386,7 +306,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites = await _db.Queryable<BPA_BatchingUint>().Where(x => x.Id == id).FirstAsync(); | |||
resEntitites.IsDeleted = 1; | |||
var res = await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
@@ -86,7 +86,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
_db.Ado.BeginTran(); | |||
// 查询数据库中是否存在未删除的工艺分类 | |||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
var resEntity = _db.Queryable<BPA_Bom>().First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
return false; | |||
@@ -130,7 +130,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
_db.Ado.BeginTran(); | |||
// 查询数据库中是否存在未删除的工艺分类 | |||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.BomId); | |||
var resEntity = _db.Queryable<BPA_Bom>().First(it => it.Id == dto.BomId); | |||
if (null == resEntity) | |||
{ | |||
throw Oops.Oh("配方不存在"); | |||
@@ -169,12 +169,11 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
try | |||
{ | |||
_db.Ado.BeginTran(); | |||
var resEntity = _db.Queryable<BPA_Bom>().Where(it => it.IsDeleted == 0).First(it => it.Id == id); | |||
var resEntity = _db.Queryable<BPA_Bom>().First(it => it.Id == id); | |||
if (null == resEntity) | |||
{ | |||
throw Oops.Oh("配方不存在"); | |||
} | |||
resEntity.IsDeleted = 1; | |||
var res = await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |||
var BomTypeInfo = _db.Queryable<BPA_BomTypeInfo>().Where(it => it.BomId == id).Select(x => x.Id).ToList(); | |||
await _db.Deleteable<BPA_BomTypeInfo>(BomTypeInfo).ExecuteCommandAsync(); | |||
@@ -234,7 +233,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var pertainList = _db.Queryable<BPA_BomTypeInfo, BPA_BomType>((a, b) => | |||
new JoinQueryInfos(JoinType.Left, a.BomTypeId == b.Id)) | |||
.Where((a, b) => a.IsDeleted == 0 && b.IsDeleted == 0) | |||
//.WhereIF(inputDto.Pertains != null && inputDto.Pertains.Count > 0, (a, b) => inputDto.Pertains.Contains(b.Pertain)) | |||
//.WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomTypeList), (a, b) => b.Id == inputDto.bomTypeList) | |||
.Select((a, b) => a.BomId) | |||
@@ -242,7 +240,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
int total = new RefAsync<int>(); | |||
var res = _db.Queryable<BPA_Bom>() | |||
.Where(it => it.IsDeleted == 0) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.Name),x=>x.Name.Contains(inputDto.Name)) | |||
//.WhereIF(!string.IsNullOrWhiteSpace(inputDto.bomTypeList), x => pertainList.Contains(x.Id)) | |||
.OrderBy(i => i.CreateAt, OrderByType.Desc) | |||
@@ -250,7 +247,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var listtype = _db.Queryable<BPA_BomTypeInfo>() | |||
.Where(a => res.Select(x => x.Id).Contains(a.BomId) && a.IsDeleted == 0).ToList(); | |||
.Where(a => res.Select(x => x.Id).Contains(a.BomId)).ToList(); | |||
var data = new List<object>(); | |||
foreach (var item in res) | |||
@@ -29,7 +29,6 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
int total = new RefAsync<int>(); | |||
var res = _db.Queryable<BPA_GoodsAttribute>() | |||
.Where(a=> a.IsDeleted == 0) | |||
.WhereIF(!dto.AttributeName.IsNullOrWhiteSpace(),x=>x.AttributeName.Contains(dto.AttributeName)) | |||
.WhereIF(!dto.GoodsTypeId.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(dto.GoodsTypeId)) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
@@ -89,7 +88,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
if (!string.IsNullOrWhiteSpace(dto.Id)) | |||
{ | |||
_db.Ado.BeginTran(); | |||
var resEntity = _db.Queryable<BPA_GoodsAttribute>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
var resEntity = _db.Queryable<BPA_GoodsAttribute>().First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
return false; | |||
@@ -227,7 +226,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
{ | |||
string groupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
var res =await _db.Queryable<BPA_GoodsAttributeValue>().Where(x=>x.GoodsAttributeId== goodsAttributeId && x.IsDeleted==0) | |||
var res =await _db.Queryable<BPA_GoodsAttributeValue>().Where(x=>x.GoodsAttributeId== goodsAttributeId) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(a => new BPA_GoodsAttributeValue | |||
@@ -252,7 +251,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
Guid newGuid = Guid.Empty; | |||
if (Guid.TryParse(dto[i].Id, out newGuid)) | |||
{ | |||
var resEntity = _db.Queryable<BPA_GoodsAttributeValue>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto[i].Id); | |||
var resEntity = _db.Queryable<BPA_GoodsAttributeValue>().First(it => it.Id == dto[i].Id); | |||
resEntity.AttributeValue = dto[i].AttributeValue; | |||
resEntity.Sort = dto[i].Sort; | |||
resEntity.WaiKey= dto[i].WaiKey; | |||
@@ -316,7 +315,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
{ | |||
var goods=await _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == id).FirstAsync(); | |||
if (goods == null) throw Oops.Oh("商品不存在"); | |||
var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().Where(x => x.GoodsTypeId.Contains( goods.GoodsTypeId) && x.IsDeleted == 0) | |||
var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().Where(x => x.GoodsTypeId.Contains( goods.GoodsTypeId)) | |||
.Select(x=>new GoodsAttributeList() | |||
{ | |||
GoodsAttributeId=x.Id, | |||
@@ -325,7 +324,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
Sort=x.Sort, | |||
}).Mapper(p => | |||
{ | |||
p.GoodsAttributeValueList = _db.Queryable<BPA_GoodsAttributeValue>().Where(x => x.GoodsAttributeId == p.GoodsAttributeId && x.IsDeleted==0).Select(x => new GoodsAttributeValueList() | |||
p.GoodsAttributeValueList = _db.Queryable<BPA_GoodsAttributeValue>().Where(x => x.GoodsAttributeId == p.GoodsAttributeId).Select(x => new GoodsAttributeValueList() | |||
{ | |||
GoodsAttributeValuId = x.Id, | |||
GoodsAttributeId = p.GoodsAttributeId, | |||
@@ -340,7 +339,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
{ | |||
//var goods = await _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == id).FirstAsync(); | |||
//if (goods == null) throw Oops.Oh("商品不存在"); | |||
var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().Where(x => x.AttributeName== name && x.IsDeleted == 0) | |||
var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().Where(x => x.AttributeName== name) | |||
.Select(x => new GoodsAttributeList() | |||
{ | |||
GoodsAttributeId = x.Id, | |||
@@ -349,7 +348,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
Sort = x.Sort, | |||
}).Mapper(p => | |||
{ | |||
p.GoodsAttributeValueList = _db.Queryable<BPA_GoodsAttributeValue>().Where(x => x.GoodsAttributeId == p.GoodsAttributeId && x.IsDeleted == 0).Select(x => new GoodsAttributeValueList() | |||
p.GoodsAttributeValueList = _db.Queryable<BPA_GoodsAttributeValue>().Where(x => x.GoodsAttributeId == p.GoodsAttributeId).Select(x => new GoodsAttributeValueList() | |||
{ | |||
GoodsAttributeValuId = x.Id, | |||
GoodsAttributeId = p.GoodsAttributeId, | |||
@@ -371,7 +370,6 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices | |||
var goodType = await _db.Queryable<BPA_GoodsType>().Where(x => x.Id == id).FirstAsync(); | |||
if (goodType == null) throw Oops.Oh("工艺分类不存在"); | |||
var res = await _db.Queryable<BPA_GoodsAttribute>() | |||
.Where(a => a.IsDeleted == 0) | |||
.WhereIF(!id.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(id)) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(a => new GoodsAttributeView | |||
@@ -97,11 +97,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
Price = a.Price, | |||
ImgUrl = a.ImgUrl, | |||
Status = a.Status, | |||
GoodsTypeId = b.IsDeleted == 0 ? a.GoodsTypeId : "", | |||
GoodsTypeName = b.IsDeleted == 0 ? b.Name : "", | |||
GoodsTypeId = a.GoodsTypeId, | |||
GoodsTypeName = b.Name, | |||
Descritption = a.Descritption, | |||
IsDeleted = a.IsDeleted, | |||
// CreateAt = a.CreateAt, | |||
GoodsUintId = a.GoodsUintId, | |||
ForeignKeyRe = a.ForeignKeyRe, | |||
@@ -306,7 +304,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
public async Task<bool> UpdateGoods(GoodsDto dto) | |||
{ | |||
// 查询数据库中是否存在未删除的工艺分类 | |||
var resEntity = _db.Queryable<BPA_GoodsInfo>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
var resEntity = _db.Queryable<BPA_GoodsInfo>().First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
throw Oops.Oh("商品不存在"); | |||
@@ -584,7 +582,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
public async Task<GoodsInfoBaseView> GetGoods(string id) | |||
{ | |||
var res = await _db.Queryable<BPA_GoodsInfo>() | |||
.Where((a) => a.IsDeleted == 0 && a.Id == id) | |||
.Where((a) => a.Id == id) | |||
.OrderBy(a => a.Sort, OrderByType.Asc) | |||
.Select((a) => new GoodsInfoBaseView | |||
{ | |||
@@ -595,12 +593,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
ImgUrl = a.ImgUrl, | |||
Status = a.Status, | |||
GoodsTypeId = a.GoodsTypeId, | |||
GoodsTypeName = SqlFunc.Subqueryable<BPA_GoodsType>().Where(s => s.Id == a.GoodsTypeId && s.IsDeleted == 0).Select(s => s.Name), | |||
GoodsTypeName = SqlFunc.Subqueryable<BPA_GoodsType>().Where(s => s.Id == a.GoodsTypeId).Select(s => s.Name), | |||
Remark = a.Descritption, | |||
// CreateAt = a.CreateAt, | |||
GoodsUintId = a.GoodsUintId, | |||
IsAttrubute = a.IsAttrubute, | |||
GoodsUintName = SqlFunc.Subqueryable<BPA_GoodsUint>().Where(s => s.Id == a.GoodsUintId && s.IsDeleted == 0).Select(s => s.Name), | |||
GoodsUintName = SqlFunc.Subqueryable<BPA_GoodsUint>().Where(s => s.Id == a.GoodsUintId).Select(s => s.Name), | |||
//GoodsAttributeList = new List<GoodsAttributeList>() | |||
}).FirstAsync(); | |||
if (res != null) | |||
@@ -652,7 +650,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
nonLiquid = new BPA_BatchingType() | |||
{ | |||
IsDeleted = 0, | |||
Name = "非液体", | |||
}; | |||
await _db.Insertable(nonLiquid).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
@@ -663,7 +660,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
liquid = new BPA_BatchingType | |||
{ | |||
IsDeleted = 0, | |||
Name = "液体料", | |||
}; | |||
await _db.Insertable(liquid).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
@@ -675,7 +671,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
unit = new BPA_BatchingUint | |||
{ | |||
IsDeleted = 0, | |||
Name = "默认单位", | |||
}; | |||
await _db.Insertable(unit).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | |||
@@ -686,23 +681,14 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var GoodBaseModellist = readGoodBaseModelExcel.ExcelToList(mapper, "商品_物料信息"); | |||
List<BPA_Batching> batchingList = GoodBaseModellist.Select(t => new BPA_Batching() | |||
{ | |||
Aittribute = 0, | |||
Batching_Name = t.BatchingName, | |||
Name = t.BatchingName, | |||
Code = GetNumber2(), | |||
IsDeleted = 0, | |||
netrecovery = 0, | |||
outstockUint = unit.Id, | |||
Price = 0, | |||
proportion = 0, | |||
Specs = "默认规格", | |||
Status = 0, | |||
StockUint = unit.Id, | |||
TypeID = t.BatchingType == "液体料" ? liquid.Id : nonLiquid.Id, | |||
}).ToList(); | |||
var batchingNameList = batchingList.Select(x => x.Batching_Name).ToList(); | |||
var batchingNameList = batchingList.Select(x => x.Name).ToList(); | |||
var batchingListrDb = _db.Queryable<BPA_Batching>().Where(x => batchingNameList.Contains(x.Batching_Name)) | |||
var batchingListrDb = _db.Queryable<BPA_Batching>().Where(x => batchingNameList.Contains(x.Name)) | |||
.ToList(); | |||
//替换 | |||
@@ -711,7 +697,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
foreach (var item2 in batchingList) | |||
{ | |||
var thisitem = batchingListrDb.FirstOrDefault(x => x.Batching_Name == item2.Batching_Name); | |||
var thisitem = batchingListrDb.FirstOrDefault(x => x.Name == item2.Name); | |||
if (thisitem != null) | |||
{ | |||
item2.Id = thisitem.Id; | |||
@@ -726,8 +712,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
} | |||
else | |||
{ | |||
var batchingListrDbName = batchingListrDb.Select(x => x.Batching_Name).ToList(); | |||
batchingList = batchingList.Where(x => !batchingListrDbName.Contains(x.Batching_Name)).ToList(); | |||
var batchingListrDbName = batchingListrDb.Select(x => x.Name).ToList(); | |||
batchingList = batchingList.Where(x => !batchingListrDbName.Contains(x.Name)).ToList(); | |||
await _db.Insertable(batchingList).ExecuteCommandAsync(); | |||
} | |||
@@ -745,7 +731,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
parentType = new BPA_GoodsType() | |||
{ | |||
IsDeleted = 0, | |||
Name = "默认分类", | |||
Remark = "", | |||
Sort = 0, | |||
@@ -765,7 +750,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
AttributeName = "默认属性", | |||
GoodsTypeId = parentType.Id, | |||
IsDeleted = 0, | |||
Sort = 0, | |||
}; | |||
@@ -773,14 +757,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
} | |||
var goodsattributevalue = await _db.Queryable<BPA_GoodsAttributeValue>() | |||
.FirstAsync(x => x.AttributeValue == "默认属性值" && x.GoodsAttributeId == goodsAttribute.Id && x.IsDeleted == 0); | |||
.FirstAsync(x => x.AttributeValue == "默认属性值" && x.GoodsAttributeId == goodsAttribute.Id); | |||
if (goodsattributevalue == null) | |||
{ | |||
goodsattributevalue = new BPA_GoodsAttributeValue() | |||
{ | |||
AttributeValue = "默认属性值", | |||
GoodsAttributeId = goodsAttribute.Id, | |||
IsDeleted = 0, | |||
Sort = 1, | |||
}; | |||
_db.Insertable(goodsattributevalue).CallEntityMethod(m => m.Create()).ExecuteCommand(); | |||
@@ -799,7 +782,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
goodsUint = new BPA_GoodsUint() | |||
{ | |||
IsDeleted = 0, | |||
Name = "默认单位", | |||
Status = 0, | |||
}; | |||
@@ -825,7 +807,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
GoodsTypeId = parentType.Id, | |||
Price = 0, | |||
IsAttrubute = false, | |||
IsDeleted = 0, | |||
IsWeigh = false, | |||
Key = null, | |||
Status = 0, | |||
@@ -935,7 +916,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
//查询设备 | |||
var name1 = nameList[1]; | |||
var name2 = nameList[2]; | |||
var device = await _db.Queryable<BPA_DeviceInfo>().FirstAsync(x => x.DeviceName == name1 && x.IsDeleted == 0); | |||
var device = await _db.Queryable<BPA_DeviceInfo>().FirstAsync(x => x.DeviceName == name1); | |||
if (device == null) | |||
{ | |||
throw Oops.Oh(nameList + " 设备【" + nameList[1] + "】不存在"); | |||
@@ -976,7 +957,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
GoodsAttributeId = goodsattributevalue.Id, | |||
GoodsId = goods?.Id, | |||
IsBatch = IsBatch, | |||
IsDeleted = 0, | |||
Sort = goodTechnologyIndex, | |||
DeviceId = device?.Id, | |||
StepName = goodTechnologyModel[i].Name, | |||
@@ -1427,7 +1407,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var technologyList = await _db.Queryable<BPA_Technology>().ToListAsync(); | |||
var technologyActionList = await _db.Queryable<BPA_TechnologyAction>().ToListAsync(); | |||
var wareHouseTemplateList = await _db.Queryable<BPA_WarehouseTemplate>().OrderBy(a => a.Id).ToListAsync(); | |||
var batchList = await _db.Queryable<BPA_Batching, BPA_BatchingType>((a, b) => new JoinQueryInfos(JoinType.Left, a.TypeID == b.Id)).Select((a, b) => new BatchingView() { Id = a.Id, Name = a.Batching_Name, TypeName = b.Name }).ToListAsync(); | |||
var batchList = await _db.Queryable<BPA_Batching>().Select(a => new BatchingView() { Id = a.Id, Name = a.Name }).ToListAsync(); | |||
try | |||
{ | |||
_db.Ado.BeginTran(); | |||
@@ -1816,7 +1796,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
var technologyActionList = await _db.Queryable<BPA_TechnologyAction>().ToListAsync(); | |||
var wareHouseTemplateList = await _db.Queryable<BPA_WarehouseTemplate>().OrderBy(a => a.Id).ToListAsync(); | |||
var goodsTechnologyActionList = await _db.Queryable<BPA_GoodsTechnologyAction>().ToListAsync(); | |||
var batchList = await _db.Queryable<BPA_Batching, BPA_BatchingType>((a, b) => new JoinQueryInfos(JoinType.Left, a.TypeID == b.Id)).Select((a, b) => new BatchingView() { Id = a.Id, Name = a.Batching_Name, TypeName = b.Name }).ToListAsync(); | |||
var batchList = await _db.Queryable<BPA_Batching>().Select(a => new BatchingView() { Id = a.Id, Name = a.Name }).ToListAsync(); | |||
var goodsDataAddList = new List<BPA_GoodsInfo>(); | |||
var goodsDataUpdateList = new List<BPA_GoodsInfo>(); | |||
var goodsTypeDataList = new List<BPA_GoodsType>(); | |||
@@ -50,7 +50,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
ChnologyId = inputDto[i].ChnologyId, | |||
CreateAt = DateTime.Now, | |||
WarehousrTemplateId = inputDto[i].WarehousrTemplateId, | |||
IsDeleted = 0, | |||
GoodsAttributeId = inputDto[i].GoodsAttributeId, | |||
Sort = string.IsNullOrWhiteSpace(inputDto[i].Sort.ToString()) ? maxsort + (i + 1) : Convert.ToInt32(inputDto[i].Sort.ToString()), | |||
IsBatch = inputDto[i].IsBatch, | |||
@@ -101,7 +100,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
StepName = inputDto[i].StepName, | |||
ChnologyId = inputDto[i].ChnologyId, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
WarehousrTemplateId = inputDto[i].WarehousrTemplateId, | |||
GoodsAttributeId = inputDto[i].GoodsAttributeId, | |||
Sort = string.IsNullOrWhiteSpace(inputDto[i].Sort.ToString()) ? maxsort + (i + 1) : Convert.ToInt32(inputDto[i].Sort.ToString()), | |||
@@ -53,7 +53,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
.Mapper(x => | |||
{ | |||
var attrViewList = _db.Queryable<BPA_GoodsAttribute>() | |||
.Where(a => a.IsDeleted == 0) | |||
.WhereIF(!x.Id.IsNullOrWhiteSpace(), a => a.GoodsTypeId.Contains(x.Id)) | |||
.OrderBy(a => a.Sort, OrderByType.Asc) | |||
.Select(a => new GoodsAttributeView | |||
@@ -290,7 +289,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
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 && u.GroupId == groupId).OrderBy(u => u.Sort) | |||
.Where(u => u.Status == CommonStatus.ENABLE && u.GroupId == groupId).OrderBy(u => u.Sort) | |||
.Select(u => new OrgTreeNode | |||
{ | |||
key = u.Id, | |||
@@ -0,0 +1,110 @@ | |||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Recipe; | |||
using BPA.SAAS.Manage.Application.DataBase.Interface; | |||
using BPA.SAAS.Manage.Core.DataBase; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.DataBase.Services | |||
{ | |||
public class RecipeService : IRecipeService, ITransient | |||
{ | |||
private readonly ISqlSugarClient _db; | |||
public RecipeService(ISqlSugarClient db) | |||
{ | |||
_db = db; | |||
} | |||
/// <summary> | |||
/// 获取配方分组 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<RecipeGroupDto>> GetRecipeGroupList() | |||
{ | |||
return await _db.Queryable<BPA_RecipeGroup>().OrderBy(t => t.Sort).Select(t => new RecipeGroupDto | |||
{ | |||
Id = t.Id, | |||
Name = t.Name, | |||
Sort = t.Sort | |||
}).ToListAsync(); | |||
} | |||
/// <summary> | |||
/// 更新配方分组 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdataRecipeGroup(RecipeGroupDto dto) | |||
{ | |||
try | |||
{ | |||
var res = 0; | |||
if (dto.Id == null) | |||
{ | |||
var group = await _db.Queryable<BPA_RecipeGroup>().FirstAsync(t => t.Name == dto.Name); | |||
if (group != null) | |||
throw Oops.Oh($"{dto.Name}已存在"); | |||
group = new BPA_RecipeGroup | |||
{ | |||
Name = dto.Name, | |||
Sort = dto.Sort | |||
}; | |||
res = await _db.Insertable(group).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); | |||
} | |||
else | |||
{ | |||
var group = await _db.Queryable<BPA_RecipeGroup>().FirstAsync(t => t.Id == dto.Id); | |||
if (group == null) | |||
throw Oops.Oh($"{dto.Name}不存在或已删除"); | |||
group.Name = dto.Name; | |||
group.Sort = dto.Sort; | |||
res = await _db.Updateable(group).ExecuteCommandAsync(); | |||
} | |||
return res > 0; | |||
} | |||
catch (Exception e) | |||
{ | |||
throw Oops.Oh(e.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 删除配方分组 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteRecipeGroup(string id) | |||
{ | |||
try | |||
{ | |||
var group = await _db.Queryable<BPA_RecipeGroup>().FirstAsync(t => t.Id == id); | |||
var res = await _db.Deleteable(group).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
catch (Exception e) | |||
{ | |||
throw Oops.Oh(e.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 通过配方分组获取配方信息 | |||
/// </summary> | |||
/// <param name="recipeGroupId"></param> | |||
/// <returns></returns> | |||
public async Task<List<RecipeInfoDto>> GetRecipeInfoList(string recipeGroupId) | |||
{ | |||
return await _db.Queryable<BPA_RecipeInfo>().Where(t => t.RecipeGroupId == recipeGroupId).OrderBy(a => a.Sort).Select(t => new RecipeInfoDto | |||
{ | |||
Id = t.Id, | |||
RecipeGroupId = t.RecipeGroupId, | |||
Name = t.Name, | |||
RecipeType = t.RecipeType, | |||
BenchmarkGram = t.BenchmarkGram, | |||
Sort = t.Sort | |||
}).ToListAsync(); | |||
} | |||
} | |||
} |
@@ -207,7 +207,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
/// <returns></returns> | |||
public async Task<List<ListSelectQuery>> GetDeviceTypeList() | |||
{ | |||
var listquery = await _db.Queryable<BPA_DeviceType>().Where(a => a.IsDeleted == 0).Select(a => new ListSelectQuery | |||
var listquery = await _db.Queryable<BPA_DeviceType>().Select(a => new ListSelectQuery | |||
{ | |||
Id = a.Id, | |||
Name = a.Name | |||
@@ -152,7 +152,6 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
Name = inputDto.Name, | |||
Status = CommonStatus.ENABLE, | |||
CreateAt = DateTime.Now, | |||
IsDeleted = 0, | |||
Type= inputDto.Type, | |||
ForeignKeyRe = inputDto.ForeignKeyRe, | |||
DeviceVersionKey = inputDto.DeviceVersionKey, | |||
@@ -225,7 +224,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList(string productFunctionId) | |||
{ | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>().Where(x => x.IsDeleted == 0 && x.ProductFunctionId == productFunctionId) | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>().Where(x => x.ProductFunctionId == productFunctionId) | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
@@ -237,7 +236,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
public async Task<List<BPA_ProductFunctionAction>> GetProductFunctionActionList() | |||
{ | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>().Where(x => x.IsDeleted == 0) | |||
var res = await _db.Queryable<BPA_ProductFunctionAction>() | |||
.OrderBy(i => i.Sort, OrderByType.Asc) | |||
.ToListAsync(); | |||
return res; | |||
@@ -265,7 +264,6 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
ActionValue = inputDto.ActionValue, | |||
Unit = inputDto.Unit, | |||
// IsBatch = true,//inputDto.IsBatch, | |||
IsDeleted = 0, | |||
Sort = inputDto.Sort, | |||
}).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); ; | |||
return res > 0; | |||
@@ -299,10 +297,6 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
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; | |||
} | |||
@@ -28,7 +28,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services | |||
public async Task<PageUtil> GetProductPage(ProductQueryInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await _db.Queryable<BPA_Product>().Where((x) => x.IsDeleted == 0) | |||
var data = await _db.Queryable<BPA_Product>() | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), x => x.Name.Contains(inputDto.Name)) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Key), x => x.Key.Contains(inputDto.Key)) | |||
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Code), x => x.Code.Contains(inputDto.Code)) | |||
@@ -33,10 +33,8 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
{ | |||
RefAsync<int> total = 0; | |||
var data =await _db.Queryable<BPA_Company>() | |||
.Where((a) => a.IsDeleted == 0) | |||
.WhereIF(!input.Name.IsNullOrEmpty(), (a) => a.Name.Contains(input.Name)) | |||
.WhereIF(!input.AdminName.IsNullOrEmpty(), (a) => a.AdminName.Contains(input.AdminName)) | |||
.WhereIF(!input.Email.IsNullOrEmpty(), (a) => a.Email.Contains(input.Email)) | |||
.Filter(null, true) | |||
.Select((a) => new CompanyDtoInput | |||
{ | |||
@@ -64,7 +62,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
{ | |||
_db.Ado.BeginTran(); | |||
var company = input.Adapt<BPA_Company>(); | |||
var Companycheck = _db.Queryable<BPA_Company>().Where(x => x.IsDeleted == 0).First(x => x.Email == company.Email); | |||
var Companycheck = _db.Queryable<BPA_Company>().First(x => x.Phone == company.Phone); | |||
if (Companycheck != null) | |||
throw Oops.Oh($"账号已存在"); | |||
@@ -90,7 +88,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
Name = input.Name + "管理员", | |||
Remark = "系统默认创建管理员角色不允许修改", | |||
Code = "sys_manager_role", | |||
RoleType=1 | |||
}).CallEntityMethod(t => t.Create()).ExecuteCommandAsync() > 0; | |||
// 查询用户 | |||
var UserRes = _db.Queryable<BPA_Users>().Filter(null, true).Where(a => a.GroupId == res.Id && a.Account == input.Email).ToList(); | |||
@@ -125,11 +122,11 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
{ | |||
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); | |||
var check = _db.Queryable<BPA_Company>().First(t => t.Id == company.Id); | |||
if (check == null) | |||
return false; | |||
if (check.Email != input.Email) | |||
if (check.Phone != input.Phone) | |||
return false; | |||
return await _db.Updateable(company).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandHasChangeAsync(); | |||
@@ -146,10 +143,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
_db.Ado.BeginTran(); | |||
// 查询数据库中是否存在未删除的活动信息 | |||
var resEntitites = _db.Queryable<BPA_Company>().In(inputList).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.IsDeleted = 1; | |||
}); | |||
//删除加盟商下面的角色和用户以及相关的菜单权限 | |||
var Roles=_db.Queryable<BPA_Roles>().Where(x=> inputList.Contains(x.GroupId)).ToList(); | |||
var Roleids= Roles.Select(x=>x.Id).ToList(); | |||
@@ -161,7 +154,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
await _db.Deleteable(Users).ExecuteCommandAsync(); | |||
await _db.Deleteable(UserRole).ExecuteCommandAsync(); | |||
await _db.Deleteable(RoleMenu).ExecuteCommandAsync(); | |||
var res = await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
var res = await _db.Deleteable(resEntitites).ExecuteCommandAsync(); | |||
_db.Ado.CommitTran(); | |||
return true; | |||
} | |||
@@ -179,10 +172,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Enable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Company>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.ENABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return true; | |||
} | |||
@@ -194,10 +183,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Disable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Company>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.DISABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return true; | |||
} | |||
@@ -36,7 +36,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
var pId = !string.IsNullOrEmpty(input.Pid?.Trim()); | |||
var data = await _db.Queryable<BPA_Organize>() | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim())) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Pid), u => u.Pids.Contains(input.Pid.Trim()) || u.Id == input.Pid.Trim()) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Pid), u => u.Id == input.Pid.Trim()) | |||
.Select<OrgOutput>() | |||
.OrderBy(a => a.CreateAt, OrderByType.Asc) | |||
.ToPageListAsync(input.Current, input.PageSize, total); | |||
@@ -57,8 +57,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
{ | |||
var pId = !string.IsNullOrEmpty(input.Pid?.Trim()); | |||
var orgs = await _db.Queryable<BPA_Organize>() | |||
.WhereIF(pId, u => u.PID == input.Pid) | |||
.Where(u => u.Status != CommonStatus.DELETED).ToListAsync(); | |||
.WhereIF(pId, u => u.Pid == input.Pid).ToListAsync(); | |||
return orgs.Adapt<List<OrgOutput>>(); | |||
} | |||
/// <summary> | |||
@@ -74,11 +73,10 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
if (tel == false) throw Oops.Oh("手机号错误"); | |||
} | |||
var sysOrg = input.Adapt<BPA_Organize>(); | |||
if (string.IsNullOrWhiteSpace(sysOrg.PID)) | |||
if (string.IsNullOrWhiteSpace(sysOrg.Pid)) | |||
{ | |||
sysOrg.PID = "0"; | |||
sysOrg.Pid = "0"; | |||
} | |||
await FillPids(sysOrg); | |||
return await _db.Insertable(sysOrg).CallEntityMethod(m => m.Create()).ExecuteCommandAsync()>0; | |||
} | |||
/// <summary> | |||
@@ -124,10 +122,8 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
var sysOrg = await _db.Queryable<BPA_Organize>().FirstAsync(u => u.Id == input.Id); | |||
sysOrg.Name=input.Name; | |||
sysOrg.Tel = input.Tel; | |||
sysOrg.Remark = input.Remark; | |||
sysOrg.Sort= input.Sort; | |||
await FillPids(sysOrg); | |||
return await _db.Updateable(sysOrg).IgnoreColumns(ignoreAllNullColumns: true) | |||
.ExecuteCommandAsync()>0; | |||
@@ -141,39 +137,20 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
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 && u.GroupId== groupId).OrderBy(u => u.Sort) | |||
.Where(u => u.GroupId== groupId).OrderBy(u => u.Sort) | |||
.Select(u => new OrgTreeNode | |||
{ | |||
key = u.Id, | |||
parentId = u.PID, | |||
parentId = u.Pid, | |||
title = u.Name, | |||
value = u.Id.ToString(), | |||
weight = u.Sort, | |||
Type = u.Type, | |||
}).ToListAsync(); | |||
return new TreeBuildUtil<OrgTreeNode>().Build(orgs); | |||
} | |||
/// <summary> | |||
/// 填充父Ids字段 | |||
/// </summary> | |||
/// <param name="sysOrg"></param> | |||
/// <returns></returns> | |||
private async Task FillPids(BPA_Organize sysOrg) | |||
{ | |||
if (string.IsNullOrWhiteSpace(sysOrg.PID) || sysOrg.PID == "0") | |||
{ | |||
sysOrg.Pids = "[0],"; | |||
sysOrg.PID = "0"; | |||
} | |||
else | |||
{ | |||
var t = await _db.Queryable<BPA_Organize>().FirstAsync(u => u.Id == sysOrg.PID); | |||
sysOrg.Pids = t.Pids + "[" + t.Id + "],"; | |||
} | |||
} | |||
/// <summary> | |||
/// 根据节点Id获取所有子节点Id集合,包含自己 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
@@ -181,7 +158,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
private async Task<List<string>> GetChildIdListWithSelfById(string id) | |||
{ | |||
var childIdList = await _db.Queryable<BPA_Organize>() | |||
.Where(u => u.Pids.Contains(id.ToString())) | |||
.Select(u => u.Id).ToListAsync(); | |||
childIdList.Add(id); | |||
return childIdList; | |||
@@ -37,9 +37,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
Id = t.Id, | |||
Name = t.Name, | |||
Remark = t.Remark, | |||
RoleType = t.RoleType, | |||
Sort = t.Sort, | |||
Status= t.Status, | |||
}).OrderBy(t => t.Sort).OrderBy(x => x.CreateAt, OrderByType.Desc).ToPageListAsync(input.Current, input.PageSize, total); | |||
PageUtil util = new PageUtil() | |||
{ | |||
@@ -196,10 +194,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Enable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Roles>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.ENABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
@@ -212,17 +206,12 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Disable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Roles>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.DISABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
public async Task<Dictionary<string, object>> GetRole() | |||
{ | |||
var res =await _db.Queryable<BPA_Roles>().Where(t => t.IsDeleted == 0 && t.Status == CommonStatus.ENABLE).ToDictionaryAsync(t => t.Id, t => t.Name); | |||
var res =await _db.Queryable<BPA_Roles>().ToDictionaryAsync(t => t.Id, t => t.Name); | |||
return res; | |||
} | |||
private string GetNumber2(int Length = 10) | |||
@@ -33,7 +33,6 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
var data =await _db.Queryable<BPA_Users>().LeftJoin<BPA_Company>((t, x) => t.GroupId == x.Id) | |||
.WhereIF(!input.Name.IsNullOrEmpty(), t => t.Name.Contains(input.Name)) | |||
.WhereIF(!input.Account.IsNullOrEmpty(), t => t.Account.Contains(input.Account)) | |||
.Where(t => t.IsDeleted != 1) | |||
.OrderBy(t => t.CreateAt, OrderByType.Desc) | |||
.Select((t, x) => new UserDtoOutput | |||
{ | |||
@@ -43,7 +42,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
CompanyName = x.Name, | |||
Name = t.Name, | |||
Phone = t.Phone, | |||
SysOrgId = t.SysOrgId, | |||
SysOrgId = t.OrgId, | |||
CreateAt=t.CreateAt | |||
}).ToPageListAsync(input.Current, input.PageSize, total); | |||
PageUtil util = new PageUtil() | |||
@@ -81,7 +80,7 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
user.Name = input.Name; | |||
user.Account = input.Account; | |||
user.Phone = input.Phone; | |||
user.SysOrgId = input.SysOrgId; | |||
user.OrgId = input.SysOrgId; | |||
var res =await _db.Updateable(user) | |||
.IgnoreColumns(t => t.Password) | |||
.IgnoreColumns(t => t.AdminType) | |||
@@ -109,10 +108,10 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Enable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Users>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.ENABLE; | |||
}); | |||
//resEntitites.ForEach(x => | |||
//{ | |||
// x.Status = CommonStatus.ENABLE; | |||
//}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
@@ -125,10 +124,10 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||
public async Task<bool> Disable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Users>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.DISABLE; | |||
}); | |||
//resEntitites.ForEach(x => | |||
//{ | |||
// x.Status = CommonStatus.DISABLE; | |||
//}); | |||
var res = await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
@@ -29,7 +29,7 @@ namespace BPA.SAAS.Manage.Application | |||
public async Task<List<BPA_DictData>> GetDicList(string TypeCode) | |||
{ | |||
var res =await _db.Queryable<BPA_DictData, BPA_DictType>((a, b) => new JoinQueryInfos(JoinType.Inner, a.TypeId.ToString() == b.Id)) | |||
.Where((a, b) => b.Code == TypeCode && a.IsDeleted == 0 && b.IsDeleted == 0) | |||
.Where((a, b) => b.Code == TypeCode) | |||
.Select((a, b) => new BPA_DictData | |||
{ | |||
Id = a.Id.SelectAll() | |||
@@ -66,7 +66,6 @@ namespace BPA.SAAS.Manage.Application | |||
} | |||
RefAsync<int> total = 0; | |||
var res =await _db.Queryable<BPA_DictData, BPA_DictType>((a, b) => new JoinQueryInfos(JoinType.Inner, a.TypeId.ToString() == b.Id)) | |||
.Where((a, b) => a.IsDeleted == 0 && b.IsDeleted == 0) | |||
.Where(conModels) | |||
.WhereIF(dto.CreateAt.HasValue, x => x.CreateAt.Date == dto.CreateAt.Value.Date) | |||
.Select((a, b) => new DictDataQueryDto | |||
@@ -90,7 +89,7 @@ namespace BPA.SAAS.Manage.Application | |||
/// <returns></returns> | |||
public async Task<bool> AddDictData(DictDataDto dto) | |||
{ | |||
var dicttypes = _db.Queryable<BPA_DictData>().Where(a => a.Code == dto.Code && a.IsDeleted == 0 && a.TypeId == dto.TypeId).ToList(); | |||
var dicttypes = _db.Queryable<BPA_DictData>().Where(a => a.Code == dto.Code && a.TypeId == dto.TypeId).ToList(); | |||
if (dicttypes.Count() > 0) | |||
{ | |||
throw Oops.Oh("编码已存在"); | |||
@@ -122,12 +121,12 @@ namespace BPA.SAAS.Manage.Application | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDictData(DictDataDto dto) | |||
{ | |||
var resEntity = _db.Queryable<BPA_DictData>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id); | |||
var resEntity = _db.Queryable<BPA_DictData>().First(it => it.Id == dto.Id); | |||
if (null == resEntity) | |||
{ | |||
return false; | |||
} | |||
var resEntity2 = _db.Queryable<BPA_DictData>().Where(it => it.IsDeleted == 0).First(it => it.Id != dto.Id && it.Code == dto.Code); | |||
var resEntity2 = _db.Queryable<BPA_DictData>().First(it => it.Id != dto.Id && it.Code == dto.Code); | |||
if (resEntity2 != null) | |||
{ | |||
throw Oops.Oh("code已存在"); | |||
@@ -53,7 +53,6 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
} | |||
RefAsync<int> total = 0; | |||
var res =await _db.Queryable<BPA_DictType>() | |||
.Where(x => x.IsDeleted == 0) | |||
.Where(conModels) | |||
.Select(x => new DictTypeQueryDto | |||
{ | |||
@@ -75,7 +74,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
/// <returns></returns> | |||
public async Task<bool> AddDictType(DictTypeDto dto) | |||
{ | |||
var dicttypes = _db.Queryable<BPA_DictType>().Where(a => a.Code == dto.Code && a.IsDeleted==0).ToList(); | |||
var dicttypes = _db.Queryable<BPA_DictType>().Where(a => a.Code == dto.Code).ToList(); | |||
if (dicttypes.Count() > 0) | |||
{ | |||
throw Oops.Oh("编码已存在"); | |||
@@ -106,7 +105,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
/// <returns></returns> | |||
public async Task<bool> UpdateDictType(DictTypeDto dto) | |||
{ | |||
var dictType = _db.Queryable<BPA_DictType>().Where(x => x.IsDeleted == 0).First(x => x.Id == dto.Id); | |||
var dictType = _db.Queryable<BPA_DictType>().First(x => x.Id == dto.Id); | |||
if (dictType == null) | |||
{ | |||
return false; | |||
@@ -142,7 +141,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
try | |||
{ | |||
_db.Ado.BeginTran(); | |||
var dictType = _db.Queryable<BPA_DictType>().Where(x => x.IsDeleted == 0).Where(x => ids.Contains(x.Id)).ToList(); | |||
var dictType = _db.Queryable<BPA_DictType>().Where(x => ids.Contains(x.Id)).ToList(); | |||
var res =await _db.Deleteable(dictType).ExecuteCommandAsync(); | |||
_db.Ado.CommitTran(); | |||
@@ -160,7 +159,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
/// <returns></returns> | |||
public Dictionary<string, object> GetDictType() | |||
{ | |||
var res = _db.Queryable<BPA_DictType>().Where(x => x.IsDeleted == 0 && x.Status == CommonStatus.ENABLE).ToDictionary(x => x.Id, x => x.Name); | |||
var res = _db.Queryable<BPA_DictType>().Where(x => x.Status == CommonStatus.ENABLE).ToDictionary(x => x.Id, x => x.Name); | |||
return res; | |||
} | |||
@@ -53,10 +53,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Router = t.Router, | |||
Pid = t.Pid, | |||
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 | |||
{ | |||
@@ -68,10 +65,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Icon = x.Icon, | |||
Router = x.Router, | |||
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 | |||
{ | |||
@@ -83,10 +77,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Pid = y.Pid.ToString(), | |||
Router = y.Router, | |||
Sort = y.Sort, | |||
Component = y.Component, | |||
Status = y.Status, | |||
IsAdmin=y.IsAdmin, | |||
Type = y.Type, | |||
//TypeName = GetTypeName(y.Type), | |||
}).ToList() | |||
}).ToList() | |||
@@ -124,7 +115,6 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
var menu = await _db.Queryable< BPA_Menu >().Where(x=>x.Id== input.Id).FirstAsync(); | |||
//menu = input.Adapt<BPA_Menu>(); | |||
menu.Code = input.Code; | |||
menu.Component = input.Component; | |||
menu.Name= input.Name; | |||
menu.Pid= input.Pid; | |||
menu.Router = input.Router; | |||
@@ -132,7 +122,6 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
menu.Sort = input.Sort; | |||
menu.Icon = input.Icon; | |||
menu.IsAdmin= input.IsAdmin; | |||
menu.Type = input.Type; | |||
return await _db.Updateable(menu).ExecuteCommandAsync()>0; | |||
} | |||
@@ -301,19 +290,16 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
Key = t.Id, | |||
Title = t.Name, | |||
value = t.Id, | |||
type=t.Type, | |||
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeOutput | |||
{ | |||
Key = x.Id, | |||
Title = x.Name, | |||
value = x.Id, | |||
type = x.Type, | |||
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeOutput | |||
{ | |||
Key = y.Id, | |||
Title = y.Name, | |||
value = y.Name, | |||
type = y.Type, | |||
}).ToList() | |||
}).ToList() | |||
}).ToList(); | |||
@@ -378,20 +364,17 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
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() | |||
@@ -403,24 +386,21 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
{ | |||
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(); | |||
.Where((t, x, y) => y.SysUserId == UserId && 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 = 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 = 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() | |||
@@ -467,10 +447,6 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
public async Task<bool> Enable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Menu>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.ENABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
@@ -483,10 +459,6 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
public async Task<bool> Disable(string Id) | |||
{ | |||
var resEntitites = _db.Queryable<BPA_Menu>().In(Id).ToList(); | |||
resEntitites.ForEach(x => | |||
{ | |||
x.Status = CommonStatus.DISABLE; | |||
}); | |||
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync(); | |||
return res>0; | |||
} | |||
@@ -69,7 +69,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
if (!string.IsNullOrWhiteSpace(GroupId)) | |||
{ | |||
var Companycheck = _db.Queryable<BPA_Company>().Where(x => x.Id == GroupId).First(); | |||
baseUrl = baseUrl + Companycheck.Code + "/"; | |||
//baseUrl = baseUrl + Companycheck.Code + "/"; | |||
} | |||
DateTime dt = DateTime.Now; | |||
baseUrl = baseUrl + inputDto.Directory + "/" + dt.ToFileTime().ToString() + "." + inputDto.FileExtension; | |||
@@ -54,7 +54,7 @@ namespace BPA.SAAS.Manage.Application.System.Services | |||
if (!string.IsNullOrWhiteSpace(GroupId)) | |||
{ | |||
var Companycheck = _db.Queryable<BPA_Company>().Where(x => x.Id == GroupId).First(); | |||
baseUrl = baseUrl + Companycheck.Code + "/"; | |||
//baseUrl = baseUrl + Companycheck.Code + "/"; | |||
} | |||
DateTime dt = DateTime.Now; | |||
baseUrl = baseUrl + inputDto.Directory + "/" + dt.ToFileTime().ToString() + "." + inputDto.FileExtension; | |||
@@ -9,7 +9,7 @@ using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core.Base | |||
{ | |||
public abstract class IBaseEntity: IDeleted | |||
public abstract class IBaseEntity | |||
{ | |||
/// <summary> | |||
/// 主键 Guid | |||
@@ -19,10 +19,6 @@ namespace BPA.SAAS.Manage.Core.Base | |||
public DateTime CreateAt { get; set; } = DateTime.Now; | |||
public string CreateBy { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public int IsDeleted { get; set; } = 0; | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
public virtual void Create() | |||
@@ -36,7 +32,6 @@ namespace BPA.SAAS.Manage.Core.Base | |||
} | |||
else | |||
{ | |||
this.CreateBy = "admin"; | |||
} | |||
} | |||
@@ -15,81 +15,27 @@ namespace BPA.SAAS.Manage.Core.DataBase | |||
{ | |||
/// <summary> | |||
/// 原料编码 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(50)", IsNullable = false)] | |||
/// </summary> | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 商品属性 (0成品,1半成品,2,易耗品) | |||
/// </summary> | |||
[SugarColumn(IsNullable = false)] | |||
public int Aittribute { get; set; } = 0; | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(200)", IsNullable = false)] | |||
public string Batching_Name { get; set; } | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 配料类型 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(200)", IsNullable = false)] | |||
public string Batching_Type { get; set; } | |||
/// <summary> | |||
/// 原料类型 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string TypeID { get; set; } | |||
/// </summary> | |||
public int Type { get; set; } | |||
/// <summary> | |||
/// 库存单位 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string StockUint { get; set; } | |||
/// <summary> | |||
/// 规格属性 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(500)", IsNullable = false)] | |||
public string Specs { get; set; } | |||
/// <summary> | |||
/// 成本价 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "decimal(10,2)", IsNullable = false)] | |||
public decimal Price { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
/// <summary> | |||
/// 净料率 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "decimal(10,2)", IsNullable = false)] | |||
public decimal netrecovery { get; set; } | |||
/// <summary> | |||
/// 出库单位 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string outstockUint { get; set; } | |||
/// <summary> | |||
/// 换算比例 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "decimal(10,2)", IsNullable = false)] | |||
public decimal proportion { get; set; } | |||
[SugarColumn(IsOnlyIgnoreInsert = true, IsOnlyIgnoreUpdate = true, IsIdentity = true)] | |||
public int AutoKey { get; set; } | |||
[SugarColumn(ColumnDataType = "Nvarchar(255)", IsNullable = true)] | |||
public string ForeignKeyRe { get; set; } | |||
public string StockUint { get; set; } | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 第三方对接标识 | |||
/// </summary> | |||
public string Key { get; set; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
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.DataBase | |||
{ | |||
/// <summary> | |||
/// 配方分组表 | |||
/// </summary> | |||
[SugarTable("bpa_recipegroup")] | |||
public class BPA_RecipeGroup : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 分组名称 | |||
/// </summary> | |||
public string Name { get;set; } | |||
/// <summary> | |||
/// 序号 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
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.DataBase | |||
{ | |||
/// <summary> | |||
/// 配方信息表 | |||
/// </summary> | |||
[SugarTable("bpa_recipeinfo")] | |||
public class BPA_RecipeInfo : IBaseEntity, IGroupId | |||
{ | |||
/// <summary> | |||
/// 配方分组Id | |||
/// </summary> | |||
public string RecipeGroupId { get; set; } | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 配方类型 | |||
/// </summary> | |||
public int RecipeType { get; set; } | |||
/// <summary> | |||
/// 基准克数 | |||
/// </summary> | |||
public decimal BenchmarkGram { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
} | |||
} |
@@ -37,7 +37,7 @@ namespace BPA.SAAS.Manage.Core | |||
SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, | |||
db => | |||
{ | |||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == 0); | |||
//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) | |||
{ | |||
@@ -24,10 +24,6 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// </summary> | |||
public string AdminName { get; set; } | |||
/// <summary> | |||
/// 邮箱账号 | |||
/// </summary> | |||
public string Email { get; set; } | |||
/// <summary> | |||
/// 电话 | |||
/// </summary> | |||
public string Phone { get; set; } | |||
@@ -35,17 +31,5 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// logo | |||
/// </summary> | |||
public string Code { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
/// <summary> | |||
/// 所属平台 0 团餐 1门店 2 后厨 3公共 | |||
/// </summary> | |||
public int Type { get; set; } | |||
} | |||
} |
@@ -22,32 +22,12 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// <summary> | |||
/// 上级id | |||
/// </summary> | |||
public string PID { get; set; } | |||
/// <summary> | |||
/// 类型 默认 机构 | |||
/// </summary> | |||
public int Type { get; set; } | |||
/// <summary> | |||
/// 上级ID集合 | |||
/// </summary> | |||
public string Pids { get; set; } | |||
public string Pid { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 电话 | |||
/// </summary> | |||
public string Tel { get; set; } | |||
/// <summary> | |||
/// AutoKey 唯一值 | |||
/// </summary> | |||
public string AutoKey { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
@@ -32,17 +32,8 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 角色类型-集团角色_0、加盟商角色_1、门店角色_2 | |||
/// </summary> | |||
public int RoleType { get; set; } | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |
@@ -35,15 +35,10 @@ namespace BPA.SAAS.Manage.Core.Org | |||
/// <summary> | |||
/// 归属组织 | |||
/// </summary> | |||
public string SysOrgId { get; set; } | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 加盟商id | |||
/// </summary> | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 状态 【正常 停用】默认 正常 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |
@@ -33,14 +33,6 @@ namespace BPA.SAAS.Manage.Core.System | |||
/// </summary> | |||
public string Router { get; set; } | |||
/// <summary> | |||
/// 组件路径 | |||
/// </summary> | |||
public string Component { get; set; } | |||
/// <summary> | |||
/// 是否可见 | |||
/// </summary> | |||
public bool Visible { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
@@ -49,17 +41,8 @@ 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)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |