From 06e0e3b7d61e95902a6129de2490461cd0693e1d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 15 十月 2025 15:06:40 +0800
Subject: [PATCH] 新增异步方法并优化服务调用逻辑在多个数据库文件中进行了二进制文件的修改、删除和新增操作,可能涉及数据库内容的更新或重建。在 HttpsClient.cs文件中新增了 PostNotLimitAsync方法,用于发送支持 JSON 格式的异步 HTTP POST 请求,并记录请求和响应参数。在 AgingInOrOutInputService.cs文件中,将 HttpsClient.PostAsync替换为PostNotLimitAsync,以利用新方法的功能特性。同时删除了不再需要的注释代码。
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
index 27a92be..858681c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
@@ -15,11 +15,15 @@
*----------------------------------------------------------------*/
#endregion << 鐗� 鏈� 娉� 閲� >>
+using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
+using Quartz.Impl.Matchers;
+using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Helper;
@@ -28,6 +32,8 @@
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
+using Quartz.Impl;
+using System.Collections.Specialized;
namespace WIDESEAWCS_QuartzJob.Service
{
@@ -35,10 +41,12 @@
{
private readonly IUnitOfWorkManage _unitOfWorkManage;
private readonly IDeviceInfoRepository _deviceInfoRepository;
- public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository) : base(BaseDal)
+ private readonly ISchedulerCenter _schedulerCenter;
+ public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository, ISchedulerCenter schedulerCenter) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_deviceInfoRepository = deviceInfoRepository;
+ _schedulerCenter = schedulerCenter;
}
/// <summary>
@@ -66,5 +74,55 @@
DeviceType = b.DeviceType
}).ToList();
}
+
+ public async Task<WebResponseContent> GetDispatchInfosAsync()
+ {
+ WebResponseContent content = new WebResponseContent();
+ NameValueCollection collection = new NameValueCollection
+ {
+ { "quartz.serializer.type", "binary" },
+ };
+ StdSchedulerFactory factory = new StdSchedulerFactory(collection);
+ IScheduler scheduler = await factory.GetScheduler();
+ var jobKeys = await scheduler.GetJobKeys(GroupMatcher<JobKey>.AnyGroup());
+ foreach (var jobKey in jobKeys)
+ {
+ // 鍦ㄨ繖閲屽鐞嗘瘡涓狫obKey
+ IJobDetail jobDetail = await scheduler.GetJobDetail(jobKey);
+ if (jobDetail != null)
+ {
+ // 鍙互鑾峰彇Job鐨勬弿杩颁俊鎭�
+ string jobDescription = jobDetail.Description;
+ // 浠ュ強Job鐨勬暟鎹槧灏勶紙JobDataMap锛�
+ JobDataMap jobDataMap = jobDetail.JobDataMap;
+ }
+ }
+
+ var triggerKeys = await scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.AnyGroup());
+ foreach (var triggerKey in triggerKeys)
+ {
+ // 鍦ㄨ繖閲屽鐞嗘瘡涓猅riggerKey
+ ITrigger trigger = await scheduler.GetTrigger(triggerKey);
+ if (trigger != null)
+ {
+ // 鑾峰彇涓嬩竴娆¤Е鍙戞椂闂达紙濡傛灉鏈夛級
+ DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
+ // 鑾峰彇涓婃瑙﹀彂鏃堕棿锛堝鏋滄湁锛�
+ DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
+ // 鑾峰彇瑙﹀彂绫诲瀷锛堝SimpleTrigger銆丆ronTrigger锛�
+ string triggerType = trigger.GetType().Name;
+ // 瀵逛簬CronTrigger锛岃繕鍙互鑾峰彇Cron琛ㄨ揪寮忥紙濡傛灉鏄級
+ //if (trigger is CronTrigger cronTrigger)
+ //{
+ // string cronExpression = cronTrigger.CronExpressionString;
+ //}
+ if (!previousFireTime.HasValue && nextFireTime.HasValue)
+ {
+ Console.WriteLine($"Job澶勪簬绛夊緟瑙﹀彂鐘舵�侊紝Trigger鍚嶇О: {triggerKey.Name}");
+ }
+ }
+ }
+ return content;
+ }
}
}
--
Gitblit v1.9.3