From 02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 25 二月 2026 17:44:26 +0800
Subject: [PATCH] 1

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
index 3666ec1..66084e4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
@@ -13,13 +13,49 @@
 using WIDESEAWCS_Core.Extensions;
 using WIDESEAWCS_Core.Filter;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core.LogHelper;
 using WIDESEAWCS_Core.Middlewares;
 using WIDESEAWCS_QuartzJob.QuartzExtensions;
 using WIDESEAWCS_QuartzJob.Seed;
 using WIDESEAWCS_SignalR;
+using WIDESEAWCS_Tasks;
 using WIDESEAWCS_WCSServer.Filter;
 
 var builder = WebApplication.CreateBuilder(args);
+
+int workerThreads = Environment.ProcessorCount * 8;
+int completionThreads = Environment.ProcessorCount;
+ThreadPool.SetMaxThreads(workerThreads, completionThreads);
+
+AppDomain.CurrentDomain.FirstChanceException += (sender, e) =>
+{
+    bool flag = e.Exception.TargetSite?.DeclaringType?.Namespace?.StartsWith("WIDESEA") == true;
+
+    if (e.Exception is not OperationCanceledException && flag)
+    {
+        string folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Log\\Exception");
+        Exception ex = e.Exception;
+        StringBuilder builder = new StringBuilder();
+        builder.Append("错误信息:");
+        builder.Append(ex.Message);
+        builder.Append(Environment.NewLine);
+        builder.Append("错误源:");
+        builder.Append(ex.Source);
+        builder.Append(Environment.NewLine);
+        builder.Append("错误堆栈:");
+        builder.Append(ex.StackTrace);
+        builder.Append(Environment.NewLine);
+        builder.Append("错误类型:");
+        builder.Append(ex.GetType().ToString());
+        builder.Append(Environment.NewLine);
+        builder.Append("错误方法:");
+        builder.Append(ex.TargetSite?.ToString());
+        builder.Append(Environment.NewLine);
+        builder.Append(Environment.NewLine);
+
+        QuartzLogger.WriteLogToFile($"Error_全局错误", builder.ToString());
+    }
+};
 
 if (!HslCommunication.Authorization.SetAuthorizationCode("95f1611d-633c-46ea-b03a-38ede1629f74"))
 {
@@ -81,6 +117,7 @@
 builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit限流 启动服务
 
 builder.Services.AddScoped<UseServiceDIAttribute>();
+builder.Services.AddScoped<CommonConveyorLineJob>();
 
 builder.Services.AddSession();
 
@@ -144,4 +181,4 @@
 app.MapHubs();
 app.MapControllers();
 
-app.Run();
\ No newline at end of file
+app.Run();                                          
\ No newline at end of file

--
Gitblit v1.9.3