From 13ab75234f9a494a49b2222a3387a17fe2625aa2 Mon Sep 17 00:00:00 2001
From: Yanko <747575620@qq.com>
Date: Mon, 19 Aug 2024 09:48:22 +0800
Subject: [PATCH] =?UTF-8?q?MES=E6=95=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BPA.MES.Base.Application.xml | 426 ++++++++++++++++++
.../Entitys/Base/ProcessEntity.cs | 26 ++
.../Entitys/Base/ProductLineStepsEntity.cs | 26 ++
.../Services/ProcessEntity/Dtos/ProcessDto.cs | 84 ++++
.../ProcessEntity/Services/IProcessService.cs | 48 ++
.../ProcessEntity/Services/ProcessService.cs | 110 +++++
.../Dtos/ProductLineStepsDto.cs | 94 ++++
.../Services/IProductLineStepsService.cs | 48 ++
.../Services/ProductLineStepsService.cs | 133 ++++++
.../BPA.MES.Base.Web.Entry/appsettings.json | 2 +-
10 files changed, 996 insertions(+), 1 deletion(-)
create mode 100644 backend/BPA.MES.Base.Application/Entitys/Base/ProcessEntity.cs
create mode 100644 backend/BPA.MES.Base.Application/Entitys/Base/ProductLineStepsEntity.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProcessEntity/Dtos/ProcessDto.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/IProcessService.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/ProcessService.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineStepsService.cs
create mode 100644 backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs
diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
index 27a7288..7a42e4e 100644
--- a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
+++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
@@ -997,6 +997,31 @@
描 述 :
+
+
+ 工艺流程库
+
+
+
+
+ 工艺流程名称
+
+
+
+
+ 流程类型
+
+
+
+
+ 备注
+
+
+
+
+ 创建时间
+
+
名 称 :产线管理
@@ -1020,6 +1045,31 @@
产线描述
+
+
+ 产线工序
+
+
+
+
+ 步骤
+
+
+
+
+ 工艺Id
+
+
+
+
+ 产线Id
+
+
+
+
+ 工艺名称
+
+
名 称 :配方物料信息
@@ -6094,6 +6144,194 @@
+
+
+ 名 称 :
+ 创 建 人 :yangxiao
+ 创建时间 :2023/8/21 10:20:37
+ 描 述 :
+
+
+
+
+ 工艺流程名称
+
+
+
+
+ 流程类型
+
+
+
+
+ 备注
+
+
+
+
+ 创建时间
+
+
+
+
+ 增加
+
+
+
+
+ 更新
+
+
+
+
+ 主键
+
+
+
+
+ 删除
+
+
+
+
+ 主键
+
+
+
+
+ 不分页
+
+
+
+
+ 分页
+
+
+
+
+ 工艺流程名称
+
+
+
+
+ 输出
+
+
+
+
+ 主键
+
+
+
+
+ 名 称 :
+ 创 建 人 :yangxiao
+ 创建时间 : 2023/8/21 10:30:26
+ 描 述 :
+
+
+
+
+ 增加
+
+
+
+
+
+ 移除
+
+
+
+
+
+ 更新
+
+
+
+
+
+ 不分页列表
+
+
+
+
+
+ 分页列表
+
+
+
+
+
+ 查询单条
+
+
+
+
+
+
+ 下拉列表
+
+
+
+
+
+ 名 称 :报警日志
+ 创 建 人 :yangxiao
+ 创建时间 :2023/8/21 11:02:36
+ 描 述 :
+
+
+
+
+ 增加
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+ 列表
+
+
+
+
+
+
+ 分页
+
+
+
+
+
+
+ 更新
+
+
+
+
+
+
+
+ 下拉
+
+
+
名 称 :产品分组
@@ -6321,6 +6559,86 @@
主键
+
+
+ 产线工艺步骤
+
+
+
+
+ 步骤
+
+
+
+
+ 工艺Id
+
+
+
+
+ 产线Id
+
+
+
+
+ 工艺名称
+
+
+
+
+ 增加
+
+
+
+
+ 更新
+
+
+
+
+ 主键
+
+
+
+
+ 删除
+
+
+
+
+ 主键
+
+
+
+
+ 分页
+
+
+
+
+ 产线Id
+
+
+
+
+ 不分页
+
+
+
+
+ 产线Id
+
+
+
+
+ 输出
+
+
+
+
+ 主键
+
+
名 称 :
@@ -6629,6 +6947,56 @@
+
+
+ 增加
+
+
+
+
+
+ 移除
+
+
+
+
+
+ 更新
+
+
+
+
+
+ 不分页列表
+
+
+
+
+
+ 下拉列表
+
+
+
+
+
+ 分页列表
+
+
+
+
+
+ 查询单条
+
+
+
+
+
+
+ 批量更新
+
+
+
+
名 称 :产线服务
@@ -6737,6 +7105,64 @@
+
+
+ 增加
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+ 详情
+
+
+
+
+
+
+
+ 列表
+
+
+
+
+
+
+ 分页
+
+
+
+
+
+
+ 下拉
+
+
+
+
+
+ 更新
+
+
+
+
+
+
+
+ 批量更新
+
+
+
+
名 称 :配方物料Dto类
diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/ProcessEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/ProcessEntity.cs
new file mode 100644
index 0000000..35c11a4
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Entitys/Base/ProcessEntity.cs
@@ -0,0 +1,26 @@
+namespace BPA.MES.Base.Application.Entitys
+{
+ ///
+ /// 工艺流程库
+ ///
+ [SugarTable("process")]
+ public class ProcessEntity:DEntityBase
+ {
+ ///
+ /// 工艺流程名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 流程类型
+ ///
+ public string ProcessType { get; set; }
+ ///
+ /// 备注
+ ///
+ public string Des { get; set; }
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreateTime { get; set; }
+ }
+}
diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/ProductLineStepsEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/ProductLineStepsEntity.cs
new file mode 100644
index 0000000..f001de0
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Entitys/Base/ProductLineStepsEntity.cs
@@ -0,0 +1,26 @@
+namespace BPA.MES.Base.Application.Entitys
+{
+ ///
+ /// 产线工序
+ ///
+ [SugarTable("product_line_steps")]
+ public class ProductLineStepsEntity : DEntityBase
+ {
+ ///
+ /// 步骤
+ ///
+ public int Step { get; set; }
+ ///
+ /// 工艺Id
+ ///
+ public string ProcessId { get; set; }
+ ///
+ /// 产线Id
+ ///
+ public string LineId { get; set; }
+ ///
+ /// 工艺名称
+ ///
+ public string ProcessName { get; set; }
+ }
+}
diff --git a/backend/BPA.MES.Base.Application/Services/ProcessEntity/Dtos/ProcessDto.cs b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Dtos/ProcessDto.cs
new file mode 100644
index 0000000..f4b178d
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Dtos/ProcessDto.cs
@@ -0,0 +1,84 @@
+namespace BPA.MES.Base.Application.Services
+{
+ ///
+ /// 名 称 :
+ /// 创 建 人 :yangxiao
+ /// 创建时间 :2023/8/21 10:20:37
+ /// 描 述 :
+ ///
+ public class ProcessDto
+ {
+ ///
+ /// 工艺流程名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 流程类型
+ ///
+ public string ProcessType { get; set; }
+ ///
+ /// 备注
+ ///
+ public string Des { get; set; }
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreateTime { get;set; }
+
+ }
+ ///
+ /// 增加
+ ///
+ public class ProcessAddInput : ProcessDto
+ {
+
+ }
+ ///
+ /// 更新
+ ///
+ public class ProcessUpdateInput : ProcessDto
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+ }
+ ///
+ /// 删除
+ ///
+ public class ProcessDelInput
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+ }
+ ///
+ /// 不分页
+ ///
+ public class ProcessQueryInput
+ {
+
+ }
+ ///
+ /// 分页
+ ///
+ public class ProcessQueryPageInput : RequestPage
+ {
+ ///
+ /// 工艺流程名称
+ ///
+ public string Name { get; set; }
+ }
+ ///
+ /// 输出
+ ///
+ public class ProcessOutput : ProcessDto
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+
+ }
+}
diff --git a/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/IProcessService.cs b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/IProcessService.cs
new file mode 100644
index 0000000..cf34cc1
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/IProcessService.cs
@@ -0,0 +1,48 @@
+namespace BPA.MES.Base.Application.Services
+{
+ ///
+ /// 名 称 :
+ /// 创 建 人 :yangxiao
+ /// 创建时间 : 2023/8/21 10:30:26
+ /// 描 述 :
+ ///
+ public interface IProcessService
+ {
+ ///
+ /// 增加
+ ///
+ ///
+ Task Add(ProcessAddInput input);
+ ///
+ /// 移除
+ ///
+ ///
+ Task Del(ProcessDelInput input);
+ ///
+ /// 更新
+ ///
+ ///
+ Task Update(ProcessUpdateInput input);
+ ///
+ /// 不分页列表
+ ///
+ ///
+ Task> List(ProcessQueryInput input);
+ ///
+ /// 分页列表
+ ///
+ ///
+ Task> PagedList(ProcessQueryPageInput input);
+ ///
+ /// 查询单条
+ ///
+ ///
+ ///
+ Task Detail(string Id);
+ ///
+ /// 下拉列表
+ ///
+ ///
+ Task SelectList();
+ }
+}
diff --git a/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/ProcessService.cs b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/ProcessService.cs
new file mode 100644
index 0000000..88d41a3
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProcessEntity/Services/ProcessService.cs
@@ -0,0 +1,110 @@
+namespace BPA.MES.Base.Application.Services
+{
+ ///
+ /// 名 称 :报警日志
+ /// 创 建 人 :yangxiao
+ /// 创建时间 :2023/8/21 11:02:36
+ /// 描 述 :
+ ///
+ [ApiDescriptionSettings("工艺流程", Name = "Process", Tag = "工艺流程", KeepName = true, SplitCamelCase = true, KeepVerb = true)]
+ public class ProcessService : IProcessService, ITransient, IDynamicApiController
+ {
+ private readonly ISqlSugarClient _dbContext;
+ public ProcessService(ISqlSugarClient db)
+ {
+ _dbContext = db;
+ }
+ ///
+ /// 增加
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Add(ProcessAddInput input)
+ {
+ ProcessEntity entity = input.Adapt();
+ return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Del(ProcessDelInput input)
+ {
+ var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync();
+ return res;
+ }
+ ///
+ /// 详情
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task Detail(string Id)
+ {
+ var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id);
+ ProcessOutput output = entity.Adapt();
+ return output;
+ }
+ ///
+ /// 列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> List(ProcessQueryInput input)
+ {
+ var entity = await _dbContext.Queryable().ToListAsync();
+ List output = entity.Adapt>();
+ return output;
+ }
+ ///
+ /// 分页
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> PagedList(ProcessQueryPageInput input)
+ {
+ var entity = await _dbContext.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name))
+
+ .OrderByDescending(x=>x.CreateTime)
+ .ToPagedListAsync(input.PageIndex, input.PageSize);
+ SqlSugarPagedList output = entity.Adapt>();
+ return output;
+ }
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Update(ProcessUpdateInput input)
+ {
+ var entity = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync();
+ entity = input.Adapt();
+ var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync();
+ return res;
+ }
+ ///
+ /// 下拉
+ ///
+ ///
+ [HttpGet]
+ public async Task SelectList()
+ {
+ var entity = await _dbContext.Queryable().Select(x => new
+ {
+ key = x.Id,
+ value = x.Name
+ }).ToListAsync();
+ return entity;
+ }
+ }
+}
\ No newline at end of file
diff --git a/backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs b/backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs
new file mode 100644
index 0000000..dd95d99
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs
@@ -0,0 +1,94 @@
+namespace BPA.MES.Base.Application.Services
+{
+ ///
+ /// 产线工艺步骤
+ ///
+ public class ProductLineStepsDto
+ {
+ ///
+ /// 步骤
+ ///
+ public int Step { get; set; }
+ ///
+ /// 工艺Id
+ ///
+ public string ProcessId { get; set; }
+ ///
+ /// 产线Id
+ ///
+ public string LineId { get; set; }
+ ///
+ /// 工艺名称
+ ///
+ public string ProcessName { get; set; }
+
+ }
+ ///
+ /// 增加
+ ///
+ public class ProductLineStepsAddInput : ProductLineStepsDto
+ {
+
+ }
+ ///
+ /// 更新
+ ///
+ public class ProductLineStepsUpdateInput : ProductLineStepsDto
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+ }
+ ///
+ /// 删除
+ ///
+ public class ProductLineStepsDelInput
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+ }
+ ///
+ /// 分页
+ ///
+ public class ProductLineStepsQueryPageInput : RequestPage
+ {
+ /////
+ ///// 名称
+ /////
+ //public string Name { get; set; }
+ /////
+ ///// 编码
+ /////
+ //public string Code { get; set; }
+ ///
+ /// 产线Id
+ ///
+ public string LineId { get; set; }
+ }
+
+ ///
+ /// 不分页
+ ///
+ public class ProductLineStepsQueryInput
+ {
+ ///
+ /// 产线Id
+ ///
+ public string LineId { get; set; }
+ }
+
+ ///
+ /// 输出
+ ///
+ public class ProductLineStepsOutput : ProductLineStepsDto
+ {
+ ///
+ /// 主键
+ ///
+ public string Id { get; set; }
+ }
+
+}
diff --git a/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineStepsService.cs b/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineStepsService.cs
new file mode 100644
index 0000000..5256666
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineStepsService.cs
@@ -0,0 +1,48 @@
+namespace BPA.MES.Base.Application.Services
+{
+ public interface IProductLineStepsService
+ {
+ ///
+ /// 增加
+ ///
+ ///
+ Task Add(ProductLineStepsAddInput input);
+ ///
+ /// 移除
+ ///
+ ///
+ Task Del(ProductLineStepsDelInput input);
+ ///
+ /// 更新
+ ///
+ ///
+ Task Update(ProductLineStepsUpdateInput input);
+ ///
+ /// 不分页列表
+ ///
+ ///
+ Task> List(ProductLineStepsQueryInput input);
+ ///
+ /// 下拉列表
+ ///
+ ///
+ Task SelectList();
+ ///
+ /// 分页列表
+ ///
+ ///
+ Task> PagedList(ProductLineStepsQueryPageInput input);
+ ///
+ /// 查询单条
+ ///
+ ///
+ ///
+ Task Detail(string Id);
+ ///
+ /// 批量更新
+ ///
+ ///
+ ///
+ Task BatchUpdate(List inputs);
+ }
+}
diff --git a/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs b/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs
new file mode 100644
index 0000000..178b117
--- /dev/null
+++ b/backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.MES.Base.Application.Services
+{
+ [ApiDescriptionSettings("产线工艺管理", Order = 0, Name = "ProductLineSteps", Tag = "产线服务", KeepName = true, SplitCamelCase = true, KeepVerb = true)]
+ public class ProductLineStepsService : IProductLineStepsService, ITransient, IDynamicApiController
+ {
+ private readonly ISqlSugarClient _dbContext;
+ public ProductLineStepsService(ISqlSugarClient db)
+ {
+ _dbContext = db;
+ }
+ ///
+ /// 增加
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Add(ProductLineStepsAddInput input)
+ {
+ //ProductLineStepsEntity entity = await _dbContext.Queryable().FirstAsync(x => x.Name == input.Name);
+ //if (entity != null)
+ //{
+ // throw Oops.Bah("名称已存在!");
+ //}
+ //ProductLineStepsEntity entity = input.Adapt();
+ //return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
+
+ var step = await _dbContext.Queryable().Where(x => x.LineId==input.LineId).MaxAsync(x => x.Step);
+ ProductLineStepsEntity entity = input.Adapt();
+ entity.Step = step+1;
+ return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Del(ProductLineStepsDelInput input)
+ {
+ var res = await _dbContext.Deleteable().Where(x => x.Id==input.Id).ExecuteCommandHasChangeAsync();
+ return res;
+ }
+ ///
+ /// 详情
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task Detail(string Id)
+ {
+ var entity = await _dbContext.Queryable().FirstAsync();
+ ProductLineStepsOutput output = entity.Adapt();
+ return output;
+ }
+ ///
+ /// 列表
+ ///
+ ///
+ ///
+ [HttpPost, AllowAnonymous]
+ public async Task> List(ProductLineStepsQueryInput input)
+ {
+ var entity = await _dbContext.Queryable().WhereIF(!string.IsNullOrEmpty(input.LineId),x=>x.LineId==input.LineId).OrderBy(x => x.Step).ToListAsync();
+ List output = entity.Adapt>();
+ return output;
+ }
+ ///
+ /// 分页
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> PagedList(ProductLineStepsQueryPageInput input)
+ {
+ var entity = await _dbContext.Queryable()
+ .ToPagedListAsync(input.PageIndex, input.PageSize);
+ SqlSugarPagedList output = entity.Adapt>();
+ return output;
+ }
+ ///
+ /// 下拉
+ ///
+ ///
+ [HttpGet]
+ public async Task SelectList()
+ {
+ var entity = await _dbContext.Queryable().Select(x => new
+ {
+ key = x.Id,
+ value = x.ProcessName
+ }).ToListAsync();
+ return entity;
+ }
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Update(ProductLineStepsUpdateInput input)
+ {
+ //var entity = await _dbContext.Queryable().FirstAsync(x => x.Id != input.Id && x.Name == input.Name);
+ //if (entity != null)
+ //{
+ // throw Oops.Bah("名称已存在!");
+ //}
+ var entity = input.Adapt();
+ var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync();
+ return res;
+ }
+ ///
+ /// 批量更新
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task BatchUpdate(List inputs)
+ {
+ List entity = inputs.Adapt>();
+ var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync();
+ return res;
+ }
+ }
+}
diff --git a/backend/BPA.MES.Base.Web.Entry/appsettings.json b/backend/BPA.MES.Base.Web.Entry/appsettings.json
index c8ad527..ee9bb66 100644
--- a/backend/BPA.MES.Base.Web.Entry/appsettings.json
+++ b/backend/BPA.MES.Base.Web.Entry/appsettings.json
@@ -10,7 +10,7 @@
"AllowedHosts": "*",
"ConnectionConfigs": [
{
- "ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=BapAdmin123456.;",
+ "ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_final_mes;Uid=root;Pwd=BapAdmin123456.;",
//"ConnectionString": "server=192.168.1.231;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=pztj8127;",
"DbType": "MySql",
"IsAutoCloseConnection": true