Browse Source

基础信息管理编码

shengtang
747575620@qq.com 1 year ago
parent
commit
4c7852b632
45 changed files with 2740 additions and 353 deletions
  1. +1336
    -279
      backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
  2. +22
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_BucketInfoEntity.cs
  3. +25
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_BucketMaterialsRecordEntity.cs
  4. +43
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs
  5. +21
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftsInfoEntity.cs
  6. +39
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_DevicesInfoEntity.cs
  7. +33
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_FinalsInfoEntity.cs
  8. +29
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_MaterialsInfoEntity.cs
  9. +30
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_StockInfoEntity.cs
  10. +1
    -12
      backend/BPA.MES.Base.Application/Entitys/Base/RecipeMaterialEntity.cs
  11. +1
    -4
      backend/BPA.MES.Base.Application/Entitys/Base/RecipesInfoEntity.cs
  12. +36
    -0
      backend/BPA.MES.Base.Application/Services/BaseService.cs
  13. +75
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Dtos/BucketInfoDto.cs
  14. +80
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Dtos/BucketMaterialsRecordDto.cs
  15. +142
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/BucketInfoService.cs
  16. +100
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/BucketMaterialsRecordServcie.cs
  17. +48
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/IBucketInfoService.cs
  18. +43
    -0
      backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/IBucketMaterialsRecordService.cs
  19. +1
    -1
      backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DeviceRecipeDto.cs
  20. +43
    -6
      backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DevicesInfoDto.cs
  21. +1
    -2
      backend/BPA.MES.Base.Application/Services/DeviceService/Services/DeviceRecipeService.cs
  22. +11
    -11
      backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs
  23. +1
    -1
      backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDeviceRecipeService.cs
  24. +1
    -2
      backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDevicesInfoService.cs
  25. +91
    -0
      backend/BPA.MES.Base.Application/Services/FinalsInfoService/Dtos/FinalsInfoDto.cs
  26. +123
    -0
      backend/BPA.MES.Base.Application/Services/FinalsInfoService/Services/FinalsInfoService.cs
  27. +49
    -0
      backend/BPA.MES.Base.Application/Services/FinalsInfoService/Services/IFinalsInfoService.cs
  28. +30
    -4
      backend/BPA.MES.Base.Application/Services/MaterialService/Dtos/MaterialsInfoDto.cs
  29. +1
    -1
      backend/BPA.MES.Base.Application/Services/MaterialService/Services/IMaterialsInfoService.cs
  30. +13
    -13
      backend/BPA.MES.Base.Application/Services/MaterialService/Services/MaterialsInfoService.cs
  31. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/GroupInfoDto.cs
  32. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipeMaterialDto.cs
  33. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipesInfoDto.cs
  34. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/GroupInfoService.cs
  35. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/IGroupInfoService.cs
  36. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipeMaterialService.cs
  37. +1
    -1
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipesInfoService.cs
  38. +1
    -4
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipeMaterialService.cs
  39. +2
    -2
      backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipesInfoService.cs
  40. +83
    -0
      backend/BPA.MES.Base.Application/Services/StockInfoService/Dtos/StockInfoDto.cs
  41. +49
    -0
      backend/BPA.MES.Base.Application/Services/StockInfoService/Services/IStockInfoService.cs
  42. +118
    -0
      backend/BPA.MES.Base.Application/Services/StockInfoService/Services/StockInfoService.cs
  43. +9
    -2
      backend/BPA.MES.Base.Core/SqlsugarSetup.cs
  44. +1
    -1
      backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json
  45. +1
    -1
      backend/BPA.MES.Base.Web.Entry/appsettings.json

+ 1336
- 279
backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
File diff suppressed because it is too large
View File


+ 22
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_BucketInfoEntity.cs View File

@@ -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; }

}
}

+ 25
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_BucketMaterialsRecordEntity.cs View File

@@ -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; }
}
}

+ 43
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftStepsEntity.cs View File

@@ -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; }
}
}

+ 21
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_CraftsInfoEntity.cs View File

@@ -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; }
}
}

+ 39
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_DevicesInfoEntity.cs View File

@@ -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; }
}
}

+ 33
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_FinalsInfoEntity.cs View File

@@ -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; }
}
}

+ 29
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_MaterialsInfoEntity.cs View File

@@ -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; }
}
}

+ 30
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_StockInfoEntity.cs View File

@@ -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; }

}
}

+ 1
- 12
backend/BPA.MES.Base.Application/Entitys/Base/RecipeMaterialEntity.cs View File

@@ -17,17 +17,6 @@
/// 配方Id
/// </summary>
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; }
}
}

+ 1
- 4
backend/BPA.MES.Base.Application/Entitys/Base/RecipesInfoEntity.cs View File

@@ -17,9 +17,6 @@
/// 自定义编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 图标
/// </summary>
public string PicUrl { get; set; }
}
}

+ 36
- 0
backend/BPA.MES.Base.Application/Services/BaseService.cs View File

@@ -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 "成功";
}
}
}

+ 75
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Dtos/BucketInfoDto.cs View File

@@ -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; }
}
}

+ 80
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Dtos/BucketMaterialsRecordDto.cs View File

@@ -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; }
}
}

+ 142
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/BucketInfoService.cs View File

@@ -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;
//}
}
}


+ 100
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/BucketMaterialsRecordServcie.cs View File

@@ -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;
}
}
}

+ 48
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/IBucketInfoService.cs View File

@@ -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);
}
}

+ 43
- 0
backend/BPA.MES.Base.Application/Services/BucketInfoService/Services/IBucketMaterialsRecordService.cs View File

@@ -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
- 1
backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DeviceRecipeDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备Dto类


+ 43
- 6
backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DevicesInfoDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备Dto类
@@ -6,9 +6,33 @@
/// 创建时间 : 2023/3/2 16:12:06
/// 描 述 :
/// </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>
/// 增加
@@ -22,7 +46,10 @@
/// </summary>
public class DevicesInfoUpdateInput : DevicesInfoDto
{

/// <summary>
/// 主键
/// </summary>
public string Id { get; set; }
}
/// <summary>
/// 删除
@@ -39,13 +66,23 @@
/// </summary>
public class DevicesInfoQueryPageInput : RequestPage
{

/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public string Code { get; set; }
}
/// <summary>
/// 输出
/// </summary>
public class DevicesInfoOutput : DevicesInfoDto
{

/// <summary>
/// 主键
/// </summary>
public string Id { get; set; }
}
}

+ 1
- 2
backend/BPA.MES.Base.Application/Services/DeviceService/Services/DeviceRecipeService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备服务
@@ -109,7 +109,6 @@
RecipeName = b.Name,
RecipeCode = b.Code,
RecipesId = a.RecipesId,
RecipesPic =b.PicUrl,
GroupId = c.GroupId,
GroupName = d.Name
})


+ 11
- 11
backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs View File

@@ -1,12 +1,12 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备服务
/// 创 建 人 :yangxiao
/// 创建时间 :2023/3/2 16:11:04
/// 描 述 :店铺数据维护
/// 描 述 :基础数据管理
/// </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
{
private readonly ISqlSugarClient _dbContext;
@@ -22,12 +22,12 @@
[HttpPost]
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)
{
throw Oops.Bah("名称已存在!");
}
DevicesInfoEntity entity = input.Adapt<DevicesInfoEntity>();
Pztj_DevicesInfoEntity entity = input.Adapt<Pztj_DevicesInfoEntity>();
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
}
/// <summary>
@@ -39,7 +39,7 @@
[HttpPost]
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;
}
/// <summary>
@@ -51,7 +51,7 @@
[HttpGet]
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>();
return output;
}
@@ -63,7 +63,7 @@
[HttpGet]
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>>();
return output;
}
@@ -75,7 +75,7 @@
[HttpPost]
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);
SqlSugarPagedList<DevicesInfoOutput> output = entity.Adapt<SqlSugarPagedList<DevicesInfoOutput>>();
return output;
@@ -88,7 +88,7 @@
[HttpGet]
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,
value = x.Name
@@ -104,7 +104,7 @@
[HttpPost]
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();
return res;
}


+ 1
- 1
backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDeviceRecipeService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备配方服务


+ 1
- 2
backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDevicesInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备服务
@@ -44,6 +44,5 @@
/// <param name="Id"></param>
/// <returns></returns>
Task<DevicesInfoOutput> Detail(string Id);
}
}

+ 91
- 0
backend/BPA.MES.Base.Application/Services/FinalsInfoService/Dtos/FinalsInfoDto.cs View File

@@ -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; }
}
}

+ 123
- 0
backend/BPA.MES.Base.Application/Services/FinalsInfoService/Services/FinalsInfoService.cs View File

@@ -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;
}
}
}


+ 49
- 0
backend/BPA.MES.Base.Application/Services/FinalsInfoService/Services/IFinalsInfoService.cs View File

@@ -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);
}
}


+ 30
- 4
backend/BPA.MES.Base.Application/Services/MaterialService/Dtos/MaterialsInfoDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :设备Dto类
@@ -6,9 +6,28 @@
/// 创建时间 : 2023/3/2 16:12:06
/// 描 述 :
/// </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>
/// 增加
@@ -22,7 +41,11 @@
/// </summary>
public class MaterialsInfoUpdateInput : MaterialsInfoDto
{

/// <summary>
/// 主键
/// </summary>
/// <example></example>
public string Id { get; set; }
}
/// <summary>
/// 删除
@@ -32,6 +55,7 @@
/// <summary>
/// 主键
/// </summary>
/// <example></example>
public string Id { get; set; }
}
/// <summary>
@@ -42,10 +66,12 @@
/// <summary>
/// 名称
/// </summary>
/// <example></example>
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
/// <example></example>
public string Code { get; set; }
}
/// <summary>


+ 1
- 1
backend/BPA.MES.Base.Application/Services/MaterialService/Services/IMaterialsInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :物料服务


+ 13
- 13
backend/BPA.MES.Base.Application/Services/MaterialService/Services/MaterialsInfoService.cs View File

@@ -1,12 +1,12 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :物料服务
/// 创 建 人 :yangxiao
/// 创建时间 :2023/3/2 16:11:04
/// 描 述 :店铺数据维护
/// 创建时间 :2023年7月17日15:41:09
/// 描 述 :基础数据管理
/// </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
{
private readonly ISqlSugarClient _dbContext;
@@ -22,12 +22,12 @@
[HttpPost]
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)
{
throw Oops.Bah("名称已存在!");
}
MaterialsInfoEntity entity = input.Adapt<MaterialsInfoEntity>();
Pztj_MaterialsInfoEntity entity = input.Adapt<Pztj_MaterialsInfoEntity>();
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
}
/// <summary>
@@ -39,7 +39,7 @@
[HttpPost]
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;
}
/// <summary>
@@ -51,7 +51,7 @@
[HttpGet]
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>();
return output;
}
@@ -63,7 +63,7 @@
[HttpGet]
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>>();
return output;
}
@@ -75,7 +75,7 @@
[HttpPost]
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.Code), x => x.Code.Contains(input.Code))
.ToPagedListAsync(input.PageIndex, input.PageSize);
@@ -90,7 +90,7 @@
[HttpGet]
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,
value = x.Name
@@ -106,8 +106,8 @@
[HttpPost]
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();
return res;
}


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/GroupInfoDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :产品分组


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipeMaterialDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :配方物料Dto类


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipesInfoDto.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :配方Dto类


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Services/GroupInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :分组信息


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Services/IGroupInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :分组信息


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipeMaterialService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :配方物料服务


+ 1
- 1
backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipesInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :配方服务


+ 1
- 4
backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipeMaterialService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :配方物料服务
@@ -95,9 +95,6 @@
MaterialId = c.Id,
RecipesId = a.RecipesId,
RecipesName = b.Name,
Sort = a.Sort,
Time = a.Time,
Outlet = a.Outlet
})
.ToListAsync();
return output;


+ 2
- 2
backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipesInfoService.cs View File

@@ -1,4 +1,4 @@
namespace BPA.MES.Base.Application.Entitys
namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :物料服务
@@ -6,7 +6,7 @@
/// 创建时间 :2023/3/2 16:11:04
/// 描 述 :店铺数据维护
/// </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
{
private readonly ISqlSugarClient _dbContext;


+ 83
- 0
backend/BPA.MES.Base.Application/Services/StockInfoService/Dtos/StockInfoDto.cs View File

@@ -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; }
}
}

+ 49
- 0
backend/BPA.MES.Base.Application/Services/StockInfoService/Services/IStockInfoService.cs View File

@@ -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);

}
}

+ 118
- 0
backend/BPA.MES.Base.Application/Services/StockInfoService/Services/StockInfoService.cs View File

@@ -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;
}
}
}

+ 9
- 2
backend/BPA.MES.Base.Core/SqlsugarSetup.cs View File

@@ -33,8 +33,15 @@ namespace BPA.MES.Base.Core
{
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
}
}


+ 1
- 1
backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json View File

@@ -22,7 +22,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "",
"applicationUrl": "http://192.168.1.243:5002",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}


+ 1
- 1
backend/BPA.MES.Base.Web.Entry/appsettings.json View File

@@ -10,7 +10,7 @@
"AllowedHosts": "*",
"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",
"IsAutoCloseConnection": true
}


Loading…
Cancel
Save