@@ -0,0 +1,4 @@ | |||||
.vs | |||||
obj | |||||
bin | |||||
Properties |
@@ -0,0 +1,154 @@ | |||||
pipeline{ | |||||
agent any | |||||
parameters { | |||||
choice( | |||||
description: 'pztjwebi:开发环境1', | |||||
name: 'environment', | |||||
choices: ['pztj'] | |||||
) | |||||
choice( | |||||
description: '前端or后端', | |||||
name: 'projectqh', | |||||
choices: ['backend','frontend'] | |||||
) | |||||
choice( | |||||
description: '执行操作(发布|回滚)', | |||||
name: 'operation', | |||||
choices: ['develop', 'rollback'] | |||||
) | |||||
choice( | |||||
description: '分支名', | |||||
name: 'branchName', | |||||
choices: ['master'] | |||||
) | |||||
string( | |||||
name: 'tag', | |||||
defaultValue: '', | |||||
description: '版本tag' | |||||
) | |||||
} | |||||
stages | |||||
{ | |||||
stage('Prepare') { | |||||
steps { | |||||
script{ | |||||
echo "1.Prepare Stage" | |||||
echo "当前环境${params.environment}" | |||||
if(params.operation=='develop') | |||||
{ | |||||
checkout scm | |||||
script { | |||||
build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() | |||||
if (env.BRANCH_NAME != 'master') { | |||||
build_tag = "${env.BRANCH_NAME}-${build_tag}" | |||||
} | |||||
} | |||||
} | |||||
else{ | |||||
script { | |||||
if(params.branchName!= 'master') | |||||
{ | |||||
build_tag = "${params.branchName}-${params.tag}" | |||||
} | |||||
else | |||||
{ | |||||
build_tag="${params.tag}" | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
stage('Test') { | |||||
steps { | |||||
script{ | |||||
echo "2.Test Stage" | |||||
} | |||||
} | |||||
} | |||||
stage('Build') { | |||||
steps { | |||||
script{ | |||||
echo "3.Build Docker Image Stage" | |||||
if(params.operation=='develop') | |||||
{ | |||||
if(params.projectqh=='backend') | |||||
{ | |||||
sh "cp -r backend/* ./" | |||||
sh "docker build -f backend/dockerfile -t 10.2.1.24:10242/bpa/pztjapi:${build_tag} ." | |||||
} | |||||
else if(params.projectqh=='frontend') | |||||
{ | |||||
sh "docker build -f frontend/dockerfile -t 10.2.1.24:10242/bpa/pztjweb:${build_tag} ." | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
stage('Push') { | |||||
steps { | |||||
script{ | |||||
echo "4.Push Docker Image Stage" | |||||
withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) { | |||||
sh "docker login -u ${harborUser} -p ${harborPassword} 10.2.1.24:10242" | |||||
if(params.operation=='develop') | |||||
{ | |||||
if(params.projectqh=='backend') | |||||
{ | |||||
sh "docker push 10.2.1.24:10242/bpa/pztjapi:${build_tag}" | |||||
} | |||||
else if(params.projectqh=='frontend') | |||||
{ | |||||
sh "docker push 10.2.1.24:10242/bpa/pztjweb:${build_tag}" | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
stage('Deploy') { | |||||
steps { | |||||
script{ | |||||
echo "5. Deploy Stage" | |||||
// if(params.environment=='test') | |||||
// { | |||||
// input "确认要部署线上环境吗?" | |||||
// } | |||||
if(params.projectqh=='backend') | |||||
{ | |||||
sh "sed -i 's/<BUILD_TAG>/${build_tag}/' k8s_pztjapi.yaml" | |||||
sh "sed -i 's/<BRANCH_NAME>/${env.BRANCH_NAME}/' k8s_pztjapi.yaml" | |||||
sh "sed -i 's/<NAMESPACES>/${params.environment}/' k8s_pztjapi.yaml" | |||||
sh "kubectl apply -f k8s_pztjapi.yaml --record" | |||||
} | |||||
else if(params.projectqh=='frontend') | |||||
{ | |||||
sh "sed -i 's/<BUILD_TAG>/${build_tag}/' k8s_pztjweb.yaml" | |||||
sh "sed -i 's/<BRANCH_NAME>/${env.BRANCH_NAME}/' k8s_pztjweb.yaml" | |||||
sh "sed -i 's/<NAMESPACES>/${params.environment}/' k8s_pztjweb.yaml" | |||||
sh "kubectl apply -f k8s_pztjweb.yaml --record" | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,7 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<configuration> | |||||
<packageSources> | |||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json"/> | |||||
<add key="bpa" value="http://10.2.1.25:10243/repository/bpa/index.json"/> | |||||
</packageSources> | |||||
</configuration> |
@@ -0,0 +1,25 @@ | |||||
**/.classpath | |||||
**/.dockerignore | |||||
**/.env | |||||
**/.git | |||||
**/.gitignore | |||||
**/.project | |||||
**/.settings | |||||
**/.toolstarget | |||||
**/.vs | |||||
**/.vscode | |||||
**/*.*proj.user | |||||
**/*.dbmdl | |||||
**/*.jfm | |||||
**/azds.yaml | |||||
**/bin | |||||
**/charts | |||||
**/docker-compose* | |||||
**/Dockerfile* | |||||
**/node_modules | |||||
**/npm-debug.log | |||||
**/obj | |||||
**/secrets.dev.yaml | |||||
**/values.dev.yaml | |||||
LICENSE | |||||
README.md |
@@ -0,0 +1,40 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | |||||
<TargetFramework>net6.0</TargetFramework> | |||||
<NoWarn>1701;1702;1591</NoWarn> | |||||
<DocumentationFile>BPA.MES.Base.Application.xml</DocumentationFile> | |||||
<ImplicitUsings>enable</ImplicitUsings> | |||||
</PropertyGroup> | |||||
<ItemGroup> | |||||
<None Remove="applicationsettings.json" /> | |||||
<None Remove="BPA.MES.Base.Application.xml" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<Content Include="applicationsettings.json"> | |||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
</Content> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<ProjectReference Include="..\BPA.MES.Base.Core\BPA.MES.Base.Core.csproj" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<Folder Include="Entitys\View\" /> | |||||
<Folder Include="Services\DeviceService\" /> | |||||
<Folder Include="Services\MaterialService\" /> | |||||
<Folder Include="Services\RecipesService\" /> | |||||
<Folder Include="Services\CustomCodeService\" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | |||||
<PackageReference Include="FreeRedis" Version="1.2.5" /> | |||||
<PackageReference Include="ServiceStack.Redis" Version="6.11.0" /> | |||||
</ItemGroup> | |||||
</Project> |
@@ -0,0 +1,88 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/4 10:15:54 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class ClaimConst | |||||
{ | |||||
/// <summary> | |||||
/// 用户Id | |||||
/// </summary> | |||||
public const string CLAINM_USERID = "UserId"; | |||||
/// <summary> | |||||
/// 账号 | |||||
/// </summary> | |||||
public const string CLAINM_ACCOUNT = "Account"; | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public const string CLAINM_NAME = "Name"; | |||||
/// <summary> | |||||
/// 头像 | |||||
/// </summary> | |||||
public const string CLAINM_AVATARURL = "AvatarUrl"; | |||||
/// <summary> | |||||
/// 电话 | |||||
/// </summary> | |||||
public const string CLAINM_PHONE = "Phone"; | |||||
/// <summary> | |||||
/// 性别 | |||||
/// </summary> | |||||
public const string CLAINM_SEX = "0"; | |||||
/// <summary> | |||||
/// 是否授权 | |||||
/// </summary> | |||||
public const string CLAINM_ISAUTH = "0"; | |||||
/// <summary> | |||||
/// 角色Id | |||||
/// </summary> | |||||
public const string CLAINM_ROLEID = ""; | |||||
/// <summary> | |||||
/// 微信session_key | |||||
/// </summary> | |||||
public const string SESSION_KEY = "session_key"; | |||||
/// <summary> | |||||
/// 是否超级管理 | |||||
/// </summary> | |||||
public const string CLAINM_SUPERADMIN = "SuperAdmin"; | |||||
/// <summary> | |||||
/// 租户Id | |||||
/// </summary> | |||||
public const string TENANT_ID = "TenantId"; | |||||
/// <summary> | |||||
/// 用户组织机构Id | |||||
/// </summary> | |||||
public const string CLAINM_ORGID = "OrgId"; | |||||
/// <summary> | |||||
/// 用户组织机构名称 | |||||
/// </summary> | |||||
public const string CLAINM_ORGNAME = "OrgName"; | |||||
/// <summary> | |||||
/// 是否是管理员 | |||||
/// </summary> | |||||
public const bool ISADMIN = false; | |||||
/// <summary> | |||||
/// 所有缓存关键字集合 | |||||
/// </summary> | |||||
public const string CACHE_KEY_ALL = "allkey"; | |||||
} | |||||
public class MQTTConfig | |||||
{ | |||||
/// <summary> | |||||
/// 地址 | |||||
/// </summary> | |||||
public static string Address { get; set; } | |||||
/// <summary> | |||||
/// 密码 | |||||
/// </summary> | |||||
public static string Pwd { get; set; } | |||||
/// <summary> | |||||
/// 账号 | |||||
/// </summary> | |||||
public static string Account { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线设备类型 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/24 16:56:13 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public enum DeviceTypeEnum | |||||
{ | |||||
/// <summary> | |||||
/// 锅 | |||||
/// </summary> | |||||
Pot, | |||||
/// <summary> | |||||
/// 釜 | |||||
/// </summary> | |||||
Kettle | |||||
} | |||||
/// <summary> | |||||
/// 配料状态 | |||||
/// </summary> | |||||
public enum EBatchingStatus | |||||
{ | |||||
None = 0, | |||||
等待配料 = 1, | |||||
正在配料 = 2, | |||||
配料完成 = 3 | |||||
} | |||||
/// <summary> | |||||
/// 工艺状态 | |||||
/// </summary> | |||||
public enum RecipeStatus | |||||
{ | |||||
None = 0, | |||||
等待执行 = 1, | |||||
正在执行 = 2, | |||||
执行完成 = 3 | |||||
} | |||||
} |
@@ -0,0 +1,10 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
public enum ELogType | |||||
{ | |||||
Error, | |||||
Info, | |||||
Warn, | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Const | |||||
{ | |||||
public enum OrderStatusEnum | |||||
{ | |||||
/// <summary> | |||||
/// 未开始 | |||||
/// </summary> | |||||
NotStarted = 0, | |||||
/// <summary> | |||||
/// 进行中 | |||||
/// </summary> | |||||
Ongoing = 1, | |||||
/// <summary> | |||||
/// 完成 | |||||
/// </summary> | |||||
Completed = 2, | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工单枚举 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/7/21 15:04:24 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public enum WorkOrderStatusEnum | |||||
{ | |||||
/// <summary> | |||||
/// 未知 | |||||
/// </summary> | |||||
Unkown = -1, | |||||
/// <summary> | |||||
/// 草稿 | |||||
/// </summary> | |||||
Draft = 0, | |||||
/// <summary> | |||||
/// 已下发 | |||||
/// </summary> | |||||
Issued = 1, | |||||
/// <summary> | |||||
/// 已接受 | |||||
/// </summary> | |||||
Receive = 2, | |||||
/// <summary> | |||||
/// 已启动 | |||||
/// </summary> | |||||
Started = 3, | |||||
/// <summary> | |||||
/// 已完成 | |||||
/// </summary> | |||||
Completed = 4, | |||||
/// <summary> | |||||
/// 废弃 | |||||
/// </summary> | |||||
Obsolete = 5, | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/27 9:35:27 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("agv_line")] | |||||
public class AgvLineEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 自定义编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 线路名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 开始点位 | |||||
/// </summary> | |||||
public string StartPointId { get; set; } | |||||
/// <summary> | |||||
/// 结束点位 | |||||
/// </summary> | |||||
public string EndPointId { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/27 9:36:07 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("agv_point")] | |||||
public class AgvPointEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 点位名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 点位编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
} |
@@ -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,38 @@ | |||||
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> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string BucketId { get; set; } | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime? CreateTime { get; set; } | |||||
/// <summary> | |||||
/// 重量 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Weight { get; set; } | |||||
/// <summary> | |||||
/// 工单Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string WorkId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工艺路线 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/17 17:01:26 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("craft_Steps")] | |||||
public class Pztj_CraftStepsEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
/// <summary> | |||||
/// 步骤 | |||||
/// </summary> | |||||
public int Step { get; set; } | |||||
/// <summary> | |||||
/// 功能描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 设备产品功能Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceProductFunctionId { get; set; } | |||||
/// <summary> | |||||
/// 功能参数 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true, ColumnDataType= "longtext")] | |||||
public string Params { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
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> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 工艺描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
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> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceType { get; set; } | |||||
/// <summary> | |||||
/// 设备描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Describe { get; set; } | |||||
/// <summary> | |||||
/// 设备维保时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string RepairDate { get; set; } | |||||
/// <summary> | |||||
/// 设备创建时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
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,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线设备 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/20 16:45:05 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("productline_devices")] | |||||
public class Pztj_LineDevicesEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 产线Id | |||||
/// </summary> | |||||
public string LineId { get; set; } | |||||
/// <summary> | |||||
/// 产线设备 | |||||
/// </summary> | |||||
public string DeviceId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线料仓 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/7/20 16:45:40 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("productline_stocks")] | |||||
public class Pztj_LineStocksEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 产线Id | |||||
/// </summary> | |||||
public string LineId { get; set; } | |||||
/// <summary> | |||||
/// 产线料仓 | |||||
/// </summary> | |||||
public string StockId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,34 @@ | |||||
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 Type { get; set; } | |||||
/// <summary> | |||||
/// 每升重量 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string WeightPerLiter { 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; } | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工单基础信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/18 17:54:43 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_info")] | |||||
public class Pztj_WorkInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工单名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 产线Id | |||||
/// </summary> | |||||
public string LineId { get; set; } | |||||
/// <summary> | |||||
/// 成品Id | |||||
/// </summary> | |||||
public string FinalId { get; set; } | |||||
/// <summary> | |||||
/// 指定设备Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceId { get; set; } | |||||
/// <summary> | |||||
/// 产量 | |||||
/// </summary> | |||||
public string Number { get;set; } | |||||
/// <summary> | |||||
/// 批次号 | |||||
/// </summary> | |||||
public string BatchId { get; set; } | |||||
/// <summary> | |||||
/// 工单当前状态 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public WorkOrderStatusEnum? Status { get; set; } | |||||
/// <summary> | |||||
/// 创建时间 | |||||
/// </summary> | |||||
public DateTime CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工单拆分 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/18 18:12:55 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_info_item")] | |||||
public class Pztj_WorkInfoItemEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工单名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 产量 | |||||
/// </summary> | |||||
public string Number { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工单状态 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/7/18 18:07:21 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_info_status")] | |||||
public class Pztj_WorkInfoStatusEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工单Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string WorkId { get; set; } | |||||
/// <summary> | |||||
/// 工单状态 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public WorkOrderStatusEnum? Status { get; set; } | |||||
/// <summary> | |||||
/// 创建时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime CreateTime { get; set; } | |||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Remark { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/9 18:22:42 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_batch")] | |||||
public class WorkBatchEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 批次名词 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 创建时间 | |||||
/// </summary> | |||||
public DateTime CreateTime { get; set; } | |||||
/// <summary> | |||||
/// 状态 | |||||
/// </summary> | |||||
public WorkOrderStatusEnum? Status { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/10 10:03:15 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_info_craftstep_record")] | |||||
public class WorkInfoCraftstepRecordEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 工单Id | |||||
/// </summary> | |||||
public string WorkId { get; set; } | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
/// <summary> | |||||
/// 工艺名称 | |||||
/// </summary> | |||||
public string CraftName { get; set; } | |||||
/// <summary> | |||||
/// 工艺步骤Id | |||||
/// </summary> | |||||
public string CraftstepId { get; set; } | |||||
/// <summary> | |||||
/// 步骤 | |||||
/// </summary> | |||||
public int Step { get; set; } | |||||
/// <summary> | |||||
/// 工艺步骤名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string CraftstepName { get; set; } | |||||
/// <summary> | |||||
/// 工艺参数 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string CraftstepParms { get; set; } | |||||
/// <summary> | |||||
/// 设备类型功能Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceProductFunctionId { get; set; } | |||||
/// <summary> | |||||
/// 设备类型功能名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceProductFunctionName { get; set; } | |||||
/// <summary> | |||||
/// 执行状态 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public RecipeStatus Status { get; set; } | |||||
/// <summary> | |||||
/// 更新时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime? UpdateTime{ get;set;} | |||||
/// <summary> | |||||
/// 第几锅 | |||||
/// </summary> | |||||
public string PotNum { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,63 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/9 18:22:42 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("work_info_materials_record")] | |||||
public class WorkInfoMaterialsRecordEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 物料名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string MaterialName { get; set; } | |||||
/// <summary> | |||||
/// 物料id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 工单id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string WorkId { get; set; } | |||||
/// <summary> | |||||
/// 重量 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Weight { get; set; } | |||||
/// <summary> | |||||
/// 第几锅 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string PotNum { get; set; } | |||||
/// <summary> | |||||
/// 配方Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string RecipeId { get; set; } | |||||
/// <summary> | |||||
/// 配方名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string RecipeName { get; set; } | |||||
/// <summary> | |||||
/// 物料状态 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public EBatchingStatus MaterialStatus { get; set; } | |||||
/// <summary> | |||||
/// 更新时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime? UpdateTime { get; set; } | |||||
/// <summary> | |||||
/// 误差 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string ErrorWeight { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/1 16:34:53 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("devices_product")] | |||||
public class DeviceProductEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 设备产品编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 设备产品描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Description { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,38 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备功能 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/2 16:03:10 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("devices_product_function")] | |||||
public class DeviceProductFunctionEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 功能名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 功能编码 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 方法参数 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||||
public string Params { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备属性 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 15:06:00 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("devices_product_parm")] | |||||
public class DeviceProductParmEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Description { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备配方表 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 13:57:00 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("devices_recipes")] | |||||
public class DeviceRecipeEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 设备Id | |||||
/// </summary> | |||||
public string DeviceId { get; set; } | |||||
/// <summary> | |||||
/// 配方Id | |||||
/// </summary> | |||||
public string RecipesId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :码表数据 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/9 9:47:53 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("dict_data")] | |||||
public class DictDataEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 类型id | |||||
/// </summary> | |||||
public string TypeId { get; set; } | |||||
/// <summary> | |||||
/// 值 | |||||
/// </summary> | |||||
public string Value { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 排序 | |||||
/// </summary> | |||||
public int Sort { get; set; } | |||||
/// <summary> | |||||
/// 添加时间 | |||||
/// </summary> | |||||
public DateTime CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :数据码表 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/9 9:48:05 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("dict_type")] | |||||
public class DictTypeEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 排序 | |||||
/// </summary> | |||||
public int Sort { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :分组信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/10 14:01:15 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("group_info")] | |||||
public class GroupInfoEntity: DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 介绍 | |||||
/// </summary> | |||||
public string Des { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/24 17:28:56 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("mqtt")] | |||||
public class MQTTInfoEntity | |||||
{ | |||||
/// <summary> | |||||
/// 地址 | |||||
/// </summary> | |||||
public string Address { get; set; } | |||||
/// <summary> | |||||
/// 密码 | |||||
/// </summary> | |||||
public string Pwd { get; set; } | |||||
/// <summary> | |||||
/// 账号 | |||||
/// </summary> | |||||
public string Account { get; set; } | |||||
/// <summary> | |||||
/// 消息发布路由 4.0和5.0不一样 | |||||
/// </summary> | |||||
public string MsgPublishRoute { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,31 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :操作日志 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/7/20 15:10:59 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("oper_log")] | |||||
public class OperLogEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 操作标题 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 内容 | |||||
/// </summary> | |||||
public string Context { get; set; } | |||||
/// <summary> | |||||
/// 返回值 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Result { get; set; } | |||||
/// <summary> | |||||
/// 创建时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime? CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,13 @@ | |||||
namespace BPA.MES.Base.Application.Entitys.Base | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :订单服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/18 18:11:48 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class OrderInfoEntity | |||||
{ | |||||
} | |||||
} |
@@ -0,0 +1,25 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/18 10:42:35 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("product_line")] | |||||
public class ProductLineEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 产线名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 产线编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 产线描述 | |||||
/// </summary> | |||||
public string Describe { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :配方物料信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/2 13:58:19 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("recipes_material")] | |||||
public class RecipeMaterialEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 物料Id | |||||
/// </summary> | |||||
public string MaterialId { get; set; } | |||||
/// <summary> | |||||
/// 配方Id | |||||
/// </summary> | |||||
public string RecipesId { get; set; } | |||||
/// <summary> | |||||
/// 重量 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Weight { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Describe { get; set; } | |||||
/// <summary> | |||||
/// 误差 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string ErrorWeight { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :配方分组 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/10 14:56:03 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("recipes_group")] | |||||
public class RecipesGroupEntity | |||||
{ | |||||
/// <summary> | |||||
/// 组Id | |||||
/// </summary> | |||||
public string GroupId { get; set; } | |||||
/// <summary> | |||||
/// 产品Id | |||||
/// </summary> | |||||
public string RecipesId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :配方信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/2 13:57:15 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("recipes_info")] | |||||
public class RecipesInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 自定义编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :店铺信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/2 13:52:13 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("store_info")] | |||||
public class StoreInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "名称不能为空")] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 地址 | |||||
/// </summary> | |||||
public string Address { get; set; } | |||||
/// <summary> | |||||
/// 联系电话 | |||||
/// </summary> | |||||
public string Phone { get; set; } | |||||
/// <summary> | |||||
/// 负责人 | |||||
/// </summary> | |||||
public string Directors { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,27 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.KepData | |||||
{ | |||||
[SugarTable("DataVAlarmLog")] | |||||
public class AlarmLog: DEntityBase | |||||
{ | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 当前值 | |||||
/// </summary> | |||||
public string Value { get; set; } | |||||
/// <summary> | |||||
/// 报警信息 | |||||
/// </summary> | |||||
public string ValueStr{ get; set; } | |||||
public DateTime CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.KepData | |||||
{ | |||||
/// <summary> | |||||
/// 大屏报警限制 | |||||
/// </summary> | |||||
[SugarTable("DataVAlarmLimit")] | |||||
public class DataVAlarmLimit: DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 限制名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 最小限制值 | |||||
/// </summary> | |||||
public decimal MinLimitValue { get; set; } | |||||
/// <summary> | |||||
/// 最大限制值 | |||||
/// </summary> | |||||
public decimal MaxLimitValue { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.KepData | |||||
{ | |||||
// [SugarTable("ch1_device1")] | |||||
public class ch1_device1 | |||||
{ | |||||
[SugarColumn(IsPrimaryKey = true)] | |||||
public int id { get; set; } | |||||
public string _NAME { get; set; } | |||||
public int _NUMERICID { get; set; } | |||||
public string _VALUE { get; set; } | |||||
public DateTime _TIMESTAMP { get; set; } | |||||
public int _QUALITY { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,54 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :报警日志 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/21 10:17:57 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("alarm")] | |||||
public class AlarmLogEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 报警信息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string MsgInfo { get; set; } | |||||
/// <summary> | |||||
/// 报警值 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Value { get; set; } | |||||
/// <summary> | |||||
/// 报警等级 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Grade { get; set; } | |||||
/// <summary> | |||||
/// 设备名称 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string DeviceName { get; set; } | |||||
/// <summary> | |||||
/// 日期 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Date { get; set; } | |||||
/// <summary> | |||||
/// 时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Time { get; set; } | |||||
/// <summary> | |||||
/// 创建时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime CreateDate { get; set; } | |||||
/// <summary> | |||||
/// 类型 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string LogType { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :程序日志 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/21 10:18:13 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("programlog")] | |||||
public class ProgramLogEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 日志类型 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true, ColumnDataType = "varchar",Length = 200)] | |||||
public string LogType { get; set; } | |||||
/// <summary> | |||||
/// 日志消息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||||
public string MsgInfo { get; set; } | |||||
/// <summary> | |||||
/// 日期 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Date { get; set; } | |||||
/// <summary> | |||||
/// 时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Time { get; set; } | |||||
/// <summary> | |||||
/// 日志消息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime CreateDate { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,45 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :运行日志 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/21 10:18:34 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SplitTable(SplitType.Month)] | |||||
//[SugarTable("runlog_{year}{month}{day}")] | |||||
[SugarTable("runlog")] | |||||
public class RunLogEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 日志类别 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string LogType { get; set; } | |||||
/// <summary> | |||||
/// 日志消息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true, ColumnDataType = "longtext")] | |||||
public string MsgInfo { get; set; } | |||||
/// <summary> | |||||
/// 日期 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Date { get; set; } | |||||
/// <summary> | |||||
/// 时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Time { get; set; } | |||||
/// <summary> | |||||
/// 日志消息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true),SplitField] | |||||
public DateTime CreateDate { get; set; } | |||||
/// <summary> | |||||
/// 更新时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)]//设置为可空字段 | |||||
public DateTime UpdateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :用户日志 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/21 10:18:50 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("user_log")] | |||||
public class UserLogEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 权限 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string Permission { get; set; } | |||||
/// <summary> | |||||
/// 用户名 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string UserName { get; set; } | |||||
/// <summary> | |||||
/// 日志消息 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public string MsgInfo { get; set; } | |||||
/// <summary> | |||||
/// 日志时间 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public DateTime CreateDate { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,24 @@ | |||||
using BPA.MES.Base.Application.Const; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.Order | |||||
{ | |||||
[SugarTable("order")] | |||||
public class OrderEntity: DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 状态 | |||||
/// </summary> | |||||
public OrderStatusEnum Status { get; set; } | |||||
public DateTime CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.Order | |||||
{ | |||||
[SugarTable("order_info")] | |||||
public class OrderInfoEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 订单ID | |||||
/// </summary> | |||||
public string OrderId { get; set; } | |||||
/// <summary> | |||||
/// 成品Id | |||||
/// </summary> | |||||
public string FinalslId { get; set; } | |||||
/// <summary> | |||||
/// 数量 | |||||
/// </summary> | |||||
public decimal Number { get; set; } | |||||
public DateTime CreateTime { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Entitys.Order | |||||
{ | |||||
/// <summary> | |||||
/// 订单关联工单 | |||||
/// </summary> | |||||
[SugarTable("order_work")] | |||||
public class OrderWorkEntity: DEntityBase | |||||
{ | |||||
public string OrderId { get; set; } | |||||
public string WorkId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
| |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :账户信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/1/3 10:18:43 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("sys_account")] | |||||
public class AccountEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 账号 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public string Account { get; set; } | |||||
/// <summary> | |||||
/// 密码 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public string Pwd { get; set; } | |||||
/// <summary> | |||||
/// 员工表Id | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public string EmployeeId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,38 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :员工信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/1/4 17:44:31 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("sys_employee")] | |||||
public class EmployeeEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 员工姓名 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 1男2女 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = true)] | |||||
public int Gender { get; set; } | |||||
/// <summary> | |||||
/// 1启用 2禁用 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public int Status { get; set; } | |||||
/// <summary> | |||||
/// 超管 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable = false)] | |||||
public bool IsAdmin { get; set; } | |||||
/// <summary> | |||||
/// 角色Id | |||||
/// </summary> | |||||
public string RoleId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,46 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :模块菜单表 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/1/4 17:32:15 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("sys_module")] | |||||
public class ModuleEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 类别 1:菜单,2:视图,3:功能 | |||||
/// </summary> | |||||
public int Category { get; set; } | |||||
/// <summary> | |||||
/// 菜单打开方式 0:框架内嵌,1:新开页面 | |||||
/// </summary> | |||||
public int OpenType { get; set; } | |||||
/// <summary> | |||||
/// 父级编号 | |||||
/// </summary> | |||||
public string ParentId { get; set; } | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { set; get; } | |||||
/// <summary> | |||||
/// 图标 | |||||
/// </summary> | |||||
public string Icon { set; get; } | |||||
/// <summary> | |||||
/// 地址 | |||||
/// </summary> | |||||
public string Url { set; get; } | |||||
/// <summary> | |||||
/// 状态 | |||||
/// </summary> | |||||
public bool IsDisabled { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,32 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :角色信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/1/4 17:32:32 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("sys_role")] | |||||
public class RoleEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 角色名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 角色类型 1超级管理员,2其他 | |||||
/// </summary> | |||||
public int? RoleType { get; set; } | |||||
/// <summary> | |||||
/// 角色描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 是否删除 | |||||
/// </summary> | |||||
public bool IsDeleted { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
namespace BPA.MES.Base.Application.Entitys | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :角色权限表 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/31 15:56:02 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[SugarTable("sys_role_module")] | |||||
public class RoleModuleEntity : DEntityBase | |||||
{ | |||||
/// <summary> | |||||
/// 角色Id | |||||
/// </summary> | |||||
public string RoleId { get; set; } | |||||
/// <summary> | |||||
/// 模块Id | |||||
/// </summary> | |||||
public string ModuleId { get; set; } | |||||
/// <summary> | |||||
/// 父级模块 | |||||
/// </summary> | |||||
[SugarColumn(IsNullable =true)] | |||||
public string ParentId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,39 @@ | |||||
using BPA.MES.Base.Application.Services; | |||||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||||
using Furion.JsonSerialization; | |||||
using Microsoft.AspNetCore.Mvc.Filters; | |||||
using System.Diagnostics; | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
public class AGVAttribute : ActionFilterAttribute | |||||
{ | |||||
/// <summary> | |||||
/// 执行操作前后 | |||||
/// </summary> | |||||
/// <param name="context"></param> | |||||
/// <param name="next"></param> | |||||
/// <returns></returns> | |||||
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) | |||||
{ | |||||
// 获取 HttpContext 和 HttpRequest 对象 | |||||
var httpContext = context.HttpContext; | |||||
var httpRequest = httpContext.Request; | |||||
var sw = new Stopwatch(); | |||||
sw.Start(); | |||||
var actionContext = await next(); | |||||
sw.Stop(); | |||||
var server = App.GetService<IAGVThirdPartyService>(); | |||||
var contentstring = JSON.Serialize(context.ActionArguments["input"]); | |||||
AGVLoadAndUnloadRequest input = JSON.Deserialize<AGVLoadAndUnloadRequest>(contentstring); | |||||
Roller_JobRequest roller_Job = new() | |||||
{ | |||||
AgvCode = input.Body.Event.agvCode, | |||||
Complete = true, | |||||
JobId = input.Body.Event.jobId, | |||||
MsgId = input.Body.Event.msgId | |||||
}; | |||||
await server.RollerJobExecute(roller_Job); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,46 @@ | |||||
using Furion.EventBus; | |||||
using Furion.JsonSerialization; | |||||
using Microsoft.AspNetCore.Mvc.Filters; | |||||
using System.Diagnostics; | |||||
using System.Security.Claims; | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :接口AOP | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/20 15:04:06 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class OperLogAttribute : ActionFilterAttribute | |||||
{ | |||||
public string _name; | |||||
public OperLogAttribute(string name) | |||||
{ | |||||
_name = name; | |||||
} | |||||
/// <summary> | |||||
/// 执行操作前后 | |||||
/// </summary> | |||||
/// <param name="context"></param> | |||||
/// <param name="next"></param> | |||||
/// <returns></returns> | |||||
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) | |||||
{ | |||||
// 获取 HttpContext 和 HttpRequest 对象 | |||||
var httpContext = context.HttpContext; | |||||
var httpRequest = httpContext.Request; | |||||
var sw = new Stopwatch(); | |||||
sw.Start(); | |||||
var actionContext = await next(); | |||||
sw.Stop(); | |||||
var userName = httpContext.User?.FindFirstValue(ClaimConst.CLAINM_NAME); | |||||
await MessageCenter.PublishAsync("ToDo:OperLog", new OperLogEntity() | |||||
{ | |||||
Context = context.ActionArguments.Count < 1 ? string.Empty : JSON.Serialize(context.ActionArguments), | |||||
Name = $"[{userName}]{_name}", | |||||
Result = actionContext.Exception == null? "true" : EnhancedStackTrace.Current().ToString() | |||||
}); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
global using Furion; | |||||
global using Furion.DataEncryption; | |||||
global using Furion.DataValidation; | |||||
global using Furion.DependencyInjection; | |||||
global using Furion.DynamicApiController; | |||||
global using Furion.Extensions; | |||||
global using Furion.FriendlyException; | |||||
global using Furion.Logging; | |||||
global using Mapster; | |||||
global using Microsoft.AspNetCore.Authorization; | |||||
global using Microsoft.AspNetCore.Http; | |||||
global using Microsoft.AspNetCore.Mvc; | |||||
global using Microsoft.CodeAnalysis; | |||||
global using BPA.MES.Base.Core; | |||||
global using static BPA.MES.Base.Core.TreeExtensions; | |||||
global using System.ComponentModel.DataAnnotations; | |||||
global using BPA.MES.Base.Application.Entitys; | |||||
global using Furion.DataEncryption.Extensions; | |||||
global using SqlSugar; |
@@ -0,0 +1,21 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :MQTT消息基类 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/21 10:24:24 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IMessage | |||||
{ | |||||
/// <summary> | |||||
/// 消息ID | |||||
/// </summary> | |||||
public int MessageId { get; set; } | |||||
/// <summary> | |||||
/// 消息版本 | |||||
/// </summary> | |||||
public Version MsgVersion { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,145 @@ | |||||
using Furion.JsonSerialization; | |||||
using Furion.RemoteRequest.Extensions; | |||||
using Newtonsoft.Json; | |||||
using System.Text; | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :MQTT通信库 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2022/11/18 15:38:40 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class MQTTService : IMQTTService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
ISysCacheService _sysCacheService; | |||||
public MQTTService(ISqlSugarClient db, ISysCacheService sysCacheService) | |||||
{ | |||||
_dbContext = db; | |||||
_sysCacheService = sysCacheService; | |||||
} | |||||
public async Task GetMQTTConfig() | |||||
{ | |||||
var entity = await _dbContext.Queryable<MQTTInfoEntity>().FirstAsync(); | |||||
if (entity != null) | |||||
{ | |||||
MQTTConfig.Address = entity.Address; | |||||
MQTTConfig.Account = entity.Account; | |||||
MQTTConfig.Pwd = entity.Pwd; | |||||
await _sysCacheService.SetAsync("mqtt", entity); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// Mqtt通用服务 | |||||
/// </summary> | |||||
public async Task<bool> MqttPublish(MqttPublishDto input) | |||||
{ | |||||
bool result = false; | |||||
MQTTInfoEntity mqttentity = new(); | |||||
mqttentity = await _sysCacheService.GetAsync<MQTTInfoEntity>("mqtt"); | |||||
if (mqttentity==null) | |||||
{ | |||||
mqttentity = await _dbContext.Queryable<MQTTInfoEntity>().FirstAsync(); | |||||
await _sysCacheService.SetAsync("mqtt", mqttentity); | |||||
} | |||||
try | |||||
{ | |||||
input.Payload.MessageId = input.MessageId; | |||||
input.Payload.MsgVersion = new Version(1, 0, 0, 0); | |||||
MsgPackage mp = new() | |||||
{ | |||||
Message = input.Payload, | |||||
MessageLen = JSON.Serialize(input.Payload).Length | |||||
}; | |||||
//组装MQTT消息 | |||||
var tem = await $"http://{mqttentity.Address}{mqttentity.MsgPublishRoute}".SetHeaders(new | |||||
{ | |||||
Authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{mqttentity.Account}:{mqttentity.Pwd}")) | |||||
}).SetBody(new | |||||
{ | |||||
input.Topic, | |||||
payload = JsonConvert.SerializeObject(mp), | |||||
qos = 2, | |||||
retain = false, | |||||
clientid = "pztj_service" | |||||
}).PostAsStringAsync(); | |||||
var res = JSON.Deserialize<MqttResult>(tem); | |||||
if (res.Code == 0 || res.Reason_code<100 || !string.IsNullOrEmpty(res.Id)) | |||||
{ | |||||
result = true; | |||||
} | |||||
Console.WriteLine($"_____________________MQTT发消息:{JsonConvert.SerializeObject(mp)}"); | |||||
} | |||||
catch | |||||
{ | |||||
} | |||||
return result; | |||||
} | |||||
[AllowAnonymous] | |||||
public async Task<bool> MqttTestPublish(string topic, string msg) | |||||
{ | |||||
bool result = false; | |||||
var mqttentity = await _dbContext.Queryable<MQTTInfoEntity>().FirstAsync(); | |||||
string mqttAddress = mqttentity.Address; | |||||
try | |||||
{ | |||||
//组装MQTT消息 | |||||
var tem = await $"http://{mqttAddress}/api/v5/publish".SetHeaders(new | |||||
{ | |||||
Authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{mqttentity.Account}:{mqttentity.Pwd}")) | |||||
}).SetBody(new | |||||
{ | |||||
topic, | |||||
payload = msg, | |||||
qos = 2, | |||||
retain = false, | |||||
clientid = "pztj_service" | |||||
}).PostAsStringAsync(); | |||||
var res = JSON.Deserialize<MqttResult>(tem); | |||||
if (res.Code == 0 || res.Reason_code < 100 || !string.IsNullOrEmpty(res.Id)) | |||||
{ | |||||
result = true; | |||||
} | |||||
} | |||||
catch | |||||
{ | |||||
} | |||||
return result; | |||||
} | |||||
} | |||||
public class MqttResult | |||||
{ | |||||
/// <summary> | |||||
/// code | |||||
/// </summary> | |||||
public int Code { get; set; } | |||||
/// <summary> | |||||
/// reason_code | |||||
/// </summary> | |||||
public int Reason_code { get; set; } | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
public class MqttPublishDto | |||||
{ | |||||
public IMessage Payload { get; set; } | |||||
public string Topic { get; set; } | |||||
public int MessageId { get; set; } | |||||
} | |||||
public interface IMQTTService | |||||
{ | |||||
Task<bool> MqttPublish(MqttPublishDto input); | |||||
Task GetMQTTConfig(); | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
public class MessageID | |||||
{ | |||||
public const int DevcieControl = 1;//设备控制ID | |||||
public const int WorkOrderIssued = 2;//工单下发ID | |||||
public const int DeviceData = 3;//设备上报数据 | |||||
public const int TaskState = 4;//AGV任务状态上报 | |||||
public const int LoadAndUnload = 8;//AGV上下料上报 | |||||
public const int PowerId = 12;// 权限验证 | |||||
public const int StateChange = 13;//状态改变 | |||||
} | |||||
} | |||||
@@ -0,0 +1,18 @@ | |||||
using Newtonsoft.Json; | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
public class MsgPackage | |||||
{ | |||||
/// <summary> | |||||
/// 消息内容 | |||||
/// </summary> | |||||
[JsonProperty(TypeNameHandling = TypeNameHandling.Auto)] | |||||
public IMessage Message { get; set; } | |||||
/// <summary> | |||||
/// 消息长度 | |||||
/// </summary> | |||||
public int MessageLen { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
namespace BPA.MES.Base.Application | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2022/11/18 15:37:07 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class Topics | |||||
{ | |||||
/// <summary> | |||||
/// 设备控制主题,前端通过消息控制设备动作(客户端/前端 --> 设备) | |||||
/// </summary> | |||||
public const string DeviceControl = "BPAProline/Client/Device/Control"; | |||||
/// <summary> | |||||
/// 工单推送主题,中控将创建的工单推送到对应的产线 (中控系统 --> 产线) | |||||
/// </summary> | |||||
public const string WorkOrderPush = "BPAPROLINE/MES/SERVER/WORKORDER/DOWN"; | |||||
/// <summary> | |||||
/// 前端展示数据推送,数据服务将设备数据推送到前端界面展示 (数据中心服务 --> 客户端/前端) | |||||
/// </summary> | |||||
public const string DeviceDataPush = "BPAProline/DataServer/Client/Data"; | |||||
/// <summary> | |||||
/// 工单状态(信息系统 --> 中控系统) | |||||
/// </summary> | |||||
public const string STWorkState = "BPAProline/CentralControl/Proline/WorkState"; | |||||
/// <summary> | |||||
/// 任务下发成功 回调 | |||||
/// </summary> | |||||
public const string ExecuteReplyTopic = "robotjob.report"; | |||||
/// <summary> | |||||
/// 上下料回调 | |||||
/// </summary> | |||||
public const string LoadAndUnloadTopic = "rollerjob.upstreamrequest"; | |||||
} | |||||
} |
@@ -0,0 +1,473 @@ | |||||
using BPA.AGV; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPA.MES.Base.Application.Services.AGVService.Dtos | |||||
{ | |||||
public class Roller_JobRequest | |||||
{ | |||||
public string Url { get; set; } | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
public string AgvCode { get; set; } | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
public string JobId { get; set; } | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
public string MsgId { get; set; } | |||||
public bool? Complete { get; set; } | |||||
} | |||||
public class AGVExecuteReplyRequest | |||||
{ | |||||
public AgvHeader Header { get; set; } | |||||
public AgvReplyBody Body { get; set; } | |||||
} | |||||
public class AgvReplyBody | |||||
{ | |||||
public AGVExecuteReplyDto Event { get; set; } | |||||
} | |||||
public class AGVExecuteReplyMQTT: IMessage | |||||
{ | |||||
public AGVExecuteReplyDto Event { get; set; } | |||||
public int MessageId { get; set; } | |||||
public Version MsgVersion { get; set; } | |||||
} | |||||
public class AGVLoadAndUnloadRequest | |||||
{ | |||||
public AgvHeader Header { get; set; } | |||||
public AGVLoadAndUnloadBody Body { get; set; } | |||||
} | |||||
public class AGVLoadAndUnloadBody | |||||
{ | |||||
public AGVLoadAndUnloadDto Event { get; set; } | |||||
} | |||||
public class AGVLoadAndUnloadMQTT : IMessage | |||||
{ | |||||
public AGVLoadAndUnloadDto Event { get; set; } | |||||
public int MessageId { get; set; } | |||||
public Version MsgVersion { get; set; } | |||||
} | |||||
public class AgvBody | |||||
{ | |||||
public AgvHeader Header { get; set; } | |||||
public AgvRetrun Body { get; set; } | |||||
} | |||||
public class AgvHeader | |||||
{ | |||||
public string RequestId { get; set; } | |||||
public string Timestamp { get; set; } | |||||
public string Version { get; set; } | |||||
} | |||||
public class AgvRetrun | |||||
{ | |||||
public string Code { get; set; } | |||||
public bool Success { get; set; } | |||||
public string Message { get; set; } | |||||
public object? Data { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 任务完成回报Dto | |||||
/// </summary> | |||||
public class AGVExecuteReplyDto | |||||
{ | |||||
/// <summary> | |||||
/// 上游系统任务号,全局唯一 | |||||
/// </summary> | |||||
public string robotJobId { get; set; } | |||||
/// <summary> | |||||
/// 仓库编号 | |||||
/// </summary> | |||||
public long warehouseId { get; set; } | |||||
/// <summary> | |||||
/// 任务快仓系统编号 | |||||
/// </summary> | |||||
public string jobId { get; set; } | |||||
/// <summary> | |||||
/// 任务状态 | |||||
/// </summary> | |||||
public string state { get; set; } | |||||
/// <summary> | |||||
/// 内部任务类型 | |||||
/// </summary> | |||||
public string jobType { get; set; } | |||||
/// <summary> | |||||
/// 数据字段 | |||||
/// </summary> | |||||
public PointToPoint jobData { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 上下料交互请求DTO | |||||
/// </summary> | |||||
public class AGVLoadAndUnloadDto | |||||
{ | |||||
/// <summary> | |||||
/// AGV编号 | |||||
/// </summary> | |||||
public string agvCode { get; set; } | |||||
/// <summary> | |||||
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔 | |||||
/// </summary> | |||||
public string containerCode { get; set; } | |||||
/// <summary> | |||||
/// 上游设备ID | |||||
/// </summary> | |||||
public long equipmentId { get; set; } | |||||
/// <summary> | |||||
/// 上游设备ID,多个用英文逗号分隔 | |||||
/// </summary> | |||||
public string equipmentIds { get; set; } | |||||
/// <summary> | |||||
/// 快仓任务编号 | |||||
/// </summary> | |||||
public string jobId { get; set; } | |||||
/// <summary> | |||||
/// 消息ID | |||||
/// </summary> | |||||
public string msgId { get; set; } | |||||
/// <summary> | |||||
/// 交互阶段LOAD:上料阶段 UNLOAD:下料阶段 | |||||
/// </summary> | |||||
public string command { get; set; } | |||||
/// <summary> | |||||
/// 上游任务号 | |||||
/// </summary> | |||||
public string robotJobId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 货到货 | |||||
/// </summary> | |||||
public class GoodsToGoods | |||||
{ | |||||
/// <summary> | |||||
/// AGV编号 | |||||
/// </summary> | |||||
public string agvCode { get; set; } | |||||
/// <summary> | |||||
/// 容器编号 | |||||
/// </summary> | |||||
public string containerCode { get; set; } | |||||
/// <summary> | |||||
/// 上料点位 | |||||
/// </summary> | |||||
public string startPointCode { get; set; } | |||||
/// <summary> | |||||
/// 上料货位编号 | |||||
/// </summary> | |||||
public string startSlotCode { get; set; } | |||||
/// <summary> | |||||
/// 下料点位 | |||||
/// </summary> | |||||
public string targetPointCode { get; set; } | |||||
/// <summary> | |||||
/// 下料货位编号 | |||||
/// </summary> | |||||
public string targetSlotCode { get; set; } | |||||
/// <summary> | |||||
/// 是否需要上料交互 | |||||
/// </summary> | |||||
public bool loadInteractive { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 点到点 | |||||
/// </summary> | |||||
public class PointToPoint | |||||
{ | |||||
/// <summary> | |||||
/// AGV编号 | |||||
/// </summary> | |||||
public string agvCode { get; set; } | |||||
/// <summary> | |||||
/// 容器编号 | |||||
/// </summary> | |||||
public string containerCode { get; set; } | |||||
/// <summary> | |||||
/// 上料点位 | |||||
/// </summary> | |||||
public string startPointCode { get; set; } | |||||
/// <summary> | |||||
/// 下料点位 | |||||
/// </summary> | |||||
public string targetPointCode { get; set; } | |||||
/// <summary> | |||||
/// 是否需要上料交互 | |||||
/// </summary> | |||||
public bool loadInteractive { get; set; } | |||||
} | |||||
public enum AGVState | |||||
{ | |||||
//任务状态: | |||||
//1)货架/货位/点到点货架搬运任务枚举: | |||||
//LIFT_UP_DONE:顶升完成 | |||||
//MOVE_BEGIN:开始移动 | |||||
//PUT_DOWN_DONE:放下完成 | |||||
//DONE:任务完成 | |||||
//CANCEL:任务取消 | |||||
//ABNORMAL_CANCEL:任务异常取消 | |||||
//ABNORMAL_COMPLETED:任务异常完成 | |||||
//2)货位到货位/点到点辊筒料箱搬运任务枚举: | |||||
//ROLLER_LOAD_DOING:正在上料 | |||||
//ROLLER_LOAD_FINISH:上料完成 | |||||
//ROLLER_UNLOAD_DOING:正在下料 | |||||
//DONE:下料完成 | |||||
//ABNORMAL_CANCEL:任务异常取消 | |||||
//ABNORMAL_COMPLETED:任务异常完成 | |||||
//3)AGV移动任务枚举: | |||||
//DONE:任务完成 | |||||
//CANCEL:任务取消 | |||||
//ABNORMAL_CANCEL:任务异常取消 | |||||
//ABNORMAL_COMPLETED:任务异常完成 | |||||
//4) 纯料箱任务枚举: | |||||
//MOVE_BEGIN:开始移动(仅单插臂或单夹报,2.8.1后) | |||||
//ENTER_STATION:到站 | |||||
//DONE:任务完成 | |||||
//LOAD_COMPLETED:取料完成 | |||||
//UNLOAD_COMPLETED:放料完成 | |||||
//ABNORMAL_CANCEL:任务异常取消ABNORMAL_COMPLETED:任务异常完成 | |||||
//5) 小皮带任务枚举: | |||||
//DONE:任务完成 | |||||
//6) QuickPick任务枚举: | |||||
//ENTER_STATION:到站 | |||||
//DONE:任务完成 | |||||
//CANCEL:任务取消 | |||||
//LEAVE_STATION离站 | |||||
//ROLLBACK 回滚(有其他任务,当前任务可不执行) | |||||
/// <summary> | |||||
/// 顶升完成 | |||||
/// </summary> | |||||
LIFT_UP_DONE = 1, | |||||
/// <summary> | |||||
/// 开始移动 | |||||
/// </summary> | |||||
MOVE_BEGIN = 2, | |||||
/// <summary> | |||||
/// 放下完成 | |||||
/// </summary> | |||||
PUT_DOWN_DONE = 3, | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE = 4, | |||||
/// <summary> | |||||
/// 任务取消 | |||||
/// </summary> | |||||
CANCEL = 5, | |||||
/// <summary> | |||||
/// 任务异常取消 | |||||
/// </summary> | |||||
ABNORMAL_CANCEL = 6, | |||||
/// <summary> | |||||
/// 任务异常完成 | |||||
/// </summary> | |||||
ABNORMAL_COMPLETED = 7 | |||||
} | |||||
public enum jobType | |||||
{ | |||||
/// <summary> | |||||
/// 1) 辊筒货位到货位搬运 | |||||
/// </summary> | |||||
SLOT_ROLLER_MOVE = 1, | |||||
POINT_ROLLER_MOVE=2 | |||||
} | |||||
public class KC_Response | |||||
{ | |||||
public KC_Response() | |||||
{ | |||||
Data = new(); | |||||
} | |||||
/// <summary> | |||||
/// 是否成功 | |||||
/// </summary> | |||||
public bool Success { get; set; } | |||||
/// <summary> | |||||
/// 状态码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 消息 | |||||
/// </summary> | |||||
public string Message { get; set; } | |||||
/// <summary> | |||||
/// 返回数据数组 | |||||
/// </summary> | |||||
public List<KC_Response_Data> Data { get; set; } | |||||
} | |||||
public class KC_Response_Data | |||||
{ | |||||
/// <summary> | |||||
/// 状态码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 消息体 | |||||
/// </summary> | |||||
public string Message { get; set; } | |||||
/// <summary> | |||||
/// 任务编号 | |||||
/// </summary> | |||||
public string RobotJobId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// AGV请求 | |||||
/// </summary> | |||||
public class KC_ExecuteRequest | |||||
{ | |||||
/// <summary> | |||||
/// 快仓api地址 | |||||
/// </summary> | |||||
public string Url { get; set; } | |||||
/// <summary> | |||||
/// 任务编码 | |||||
/// </summary> | |||||
public string RobotJobId { get; set; } | |||||
/// <summary> | |||||
/// 仓库编码 默认值1 | |||||
/// </summary> | |||||
public long WarehouseId { get; set; } = 1; | |||||
public string RobotJobGroupId { get; set; } | |||||
public int? Sequence { get; set; } | |||||
public string RobotJobGroupNum { get; set; } | |||||
/// <summary> | |||||
/// 优先级 0-99 越高越先执行 | |||||
/// </summary> | |||||
public int? JobPriority { get; set; } | |||||
public int? JobPriorityType { get; set; } | |||||
public string Deadline { get; set; } | |||||
public string AgvType { get; set; } | |||||
public string AgvEndPoint { get; set; } | |||||
public bool NeedOperation { get; set; } | |||||
public string AgvCode { get; set; } | |||||
public int? TaskCountDown { get; set; } = 0; | |||||
public string BusinessType { get; set; } | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
//任务类型 用来滚筒点对点 POINT_ROLLER_MOVE n8H7jX | |||||
public string JobType { get; set; } = "POINT_ROLLER_MOVE"; | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
public KC_JobDataRequest? JobData { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 任务下发起止点信息 | |||||
/// </summary> | |||||
public class KC_JobDataRequest | |||||
{ | |||||
/// <summary> | |||||
/// 用户自定义信息编号 | |||||
/// </summary> | |||||
public string ContainerCode { get; set; } | |||||
/// <summary> | |||||
/// 起点点位 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
public string StartPoint { get; set; } | |||||
/// <summary> | |||||
/// 终点点位 | |||||
/// </summary> | |||||
[Required(ErrorMessage = "[{0}]不能为空")] | |||||
[MaxLength(64, ErrorMessage = "[{0}]不能超过64字符")] | |||||
public string EndPoint { get; set; } | |||||
/// <summary> | |||||
/// 上料方式 自动/人工 | |||||
/// </summary> | |||||
public bool? AutoLoad { get; set; } | |||||
/// <summary> | |||||
/// 上料交互方式 //接口对接 false | |||||
/// </summary> | |||||
public bool? EnableIOLoad { get; set; } = false; | |||||
/// <summary> | |||||
/// 下料方式 true自动/false人工 | |||||
/// </summary> | |||||
public bool? AutoUnload { get; set; } | |||||
/// <summary> | |||||
/// 接口对接 false | |||||
/// </summary> | |||||
public bool? EnableIOUnload { get; set; } = false; | |||||
/// <summary> | |||||
/// 起点设备ID | |||||
/// </summary> | |||||
public long LoadEquipmentId { get; set; } | |||||
/// <summary> | |||||
/// 目标设备ID | |||||
/// </summary> | |||||
public long UnloadEquipmentId { get; set; } | |||||
public long LoadInteractive { get; set; } | |||||
public long LoadHeight { get; set; } | |||||
public long UnloadHeight { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,95 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 9:59:47 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class AgvLineDto | |||||
{ | |||||
/// <summary> | |||||
/// 自定义编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 线路名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 开始点位 | |||||
/// </summary> | |||||
public string StartPointId { get; set; } | |||||
/// <summary> | |||||
/// 结束点位 | |||||
/// </summary> | |||||
public string EndPointId { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class AgvLineAddInput : AgvLineDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 修改 | |||||
/// </summary> | |||||
public class AgvLineUpdateInput : AgvLineDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 刪除 | |||||
/// </summary> | |||||
public class AgvLineDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 普通查询条件 | |||||
/// </summary> | |||||
public class AgvLineQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页查询条件 | |||||
/// </summary> | |||||
public class AgvLineQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class AgvLineOutput : AgvLineDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
//下面增加多的数据 | |||||
} | |||||
} |
@@ -0,0 +1,83 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 10:00:01 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class AgvPointDto | |||||
{ | |||||
/// <summary> | |||||
/// 点位名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 点位编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class AgvPointAddInput : AgvPointDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 修改 | |||||
/// </summary> | |||||
public class AgvPointUpdateInput : AgvPointDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 刪除 | |||||
/// </summary> | |||||
public class AgvPointDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 普通查询条件 | |||||
/// </summary> | |||||
public class AgvPointQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页查询条件 | |||||
/// </summary> | |||||
public class AgvPointQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class AgvPointOutput : AgvPointDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
//下面增加多的数据 | |||||
} | |||||
} |
@@ -0,0 +1,170 @@ | |||||
using BPA.AGV; | |||||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||||
using Furion.EventBus; | |||||
using Furion.JsonSerialization; | |||||
using Furion.RemoteRequest.Extensions; | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// AGV第三方api | |||||
/// </summary> | |||||
[AllowAnonymous, NonUnify] | |||||
[ApiDescriptionSettings("AGV管理", Name = "AgvThirdParty", Tag = "AGV第三方api", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class AGVThirdPartyService : IAGVThirdPartyService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly AGVHandler _aGVHandler; | |||||
private readonly IMQTTService _MQTTService; | |||||
public AGVThirdPartyService(AGVHandler aGVHandler, IMQTTService MQTTService) | |||||
{ | |||||
_aGVHandler = aGVHandler; | |||||
_MQTTService = MQTTService; | |||||
} | |||||
/// <summary> | |||||
/// 下发任务 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<KC_Response> Execute(KC_ExecuteRequest input) | |||||
{ | |||||
List<KC_ExecuteRequest> cExecuteRequests = new(); | |||||
if (string.IsNullOrEmpty(input.RobotJobId)) | |||||
{ | |||||
throw Oops.Bah("任务编号不能为空"); | |||||
} | |||||
if (input.JobData != null) | |||||
input = new KC_ExecuteRequest | |||||
{ | |||||
Url = string.IsNullOrEmpty(input.Url) ? App.GetConfig<string>("AGVUrl")+"/api/quicktron/wcs/standardized.robot.job.submit": input.Url + "/api/quicktron/wcs/standardized.robot.job.submit", | |||||
RobotJobId = input.RobotJobId,//任务号 | |||||
WarehouseId = input.WarehouseId,//仓库编码 默认值1 | |||||
JobPriority = input.JobPriority, //优先级 0-99 越高越先执行 | |||||
JobPriorityType = input.JobPriorityType, //优先级类型 0 普通和1 强制. | |||||
JobType = input.JobType,//任务类型 用来滚筒点对点 POINT_ROLLER_MOVE n8H7jX | |||||
JobData = new KC_JobDataRequest | |||||
{ | |||||
StartPoint = input.JobData.StartPoint, //起点 | |||||
EndPoint = input.JobData.EndPoint,//终点 | |||||
ContainerCode = input.JobData.ContainerCode,//桶号 | |||||
AutoLoad = input.JobData.AutoLoad,//上料方式 自动/人工 | |||||
EnableIOLoad = input.JobData.EnableIOLoad,//上料交互方式 //接口对接 false | |||||
AutoUnload = input.JobData.AutoUnload,//下料方式 true自动/false人工 | |||||
EnableIOUnload = input.JobData.EnableIOUnload,//接口对接 false | |||||
LoadEquipmentId = input.JobData.LoadEquipmentId,//起点设备ID | |||||
UnloadEquipmentId = input.JobData.UnloadEquipmentId,//目标设备ID | |||||
} | |||||
}; | |||||
cExecuteRequests.Add(input); | |||||
try | |||||
{ | |||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{input.RobotJobId}接收到下发任务!"); | |||||
var res = await input.Url.SetBody(cExecuteRequests).PostAsStringAsync(); | |||||
return JSON.Deserialize<KC_Response>(res); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw Oops.Bah(ex.Message); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 取消任务 | |||||
/// </summary> | |||||
/// <param name="kCCancelRequest"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<KCResponse> Cancel(KCCancelRequest kCCancelRequest) | |||||
{ | |||||
kCCancelRequest.Url = string.IsNullOrEmpty(kCCancelRequest.Url) ? App.GetConfig<string>("AGVUrl") + "/api/quicktron/wcs/standardized.robot.job.cancel" : kCCancelRequest.Url + "/api/quicktron/wcs/standardized.robot.job.cancel"; | |||||
return await _aGVHandler.CancelAsync(kCCancelRequest); | |||||
} | |||||
/// <summary> | |||||
/// 上下料反馈给AGV接口 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
public async Task<RollerJobResponse> RollerJobExecute(Roller_JobRequest input) | |||||
{ | |||||
//http://[IP:Port]/api/quicktron/wcs/standardized.roller.job.upstream.response | |||||
input.Url = string.IsNullOrEmpty(input.Url) ? App.GetConfig<string>("AGVUrl") + "/api/quicktron/wcs/standardized.roller.job.upstream.response": input.Url+ "/api/quicktron/wcs/standardized.roller.job.upstream.response"; | |||||
try | |||||
{ | |||||
var res = await input.Url.SetBody(input).PostAsStringAsync(); | |||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{input.JobId}上下料反馈给AGV接口!{res}"); | |||||
return JSON.Deserialize<RollerJobResponse>(res); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
return new RollerJobResponse() { Success = false }; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 任务反馈(暴露给AGV厂商) | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<AgvBody> ExecuteReply(AGVExecuteReplyRequest input) | |||||
{ | |||||
try | |||||
{ | |||||
var data = new AGVExecuteReplyMQTT() | |||||
{ | |||||
Event = input.Body.Event, | |||||
}; | |||||
bool res = await _MQTTService.MqttPublish(new MqttPublishDto(){ Payload= data, Topic = Topics.ExecuteReplyTopic, MessageId = MessageID.TaskState }); | |||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:接收到AGV反馈请求!", res.ToString()); | |||||
AgvBody agvBody = new() | |||||
{ | |||||
Header = input.Header, | |||||
Body = new AgvRetrun { Code = "SUCCESS", Success = res, Message = "SUCCESS", Data = null } | |||||
}; | |||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:AGV反馈消息!{JSON.Serialize(agvBody)}"); | |||||
return agvBody; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
AgvBody agvBody = new() | |||||
{ | |||||
Header = input.Header, | |||||
Body = new AgvRetrun { Code = "SUCCESS", Success = false, Message = ex.Message, Data = null } | |||||
}; | |||||
return agvBody; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// AGV上下料交互请求 (暴露给AGV厂商) | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost, AGV] | |||||
public async Task<AgvBody> LoadAndUnload(AGVLoadAndUnloadRequest input) | |||||
{ | |||||
try | |||||
{ | |||||
var data = new AGVLoadAndUnloadMQTT() | |||||
{ | |||||
Event = input.Body.Event, | |||||
}; | |||||
bool res = await _MQTTService.MqttPublish(new MqttPublishDto() { Payload= data, Topic = Topics.LoadAndUnloadTopic, MessageId = MessageID.LoadAndUnload }); | |||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:接收到AGV上下料交互请求!{res.ToString()}"); | |||||
AgvBody agvBody = new() | |||||
{ | |||||
Header = input.Header, | |||||
Body = new AgvRetrun { Code = "SUCCESS", Success = res, Message = "SUCCESS", Data = null } | |||||
}; | |||||
return agvBody; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
AgvBody agvBody = new() | |||||
{ | |||||
Header = input.Header, | |||||
Body = new AgvRetrun { Code = "SUCCESS", Success = false, Message = ex.Message, Data = null } | |||||
}; | |||||
return agvBody; | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,115 @@ | |||||
namespace BPA.MES.Base.Application.Services.AGVService.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :AGV线路管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 10:03:21 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[ApiDescriptionSettings("AGV管理", Name = "AgvLine", Tag = "AGV线路", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class AgvLineService : IAgvLineService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public AgvLineService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(AgvLineAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<AgvLineEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
AgvLineEntity entity = input.Adapt<AgvLineEntity>(); | |||||
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(AgvLineDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<AgvLineEntity>().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<AgvLineOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvLineEntity>().FirstAsync(x => x.Id == Id); | |||||
AgvLineOutput output = entity.Adapt<AgvLineOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<List<AgvLineOutput>> List(AgvLineQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvLineEntity>().ToListAsync(); | |||||
List<AgvLineOutput> output = entity.Adapt<List<AgvLineOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<AgvLineOutput>> PagedList(AgvLineQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvLineEntity>() | |||||
.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); | |||||
SqlSugarPagedList<AgvLineOutput> output = entity.Adapt<SqlSugarPagedList<AgvLineOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvLineEntity>().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(AgvLineUpdateInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvLineEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<AgvLineEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,115 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :AGV点位管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 10:03:37 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[ApiDescriptionSettings("AGV管理", Name = "AgvPoint", Tag = "AGV点位", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class AgvPointService : IAgvPointService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public AgvPointService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(AgvPointAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<AgvPointEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
AgvPointEntity entity = input.Adapt<AgvPointEntity>(); | |||||
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(AgvPointDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<AgvPointEntity>().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<AgvPointOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvPointEntity>().FirstAsync(x => x.Id == Id); | |||||
AgvPointOutput output = entity.Adapt<AgvPointOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<List<AgvPointOutput>> List(AgvPointQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvPointEntity>().ToListAsync(); | |||||
List<AgvPointOutput> output = entity.Adapt<List<AgvPointOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<AgvPointOutput>> PagedList(AgvPointQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvPointEntity>() | |||||
.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); | |||||
SqlSugarPagedList<AgvPointOutput> output = entity.Adapt<SqlSugarPagedList<AgvPointOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvPointEntity>().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(AgvPointUpdateInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<AgvPointEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<AgvPointEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,40 @@ | |||||
using BPA.AGV; | |||||
using BPA.MES.Base.Application.Services.AGVService.Dtos; | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
public interface IAGVThirdPartyService | |||||
{ | |||||
/// <summary> | |||||
/// 下发任务 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<KC_Response> Execute(KC_ExecuteRequest input); | |||||
/// <summary> | |||||
/// 取消任务 | |||||
/// </summary> | |||||
/// <param name="kCCancelRequest"></param> | |||||
/// <returns></returns> | |||||
Task<KCResponse> Cancel(KCCancelRequest kCCancelRequest); | |||||
/// <summary> | |||||
/// 任务回调 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<AgvBody> ExecuteReply(AGVExecuteReplyRequest input); | |||||
/// <summary> | |||||
/// AGV上下料交互请求 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<AgvBody> LoadAndUnload(AGVLoadAndUnloadRequest input); | |||||
/// <summary> | |||||
/// 上下料反馈给AGV接口 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<RollerJobResponse> RollerJobExecute(Roller_JobRequest input); | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 : | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 10:02:54 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IAgvLineService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(AgvLineAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(AgvLineDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(AgvLineUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<AgvLineOutput>> List(AgvLineQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<AgvLineOutput>> PagedList(AgvLineQueryPageInput input); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<AgvLineOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :AVG点位 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/7 10:03:06 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IAgvPointService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(AgvPointAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(AgvPointDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(AgvPointUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<AgvPointOutput>> List(AgvPointQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<AgvPointOutput>> PagedList(AgvPointQueryPageInput input); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<AgvPointOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,50 @@ | |||||
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 "成功"; | |||||
} | |||||
/// <summary> | |||||
/// 测试 | |||||
/// </summary> | |||||
[AllowAnonymous] | |||||
public void Test() | |||||
{ | |||||
//Type personType = Type.GetType("BPA.MES.Base.Application, DictDataAddInput"); | |||||
//object person = Activator.CreateInstance(personType); | |||||
Type type = Type.GetType("BPA.MES.Base.Application.Services.DictService.Dtos"); | |||||
string fullName = "BPA.MES.Base.Application.Services.DictDataAddInput"; | |||||
Type? instanceClass = Assembly.Load("BPA.MES.Base.Application").GetType(fullName); | |||||
var myInstance = instanceClass?.Assembly.CreateInstance(fullName); | |||||
} | |||||
} | |||||
} |
@@ -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,135 @@ | |||||
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; } | |||||
/// <summary> | |||||
/// 物料重量 | |||||
/// </summary> | |||||
public string Weight { get; set; } | |||||
/// <summary> | |||||
/// 工单Id | |||||
/// </summary> | |||||
public string WorkId { 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 BucketMaterialsRecordQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 工单Id | |||||
/// </summary> | |||||
public string WorkId { get; set; } | |||||
/// <summary> | |||||
/// 桶Id | |||||
/// </summary> | |||||
public string BucketId { get; set; } | |||||
/// <summary> | |||||
/// 桶编号 | |||||
/// </summary> | |||||
public string BucketCode { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class BucketMaterialsRecordQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 桶Id | |||||
/// </summary> | |||||
public string BucketId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 清空桶 | |||||
/// </summary> | |||||
public class BucketClearInput | |||||
{ | |||||
public string BucketId { 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; } | |||||
/// <summary> | |||||
/// 工单名称 | |||||
/// </summary> | |||||
public string WorkName { get; set; } | |||||
/// <summary> | |||||
/// 桶编码 | |||||
/// </summary> | |||||
public string BucketCode { get; set; } | |||||
/// <summary> | |||||
/// 计划重量 | |||||
/// </summary> | |||||
public string SchemeWeight { get; set; } | |||||
/// <summary> | |||||
/// 第几锅 | |||||
/// </summary> | |||||
public string PotNum { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,168 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("基础数据管理", Order = 3, Tag = "桶服务", 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 || x.Code == input.Code); | |||||
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> | |||||
[HttpPost] | |||||
public async Task<Pztj_BucketInfoEntity> AddRetrun(BucketInfoAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<Pztj_BucketInfoEntity>().FirstAsync(x => x.Name == input.Name || x.Code == input.Code); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
Pztj_BucketInfoEntity entity = input.Adapt<Pztj_BucketInfoEntity>(); | |||||
var res = await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||||
if (!res) | |||||
{ | |||||
throw Oops.Bah("新增桶失败!"); | |||||
} | |||||
return entity; | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="input"></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 && b.Id == SqlFunc.Subqueryable<Pztj_BucketMaterialsRecordEntity>().Where(s => s.BucketId == a.Id).OrderByDesc(s => s.CreateTime).Select(s => s.Id)) | |||||
.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) | |||||
{ | |||||
var isExit =await _dbContext.Queryable<Pztj_BucketInfoEntity>().Where(x => x.Id != input.Id && (x.Name == input.Name || x.Code == input.Code)).FirstAsync(); | |||||
if (isExit != null) | |||||
{ | |||||
throw Oops.Bah("名称或编码已存在!"); | |||||
} | |||||
Pztj_BucketInfoEntity entity = input.Adapt<Pztj_BucketInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).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,140 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :桶记录 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :基础数据管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("基础数据管理", Order = 3, Tag = "桶服务", Name = "BucketMaterialsRecord", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
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>(); | |||||
var work_entity =await _dbContext.Queryable<WorkInfoMaterialsRecordEntity>().FirstAsync(x => x.Id == input.MaterialId); | |||||
if (work_entity==null) | |||||
{ | |||||
throw Oops.Bah("没有找到此物料信息!"); | |||||
} | |||||
entity.WorkId = work_entity.WorkId; | |||||
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> | |||||
[HttpPost] | |||||
public async Task<List<BucketMaterialsRecordOutput>> List(BucketMaterialsRecordQueryInput input) | |||||
{ | |||||
var output = await _dbContext.Queryable<Pztj_BucketMaterialsRecordEntity>() | |||||
.LeftJoin<WorkInfoMaterialsRecordEntity>((a, b) => a.MaterialId == b.Id) | |||||
.LeftJoin<Pztj_BucketInfoEntity>((a, b, c) => a.BucketId == c.Id) | |||||
.LeftJoin<Pztj_WorkInfoEntity>((a,b,c,d)=>b.WorkId==d.Id) | |||||
.WhereIF(!string.IsNullOrEmpty(input.BucketId), (a, b, c) => a.BucketId == input.BucketId) | |||||
.WhereIF(!string.IsNullOrEmpty(input.WorkId), (a, b, c) => b.WorkId == b.WorkId) | |||||
.WhereIF(!string.IsNullOrEmpty(input.BucketCode),(a,b,c)=>c.Code==input.BucketCode) | |||||
.Select((a, b, c, d) => new BucketMaterialsRecordOutput | |||||
{ | |||||
Id = a.Id, | |||||
MaterialId = a.MaterialId, | |||||
BucketId = a.BucketId, | |||||
Weight = a.Weight, | |||||
CreateTime = a.CreateTime, | |||||
SchemeWeight = b.Weight, | |||||
WorkId = d.Id, | |||||
MaterialName = b.MaterialName, | |||||
BucketName = c.Name, | |||||
WorkName = b.RecipeName, | |||||
PotNum = b.PotNum, | |||||
BucketCode = c.Code | |||||
}) | |||||
.ToListAsync(); | |||||
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) | |||||
.WhereIF(!string.IsNullOrEmpty(input.BucketId),(a,b,c)=>a.BucketId==input.BucketId) | |||||
.OrderByDescending((a,b,c)=>a.CreateTime) | |||||
.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).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 清空桶 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Clear(BucketClearInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<Pztj_BucketMaterialsRecordEntity>().Where(x => x.BucketId == input.BucketId).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,53 @@ | |||||
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<Pztj_BucketInfoEntity> AddRetrun(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,49 @@ | |||||
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(BucketMaterialsRecordQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<BucketMaterialsRecordOutput>> PagedList(BucketMaterialsRecordQueryPageInput input); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<BucketMaterialsRecordOutput> Detail(string Id); | |||||
/// <summary> | |||||
/// 清空桶 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
Task<bool> Clear(BucketClearInput input); | |||||
} | |||||
} |
@@ -0,0 +1,83 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产品分组 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/10 13:59:43 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class CraftsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 工艺名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 设备类型 0:炒锅 1:反应釜 | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 工艺描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class CraftsInfoAddInput : CraftsInfoDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class CraftsInfoUpdateInput : CraftsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class CraftsInfoDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class CraftsInfoQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 设备类型 0:炒锅 1:反应釜 | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 不分页 | |||||
/// </summary> | |||||
public class CraftsInfoQueryInput | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class CraftsInfoOutput : CraftsInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
/// <example></example> | |||||
public string Id { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,100 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/18 14:03:27 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class CraftsStepsDto | |||||
{ | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
/// <summary> | |||||
/// 步骤 | |||||
/// </summary> | |||||
public int Step { get; set; } | |||||
/// <summary> | |||||
/// 功能描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 设备产品功能Id | |||||
/// </summary> | |||||
public string DeviceProductFunctionId { get; set; } | |||||
/// <summary> | |||||
/// 功能参数 | |||||
/// </summary> | |||||
public string Params { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class CraftsStepsAddInput : CraftsStepsDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class CraftsStepsUpdateInput : CraftsStepsDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class CraftsStepsDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class CraftsStepsQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 工艺Id | |||||
/// </summary> | |||||
public string CraftId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class CraftsStepsOutput : CraftsStepsDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 工艺名称 | |||||
/// </summary> | |||||
public string CraftName { get; set; } | |||||
/// <summary> | |||||
/// 设备产品功能名称 | |||||
/// </summary> | |||||
public string DeviceProductFunctionName { get; set; } | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,130 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工艺信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/10 14:03:06 | |||||
/// 描 述 :配方工艺管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("配方工艺管理", Order = 0, Tag = "工艺服务", Name = "CraftsInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class CraftsInfoService : ICraftsInfoService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public CraftsInfoService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(CraftsInfoAddInput input) | |||||
{ | |||||
Pztj_CraftsInfoEntity entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>().FirstAsync(x => x.Name ==input.Name); | |||||
if (entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
entity = input.Adapt<Pztj_CraftsInfoEntity>(); | |||||
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(CraftsInfoDelInput input) | |||||
{ | |||||
//事务,删除所有子表 | |||||
try | |||||
{ | |||||
_dbContext.Ado.BeginTran(); | |||||
await _dbContext.Deleteable<Pztj_CraftsInfoEntity>().Where(x => x.Id == input.Id).ExecuteCommandAsync(); | |||||
await _dbContext.Deleteable<Pztj_CraftStepsEntity>().Where(x => x.CraftId == input.Id).ExecuteCommandAsync(); | |||||
_dbContext.Ado.CommitTran(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
_dbContext.Ado.RollbackTran(); | |||||
throw Oops.Bah("删除失败!"); | |||||
} | |||||
return true; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<CraftsInfoOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>().FirstAsync(); | |||||
CraftsInfoOutput output = entity.Adapt<CraftsInfoOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost, AllowAnonymous] | |||||
public async Task<List<CraftsInfoOutput>> List(CraftsInfoQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>().ToListAsync(); | |||||
List<CraftsInfoOutput> output = entity.Adapt<List<CraftsInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<CraftsInfoOutput>> PagedList(CraftsInfoQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>() | |||||
.WhereIF(!string.IsNullOrEmpty(input.DeviceProductId), x => x.DeviceProductId == input.DeviceProductId) | |||||
.WhereIF(!string.IsNullOrEmpty(input.Name),x=>x.Name.Contains(input.Name)) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<CraftsInfoOutput> output = entity.Adapt<SqlSugarPagedList<CraftsInfoOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>().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(CraftsInfoUpdateInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftsInfoEntity>().FirstAsync(x => x.Id != input.Id && x.Name == input.Name); | |||||
if (entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
entity = input.Adapt<Pztj_CraftsInfoEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,144 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工艺路线服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/2 16:11:04 | |||||
/// 描 述 :CraftsInfo 工艺管理 CraftsSteps工艺步骤管理 | |||||
/// </summary> | |||||
[ApiDescriptionSettings("配方工艺管理", Order = 0, Tag = "工艺服务", Name = "CraftsSteps", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class CraftsStepsService : ICraftsStepsService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public CraftsStepsService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(CraftsStepsAddInput input) | |||||
{ | |||||
var step = await _dbContext.Queryable<Pztj_CraftStepsEntity>().Where(x=>x.CraftId==input.CraftId).MaxAsync(x => x.Step); | |||||
Pztj_CraftStepsEntity entity = input.Adapt<Pztj_CraftStepsEntity>(); | |||||
entity.Step = step+1; | |||||
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(CraftsStepsDelInput input) | |||||
{ | |||||
var stepItem = await _dbContext.Queryable<Pztj_CraftStepsEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
string craftsId = stepItem.CraftId; | |||||
int step = stepItem.Step; | |||||
var res = await _dbContext.Deleteable<Pztj_CraftStepsEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||||
if (res) | |||||
{ | |||||
var stepList = await _dbContext.Queryable<Pztj_CraftStepsEntity>().Where(x => x.CraftId == craftsId).OrderBy(x=>x.Step).ToListAsync(); | |||||
for (int i = 0; i < stepList.Count; i++) | |||||
{ | |||||
stepList[i].Step = i + 1; | |||||
} | |||||
await _dbContext.Updateable(stepList).ExecuteCommandAsync(); | |||||
} | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<CraftsStepsOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftStepsEntity>().FirstAsync(x => x.Id == Id); | |||||
CraftsStepsOutput output = entity.Adapt<CraftsStepsOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<List<CraftsStepsOutput>> List() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftStepsEntity>().ToListAsync(); | |||||
List<CraftsStepsOutput> output = entity.Adapt<List<CraftsStepsOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<CraftsStepsOutput>> PagedList(CraftsStepsQueryPageInput input) | |||||
{ | |||||
var output = await _dbContext.Queryable<Pztj_CraftStepsEntity>() | |||||
.LeftJoin<DeviceProductFunctionEntity>((a,b)=>a.DeviceProductFunctionId==b.Id) | |||||
.WhereIF(!string.IsNullOrEmpty(input.CraftId), (a, b) => a.CraftId == input.CraftId) | |||||
.OrderBy((a, b) => a.Step) | |||||
.Select((a,b)=>new CraftsStepsOutput | |||||
{ | |||||
Id = a.Id.SelectAll(), | |||||
DeviceProductFunctionName = b.Name, | |||||
DeviceProductFunctionId = a.DeviceProductFunctionId, | |||||
DeviceProductId = b.DeviceProductId | |||||
}) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<Pztj_CraftStepsEntity>().Select(x => new | |||||
{ | |||||
key = x.Id, | |||||
value = x.Description | |||||
}).ToListAsync(); | |||||
return entity; | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<bool> Update(CraftsStepsUpdateInput input) | |||||
{ | |||||
Pztj_CraftStepsEntity entity = input.Adapt<Pztj_CraftStepsEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(it => it.Step).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
/// <summary> | |||||
/// 批量更新 | |||||
/// </summary> | |||||
/// <param name="inputs"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> BatchUpdate(List<CraftsStepsUpdateInput> inputs) | |||||
{ | |||||
List<Pztj_CraftStepsEntity> entity = inputs.Adapt<List<Pztj_CraftStepsEntity>>(); | |||||
var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} | |||||
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :工艺信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/3/10 14:03:21 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface ICraftsInfoService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(CraftsInfoAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(CraftsInfoDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(CraftsInfoUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<CraftsInfoOutput>> List(CraftsInfoQueryInput Input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<CraftsInfoOutput>> PagedList(CraftsInfoQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<CraftsInfoOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,54 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :产线管理 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 :2023/7/18 14:05:16 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface ICraftsStepsService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(CraftsStepsAddInput input); | |||||
/// <summary> | |||||
/// 移除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(CraftsStepsDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(CraftsStepsUpdateInput input); | |||||
/// <summary> | |||||
/// 批量更新 | |||||
/// </summary> | |||||
/// <param name="inputs"></param> | |||||
/// <returns></returns> | |||||
Task<bool> BatchUpdate(List<CraftsStepsUpdateInput> inputs); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<CraftsStepsOutput>> List(); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<CraftsStepsOutput>> PagedList(CraftsStepsQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<CraftsStepsOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,87 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/2 16:19:15 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class DeviceProductDto | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 设备产品编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 设备产品描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class DeviceProductAddInput : DeviceProductDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 修改 | |||||
/// </summary> | |||||
public class DeviceProductUpdateInput : DeviceProductDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 刪除 | |||||
/// </summary> | |||||
public class DeviceProductDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 普通查询条件 | |||||
/// </summary> | |||||
public class DeviceProductQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页查询条件 | |||||
/// </summary> | |||||
public class DeviceProductQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class DeviceProductOutput : DeviceProductDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
//下面增加多的数据 | |||||
} | |||||
} |
@@ -0,0 +1,111 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品模型功能 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:04:53 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class DeviceProductFunctionDto | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 功能名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 功能编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 方法参数 | |||||
/// </summary> | |||||
public string Params { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class DeviceProductFunctionAddInput : DeviceProductFunctionDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 修改 | |||||
/// </summary> | |||||
public class DeviceProductFunctionUpdateInput : DeviceProductFunctionDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 刪除 | |||||
/// </summary> | |||||
public class DeviceProductFunctionDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 普通查询条件 | |||||
/// </summary> | |||||
public class DeviceProductFunctionQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 设备产品名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 设备产品编号 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页查询条件 | |||||
/// </summary> | |||||
public class DeviceProductFunctionQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class DeviceProductFunctionOutput : DeviceProductFunctionDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
//下面增加多的数据 | |||||
} | |||||
} |
@@ -0,0 +1,91 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品参数 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:04:53 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class DeviceProductParmDto | |||||
{ | |||||
/// <summary> | |||||
/// 设备产品Id | |||||
/// </summary> | |||||
public string DeviceProductId { get; set; } | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
/// <summary> | |||||
/// 描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class DeviceProductParmAddInput : DeviceProductParmDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 修改 | |||||
/// </summary> | |||||
public class DeviceProductParmUpdateInput : DeviceProductParmDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 刪除 | |||||
/// </summary> | |||||
public class DeviceProductParmDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 普通查询条件 | |||||
/// </summary> | |||||
public class DeviceProductParmQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页查询条件 | |||||
/// </summary> | |||||
public class DeviceProductParmQueryPageInput : RequestPage | |||||
{ | |||||
/// <summary> | |||||
/// 名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
/// <summary> | |||||
/// 编码 | |||||
/// </summary> | |||||
public string Code { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class DeviceProductParmOutput : DeviceProductParmDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
//下面增加多的数据 | |||||
} | |||||
} |
@@ -0,0 +1,128 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品功能服务 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:03:25 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[ApiDescriptionSettings("设备产品模型", Name = "DeviceProductFunction", Tag = "设备产品功能", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class DeviceProductFunctionService : IDeviceProductFunctionService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public DeviceProductFunctionService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(DeviceProductFunctionAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().Where(x=>x.DeviceProductId==input.DeviceProductId && x.Name == input.Name).FirstAsync(); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
DeviceProductFunctionEntity entity = input.Adapt<DeviceProductFunctionEntity>(); | |||||
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(DeviceProductFunctionDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<DeviceProductFunctionEntity>().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<DeviceProductFunctionOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().FirstAsync(x => x.Id == Id); | |||||
DeviceProductFunctionOutput output = entity.Adapt<DeviceProductFunctionOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<List<DeviceProductFunctionOutput>> List(DeviceProductFunctionQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>() | |||||
.WhereIF(!string.IsNullOrEmpty(input.DeviceProductId), x => x.DeviceProductId==input.DeviceProductId) | |||||
.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name)) | |||||
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) | |||||
.ToListAsync(); | |||||
List<DeviceProductFunctionOutput> output = entity.Adapt<List<DeviceProductFunctionOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<DeviceProductFunctionOutput>> PagedList(DeviceProductFunctionQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>() | |||||
.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.DeviceProductId),x=>x.DeviceProductId==input.DeviceProductId) | |||||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||||
SqlSugarPagedList<DeviceProductFunctionOutput> output = entity.Adapt<SqlSugarPagedList<DeviceProductFunctionOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().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(DeviceProductFunctionUpdateInput input) | |||||
{ | |||||
var isEntity = await _dbContext.Queryable<DeviceProductFunctionEntity>() | |||||
.Where(x =>x.Id != input.Id && x.DeviceProductId == input.DeviceProductId && x.Name == input.Name).FirstAsync(); | |||||
if (isEntity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
var entity = await _dbContext.Queryable<DeviceProductFunctionEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<DeviceProductFunctionEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,115 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备参数 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:03:25 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[ApiDescriptionSettings("设备产品模型", Name = "DeviceProductParm", Tag = "设备产品参数", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class DeviceProductParmService : IDeviceProductParmService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public DeviceProductParmService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(DeviceProductParmAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<DeviceProductParmEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
DeviceProductParmEntity entity = input.Adapt<DeviceProductParmEntity>(); | |||||
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(DeviceProductParmDelInput input) | |||||
{ | |||||
var res = await _dbContext.Deleteable<DeviceProductParmEntity>().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<DeviceProductParmOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductParmEntity>().FirstAsync(x => x.Id == Id); | |||||
DeviceProductParmOutput output = entity.Adapt<DeviceProductParmOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<List<DeviceProductParmOutput>> List(DeviceProductParmQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductParmEntity>().ToListAsync(); | |||||
List<DeviceProductParmOutput> output = entity.Adapt<List<DeviceProductParmOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<DeviceProductParmOutput>> PagedList(DeviceProductParmQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductParmEntity>() | |||||
.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); | |||||
SqlSugarPagedList<DeviceProductParmOutput> output = entity.Adapt<SqlSugarPagedList<DeviceProductParmOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductParmEntity>().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(DeviceProductParmUpdateInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductParmEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<DeviceProductParmEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,127 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:03:25 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
[ApiDescriptionSettings("设备产品模型", Name = "DeviceProduct", Tag = "设备产品管理", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||||
public class DeviceProductService : IDeviceProductService, ITransient, IDynamicApiController | |||||
{ | |||||
private readonly ISqlSugarClient _dbContext; | |||||
public DeviceProductService(ISqlSugarClient db) | |||||
{ | |||||
_dbContext = db; | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<bool> Add(DeviceProductAddInput input) | |||||
{ | |||||
var r_entity = await _dbContext.Queryable<DeviceProductEntity>().FirstAsync(x => x.Name == input.Name); | |||||
if (r_entity != null) | |||||
{ | |||||
throw Oops.Bah("名称已存在!"); | |||||
} | |||||
DeviceProductEntity entity = input.Adapt<DeviceProductEntity>(); | |||||
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(DeviceProductDelInput input) | |||||
{ | |||||
//事务,删除所有子表 | |||||
try | |||||
{ | |||||
_dbContext.Ado.BeginTran(); | |||||
await _dbContext.Deleteable<DeviceProductEntity>().Where(x => x.Id == input.Id).ExecuteCommandAsync(); | |||||
await _dbContext.Deleteable<DeviceProductFunctionEntity>().Where(x => x.DeviceProductId == input.Id).ExecuteCommandAsync(); | |||||
_dbContext.Ado.CommitTran(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
_dbContext.Ado.RollbackTran(); | |||||
throw Oops.Bah("删除失败!"); | |||||
} | |||||
return true; | |||||
} | |||||
/// <summary> | |||||
/// 详情 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<DeviceProductOutput> Detail(string Id) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductEntity>().FirstAsync(x => x.Id == Id); | |||||
DeviceProductOutput output = entity.Adapt<DeviceProductOutput>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpPost] | |||||
public async Task<List<DeviceProductOutput>> List(DeviceProductQueryInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductEntity>().ToListAsync(); | |||||
List<DeviceProductOutput> output = entity.Adapt<List<DeviceProductOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
/// <param name="input"></param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
public async Task<SqlSugarPagedList<DeviceProductOutput>> PagedList(DeviceProductQueryPageInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductEntity>() | |||||
.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); | |||||
SqlSugarPagedList<DeviceProductOutput> output = entity.Adapt<SqlSugarPagedList<DeviceProductOutput>>(); | |||||
return output; | |||||
} | |||||
/// <summary> | |||||
/// 下拉 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
/// <exception cref="NotImplementedException"></exception> | |||||
[HttpGet] | |||||
public async Task<dynamic> SelectList() | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductEntity>().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(DeviceProductUpdateInput input) | |||||
{ | |||||
var entity = await _dbContext.Queryable<DeviceProductEntity>().Where(x => x.Id == input.Id).FirstAsync(); | |||||
entity = input.Adapt<DeviceProductEntity>(); | |||||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||||
return res; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品功能 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:02:57 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IDeviceProductFunctionService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(DeviceProductFunctionAddInput input); | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(DeviceProductFunctionDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(DeviceProductFunctionUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<DeviceProductFunctionOutput>> List(DeviceProductFunctionQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<DeviceProductFunctionOutput>> PagedList(DeviceProductFunctionQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<DeviceProductFunctionOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品参数 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/7/31 18:02:57 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IDeviceProductParmService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(DeviceProductParmAddInput input); | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(DeviceProductParmDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(DeviceProductParmUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<DeviceProductParmOutput>> List(DeviceProductParmQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<DeviceProductParmOutput>> PagedList(DeviceProductParmQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<DeviceProductParmOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备产品基础信息 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/8/2 16:19:35 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public interface IDeviceProductService | |||||
{ | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Add(DeviceProductAddInput input); | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Del(DeviceProductDelInput input); | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<bool> Update(DeviceProductUpdateInput input); | |||||
/// <summary> | |||||
/// 不分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<List<DeviceProductOutput>> List(DeviceProductQueryInput input); | |||||
/// <summary> | |||||
/// 分页列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<SqlSugarPagedList<DeviceProductOutput>> PagedList(DeviceProductQueryPageInput input); | |||||
/// <summary> | |||||
/// 下拉列表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
Task<dynamic> SelectList(); | |||||
/// <summary> | |||||
/// 查询单条 | |||||
/// </summary> | |||||
/// <param name="Id"></param> | |||||
/// <returns></returns> | |||||
Task<DeviceProductOutput> Detail(string Id); | |||||
} | |||||
} |
@@ -0,0 +1,99 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备Dto类 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/2 16:12:06 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
public class DeviceRecipeDto : DeviceRecipeEntity | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 增加 | |||||
/// </summary> | |||||
public class DeviceRecipeAddInput : DeviceRecipeDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class DeviceRecipeUpdateInput : DeviceRecipeDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class DeviceRecipeDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 不分页 | |||||
/// </summary> | |||||
public class DeviceRecipeQueryInput | |||||
{ | |||||
/// <summary> | |||||
/// 设备Id | |||||
/// </summary> | |||||
public string DeviceId { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </summary> | |||||
public class DeviceRecipeQueryPageInput : RequestPage | |||||
{ | |||||
} | |||||
public class DeviceRecipeBatchAddInput | |||||
{ | |||||
/// <summary> | |||||
/// 设备Id | |||||
/// </summary> | |||||
public string DeviceId { get; set; } | |||||
/// <summary> | |||||
/// 配方数组 | |||||
/// </summary> | |||||
public List<string> RecipesIds { get; set; } = new(); | |||||
} | |||||
/// <summary> | |||||
/// 输出 | |||||
/// </summary> | |||||
public class DeviceRecipeOutput : DeviceRecipeDto | |||||
{ | |||||
/// <summary> | |||||
/// 设备名称 | |||||
/// </summary> | |||||
public string DeviceName { get; set; } | |||||
/// <summary> | |||||
/// 配方名称 | |||||
/// </summary> | |||||
public string RecipeName { get; set; } | |||||
/// <summary> | |||||
/// 配方代码 | |||||
/// </summary> | |||||
public string RecipeCode { get; set; } | |||||
/// <summary> | |||||
/// 分组Id | |||||
/// </summary> | |||||
public string GroupId { get; set; } | |||||
/// <summary> | |||||
/// 分组名称 | |||||
/// </summary> | |||||
public string GroupName { get; set; } | |||||
/// <summary> | |||||
/// 配方图片地址 | |||||
/// </summary> | |||||
public string RecipesPic { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,88 @@ | |||||
namespace BPA.MES.Base.Application.Services | |||||
{ | |||||
/// <summary> | |||||
/// 名 称 :设备Dto类 | |||||
/// 创 建 人 :yangxiao | |||||
/// 创建时间 : 2023/3/2 16:12:06 | |||||
/// 描 述 : | |||||
/// </summary> | |||||
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> | |||||
public class DevicesInfoAddInput : DevicesInfoDto | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// 更新 | |||||
/// </summary> | |||||
public class DevicesInfoUpdateInput : DevicesInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 删除 | |||||
/// </summary> | |||||
public class DevicesInfoDelInput | |||||
{ | |||||
/// <summary> | |||||
/// 主键 | |||||
/// </summary> | |||||
public string Id { get; set; } | |||||
} | |||||
/// <summary> | |||||
/// 分页 | |||||
/// </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; } | |||||
} | |||||
} |