diff --git a/ClassLibrary1/Class1.cs b/ClassLibrary1/Class1.cs
new file mode 100644
index 0000000..ca3cd76
--- /dev/null
+++ b/ClassLibrary1/Class1.cs
@@ -0,0 +1,7 @@
+namespace ClassLibrary1
+{
+ public class Class1
+ {
+
+ }
+}
diff --git a/ClassLibrary1/ClassLibrary1.csproj b/ClassLibrary1/ClassLibrary1.csproj
new file mode 100644
index 0000000..fa71b7a
--- /dev/null
+++ b/ClassLibrary1/ClassLibrary1.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/DOAN.Admin.WebApi/Controllers/CommonController.cs b/DOAN.Admin.WebApi/Controllers/CommonController.cs
index 443fce3..c3d0f5b 100644
--- a/DOAN.Admin.WebApi/Controllers/CommonController.cs
+++ b/DOAN.Admin.WebApi/Controllers/CommonController.cs
@@ -53,7 +53,7 @@ namespace DOAN.Admin.WebApi.Controllers
{
var hello = _localizer["hello"].Value;
return Ok($"{hello}看到这里页面说明你已经成功启动了本项目:)\n\n" +
- "如果觉得项目有用,打赏作者喝杯咖啡作为奖励\n☛☛http://www.izhaorui.cn/vip\n");
+ "苏州道安自动化有限公司");
}
///
diff --git a/DOAN.Admin.WebApi/Controllers/PBL/BillofmaterialsController.cs b/DOAN.Admin.WebApi/Controllers/PBL/BillofmaterialsController.cs
index 7c00f48..3273838 100644
--- a/DOAN.Admin.WebApi/Controllers/PBL/BillofmaterialsController.cs
+++ b/DOAN.Admin.WebApi/Controllers/PBL/BillofmaterialsController.cs
@@ -5,7 +5,7 @@ using DOAN.Service.PBL.IService;
using DOAN.Admin.WebApi.Filters;
//创建时间:2024-09-23
-namespace DOAN.Admin.WebApi.Controllers.Business
+namespace DOAN.Admin.WebApi.Controllers.PBL
{
///
/// 物料清单
diff --git a/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs b/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs
new file mode 100644
index 0000000..633d73e
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs
@@ -0,0 +1,53 @@
+using Microsoft.AspNetCore.Mvc;
+using DOAN.Model.PBL.Dto;
+using DOAN.Model.PBL;
+using DOAN.Service.PBL.IService;
+using DOAN.Admin.WebApi.Filters;
+
+//创建时间:2024-09-23
+namespace DOAN.Admin.WebApi.Controllers.PBL
+{
+ ///
+ /// 与MES交互
+ ///
+ [AllowAnonymous]
+ [Route("PBL/mes_interation")]
+ public class MESInteractionController : BaseController
+ {
+ private readonly IMESInteractionServcie mesInteraction;
+ public MESInteractionController(IMESInteractionServcie mesInteraction)
+ {
+ this.mesInteraction = mesInteraction;
+ }
+
+ //TODO 接受工单 亮灯
+
+ [HttpPost("mes_light_up")]
+ public IActionResult MESLightUp([FromBody] LightUpDto light)
+ {
+ var response= mesInteraction.MESLightUp(light);
+
+ return SUCCESS(response);
+ }
+
+ //TODO 扫码灭灯
+ [HttpGet("mes_light_down")]
+ public IActionResult MESLightDown(string scan_code)
+ {
+ if(string.IsNullOrEmpty(scan_code))
+ {
+ throw new CustomException("扫描内容为空");
+ }
+ var response = mesInteraction.MESLightDown(scan_code);
+
+ return SUCCESS(response);
+ }
+
+
+ }
+
+}
+
+
+
+
diff --git a/DOAN.Admin.WebApi/Controllers/PBL/StoragelocationController.cs b/DOAN.Admin.WebApi/Controllers/PBL/StoragelocationController.cs
index 8717aab..751abac 100644
--- a/DOAN.Admin.WebApi/Controllers/PBL/StoragelocationController.cs
+++ b/DOAN.Admin.WebApi/Controllers/PBL/StoragelocationController.cs
@@ -5,7 +5,7 @@ using DOAN.Service.PBL.IService;
using DOAN.Admin.WebApi.Filters;
//创建时间:2024-09-23
-namespace DOAN.Admin.WebApi.Controllers.Business
+namespace DOAN.Admin.WebApi.Controllers.PBL
{
///
/// 料架表
diff --git a/DOAN.Admin.WebApi/Program.cs b/DOAN.Admin.WebApi/Program.cs
index 4b33ef3..67a2f26 100644
--- a/DOAN.Admin.WebApi/Program.cs
+++ b/DOAN.Admin.WebApi/Program.cs
@@ -84,6 +84,9 @@ builder.Services.AddSignalR()
builder.Services.AddSwaggerConfig();
// 显示logo
builder.Services.AddLogo();
+//激活 HslCommunication
+builder.Services.AddHslCommunication();
+
// 添加本地化服务
builder.Services.AddLocalization(options => options.ResourcesPath = "");
diff --git a/DOAN.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml b/DOAN.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml
index 426a9b5..7372c62 100644
--- a/DOAN.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/DOAN.Admin.WebApi/Properties/PublishProfiles/FolderProfile.pubxml
@@ -14,8 +14,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
FileSystem
<_TargetId>Folder
- net7.0
+ net8.0
e5497bb4-b0c1-4794-9fae-163f626ec399
- false
+ true
+ win-x64
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/appsettings.Development.json b/DOAN.Admin.WebApi/appsettings.Development.json
index e07a8c7..79d78d5 100644
--- a/DOAN.Admin.WebApi/appsettings.Development.json
+++ b/DOAN.Admin.WebApi/appsettings.Development.json
@@ -10,7 +10,7 @@
"dbConfigs": [
{
- "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog=pbl_huaxiang;Charset=utf8mb4",
+ "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=pbl_huaxiang;Charset=utf8mb4",
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
"ConfigId": "0", //多租户唯一标识
"IsAutoCloseConnection": true
@@ -20,12 +20,12 @@
//代码生成数据库配置
"CodeGenDbConfig": {
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
- "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog={dbName};",
+ "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog={dbName};",
"DbType": 0,
"IsAutoCloseConnection": true,
"DbName": "pbl_huaxiang" //代码生成默认连接数据库,Oracle库是实例的名称
},
- "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
+ "urls": "http://0.0.0.0:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
"corsUrls": [ "http://localhost:8887", "http://localhost:8886" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
"JwtSettings": {
"Issuer": "DOANAdmin.NET", //即token的签发者。
diff --git a/DOAN.Admin.WebApi/appsettings.Production.json b/DOAN.Admin.WebApi/appsettings.Production.json
index 923cf2e..b433de2 100644
--- a/DOAN.Admin.WebApi/appsettings.Production.json
+++ b/DOAN.Admin.WebApi/appsettings.Production.json
@@ -8,8 +8,8 @@
},
"dbConfigs": [
{
- "Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=123456;Initial Catalog=DOANAdmin;",
- "DbType": 1, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
+ "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=pbl_huaxiang;",
+ "DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
"ConfigId": "0", //多租户唯一标识
"IsAutoCloseConnection": true
}
@@ -18,12 +18,12 @@
//代码生成数据库配置
"CodeGenDbConfig": {
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
- "Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog={dbName};",
- "DbType": 1,
+ "Conn": "Data Source=127.0.0.1;User ID=admin;Password=admin123;Initial Catalog={dbName};",
+ "DbType": 0,
"IsAutoCloseConnection": true,
- "DbName": "DOANAdmin" //代码生成默认连接数据库,Oracle库是实例的名称
+ "DbName": "pbl_huaxiang" //代码生成默认连接数据库,Oracle库是实例的名称
},
- "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
+ "urls": "http://127.0.0.1:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
"corsUrls": [ "http://localhost:8887", "http://localhost:8886" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
"JwtSettings": {
"Issuer": "DOANAdmin.NET", //即token的签发者。
diff --git a/DOAN.Model/PBL/Dto/LightUp.cs b/DOAN.Model/PBL/Dto/LightUp.cs
new file mode 100644
index 0000000..3e720ef
--- /dev/null
+++ b/DOAN.Model/PBL/Dto/LightUp.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.PBL.Dto
+{
+ public class LightUpDto
+ {
+ ///
+ /// 工单号
+ ///
+ public string Workorder { get; set; }
+
+
+ ///
+ /// 订单号
+ ///
+ public string OrderNumber { get; set; }
+
+
+ ///
+ /// 总成零件号
+ ///
+ public string AssemblyPartNumber { get; set; }
+
+
+
+
+
+
+ }
+
+
+}
diff --git a/DOAN.Model/PBL/Light_Log.cs b/DOAN.Model/PBL/Light_Log.cs
new file mode 100644
index 0000000..c0d4572
--- /dev/null
+++ b/DOAN.Model/PBL/Light_Log.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.PBL
+{
+ ///
+ /// 库存日志
+ ///
+ [SugarTable("light_log")]
+ public class Light_Log
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 1亮灯、2灭灯
+ ///
+ [SugarColumn(ColumnName = "light_operation")]
+ public int LightOperation { get; set; }
+
+
+ ///
+ /// 货架号
+ ///
+ [SugarColumn(ColumnName = "shelf_code")]
+ public string ShelfCode { get; set; }
+
+
+ ///
+ /// 操作者
+ ///
+ [SugarColumn(ColumnName = "operationer")]
+ public string Operationer { get; set; }
+
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+ }
+}
diff --git a/DOAN.Model/PBL/MES_Interaction.cs b/DOAN.Model/PBL/MES_Interaction.cs
new file mode 100644
index 0000000..4f0ae66
--- /dev/null
+++ b/DOAN.Model/PBL/MES_Interaction.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.PBL
+{
+ ///
+ /// mes交互日志
+ ///
+ [SugarTable("mes_interation_log")]
+ public class MES_Interation_Log
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 工单号
+ ///
+ [SugarColumn(ColumnName = "Workorder")]
+ public string Workorder { get; set; }
+
+
+ ///
+ /// 订单号
+ ///
+ [SugarColumn(ColumnName = "OrderNumber")]
+ public string OrderNumber { get; set; }
+
+
+ ///
+ /// 总成零件号
+ ///
+ [SugarColumn(ColumnName = "AssemblyPartNumber")]
+ public string AssemblyPartNumber { get; set; }
+
+ ///
+ /// 扫描scancode
+ ///
+ [SugarColumn(ColumnName = "scancode")]
+ public string ScanCode { get; set; }
+
+
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime CreatedTime { get; set; }
+
+
+
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime UpdatedTime { get; set; }
+ }
+}
diff --git a/DOAN.Service/PBL/IService/IMESInteractionServcie.cs b/DOAN.Service/PBL/IService/IMESInteractionServcie.cs
new file mode 100644
index 0000000..3e0e1f4
--- /dev/null
+++ b/DOAN.Service/PBL/IService/IMESInteractionServcie.cs
@@ -0,0 +1,17 @@
+using DOAN.Model.PBL.Dto;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Service.PBL.IService
+{
+ public interface IMESInteractionServcie
+ {
+
+ bool MESLightUp(LightUpDto light);
+ bool MESLightDown(string scan_code);
+ }
+}
diff --git a/DOAN.Service/PBL/MESInteractionServcie.cs b/DOAN.Service/PBL/MESInteractionServcie.cs
new file mode 100644
index 0000000..e0b7aef
--- /dev/null
+++ b/DOAN.Service/PBL/MESInteractionServcie.cs
@@ -0,0 +1,109 @@
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model.PBL.Dto;
+using DOAN.Model.PBL;
+using DOAN.Repository;
+using DOAN.Service.PBL.IService;
+using Mapster;
+using System.Runtime.InteropServices;
+using SqlSugar;
+using System.Security.Cryptography.X509Certificates;
+
+
+namespace DOAN.Service.PBL
+{
+ ///
+ /// 料架表Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IMESInteractionServcie), ServiceLifetime = LifeTime.Transient)]
+ public class MESInteractionServcie : BaseService, IMESInteractionServcie
+ {
+ public bool MESLightUp(LightUpDto light)
+ {
+ // 1.记录MES交互记录
+ MES_Interation_Log item = light.Adapt();
+ item.Id = XUEHUA;
+ item.CreatedTime= DateTime.Now;
+ Context.Insertable(item).ExecuteCommand();
+
+ // 2.根据总成零件号 查询对应零件号,使得对应料架亮灯
+
+ //镜壳 料架
+ Storagelocation MirrorshellShelf = Context.Queryable().Where(it => it.Partnumber ==
+ SqlFunc.Subqueryable().Where(It => It.Productcode == light.AssemblyPartNumber).Select(it => it.MirrorshellCode)).First();
+
+ //镜体 料架
+ Storagelocation MirrorshellBody = Context.Queryable().Where(it => it.Partnumber ==
+ SqlFunc.Subqueryable().Where(It => It.Productcode == light.AssemblyPartNumber).Select(it => it.MirrorbodyCode)).First();
+
+ // 3.对应料架亮灯
+ Light_Log light_Log = new Light_Log();
+ light_Log.Id = XUEHUA;
+ light_Log.LightOperation = 1;
+ if (MirrorshellShelf != null)
+ {
+ light_Log.ShelfCode = MirrorshellShelf.RackCode;
+
+ }
+
+ light_Log.Operationer = "PBL";
+ light_Log.CreatedTime = DateTime.Now;
+ Light_Log light_Log2 = new Light_Log();
+ light_Log2.Id = XUEHUA;
+ light_Log2.LightOperation = 1;
+ if (MirrorshellShelf != null)
+ {
+ light_Log2.ShelfCode = MirrorshellShelf.RackCode;
+
+ }
+
+ light_Log2.Operationer = "PBL";
+ light_Log2.CreatedTime = DateTime.Now;
+ Context.Insertable(light_Log2).ExecuteCommand();
+ int result = Context.Insertable(light_Log).ExecuteCommand();
+
+ if (result > 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+
+
+ public bool MESLightDown(string scan_code)
+ {
+ // 1.记录MES交互记录
+ MES_Interation_Log item = new MES_Interation_Log();
+ item.Id = XUEHUA;
+ item.ScanCode=scan_code;
+ item.CreatedTime = DateTime.Now;
+ Context.Insertable(item).ExecuteCommand();
+
+ //2 找到对应的料架 灭灯
+ Storagelocation storagelocation= Context.Queryable().Where(it => it.Partnumber == scan_code).First();
+ Light_Log light_Log = new Light_Log();
+ light_Log.Id = XUEHUA;
+ light_Log.LightOperation = 2;
+ if (storagelocation != null) {
+ light_Log.ShelfCode = storagelocation.RackCode ;
+ }
+
+ light_Log.Operationer = "PBL";
+ light_Log.CreatedTime = DateTime.Now;
+ int result= Context.Insertable(light_Log).ExecuteCommand();
+ if (result > 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.ServiceCore/Middleware/GlobalExceptionMiddleware.cs b/DOAN.ServiceCore/Middleware/GlobalExceptionMiddleware.cs
index 0c2ac11..4610700 100644
--- a/DOAN.ServiceCore/Middleware/GlobalExceptionMiddleware.cs
+++ b/DOAN.ServiceCore/Middleware/GlobalExceptionMiddleware.cs
@@ -85,7 +85,7 @@ namespace DOAN.ServiceCore.Middleware
#if DEBUG
if (logLevel == LogLevel.Error)
{
- apiResult.Add("error", "请在issue里面寻找答案或者官方文档查看常见问题:https://gitee.com/izory/DOANAdminNetCore/issues");
+ apiResult.Add("error", "请在issue里面寻找答案或者官方文档查看常见问题:");
}
#endif
string responseResult = textJson.JsonSerializer.Serialize(apiResult, options);
diff --git a/Infrastructure/Cache/CacheHelper.cs b/Infrastructure/Cache/CacheHelper.cs
index d361fac..ada267e 100644
--- a/Infrastructure/Cache/CacheHelper.cs
+++ b/Infrastructure/Cache/CacheHelper.cs
@@ -134,7 +134,7 @@ namespace DOAN.Common
//.net7需要这样写
var coherentState = Cache.GetType().GetField("_coherentState", flags).GetValue(Cache);
- var entries = coherentState.GetType().GetField("_entries", flags).GetValue(coherentState);
+ var entries = coherentState.GetType()?.GetField("_entries", flags)?.GetValue(coherentState);
var keys = new List();
if (entries is not IDictionary cacheItems) return keys;
diff --git a/Infrastructure/DOAN.Infrastructure.csproj b/Infrastructure/DOAN.Infrastructure.csproj
index 7b8af04..a9a5afa 100644
--- a/Infrastructure/DOAN.Infrastructure.csproj
+++ b/Infrastructure/DOAN.Infrastructure.csproj
@@ -23,4 +23,26 @@
+
+
+ dll\HslCommunication.dll
+
+
+ ..\..\..\..\..\=====项目标准目录=====\3-设备程序\X1F1-服务器参数配置-20230908\packages\ICSharpCode.SharpZipLib.0.86.0.518\lib\net45\ICSharpCode.SharpZipLib.dll
+
+
+ ..\..\..\..\..\=====项目标准目录=====\3-设备程序\X1F1-服务器参数配置-20230908\STBIN\RefAssembly\NPOI.dll
+
+
+ ..\..\..\..\..\=====项目标准目录=====\3-设备程序\X1F1-服务器参数配置-20230908\STBIN\RefAssembly\NPOI.OOXML.dll
+
+
+ ..\..\..\..\..\=====项目标准目录=====\3-设备程序\X1F1-服务器参数配置-20230908\STBIN\RefAssembly\NPOI.OpenXml4Net.dll
+
+
+ dll\Register.dll
+ True
+
+
+
diff --git a/Infrastructure/WebExtensions/HslCommunicationExtension.cs b/Infrastructure/WebExtensions/HslCommunicationExtension.cs
new file mode 100644
index 0000000..77046b5
--- /dev/null
+++ b/Infrastructure/WebExtensions/HslCommunicationExtension.cs
@@ -0,0 +1,32 @@
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Register;
+
+namespace DOAN.Infrastructure.WebExtensions
+{
+ public static class HslCommunicationExtension
+ {
+
+ public static void AddHslCommunication(this IServiceCollection services)
+ {
+ //if (!HslCommunication.Authorization.SetAuthorizationCode("71d19e25-1fc3-419f-adaa-8c14df37952a"))
+ //{
+ // Console.WriteLine("HslCommunication激活失败");
+
+ //}
+ if (!Register.Reg.RegLicense())
+ {
+ Console.WriteLine("HslCommunication激活失败");
+ }
+ else
+ {
+ Console.WriteLine("HslCommunication激活成功");
+ }
+ ;
+ }
+ }
+}
diff --git a/Infrastructure/dll/HslCommunication.dll b/Infrastructure/dll/HslCommunication.dll
new file mode 100644
index 0000000..848d236
Binary files /dev/null and b/Infrastructure/dll/HslCommunication.dll differ
diff --git a/Infrastructure/dll/Register.dll b/Infrastructure/dll/Register.dll
new file mode 100644
index 0000000..5309e5f
Binary files /dev/null and b/Infrastructure/dll/Register.dll differ