氚云丨开发课— 06 Timer 定时器的常见使用| 学习笔记

简介: 快速学习氚云丨开发课— 06 Timer 定时器的常见使用。

开发者学堂课程【低代码氚云应用开发课程氚云丨开发课— 06 Timer 定时器的常见使用】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/894/detail/14283


氚云丨开发课— 06 Timer 定时器的常见使用


Timer 定时器的常见使用

Timer
特性:继承类 Timer,4小时执行一遍,时间不固定
public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){ }
//重写窟时器引擎执行的方法,必须存在,且方法名必须为 OnWork
protected override void OnWork(H3.IEngine engine)
public class D66159979535fac4d814ac9a4e8e6596915f458: H3.SmartForm.SmartFormController
public D9@159979535fac4d814ac9a4e8e6596915f458(H3.SmartForm.SmartFormRequest request): base(request)
protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
base.OnLoad(response);protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartForn
base.OnSubmit(actionName, postValue, response);public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){}
//重写定时器引擎执行的方法,必须存在,且方法名必须为 OnWork

protected override void OnWork(H3.IEngineI engine)
string SelSql ="select * from I_D881599c275fala12e94a869fdd62e5727717b8 where datee";
DataTable SelDt = engine.Query.QueryTable(SelSql, null);if(SelDt 1= null && SelDt.Rows.Count > e)foreach(DataRow item in SelDt.Rows) 

发送消息通知
示例:
List _messageList=newList0;

string title =“欢迎词”;/标题
string welcomeWords ="hello,氚云!\n很荣幸加入你";//发送内容
string send = H3.Organization.User.SystemUserld;//发起人
string receiverid = this.Request.UserContext.Userld;//接收人
H3.Notification.UserMessage _message = new
H3.Notification.UserMessage(H3.Notification.UserMessageType.DingTalkPlainText,
send, receiverid,"", title, welcomeWords,""):
_messageList.Add(_message);
ifL_messageList.Count > 0)
this.Request.Engine.Notifier.Send(_messageList.ToArray();://执行发送public void SendMessage(H3.IEngine engine,H3.DataModel.Bizobject biz)H3.Task.UserTask task = new H3.Task.UserTask();string appId ="D801599c275fala12e94a869fdd62e5727717b8"; //应用编码
task.ObjectId = Guid.NewGuid().ToString();//Guid 码
task.Sender = H3.Organization.User.SystemUserId;//任务的发起人 id
task.UserId ="a98364eb-5743-4890-9ed9-2bb3fBaebc92";//任务的接收人 id
task.AppCode ="D901599W";//应用编码
task.TaskType = H3.Task.TaskType.Reminder;//任务类型为提醒
task.SchemaCode ="De61599c275fala12e94a869fdd62e5727717b8";//表单编码
task.TargetType = H3.LinkTargetType.BizObject;//关联类型
task.TargetId = biz.ObjectId;//关联业务对象的ID
task.TargetName = biz.Name;//关联业务对象的数据标题
task.Name =“库存过期";//提醒标题
task.Summary ="库存过期";//提醒的内容
task.AlertTime = DateTime.Now;// 提醒时间
task.ReminderType = H3.Task.ReminderType.Once;//提醒类型
task.StartTime = DateTime.Now;//开始时间
task.EndTime = DateTime.Now;//截止时间
task.TaskState = H3.Task.TaskState.Unfinished;//任务状态
task.AlertState = H3.Task.AlentState.Waiting;//提醒的状态
ensine.TaskManaser.AddTask(ta2E):77添加任务

public class MyTest_Timer: H3.SmartForm.Timer
//构造方法,跟类名保持一致,里面不必书写代码,但是必须存在
public MyTest_Timer(){ }
//重写定时器引擎执行的方法,必须存在,且方法名必须为 Onwork
protected override void OnWork(H3.IEngine engine)DoTask(engine);
public void PoTaskH3.IEngine engine)string SelSql ="select * from I_D6@1599c275fala12e94a869fdd62e5727717b8

where datee";
DataTable SelDt = engine.Query.QueryTable(SelSql, null);
if(SelDt != null && SelDt.Rows.Count >e)
foreach(DataRow item in SelDt.Rows)
H3.DataMode1.BizObject biz = H3.DataModel.Biz0bject.Load(H3.Organization.User.SystemUserId, engine,"D861599c275fa1a12e94a869fdd62e5727717
SendMessage(engine, biz);

using System;using System.Collections.Generic;
using System.Text;
using H3;
using System.Data;public class D6@159979535fac4d814ac9a4e8e6596915f458:H3.SmartForm.SmartFormController
public Dee159979535fac4d814ac9a4e8e6596915f458(H3.SmartForm.SmartFormRequest request): base(request)protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
MyTest_Timer timer=new MyTest_Timer();timer.DoTask(this.Engine);
base.OnLoad(response);protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)base.OnSubmit(actionName, postvalue, response);

相关文章
|
8天前
|
关系型数据库 MySQL 测试技术
技术分享:深入C++时间操作函数的应用与实践
技术分享:深入C++时间操作函数的应用与实践
11 1
|
2月前
|
存储 NoSQL 应用服务中间件
定时器笔记
定时器笔记
36 0
|
9月前
|
安全 机器人 云栖大会
倒计时2天!4个小开发者,和他们对云栖大会的好奇
倒计时2天!4个小开发者,和他们对云栖大会的好奇
86 0
|
Go 调度
计时器的生命周期 | 青训营笔记
计时器的生命周期 | 青训营笔记
75 0
高职考技能提升教程007期 timer定时器综合运用 VB语言 刘金玉
高职考技能提升教程007期 timer定时器综合运用 VB语言 刘金玉
|
前端开发
前端学习案例1-计时器1
前端学习案例1-计时器1
52 0
前端学习案例1-计时器1
|
前端开发
前端学习案例3-计时器3
前端学习案例3-计时器3
62 0
前端学习案例3-计时器3
|
前端开发
前端学习案例2-计时器2
前端学习案例2-计时器2
41 0
前端学习案例2-计时器2
|
存储 Linux 调度
Linux驱动开发——定时器
Linux驱动开发——定时器
150 0
Linux驱动开发——定时器
嵌入式开发学习之--系统定时器
嵌入式开发学习之--系统定时器
嵌入式开发学习之--系统定时器