Merge branch 'dev' of ssh://git.tuotong-tech.com:9105/tnb/tnb.server into dev
This commit is contained in:
25
EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
Normal file
25
EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备生命周期
|
||||
/// </summary>
|
||||
public static class EquipmentLife
|
||||
{
|
||||
/// <summary>
|
||||
/// 启用
|
||||
/// </summary>
|
||||
public const string ENABLE = "1";
|
||||
/// <summary>
|
||||
/// 停用
|
||||
/// </summary>
|
||||
public const string DISABLE = "2";
|
||||
/// <summary>
|
||||
/// 库存
|
||||
/// </summary>
|
||||
public const string STOCK = "3";
|
||||
/// <summary>
|
||||
/// 报废
|
||||
/// </summary>
|
||||
public const string SCRAP = "4";
|
||||
}
|
||||
}
|
||||
150
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
Normal file
150
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///设备点巡检项目
|
||||
///</summary>
|
||||
[SugarTable("eqp_spot_ins_item")]
|
||||
public class EqpSpotInsItem : BaseEntity<string>
|
||||
{
|
||||
public EqpSpotInsItem()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:判断类型1数值2结果
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string judge_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:上限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? high_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否包含上限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? high_value_is_include { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:下限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? low_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否包含下限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? low_value_is_include { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:标准值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? standard_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单位id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:排序
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public int ordinal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:类型 1 点检 2巡检
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编码
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:名称
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:判断内容
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string judge_content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检方法
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string inspection_method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:备注
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:所属组织
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string org_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public double? standard_value { get; set; }
|
||||
public decimal? standard_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单位id
|
||||
@@ -131,4 +131,11 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检设备模板id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string spot_ins_tem_equip_id {get;set;}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace Tnb.EquipMgr.Entities
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备id
|
||||
/// Default:
|
||||
@@ -70,18 +71,18 @@ namespace Tnb.EquipMgr.Entities
|
||||
public DateTime? send_date_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:滞后推送时间
|
||||
/// Desc:计划执行通知提前量
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? after_send_date_time { get; set; }
|
||||
public int? plan_run_notice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否滞后推送
|
||||
/// Desc:执行滞后推送时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? is_after_send { get; set; }
|
||||
public int? plan_delay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
@@ -131,5 +132,81 @@ namespace Tnb.EquipMgr.Entities
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string send_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编码
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:计划执行通知提前量单位 1 小时 2 天 3 周
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string plan_run_notice_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:执行滞后推送时间单位 1 小时 2 天 3 周
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string plan_delay_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核岗位id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_post_info_user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:责任岗位id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string send_post_info_user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否复核
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string is_repeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? repeat_time {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核备注
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_remark {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核人id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_user_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:仅用于关联表字段查询用不存储数据
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName="query_info")]
|
||||
public string query_info {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string attachment { get; set; }
|
||||
}
|
||||
}
|
||||
33
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipD.cs
Normal file
33
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipD.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///点巡检设备模板子表
|
||||
///</summary>
|
||||
[SugarTable("eqp_spot_ins_tem_equip_d")]
|
||||
public class EqpSpotInsTemEquipD : BaseEntity<string>
|
||||
{
|
||||
public EqpSpotInsTemEquipD(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备模板id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string spot_ins_tem_equip_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检项id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string spot_ins_item_id {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,186 @@
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Logging;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
namespace JNPF.TaskScheduler.Listener
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成点巡检计划
|
||||
/// </summary>
|
||||
public class GenerateSpotInspectionPlanTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
[SpareTime("0 45 14 * * ? *", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||
private ISqlSugarRepository<EqpSpotInsTemEquipH> _repository => App.GetService<ISqlSugarRepository<EqpSpotInsTemEquipH>>();
|
||||
// public GenerateSpotInspectionPlanTimeWorker(ISqlSugarRepository<EqpSpotInsTemEquipH> repository)
|
||||
// {
|
||||
// _repository = repository;
|
||||
// }
|
||||
|
||||
[SpareTime("0 0 0 * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||
{
|
||||
Console.WriteLine("hello world");
|
||||
Log.Information("----------------------开始生成点巡检计划----------------------");
|
||||
|
||||
try
|
||||
{
|
||||
List<EqpSpotInsTemEquipH> eqpSpotInsTemEquipHsByOne = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "1");
|
||||
List<EqpSpotInsTemEquipH> eqpSpotInsTemEquipHsByCirculate = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "2");
|
||||
List<EqpSpotInsRecordH> tobeCreateList = new List<EqpSpotInsRecordH>();
|
||||
List<EqpSpotInsTemEquipH> tobeCreateTemplets = new List<EqpSpotInsTemEquipH>();
|
||||
var db = _repository.AsSugarClient();
|
||||
|
||||
foreach (var item in eqpSpotInsTemEquipHsByOne)
|
||||
{
|
||||
if (item.start_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd HH:mm") == DateTime.Now.ToString("yyyy-MM-dd HH:mm"))
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (eqpSpotInsTemEquipHsByCirculate != null && eqpSpotInsTemEquipHsByCirculate.Count > 0)
|
||||
{
|
||||
//查询最后一条数据加上周期是否等于现在等于表示周期到了 已废除
|
||||
// List<string> ids = eqpSpotInsTemEquipHsByCirculate.Select(x => x.id).ToList();
|
||||
// List<SpotInsRecordLastDTO> lastPlans = db.Queryable<EqpSpotInsRecordH>()
|
||||
// .GroupBy(a => new { a.spot_ins_tem_equip_id })
|
||||
// .Where(a => ids.Contains(a.spot_ins_tem_equip_id))
|
||||
// .Select(a => new SpotInsRecordLastDTO()
|
||||
// {
|
||||
// spot_ins_tem_equip_id = a.spot_ins_tem_equip_id,
|
||||
// create_time = SqlFunc.AggregateMax(a.create_time.Value)
|
||||
// }).ToList();
|
||||
//
|
||||
// foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
// {
|
||||
// var lastPlan = lastPlans.FirstOrDefault(x => x.spot_ins_tem_equip_id == item.id);
|
||||
// if (lastPlan == null || lastPlan.create_time == null || lastPlan.create_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd HH") == DateTime.Now.ToString("yyyy-MM-dd HH"))
|
||||
// {
|
||||
// tobeCreateTemplets.Add(item);
|
||||
// }
|
||||
// }
|
||||
|
||||
//整除表示一个周期到了
|
||||
foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
{
|
||||
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm")).Ticks);
|
||||
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd HH:mm")).Ticks);
|
||||
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
if (ts3.TotalMinutes * 10 / 60 % (10 * (double)item.plan_cycle)==0)
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tobeCreateTemplets != null && tobeCreateTemplets.Count > 0)
|
||||
{
|
||||
List<EqpEquipment> equipments = db.Queryable<EqpEquipment>().Where(x => x.life==Tnb.EquipMgr.EquipmentLife.ENABLE).ToList();
|
||||
int index = 1;
|
||||
foreach (var item in tobeCreateTemplets)
|
||||
{
|
||||
//只有启用设备才生成计划
|
||||
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||
continue;
|
||||
|
||||
string code = $"{DateTime.Now.ToString("yyyyMMddHHmm")+(index++).ToString().PadLeft(3,'0')}";
|
||||
tobeCreateList.Add(new EqpSpotInsRecordH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
code = code,
|
||||
// equip_type_id = item.equip_type_id,
|
||||
equip_id = item.equip_id,
|
||||
spot_ins_tem_equip_id = item.id,
|
||||
plan_run_notice = item.plan_run_notice,
|
||||
plan_run_notice_unit = item.plan_run_notice_unit,
|
||||
plan_delay = item.plan_delay,
|
||||
plan_delay_unit = item.plan_delay_unit,
|
||||
send_post_info_user_id = item.send_post_info_user_id,
|
||||
is_repeat = item.is_repeat,
|
||||
repeat_post_info_user_id = item.repeat_post_info_user_id,
|
||||
is_send = item.is_send,
|
||||
create_time = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||
{
|
||||
List<string> templetIDs = tobeCreateList.Select(x => x.spot_ins_tem_equip_id).ToList();
|
||||
List<EqpSpotInsTemEquipD> spotInsTemEquipDs = db.Queryable<EqpSpotInsTemEquipD>().Where(x => templetIDs.Contains(x.spot_ins_tem_equip_id)).ToList();
|
||||
List<string> spotInsItemIDs = spotInsTemEquipDs.Select(x => x.spot_ins_item_id).ToList();
|
||||
List<EqpSpotInsItem> spotCheckItems = db.Queryable<EqpSpotInsItem>().Where(x => spotInsItemIDs.Contains(x.id)).ToList();
|
||||
|
||||
|
||||
foreach (var tobeCreatePlan in tobeCreateList)
|
||||
{
|
||||
List<EqpSpotInsRecordD> spotInsRecordDs = new List<EqpSpotInsRecordD>();
|
||||
List<string> spotInsItems = spotInsTemEquipDs
|
||||
.Where(x => x.spot_ins_tem_equip_id == tobeCreatePlan.spot_ins_tem_equip_id)
|
||||
.Select(x => x.spot_ins_item_id).ToList();
|
||||
List<EqpSpotInsItem> tobeCreateItems = spotCheckItems.Where(x => spotInsItems.Contains(x.id)).ToList();
|
||||
foreach (var tobeCreateItem in tobeCreateItems)
|
||||
{
|
||||
spotInsRecordDs.Add(new EqpSpotInsRecordD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
spot_ins_record_id = tobeCreatePlan.id,
|
||||
spot_ins_tem_equip_id = tobeCreatePlan.spot_ins_tem_equip_id,
|
||||
spot_ins_item_id = tobeCreateItem.id,
|
||||
code = tobeCreateItem.code,
|
||||
name = tobeCreateItem.name,
|
||||
judge_type = tobeCreateItem.judge_type,
|
||||
low_value = tobeCreateItem.low_value,
|
||||
high_value = tobeCreateItem.high_value,
|
||||
low_value_is_include = tobeCreateItem.low_value_is_include,
|
||||
high_value_is_include = tobeCreateItem.high_value_is_include,
|
||||
standard_value = tobeCreateItem.standard_value,
|
||||
unit_id = tobeCreateItem.unit_id,
|
||||
inspection_method = tobeCreateItem.inspection_method,
|
||||
judge_content = tobeCreateItem.judge_content,
|
||||
remark = tobeCreateItem.remark
|
||||
});
|
||||
}
|
||||
|
||||
var dbResult = db.Ado.UseTran(() =>
|
||||
{
|
||||
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||
{
|
||||
db.Insertable<EqpSpotInsRecordH>(tobeCreateList).ExecuteCommand();
|
||||
}
|
||||
|
||||
if (spotInsRecordDs != null && spotInsRecordDs.Count > 0)
|
||||
{
|
||||
db.Insertable<EqpSpotInsRecordD>(spotInsRecordDs).ExecuteCommand();
|
||||
}
|
||||
});
|
||||
if (!dbResult.IsSuccess)
|
||||
{
|
||||
Console.WriteLine(dbResult.ErrorMessage);
|
||||
Log.Error(dbResult.ErrorMessage);
|
||||
}
|
||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Log.Error(e.Message);
|
||||
}
|
||||
|
||||
|
||||
Log.Information("----------------------结束生成点巡检计划----------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 最后一个点巡检记录
|
||||
/// </summary>
|
||||
private class SpotInsRecordLastDTO
|
||||
{
|
||||
public string spot_ins_tem_equip_id { get; set; }
|
||||
public DateTime create_time { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,11 +324,12 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
Action<SpareTimer, long>? action = null;
|
||||
ContentModel? comtentModel = input.ExecuteContent.ToObject<ContentModel>();
|
||||
input.ExecuteCycleJson = comtentModel.cron;
|
||||
TaskMethodInfo? taskMethod = null;
|
||||
switch (input.ExecuteType)
|
||||
{
|
||||
case "3":
|
||||
// 查询符合条件的任务方法
|
||||
TaskMethodInfo? taskMethod = GetTaskMethods()?.Result.FirstOrDefault(m => m.id == comtentModel.localHostTaskId);
|
||||
taskMethod = GetTaskMethods()?.Result.FirstOrDefault(m => m.id == comtentModel.localHostTaskId);
|
||||
if (taskMethod == null) break;
|
||||
|
||||
// 创建任务对象
|
||||
@@ -354,20 +355,20 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
{
|
||||
interval = (starTime.ParseToDateTime() - DateTime.Now).TotalMilliseconds.ParseToInt();
|
||||
}
|
||||
SpareTime.DoOnce(interval, action, "Once_" + input.Id);
|
||||
SpareTime.Do(
|
||||
() =>
|
||||
|
||||
if (taskMethod.StartNow) //modifyby zhoukeda 20230516
|
||||
{
|
||||
SpareTime.DoOnce(interval, action, "Once_" + input.Id);
|
||||
}
|
||||
|
||||
Func<DateTimeOffset?> nextHandle = null;
|
||||
var isRun = comtentModel.endTime.IsNullOrEmpty() ? DateTime.Now >= starTime : DateTime.Now >= starTime && DateTime.Now < endTime;
|
||||
if (isRun)
|
||||
{
|
||||
return SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
nextHandle = ()=>SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
SpareTime.Do(nextHandle
|
||||
,
|
||||
action, input.Id, comtentModel.ConnectionConfig.ToJsonString(), true, executeType: SpareTimeExecuteTypes.Parallel, cancelInNoneNextTime: false);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Tnb.TaskScheduler.Interfaces\Tnb.TaskScheduler.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Tnb.Core" Version="2023.3.24.1010" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user