@@ -0,0 +1,22 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄桶管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 11:33:10 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("bucket_info")] | |||||
public class Pztj_BucketInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 桶名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 桶编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶原料记录 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 11:47:33 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("bucket_material_record")] | |||||
public class Pztj_BucketMaterialsRecordEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 桶Id | |||||
/// </summary> | |||||
public string BucketId { get; set; } | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
public DateTime? CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.App | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 17:01:26 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("craft_Steps")] | |||||
public class Pztj_CraftStepsEntity | |||||
{ | |||||
/// <summary> | |||||
/// 步骤 | |||||
/// </summary> | |||||
public string Step { get; set; } | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 单位 | |||||
/// </summary> | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 功能参数 | |||||
/// </summary> | |||||
public string Value { get; set; } | |||||
/// <summary> | |||||
/// 功能值 物料信息 | |||||
/// </summary> | |||||
public List<string> Materials { get; set; } | |||||
/// <summary> | |||||
/// 功能描述 | |||||
/// </summary> | |||||
public string Describe { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄工艺基础信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 14:43:37 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("craft_info")] | |||||
public class Pztj_CraftsInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工艺名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 工艺描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄设备基础表 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 11:26:34 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("device_info")] | |||||
public class Pztj_DevicesInfoEntity: DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "名称不能为空")] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "编码不能为空")] | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 设备类型 | |||||
/// </summary> | |||||
public string DeviceType { get; set; } | |||||
/// <summary> | |||||
/// 设备描述 | |||||
/// </summary> | |||||
public string Describe { get; set; } | |||||
/// <summary> | |||||
/// 设备维保时间 | |||||
/// </summary> | |||||
public string RepairDate { get; set; } | |||||
/// <summary> | |||||
/// 设备创建时间 | |||||
/// </summary> | |||||
public string CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄成品基础信息管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 14:07:56 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("final_info")] | |||||
public class Pztj_FinalsInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 成品编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 成品名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 配方Id | |||||
/// </summary> | |||||
public string RecipeId { get; set; } | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
public DateTime? CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄原料管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 11:32:06 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("material_Info")] | |||||
public class Pztj_MaterialsInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 原料名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 原料编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 原料单位 | |||||
/// </summary> | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 原料分组 | |||||
/// </summary> | |||||
public string Gourp { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :胖子天骄料仓管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/14 11:31:34 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("stock_info")] | |||||
public class Pztj_StockInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 料仓编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 料仓名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 料仓容积 | |||||
/// </summary> | |||||
public string Volume { get; set; } | |||||
} | |||||
} |
@@ -17,17 +17,6 @@ | |||||
/// 配方Id | /// 配方Id | ||||
/// </summary> | /// </summary> | ||||
public string RecipesId { get; set; } | public string RecipesId { get; set; } | ||||
/// <summary> | |||||
/// 通道 | |||||
/// </summary> | |||||
public string Outlet { get; set; } | |||||
/// <summary> | |||||
/// 顺序 | |||||
/// </summary> | |||||
public string Sort { get; set; } | |||||
/// <summary> | |||||
/// 时间(s) | |||||
/// </summary> | |||||
public string Time { get; set; } | |||||
} | } | ||||
} | } |
@@ -17,9 +17,6 @@ | |||||
/// 自定义编码 | /// 自定义编码 | ||||
/// </summary> | /// </summary> | ||||
public string Code { get; set; } | public string Code { get; set; } | ||||
/// <summary> | |||||
/// 图标 | |||||
/// </summary> | |||||
public string PicUrl { get; set; } | |||||
} | } | ||||
} | } |
@@ -0,0 +1,36 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Reflection; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 16:13:10 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class BaseService: ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public BaseService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 初始化数据库 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public string CreateDB() | |||||
{ | |||||
var types = Assembly.Load("BPA.MES.Base.Application").GetTypes() | |||||
.Where(x => x.GetCustomAttribute<SugarTable>() != null | |||||
&& x.Namespace == "BPA.MES.Base.Application.Entitys").ToArray(); | |||||
_dbContext.CodeFirst.InitTables(types); | |||||
return "成功"; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,75 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 15:43:00 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class BucketInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 桶名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 桶编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class BucketInfoAddInput : BucketInfoDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class BucketInfoUpdateInput : BucketInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class BucketInfoDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class BucketInfoQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class BucketInfoOutput : BucketInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 当前原料名称 | |||||
/// </summary> | |||||
public string MaterialName { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,80 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 17:29:52 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class BucketMaterialsRecordDto | |||||
{ | |||||
/// <summary> | |||||
/// 桶Id | |||||
/// </summary> | |||||
public string BucketId { get; set; } | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
public DateTime? CreateTime { get; set; } | |||||
} | |||||
public class BucketMaterialsRecordAddInput : BucketMaterialsRecordDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class BucketMaterialsRecordUpdateInput : BucketMaterialsRecordDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class BucketMaterialsRecordDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class BucketMaterialsRecordQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class BucketMaterialsRecordOutput : BucketMaterialsRecordDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 原料名称 | |||||
/// </summary> | |||||
public string MaterialName { get; set; } | |||||
/// <summary> | |||||
/// 桶名称 | |||||
/// </summary> | |||||
public string BucketName { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,142 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("基础数据管理", Order = 3, Name = "BucketInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class BucketInfoService : IBucketInfoService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public BucketInfoService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(BucketInfoAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
Pztj_BucketInfoEntity entity = input.Adapt<Pztj_BucketInfoEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Del(BucketInfoDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<Pztj_BucketInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<BucketInfoOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
BucketInfoOutput output = entity.Adapt<BucketInfoOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<List<BucketInfoOutput>> List() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>().ToListAsync(); | |||||
List<BucketInfoOutput> output = entity.Adapt<List<BucketInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<BucketInfoOutput>> PagedList(BucketInfoQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>() | |||||
.LeftJoin<Pztj_BucketMaterialsRecordEntity>((a,b)=>a.Id==b.BucketId) | |||||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b,c)=>b.MaterialId==c.Id) | |||||
.Select((a,b,c)=>new BucketInfoOutput | |||||
{ | |||||
Id = a.Id.SelectAll(), | |||||
MaterialName = c.Name | |||||
}) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<BucketInfoOutput> output = entity.Adapt<SqlSugarPagedList<BucketInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>().Select(x => new | |||||
{ | |||||
key = x.Id, | |||||
value = x.Name | |||||
}).ToListAsync(); | |||||
return entity; | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Update(BucketInfoUpdateInput input) | |||||
{ | |||||
Pztj_BucketInfoEntity entity = input.Adapt<Pztj_BucketInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
///// <summary> | |||||
///// 根据桶Id查询记录 | |||||
///// </summary> | |||||
///// <param name="bucketId"></param> | |||||
///// <returns></returns> | |||||
//public async Task<BucketMaterialsRecordOutput> RecordList(string bucketId) | |||||
//{ | |||||
// var entity = await _dbContext.Queryable<Pztj_BucketMaterialsRecordEntity>() | |||||
// .LeftJoin<Pztj_MaterialsInfoEntity>((a, b) => a.MaterialId == b.Id) | |||||
// .Select((a, b) => new BucketMaterialsRecordOutput | |||||
// { | |||||
// Id = a.Id.SelectAll(), | |||||
// MaterialName = b.Name | |||||
// }) | |||||
// .ToListAsync(); | |||||
// SqlSugarPagedList<BucketMaterialsRecordOutput> output = entity.Adapt<SqlSugarPagedList<BucketMaterialsRecordOutput>>(); | |||||
// return output; | |||||
//} | |||||
} | |||||
} | |||||
@@ -0,0 +1,100 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶记录 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 17:37:13 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class BucketMaterialsRecordServcie : IBucketMaterialsRecordService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public BucketMaterialsRecordServcie(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(BucketMaterialsRecordAddInput input) | |||||
{ | |||||
Pztj_BucketMaterialsRecordEntity entity = input.Adapt<Pztj_BucketMaterialsRecordEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Del(BucketMaterialsRecordDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<Pztj_BucketMaterialsRecordEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<BucketMaterialsRecordOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketMaterialsRecordEntity>().FirstAsync(x => x.Id == Id); | |||||
BucketMaterialsRecordOutput output = entity.Adapt<BucketMaterialsRecordOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<List<BucketMaterialsRecordOutput>> List() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketMaterialsRecordEntity>().ToListAsync(); | |||||
List<BucketMaterialsRecordOutput> output = entity.Adapt<List<BucketMaterialsRecordOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<BucketMaterialsRecordOutput>> PagedList(BucketMaterialsRecordQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_BucketMaterialsRecordEntity>() | |||||
.LeftJoin<Pztj_BucketInfoEntity>((a,b)=>a.BucketId==b.Id) | |||||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b,c)=>a.MaterialId==c.Id) | |||||
.Select((a,b,c)=>new BucketMaterialsRecordOutput | |||||
{ | |||||
Id = a.Id.SelectAll(), | |||||
MaterialName = c.Name, | |||||
BucketName = b.Name | |||||
}) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<BucketMaterialsRecordOutput> output = entity.Adapt<SqlSugarPagedList<BucketMaterialsRecordOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Update(BucketMaterialsRecordUpdateInput input) | |||||
{ | |||||
Pztj_BucketMaterialsRecordEntity entity = input.Adapt<Pztj_BucketMaterialsRecordEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 15:43:10 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IBucketInfoService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(BucketInfoAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(BucketInfoDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(BucketInfoUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<BucketInfoOutput>> List(); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<BucketInfoOutput>> PagedList(BucketInfoQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<BucketInfoOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶记录 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 17:37:03 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IBucketMaterialsRecordService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(BucketMaterialsRecordAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(BucketMaterialsRecordDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(BucketMaterialsRecordUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<BucketMaterialsRecordOutput>> List(); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<BucketMaterialsRecordOutput>> PagedList(BucketMaterialsRecordQueryPageInput input); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<BucketMaterialsRecordOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备Dto类 | /// 名 称 :设备Dto类 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备Dto类 | /// 名 称 :设备Dto类 | ||||
@@ -6,9 +6,33 @@ | |||||
/// 创建时间 : 2023/3/2 16:12:06 | /// 创建时间 : 2023/3/2 16:12:06 | ||||
/// 描 述 : | /// 描 述 : | ||||
/// </summary> | /// </summary> | ||||
public class DevicesInfoDto : DevicesInfoEntity | |||||
public class DevicesInfoDto | |||||
{ | { | ||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
/// <example>设备名称</example> | |||||
[Required(ErrorMessage = "名称不能为空")] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "编码不能为空")] | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 设备类型 | |||||
/// </summary> | |||||
public string DeviceType { get; set; } | |||||
/// <summary> | |||||
/// 设备描述 | |||||
/// </summary> | |||||
/// <example>设备描述</example> | |||||
public string Describe { get; set; } | |||||
/// <summary> | |||||
/// 设备维保时间 | |||||
/// </summary> | |||||
/// <example>2023-7-17</example> | |||||
public string RepairDate { get; set; } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 增加 | /// 增加 | ||||
@@ -22,7 +46,10 @@ | |||||
/// </summary> | /// </summary> | ||||
public class DevicesInfoUpdateInput : DevicesInfoDto | public class DevicesInfoUpdateInput : DevicesInfoDto | ||||
{ | { | ||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除 | /// 删除 | ||||
@@ -39,13 +66,23 @@ | |||||
/// </summary> | /// </summary> | ||||
public class DevicesInfoQueryPageInput : RequestPage | public class DevicesInfoQueryPageInput : RequestPage | ||||
{ | { | ||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 输出 | /// 输出 | ||||
/// </summary> | /// </summary> | ||||
public class DevicesInfoOutput : DevicesInfoDto | public class DevicesInfoOutput : DevicesInfoDto | ||||
{ | { | ||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备服务 | /// 名 称 :设备服务 | ||||
@@ -109,7 +109,6 @@ | |||||
RecipeName = b.Name, | RecipeName = b.Name, | ||||
RecipeCode = b.Code, | RecipeCode = b.Code, | ||||
RecipesId = a.RecipesId, | RecipesId = a.RecipesId, | ||||
RecipesPic =b.PicUrl, | |||||
GroupId = c.GroupId, | GroupId = c.GroupId, | ||||
GroupName = d.Name | GroupName = d.Name | ||||
}) | }) | ||||
@@ -1,12 +1,12 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备服务 | /// 名 称 :设备服务 | ||||
/// 创 建 人 :yangxiao | /// 创 建 人 :yangxiao | ||||
/// 创建时间 :2023/3/2 16:11:04 | /// 创建时间 :2023/3/2 16:11:04 | ||||
/// 描 述 :店铺数据维护 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | /// </summary> | ||||
[ApiDescriptionSettings(Name = "DevicesInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
[ApiDescriptionSettings("基础数据管理",Order = 0, Name = "DevicesInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class DevicesInfoService : IDevicesInfoService, ITransient, IDynamicApiController | public class DevicesInfoService : IDevicesInfoService, ITransient, IDynamicApiController | ||||
{ | { | ||||
private readonly ISqlSugarClient _dbContext; | private readonly ISqlSugarClient _dbContext; | ||||
@@ -22,12 +22,12 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Add(DevicesInfoAddInput input) | public async Task<bool> Add(DevicesInfoAddInput input) | ||||
{ | { | ||||
var r_entity = await _dbContext.Queryable<DevicesInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
var r_entity = await _dbContext.Queryable<Pztj_DevicesInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | if (r_entity != null) | ||||
{ | { | ||||
throw Oops.Bah("名称已存在!"); | throw Oops.Bah("名称已存在!"); | ||||
} | } | ||||
DevicesInfoEntity entity = input.Adapt<DevicesInfoEntity>(); | |||||
Pztj_DevicesInfoEntity entity = input.Adapt<Pztj_DevicesInfoEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -39,7 +39,7 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Del(DevicesInfoDelInput input) | public async Task<bool> Del(DevicesInfoDelInput input) | ||||
{ | { | ||||
var res = await _dbContext.Deleteable<DevicesInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
var res = await _dbContext.Deleteable<Pztj_DevicesInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | return res; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -51,7 +51,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<DevicesInfoOutput> Detail(string Id) | public async Task<DevicesInfoOutput> Detail(string Id) | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<DevicesInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
var entity = await _dbContext.Queryable<Pztj_DevicesInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
DevicesInfoOutput output = entity.Adapt<DevicesInfoOutput>(); | DevicesInfoOutput output = entity.Adapt<DevicesInfoOutput>(); | ||||
return output; | return output; | ||||
} | } | ||||
@@ -63,7 +63,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<List<DevicesInfoOutput>> List() | public async Task<List<DevicesInfoOutput>> List() | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<DevicesInfoEntity>().ToListAsync(); | |||||
var entity = await _dbContext.Queryable<Pztj_DevicesInfoEntity>().ToListAsync(); | |||||
List<DevicesInfoOutput> output = entity.Adapt<List<DevicesInfoOutput>>(); | List<DevicesInfoOutput> output = entity.Adapt<List<DevicesInfoOutput>>(); | ||||
return output; | return output; | ||||
} | } | ||||
@@ -75,7 +75,7 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<SqlSugarPagedList<DevicesInfoOutput>> PagedList(DevicesInfoQueryPageInput input) | public async Task<SqlSugarPagedList<DevicesInfoOutput>> PagedList(DevicesInfoQueryPageInput input) | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<DevicesInfoEntity>() | |||||
var entity = await _dbContext.Queryable<Pztj_DevicesInfoEntity>() | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | .ToPagedListAsync(input.PageIndex, input.PageSize); | ||||
SqlSugarPagedList<DevicesInfoOutput> output = entity.Adapt<SqlSugarPagedList<DevicesInfoOutput>>(); | SqlSugarPagedList<DevicesInfoOutput> output = entity.Adapt<SqlSugarPagedList<DevicesInfoOutput>>(); | ||||
return output; | return output; | ||||
@@ -88,7 +88,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<dynamic> SelectList() | public async Task<dynamic> SelectList() | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<DevicesInfoEntity>().Select(x => new | |||||
var entity = await _dbContext.Queryable<Pztj_DevicesInfoEntity>().Select(x => new | |||||
{ | { | ||||
key = x.Id, | key = x.Id, | ||||
value = x.Name | value = x.Name | ||||
@@ -104,7 +104,7 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Update(DevicesInfoUpdateInput input) | public async Task<bool> Update(DevicesInfoUpdateInput input) | ||||
{ | { | ||||
DevicesInfoEntity entity = input.Adapt<DevicesInfoEntity>(); | |||||
Pztj_DevicesInfoEntity entity = input.Adapt<Pztj_DevicesInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | ||||
return res; | return res; | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备配方服务 | /// 名 称 :设备配方服务 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备服务 | /// 名 称 :设备服务 | ||||
@@ -44,6 +44,5 @@ | |||||
/// <param name="Id"></param> | /// <param name="Id"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<DevicesInfoOutput> Detail(string Id); | Task<DevicesInfoOutput> Detail(string Id); | ||||
} | } | ||||
} | } |
@@ -0,0 +1,91 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :成品管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 15:59:39 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class FinalsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 成品编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 成品名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 配方Id | |||||
/// </summary> | |||||
public string RecipeId { get; set; } | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
public DateTime? CreateTime { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class FinalsInfoAddInput : FinalsInfoDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class FinalsInfoUpdateInput : FinalsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class FinalsInfoDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class FinalsInfoQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class FinalsInfoOutput : FinalsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 配方名称 | |||||
/// </summary> | |||||
public string RecipeName { get; set; } | |||||
/// <summary> | |||||
/// 工艺名称 | |||||
/// </summary> | |||||
public string CraftName { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,123 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :成品管理服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("基础数据管理", Order = 4, Name = "FinalsInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class FinalsInfoService : IFinalsInfoService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public FinalsInfoService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(FinalsInfoAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
Pztj_FinalsInfoEntity entity = input.Adapt<Pztj_FinalsInfoEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Del(FinalsInfoDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<Pztj_FinalsInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<FinalsInfoOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
FinalsInfoOutput output = entity.Adapt<FinalsInfoOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<List<FinalsInfoOutput>> List() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().ToListAsync(); | |||||
List<FinalsInfoOutput> output = entity.Adapt<List<FinalsInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<FinalsInfoOutput>> PagedList(FinalsInfoQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_FinalsInfoEntity>() | |||||
.LeftJoin<Pztj_CraftsInfoEntity>((a,b)=>a.CraftId==b.Id) | |||||
.LeftJoin<RecipesInfoEntity>((a, b, c) => a.RecipeId == c.Id) | |||||
.WhereIF(!string.IsNullOrEmpty(input.Name),a=>a.Name.Contains(input.Name)) | |||||
.WhereIF(!string.IsNullOrEmpty(input.Code), a => a.Name.Contains(input.Code)) | |||||
.Select((a,b,c)=> new FinalsInfoOutput | |||||
{ | |||||
Id = a.SelectAll().Id, | |||||
RecipeName = c.Name, | |||||
CraftName = b.Name | |||||
}) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<FinalsInfoOutput> output = entity.Adapt<SqlSugarPagedList<FinalsInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_FinalsInfoEntity>().Select(x => new | |||||
{ | |||||
key = x.Id, | |||||
value = x.Name | |||||
}).ToListAsync(); | |||||
return entity; | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Update(FinalsInfoUpdateInput input) | |||||
{ | |||||
Pztj_FinalsInfoEntity entity = input.Adapt<Pztj_FinalsInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} | |||||
@@ -0,0 +1,49 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :成品信息管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 16:02:25 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IFinalsInfoService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(FinalsInfoAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(FinalsInfoDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(FinalsInfoUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<FinalsInfoOutput>> List(); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<FinalsInfoOutput>> PagedList(FinalsInfoQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<FinalsInfoOutput> Detail(string Id); | |||||
} | |||||
} | |||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :设备Dto类 | /// 名 称 :设备Dto类 | ||||
@@ -6,9 +6,28 @@ | |||||
/// 创建时间 : 2023/3/2 16:12:06 | /// 创建时间 : 2023/3/2 16:12:06 | ||||
/// 描 述 : | /// 描 述 : | ||||
/// </summary> | /// </summary> | ||||
public class MaterialsInfoDto : MaterialsInfoEntity | |||||
public class MaterialsInfoDto | |||||
{ | { | ||||
/// <summary> | |||||
/// 原料名称 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 原料编号 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 原料单位 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Unit { get; set; } | |||||
/// <summary> | |||||
/// 原料分组 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Gourp { get; set; } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 增加 | /// 增加 | ||||
@@ -22,7 +41,11 @@ | |||||
/// </summary> | /// </summary> | ||||
public class MaterialsInfoUpdateInput : MaterialsInfoDto | public class MaterialsInfoUpdateInput : MaterialsInfoDto | ||||
{ | { | ||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Id { get; set; } | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 删除 | /// 删除 | ||||
@@ -32,6 +55,7 @@ | |||||
/// <summary> | /// <summary> | ||||
/// 主键 | /// 主键 | ||||
/// </summary> | /// </summary> | ||||
/// <example></example> | |||||
public string Id { get; set; } | public string Id { get; set; } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -42,10 +66,12 @@ | |||||
/// <summary> | /// <summary> | ||||
/// 名称 | /// 名称 | ||||
/// </summary> | /// </summary> | ||||
/// <example></example> | |||||
public string Name { get; set; } | public string Name { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 编码 | /// 编码 | ||||
/// </summary> | /// </summary> | ||||
/// <example></example> | |||||
public string Code { get; set; } | public string Code { get; set; } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :物料服务 | /// 名 称 :物料服务 | ||||
@@ -1,12 +1,12 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :物料服务 | /// 名 称 :物料服务 | ||||
/// 创 建 人 :yangxiao | /// 创 建 人 :yangxiao | ||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :店铺数据维护 | |||||
/// 创建时间 :2023年7月17日15:41:09 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | /// </summary> | ||||
[ApiDescriptionSettings(Name = "MaterialsInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
[ApiDescriptionSettings("基础数据管理", Order = 2, Name = "MaterialsInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class MaterialsInfoService : IMaterialsInfoService, ITransient, IDynamicApiController | public class MaterialsInfoService : IMaterialsInfoService, ITransient, IDynamicApiController | ||||
{ | { | ||||
private readonly ISqlSugarClient _dbContext; | private readonly ISqlSugarClient _dbContext; | ||||
@@ -22,12 +22,12 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Add(MaterialsInfoAddInput input) | public async Task<bool> Add(MaterialsInfoAddInput input) | ||||
{ | { | ||||
var r_entity = await _dbContext.Queryable<MaterialsInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
var r_entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | if (r_entity != null) | ||||
{ | { | ||||
throw Oops.Bah("名称已存在!"); | throw Oops.Bah("名称已存在!"); | ||||
} | } | ||||
MaterialsInfoEntity entity = input.Adapt<MaterialsInfoEntity>(); | |||||
Pztj_MaterialsInfoEntity entity = input.Adapt<Pztj_MaterialsInfoEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -39,7 +39,7 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Del(MaterialsInfoDelInput input) | public async Task<bool> Del(MaterialsInfoDelInput input) | ||||
{ | { | ||||
var res = await _dbContext.Deleteable<MaterialsInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
var res = await _dbContext.Deleteable<Pztj_MaterialsInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | return res; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -51,7 +51,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<MaterialsInfoOutput> Detail(string Id) | public async Task<MaterialsInfoOutput> Detail(string Id) | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<MaterialsInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
MaterialsInfoOutput output = entity.Adapt<MaterialsInfoOutput>(); | MaterialsInfoOutput output = entity.Adapt<MaterialsInfoOutput>(); | ||||
return output; | return output; | ||||
} | } | ||||
@@ -63,7 +63,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<List<MaterialsInfoOutput>> List() | public async Task<List<MaterialsInfoOutput>> List() | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<MaterialsInfoEntity>().ToListAsync(); | |||||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().ToListAsync(); | |||||
List<MaterialsInfoOutput> output = entity.Adapt<List<MaterialsInfoOutput>>(); | List<MaterialsInfoOutput> output = entity.Adapt<List<MaterialsInfoOutput>>(); | ||||
return output; | return output; | ||||
} | } | ||||
@@ -75,7 +75,7 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<SqlSugarPagedList<MaterialsInfoOutput>> PagedList(MaterialsInfoQueryPageInput input) | public async Task<SqlSugarPagedList<MaterialsInfoOutput>> PagedList(MaterialsInfoQueryPageInput input) | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<MaterialsInfoEntity>() | |||||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>() | |||||
.WhereIF(!string.IsNullOrEmpty(input.Name),x=>x.Name.Contains(input.Name)) | .WhereIF(!string.IsNullOrEmpty(input.Name),x=>x.Name.Contains(input.Name)) | ||||
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) | .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) | ||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | .ToPagedListAsync(input.PageIndex, input.PageSize); | ||||
@@ -90,7 +90,7 @@ | |||||
[HttpGet] | [HttpGet] | ||||
public async Task<dynamic> SelectList() | public async Task<dynamic> SelectList() | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<MaterialsInfoEntity>().Select(x => new | |||||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().Select(x => new | |||||
{ | { | ||||
key = x.Id, | key = x.Id, | ||||
value = x.Name | value = x.Name | ||||
@@ -106,8 +106,8 @@ | |||||
[HttpPost] | [HttpPost] | ||||
public async Task<bool> Update(MaterialsInfoUpdateInput input) | public async Task<bool> Update(MaterialsInfoUpdateInput input) | ||||
{ | { | ||||
var entity = await _dbContext.Queryable<MaterialsInfoEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<MaterialsInfoEntity>(); | |||||
var entity = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<Pztj_MaterialsInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | ||||
return res; | return res; | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :产品分组 | /// 名 称 :产品分组 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :配方物料Dto类 | /// 名 称 :配方物料Dto类 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :配方Dto类 | /// 名 称 :配方Dto类 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :分组信息 | /// 名 称 :分组信息 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :分组信息 | /// 名 称 :分组信息 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :配方物料服务 | /// 名 称 :配方物料服务 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :配方服务 | /// 名 称 :配方服务 | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :配方物料服务 | /// 名 称 :配方物料服务 | ||||
@@ -95,9 +95,6 @@ | |||||
MaterialId = c.Id, | MaterialId = c.Id, | ||||
RecipesId = a.RecipesId, | RecipesId = a.RecipesId, | ||||
RecipesName = b.Name, | RecipesName = b.Name, | ||||
Sort = a.Sort, | |||||
Time = a.Time, | |||||
Outlet = a.Outlet | |||||
}) | }) | ||||
.ToListAsync(); | .ToListAsync(); | ||||
return output; | return output; | ||||
@@ -1,4 +1,4 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 名 称 :物料服务 | /// 名 称 :物料服务 | ||||
@@ -6,7 +6,7 @@ | |||||
/// 创建时间 :2023/3/2 16:11:04 | /// 创建时间 :2023/3/2 16:11:04 | ||||
/// 描 述 :店铺数据维护 | /// 描 述 :店铺数据维护 | ||||
/// </summary> | /// </summary> | ||||
[ApiDescriptionSettings(Name = "RecipesInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
[ApiDescriptionSettings(Name = "RecipesInfo",GroupName ="配方工艺管理", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class RecipesInfoService : IRecipesInfoService, ITransient, IDynamicApiController | public class RecipesInfoService : IRecipesInfoService, ITransient, IDynamicApiController | ||||
{ | { | ||||
private readonly ISqlSugarClient _dbContext; | private readonly ISqlSugarClient _dbContext; | ||||
@@ -0,0 +1,83 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : 料仓服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 15:27:20 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class StockInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 料仓编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 料仓名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 料仓容积 | |||||
/// </summary> | |||||
public string Volume { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class StockInfoAddInput : StockInfoDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class StockInfoUpdateInput : StockInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class StockInfoDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class StockInfoQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class StockInfoOutput : StockInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 物料Name | |||||
/// </summary> | |||||
public string MaterialName { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :料仓服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 15:32:17 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IStockInfoService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(StockInfoAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(StockInfoDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(StockInfoUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<StockInfoOutput>> List(); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<StockInfoOutput>> PagedList(StockInfoQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<StockInfoOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,118 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :料仓服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("基础数据管理", Order = 1, Name = "StockInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class StockInfoService : IStockInfoService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public StockInfoService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(StockInfoAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<Pztj_StockInfoEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
Pztj_StockInfoEntity entity = input.Adapt<Pztj_StockInfoEntity>(); | |||||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Del(StockInfoDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<Pztj_StockInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<StockInfoOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_StockInfoEntity>().FirstAsync(x => x.Id == Id); | |||||
StockInfoOutput output = entity.Adapt<StockInfoOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<List<StockInfoOutput>> List() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_StockInfoEntity>().ToListAsync(); | |||||
List<StockInfoOutput> output = entity.Adapt<List<StockInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<StockInfoOutput>> PagedList(StockInfoQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_StockInfoEntity>() | |||||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b)=>a.MaterialId==b.Id) | |||||
.Select((a,b)=>new StockInfoOutput | |||||
{ | |||||
Id=a.Id.SelectAll(), | |||||
MaterialName= b.Name | |||||
}) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<StockInfoOutput> output = entity.Adapt<SqlSugarPagedList<StockInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_StockInfoEntity>().Select(x => new | |||||
{ | |||||
key = x.Id, | |||||
value = x.Name | |||||
}).ToListAsync(); | |||||
return entity; | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Update(StockInfoUpdateInput input) | |||||
{ | |||||
Pztj_StockInfoEntity entity = input.Adapt<Pztj_StockInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -33,8 +33,15 @@ namespace BPA.MES.Base.Core | |||||
{ | { | ||||
Console.WriteLine(sql);//输出sql | Console.WriteLine(sql);//输出sql | ||||
}; | }; | ||||
}); | |||||
db.Aop.DataExecuting = (oldValue, entityInfo) => | |||||
{ | |||||
if (entityInfo.PropertyName == "CreateTime" && entityInfo.OperationType == DataFilterType.InsertByObject) | |||||
{ | |||||
entityInfo.SetValue(DateTime.Now); | |||||
}; | |||||
}; | |||||
} | |||||
); | |||||
services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton | services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton | ||||
} | } | ||||
} | } | ||||
@@ -22,7 +22,7 @@ | |||||
"dotnetRunMessages": true, | "dotnetRunMessages": true, | ||||
"launchBrowser": true, | "launchBrowser": true, | ||||
"launchUrl": "", | "launchUrl": "", | ||||
"applicationUrl": "http://192.168.1.243:5002", | |||||
"applicationUrl": "http://localhost:5000", | |||||
"environmentVariables": { | "environmentVariables": { | ||||
"ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
} | } | ||||
@@ -10,7 +10,7 @@ | |||||
"AllowedHosts": "*", | "AllowedHosts": "*", | ||||
"ConnectionConfigs": [ | "ConnectionConfigs": [ | ||||
{ | { | ||||
"ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_mes_base;Uid=root;Pwd=BapAdmin123456.;", | |||||
"ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=BapAdmin123456.;", | |||||
"DbType": "MySql", | "DbType": "MySql", | ||||
"IsAutoCloseConnection": true | "IsAutoCloseConnection": true | ||||
} | } | ||||