生成一段c sharp rgv调度代码

时间: 2023-03-14 21:32:20 浏览: 64
string sqldataSource = ConfigurationManager.AppSettings["DataSource"]; using (SqlConnection connection = new SqlConnection(sqldataSource)) { connection.Open(); SqlCommand command = new SqlCommand("Select * from Scheduler", connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string jobName = reader["JobName"].ToString(); string jobGroup = reader["JobGroup"].ToString(); string jobDescription = reader["JobDescription"].ToString(); string jobTypeName = reader["JobTypeName"].ToString(); string jobDataMap = reader["JobDataMap"].ToString(); string triggerName = reader["TriggerName"].ToString(); string triggerGroup = reader["TriggerGroup"].ToString(); string triggerDescription = reader["TriggerDescription"].ToString(); string triggerTypeName = reader["TriggerTypeName"].ToString(); string triggerStartTime = reader["TriggerStartTime"].ToString(); string triggerEndTime = reader["TriggerEndTime"].ToString(); string cronExpression = reader["CronExpression"].ToString(); string priority = reader["Priority"].ToString(); string misfireInstruction = reader["MisfireInstruction"].ToString(); string repeatInterval = reader["RepeatInterval"].ToString(); string repeatCount = reader["RepeatCount"].ToString(); string timeZoneId = reader["TimeZoneId"].ToString(); IJobDetail job = JobBuilder.Create(Type.GetType(jobTypeName)) .WithIdentity(jobName, jobGroup) .WithDescription(jobDescription) .Build(); job.JobDataMap.PutAll(JobDataMap.FromString(jobDataMap)); ITrigger trigger = null; if (triggerTypeName == typeof(CronTriggerImpl).Name) { trigger = TriggerBuilder.Create() .WithIdentity(triggerName, triggerGroup) .WithDescription(triggerDescription) .WithCronSchedule(cronExpression, x => x.WithMisfireHandlingInstructionDoNothing().InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(timeZoneId))) .ForJob(jobName, jobGroup) .Build(); } else if (triggerTypeName == typeof(SimpleTriggerImpl).Name) { trigger = TriggerBuilder.Create() .WithIdentity(triggerName, triggerGroup) .WithDescription(triggerDescription) .StartAt(DateTime.Parse(triggerStartTime)) .EndAt(DateTime.Parse(triggerEndTime)) .WithSimpleSchedule(x => x.WithIntervalInSeconds(int.Parse(repeatInterval)) .WithRepeatCount(int.Parse(repeatCount)) .WithMisfireHandlingInstructionFireNow()) .ForJob(jobName, jobGroup) .Build(); } await scheduler.ScheduleJob(job, trigger); } reader.Close(); connection.Close(); }答:使用CSharp编写的RGV调度代码如下:string sqldataSource = ConfigurationManager.AppSettings["DataSource"]; using (SqlConnection connection = new SqlConnection(sqldataSource)) { connection.Open(); SqlCommand command = new SqlCommand("Select * from Scheduler", connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { string jobName = reader["JobName"].ToString(); string jobGroup = reader["JobGroup"].ToString(); string jobDescription = reader["JobDescription"].ToString(); string jobTypeName = reader["JobTypeName"].ToString(); string jobDataMap = reader["JobDataMap"].ToString(); string triggerName = reader["TriggerName"].ToString(); string triggerGroup = reader["TriggerGroup"].ToString(); string triggerDescription = reader["TriggerDescription"].ToString(); string triggerTypeName = reader["TriggerTypeName"].ToString(); string triggerStartTime = reader["TriggerStartTime"].ToString(); string triggerEndTime = reader["TriggerEndTime"].ToString(); string cronExpression = reader["CronExpression"].ToString(); string priority = reader["Priority"].ToString(); string misfireInstruction = reader["MisfireInstruction"].ToString(); string repeatInterval = reader["RepeatInterval"].ToString(); string repeatCount = reader["RepeatCount"].ToString(); string timeZoneId = reader["TimeZoneId"].ToString(); IJobDetail job = JobBuilder.Create(Type.GetType(jobTypeName)) .WithIdentity(jobName, jobGroup) .WithDescription(jobDescription) .Build(); job.JobDataMap.PutAll(JobDataMap.FromString(jobDataMap)); ITrigger trigger = null; if (triggerTypeName == typeof(CronTriggerImpl).Name) { trigger = TriggerBuilder.Create() .WithIdentity(triggerName, triggerGroup) .WithDescription(triggerDescription) .WithCronSchedule(cronExpression, x => x.WithMisfireHandlingInstructionDoNothing().InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(timeZoneId))) .ForJob(jobName, jobGroup) .Build(); } else if (triggerTypeName == typeof(SimpleTriggerImpl).Name) { trigger = TriggerBuilder.Create() .WithIdentity(triggerName, triggerGroup) .WithDescription(triggerDescription) .StartAt(DateTime.Parse(triggerStartTime)) .EndAt(DateTime.Parse(triggerEndTime)) .WithSimpleSchedule(x => x.WithIntervalInSeconds(int.Parse(repeatInterval)) .WithRepeatCount(int.Parse(repeatCount)) .WithMisfireHandlingInstructionFireNow()) .ForJob(jobName, jobGroup) .Build(); } await scheduler.ScheduleJob(job, trigger); } reader.Close(); connection.Close(); }

相关推荐

最新推荐

2018数模国赛B题-国二

2018数模国赛B题-国二。本文通过建立智能RGV的贪心算法动态调度模型,利用C++编程进行模型模拟,给出了智能RGV在三种不同的具体情况下的调度策略和系统的作业效率。

自动化立体仓库设计与优化

一、 自动化立体仓库设计 自动化立体仓库作为现代物流行业的重中之重,发挥着十分重要的作用。实现这些功能的直接机构包括: (1) 自动仓储设备(自动化立体仓库)(2) 其它货架(乎面托盘货架与流动货架等)(3)...

JavaScript介绍.zip

javascript,JavaScript 最初由 Netscape 公司的 Brendan Eich 在 1995 年开发,用于 Netscape Navigator 浏览器。随着时间的推移,JavaScript 成为了网页开发中不可或缺的一部分,并且其应用范围已经远远超出了浏览器,成为了全栈开发的重要工具。

上位机开发罗克韦尔abcip通信协议详解

上位机开发罗克韦尔abcip通信协议详解 1.注册会话命令详解 6500 0400 00000000 00000000 0000000000000000 00000000 0100 0000 响应 6500 0400 05000400 00000000 0000000000000000 00000000 0100 0000 6500:注册请求命令 0400:服务长度(0100 0000) 00000000:会话句柄 (由PLC生成) 00000000:状态默认 0000000000000000:发送方描述,默认0 00000000:选项,默认0 0100:协议版本,默认1 0000:选项标记,默认0

Microsoft SPY++ 工具及使用教程

Spy++ (SPYXX.EXE) 是一个基于 Win32 的实用工具,提供系统进程、线程、窗口和窗口消息的图形视图。 Spy++ 有两个版本。 第一个版本,名为 Spy++ (spyxx.exe),用于显示发送到在 32 位进程中运行的窗口的消息。 例如,在 32 位进程中运行的 Visual Studio。 因此,可以使用 Spy++ 来显示发送到“解决方案资源管理器” 中的消息。 由于 Visual Studio 中大多数生成的默认配置都是在 32 位进程中运行的,因此如果已安装所需组件,则第一个版本的 Spy++ 就是在 Visual Studio 中的“工具”菜单上可用的那一个。 第二个版本,名为 Spy++(64 位)(spyxx_amd64.exe),用于显示发送到在 64 位进程中运行的窗口的消息。 例如,在 64 位操作系统上,记事本在 64 位进程中运行。 因此,可以使用 Spy++(64 位)来显示发送到记事本的消息。 详细的使用说明请见:https://blog.csdn.net/huang1600301017/article/details/138137

stc12c5a60s2 例程

stc12c5a60s2 单片机的所有功能的实例,包括SPI、AD、串口、UCOS-II操作系统的应用。

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire

【迁移学习在车牌识别中的应用优势与局限】: 讨论迁移学习在车牌识别中的应用优势和局限

![【迁移学习在车牌识别中的应用优势与局限】: 讨论迁移学习在车牌识别中的应用优势和局限](https://img-blog.csdnimg.cn/direct/916e743fde554bcaaaf13800d2f0ac25.png) # 1. 介绍迁移学习在车牌识别中的背景 在当今人工智能技术迅速发展的时代,迁移学习作为一种强大的技术手段,在车牌识别领域展现出了巨大的潜力和优势。通过迁移学习,我们能够将在一个领域中学习到的知识和模型迁移到另一个相关领域,从而减少对大量标注数据的需求,提高模型训练效率,加快模型收敛速度。这种方法不仅能够增强模型的泛化能力,提升识别的准确率,还能有效应对数据

margin-top: 50%;

margin-top: 50%; 是一种CSS样式代码,用于设置元素的上边距(即与上方元素或父级元素之间的距离)为其父元素高度的50%。 这意味着元素的上边距将等于其父元素高度的50%。例如,如果父元素的高度为100px,则该元素的上边距将为50px。 请注意,这个值只在父元素具有明确的高度(非auto)时才有效。如果父元素的高度是auto,则无法确定元素的上边距。 希望这个解释对你有帮助!如果你还有其他问题,请随时提问。

Android通过全局变量传递数据

在Activity之间数据传递中还有一种比较实用的方式 就是全局对象 实用J2EE的读者来说都知道Java Web的四个作用域 这四个作用域从小到大分别是Page Request Session和Application 其中Application域在应用程序的任何地方都可以使用和访问 除非是Web服务器停止 Android中的全局对象非常类似于Java Web中的Application域 除非是Android应用程序清除内存 否则全局对象将一直可以访问 1 定义一个类继承Application public class MyApp extends Application 2 在AndroidMainfest xml中加入全局变量 android:name " MyApp" 3 在传数据类中获取全局变量Application对象并设置数据 myApp MyApp getApplication ; myApp setName "jack" ; 修改之后的名称 4 在收数据类中接收Application对象 myApp MyApp getApplication ;">在Activity之间数据传递中还有一种比较实用的方式 就是全局对象 实用J2EE的读者来说都知道Java Web的四个作用域 这四个作用域从小到大分别是Page Request Session和Application 其中Application域在应用程序的任何地方都可以使用和 [更多]