合并
This commit is contained in:
@@ -7,7 +7,7 @@ namespace JNPF.TaskScheduler.Entitys.Entity;
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// 版 本:V3.2
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2021-06-01 .
|
||||
/// </summary>
|
||||
[SugarTable("snowid")]
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace JNPF.TaskScheduler.Entitys;
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// 版 本:V3.2
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2021-06-01 .
|
||||
/// </summary>
|
||||
[SugarTable("base_timetask")]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace JNPF.TaskScheduler.Entitys;
|
||||
/// <summary>
|
||||
/// 定时任务日志
|
||||
/// 版 本:V3.2
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2021-06-01 .
|
||||
/// </summary>
|
||||
[SugarTable("BASE_TIMETASKLOG")]
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace JNPF.TaskScheduler.Interfaces.TaskScheduler;
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// 版 本:V3.2
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 作 者:JNPF开发平台组
|
||||
/// 日 期:2021-06-01 .
|
||||
/// </summary>
|
||||
|
||||
@@ -1,149 +1,149 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Model;
|
||||
using JNPF.TaskScheduler.Interfaces.TaskScheduler;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Entity;
|
||||
|
||||
namespace Tnb.TaskScheduler.Listener
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成质检任务
|
||||
/// </summary>
|
||||
public class QcTaskTimeWorker //u: ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<QcCheckPlanH> repository => App.GetService<ISqlSugarRepository<QcCheckPlanH>>();
|
||||
private ITimeTaskService timeTaskService => App.GetService<ITimeTaskService>();
|
||||
[SpareTime("0 0 0 * * ?", "生成质检任务", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||
public async void CreateTask(SpareTimer timer, long count)
|
||||
{
|
||||
try
|
||||
{
|
||||
var TimeTasks = await timeTaskService.GetTasks();
|
||||
var timeTaskEntity = TimeTasks.Where(p => p.Id == timer.WorkerName && p.EnabledMark == 1).FirstOrDefault();
|
||||
if (timeTaskEntity == null)
|
||||
return;
|
||||
ContentModel? comtentModel = timeTaskEntity.ExecuteContent.ToObject<ContentModel>();
|
||||
var client = repository.CopyNew();
|
||||
var PlanH = await client.Queryable<QcCheckPlanH>().Where(p => p.id == comtentModel.parameter.Where(p => p.field == "id").First().value).FirstAsync();
|
||||
var PlanDs = await client.Queryable<QcCheckPlanD>().Where(p => p.mainid == PlanH.id).ToListAsync();
|
||||
if (PlanH == null || PlanDs.Count == 0)
|
||||
return;
|
||||
List<string> strs = new List<string>();
|
||||
strs.Add("26589795199765");//首检
|
||||
strs.Add("26589835919125");//生产检
|
||||
strs.Add("26590141686549");//巡检
|
||||
if (strs.Contains(PlanH.checktype))
|
||||
{
|
||||
var PlanMaterials = await client.Queryable<QcCheckPlanMaterial>().Where(p => p.planid == PlanH.id).Select(p => p.materialid).ToListAsync();
|
||||
var PlanProcesss = await client.Queryable<QcCheckPlanProcess>().Where(p => p.planid == PlanH.id).Select(p => p.processid).ToListAsync();
|
||||
var PlanWork = await client.Queryable<QcCheckPlanWork>().Where(p => p.planid == PlanH.id).Select(p => p.workid).ToListAsync();
|
||||
//物料工序工位不能同时为空
|
||||
if (PlanMaterials.Count == 0 && PlanProcesss.Count == 0 && PlanWork.Count == 0)
|
||||
return;
|
||||
var PrdMoTasks = await client.Queryable<PrdMoTask>()
|
||||
.WhereIF(PlanMaterials.Count > 0, p => PlanMaterials.Contains(p.material_id))
|
||||
.WhereIF(PlanProcesss.Count > 0, p => PlanProcesss.Contains(p.process_id))
|
||||
.WhereIF(PlanWork.Count > 0, p => PlanWork.Contains(p.workstation_id))
|
||||
.Where(p => p.mo_task_status == "InProgress")//进行中
|
||||
.ToListAsync();
|
||||
|
||||
var DictionaryType = await client.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
var DictionaryData = await client.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync();
|
||||
var time = DateTime.Now;
|
||||
foreach (var PrdMoTask in PrdMoTasks)
|
||||
{
|
||||
|
||||
QcCheckExecH qcCheckExecH = new QcCheckExecH();
|
||||
qcCheckExecH.id = SnowflakeIdHelper.NextId();
|
||||
qcCheckExecH.checktype = PlanH.checktype;
|
||||
qcCheckExecH.status = DictionaryData.Id;
|
||||
qcCheckExecH.tasktime = time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
qcCheckExecH.materialid = PrdMoTask.material_id;
|
||||
qcCheckExecH.processid = PrdMoTask.process_id;
|
||||
qcCheckExecH.workid = PrdMoTask.workstation_id;
|
||||
qcCheckExecH.create_time = time;
|
||||
var ExecDs = new List<QcCheckExecD>();
|
||||
foreach (var PlanD in PlanDs)
|
||||
{
|
||||
QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
QcCheckExecD.mainid = qcCheckExecH.id;
|
||||
QcCheckExecD.extype = PlanD.extype;
|
||||
QcCheckExecD.excontent = PlanD.excontent;
|
||||
QcCheckExecD.check = PlanD.check;
|
||||
QcCheckExecD.errorcause = PlanD.errorcause;
|
||||
QcCheckExecD.errorlevel = PlanD.errorlevel;
|
||||
QcCheckExecD.remark = PlanD.remark;
|
||||
QcCheckExecD.attachment = PlanD.attachment;
|
||||
QcCheckExecD.isexec = PlanD.isexec;
|
||||
QcCheckExecD.custom = PlanD.custom;
|
||||
QcCheckExecD.typeid = PlanD.typeid;
|
||||
QcCheckExecD.itemid = PlanD.itemid;
|
||||
QcCheckExecD.create_time = time;
|
||||
ExecDs.Add(QcCheckExecD);
|
||||
}
|
||||
await client.Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
await client.Insertable(ExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var PlanMaterials = await client.Queryable<QcCheckPlanMaterial>().Where(p => p.planid == PlanH.id).Select(p => p.materialid).ToListAsync();
|
||||
var DictionaryType = await client.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
var DictionaryData = await client.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync();
|
||||
var time = DateTime.Now;
|
||||
foreach (var Material in PlanMaterials)
|
||||
{
|
||||
QcCheckExecH qcCheckExecH = new QcCheckExecH();
|
||||
qcCheckExecH.id = SnowflakeIdHelper.NextId();
|
||||
qcCheckExecH.checktype = PlanH.checktype;
|
||||
qcCheckExecH.status = DictionaryData.Id;
|
||||
qcCheckExecH.tasktime = time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
qcCheckExecH.materialid = Material;
|
||||
qcCheckExecH.processid = "";
|
||||
qcCheckExecH.workid = "";
|
||||
qcCheckExecH.create_time = time;
|
||||
var ExecDs = new List<QcCheckExecD>();
|
||||
foreach (var PlanD in PlanDs)
|
||||
{
|
||||
QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
QcCheckExecD.mainid = qcCheckExecH.id;
|
||||
QcCheckExecD.extype = PlanD.extype;
|
||||
QcCheckExecD.excontent = PlanD.excontent;
|
||||
QcCheckExecD.check = PlanD.check;
|
||||
QcCheckExecD.errorcause = PlanD.errorcause;
|
||||
QcCheckExecD.errorlevel = PlanD.errorlevel;
|
||||
QcCheckExecD.remark = PlanD.remark;
|
||||
QcCheckExecD.attachment = PlanD.attachment;
|
||||
QcCheckExecD.isexec = PlanD.isexec;
|
||||
QcCheckExecD.custom = PlanD.custom;
|
||||
QcCheckExecD.typeid = PlanD.typeid;
|
||||
QcCheckExecD.itemid = PlanD.itemid;
|
||||
QcCheckExecD.create_time = time;
|
||||
ExecDs.Add(QcCheckExecD);
|
||||
}
|
||||
await client.Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
await client.Insertable(ExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
//只执行一次的 修改EnabledMark字段
|
||||
var InterfaceParameter = comtentModel.parameter.Where(p => p.field == "doonce").FirstOrDefault();
|
||||
if (InterfaceParameter != null && bool.Parse(InterfaceParameter.value))
|
||||
{
|
||||
timeTaskEntity.EnabledMark = 0;
|
||||
await client.Updateable(timeTaskEntity).ExecuteCommandAsync();
|
||||
SpareTime.Cancel(timeTaskEntity.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// using JNPF;
|
||||
// using JNPF.Common.Security;
|
||||
// using JNPF.Systems.Entitys.System;
|
||||
// using JNPF.TaskScheduler;
|
||||
// using JNPF.TaskScheduler.Entitys.Model;
|
||||
// using JNPF.TaskScheduler.Interfaces.TaskScheduler;
|
||||
// using SqlSugar;
|
||||
// using Tnb.ProductionMgr.Entities;
|
||||
// using Tnb.QcMgr.Entities;
|
||||
// using Tnb.QcMgr.Entities.Entity;
|
||||
//
|
||||
// namespace Tnb.TaskScheduler.Listener
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 生成质检任务
|
||||
// /// </summary>
|
||||
// public class QcTaskTimeWorker //u: ISpareTimeWorker
|
||||
// {
|
||||
// private ISqlSugarRepository<QcCheckPlanH> repository => App.GetService<ISqlSugarRepository<QcCheckPlanH>>();
|
||||
// private ITimeTaskService timeTaskService => App.GetService<ITimeTaskService>();
|
||||
// [SpareTime("0 0 0 * * ?", "生成质检任务", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||
// public async void CreateTask(SpareTimer timer, long count)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var TimeTasks = await timeTaskService.GetTasks();
|
||||
// var timeTaskEntity = TimeTasks.Where(p => p.Id == timer.WorkerName && p.EnabledMark == 1).FirstOrDefault();
|
||||
// if (timeTaskEntity == null)
|
||||
// return;
|
||||
// ContentModel? comtentModel = timeTaskEntity.ExecuteContent.ToObject<ContentModel>();
|
||||
// var client = repository.CopyNew();
|
||||
// var PlanH = await client.Queryable<QcCheckPlanH>().Where(p => p.id == comtentModel.parameter.Where(p => p.field == "id").First().value).FirstAsync();
|
||||
// var PlanDs = await client.Queryable<QcCheckPlanD>().Where(p => p.mainid == PlanH.id).ToListAsync();
|
||||
// if (PlanH == null || PlanDs.Count == 0)
|
||||
// return;
|
||||
// List<string> strs = new List<string>();
|
||||
// strs.Add("26589795199765");//首检
|
||||
// strs.Add("26589835919125");//生产检
|
||||
// strs.Add("26590141686549");//巡检
|
||||
// if (strs.Contains(PlanH.checktype))
|
||||
// {
|
||||
// var PlanMaterials = await client.Queryable<QcCheckPlanMaterial>().Where(p => p.planid == PlanH.id).Select(p => p.materialid).ToListAsync();
|
||||
// var PlanProcesss = await client.Queryable<QcCheckPlanProcess>().Where(p => p.planid == PlanH.id).Select(p => p.processid).ToListAsync();
|
||||
// var PlanWork = await client.Queryable<QcCheckPlanWork>().Where(p => p.planid == PlanH.id).Select(p => p.workid).ToListAsync();
|
||||
// //物料工序工位不能同时为空
|
||||
// if (PlanMaterials.Count == 0 && PlanProcesss.Count == 0 && PlanWork.Count == 0)
|
||||
// return;
|
||||
// var PrdMoTasks = await client.Queryable<PrdMoTask>()
|
||||
// .WhereIF(PlanMaterials.Count > 0, p => PlanMaterials.Contains(p.material_id))
|
||||
// .WhereIF(PlanProcesss.Count > 0, p => PlanProcesss.Contains(p.process_id))
|
||||
// .WhereIF(PlanWork.Count > 0, p => PlanWork.Contains(p.workstation_id))
|
||||
// .Where(p => p.mo_task_status == "InProgress")//进行中
|
||||
// .ToListAsync();
|
||||
//
|
||||
// var DictionaryType = await client.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
// var DictionaryData = await client.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync();
|
||||
// var time = DateTime.Now;
|
||||
// foreach (var PrdMoTask in PrdMoTasks)
|
||||
// {
|
||||
//
|
||||
// QcCheckExecH qcCheckExecH = new QcCheckExecH();
|
||||
// qcCheckExecH.id = SnowflakeIdHelper.NextId();
|
||||
// qcCheckExecH.checktype = PlanH.checktype;
|
||||
// qcCheckExecH.status = DictionaryData.Id;
|
||||
// qcCheckExecH.tasktime = time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
// qcCheckExecH.materialid = PrdMoTask.material_id;
|
||||
// qcCheckExecH.processid = PrdMoTask.process_id;
|
||||
// qcCheckExecH.workid = PrdMoTask.workstation_id;
|
||||
// qcCheckExecH.create_time = time;
|
||||
// var ExecDs = new List<QcCheckExecD>();
|
||||
// foreach (var PlanD in PlanDs)
|
||||
// {
|
||||
// QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
// QcCheckExecD.mainid = qcCheckExecH.id;
|
||||
// QcCheckExecD.extype = PlanD.extype;
|
||||
// QcCheckExecD.excontent = PlanD.excontent;
|
||||
// QcCheckExecD.check = PlanD.check;
|
||||
// QcCheckExecD.errorcause = PlanD.errorcause;
|
||||
// QcCheckExecD.errorlevel = PlanD.errorlevel;
|
||||
// QcCheckExecD.remark = PlanD.remark;
|
||||
// QcCheckExecD.attachment = PlanD.attachment;
|
||||
// QcCheckExecD.isexec = PlanD.isexec;
|
||||
// QcCheckExecD.custom = PlanD.custom;
|
||||
// QcCheckExecD.typeid = PlanD.typeid;
|
||||
// QcCheckExecD.itemid = PlanD.itemid;
|
||||
// QcCheckExecD.create_time = time;
|
||||
// ExecDs.Add(QcCheckExecD);
|
||||
// }
|
||||
// await client.Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
// await client.Insertable(ExecDs).ExecuteCommandAsync();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var PlanMaterials = await client.Queryable<QcCheckPlanMaterial>().Where(p => p.planid == PlanH.id).Select(p => p.materialid).ToListAsync();
|
||||
// var DictionaryType = await client.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
// var DictionaryData = await client.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync();
|
||||
// var time = DateTime.Now;
|
||||
// foreach (var Material in PlanMaterials)
|
||||
// {
|
||||
// QcCheckExecH qcCheckExecH = new QcCheckExecH();
|
||||
// qcCheckExecH.id = SnowflakeIdHelper.NextId();
|
||||
// qcCheckExecH.checktype = PlanH.checktype;
|
||||
// qcCheckExecH.status = DictionaryData.Id;
|
||||
// qcCheckExecH.tasktime = time.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
// qcCheckExecH.materialid = Material;
|
||||
// qcCheckExecH.processid = "";
|
||||
// qcCheckExecH.workid = "";
|
||||
// qcCheckExecH.create_time = time;
|
||||
// var ExecDs = new List<QcCheckExecD>();
|
||||
// foreach (var PlanD in PlanDs)
|
||||
// {
|
||||
// QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
// QcCheckExecD.mainid = qcCheckExecH.id;
|
||||
// QcCheckExecD.extype = PlanD.extype;
|
||||
// QcCheckExecD.excontent = PlanD.excontent;
|
||||
// QcCheckExecD.check = PlanD.check;
|
||||
// QcCheckExecD.errorcause = PlanD.errorcause;
|
||||
// QcCheckExecD.errorlevel = PlanD.errorlevel;
|
||||
// QcCheckExecD.remark = PlanD.remark;
|
||||
// QcCheckExecD.attachment = PlanD.attachment;
|
||||
// QcCheckExecD.isexec = PlanD.isexec;
|
||||
// QcCheckExecD.custom = PlanD.custom;
|
||||
// QcCheckExecD.typeid = PlanD.typeid;
|
||||
// QcCheckExecD.itemid = PlanD.itemid;
|
||||
// QcCheckExecD.create_time = time;
|
||||
// ExecDs.Add(QcCheckExecD);
|
||||
// }
|
||||
// await client.Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
// await client.Insertable(ExecDs).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// //只执行一次的 修改EnabledMark字段
|
||||
// var InterfaceParameter = comtentModel.parameter.Where(p => p.field == "doonce").FirstOrDefault();
|
||||
// if (InterfaceParameter != null && bool.Parse(InterfaceParameter.value))
|
||||
// {
|
||||
// timeTaskEntity.EnabledMark = 0;
|
||||
// await client.Updateable(timeTaskEntity).ExecuteCommandAsync();
|
||||
// SpareTime.Cancel(timeTaskEntity.Id);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using JNPF;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.TaskScheduler.Listener
|
||||
{
|
||||
public class RequestJavaOneTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<BasPushRuleH> _repository => App.GetService<ISqlSugarRepository<BasPushRuleH>>();
|
||||
|
||||
[SpareTime("* * * * * ?", "自动生成待检出库", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false, DoOnce = true)]
|
||||
public async void RequestOne(SpareTimer timer, long count)
|
||||
{
|
||||
// Log.Information("----------------------开始生成特种设备检验计划----------------------");
|
||||
|
||||
try
|
||||
{
|
||||
Log.Information($"开始调用自动生成待检出库:");
|
||||
var db = _repository.CopyNew();
|
||||
TimeTaskEntity timeTaskEntity = await db.Queryable<TimeTaskEntity>().SingleAsync(x => x.Id == timer.WorkerName);
|
||||
string url = timeTaskEntity.Description;
|
||||
if (url != null && !string.IsNullOrEmpty(url))
|
||||
{
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
//["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(url, "", header);
|
||||
Log.Information($"开始调用j自动生成待检出库:{url}结束");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Log.Error(e.Message);
|
||||
}
|
||||
|
||||
|
||||
// Log.Information("----------------------结束生成特种设备检验计划----------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using JNPF;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.TaskScheduler.Listener
|
||||
{
|
||||
public class RequestJavaThreeTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<BasPushRuleH> _repository => App.GetService<ISqlSugarRepository<BasPushRuleH>>();
|
||||
|
||||
[SpareTime("* * * * * ?", "定时任务3", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false, DoOnce = true)]
|
||||
public async void RequestThree(SpareTimer timer, long count)
|
||||
{
|
||||
// Log.Information("----------------------开始生成特种设备检验计划----------------------");
|
||||
|
||||
try
|
||||
{
|
||||
var db = _repository.CopyNew();
|
||||
TimeTaskEntity timeTaskEntity = await db.Queryable<TimeTaskEntity>().SingleAsync(x => x.Id == timer.WorkerName);
|
||||
string url = timeTaskEntity.Description;
|
||||
if (url != null && !string.IsNullOrEmpty(url))
|
||||
{
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
//["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(url, "", header);
|
||||
Log.Error($"开始调用java接口3:{url}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Log.Error(e.Message);
|
||||
}
|
||||
|
||||
|
||||
// Log.Information("----------------------结束生成特种设备检验计划----------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using JNPF;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.TaskScheduler.Listener
|
||||
{
|
||||
public class RequestJavaTwoTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<BasPushRuleH> _repository => App.GetService<ISqlSugarRepository<BasPushRuleH>>();
|
||||
|
||||
[SpareTime("* * * * * ?", "定时任务2", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false, DoOnce = true)]
|
||||
public async void RequestTwo(SpareTimer timer, long count)
|
||||
{
|
||||
// Log.Information("----------------------开始生成特种设备检验计划----------------------");
|
||||
|
||||
try
|
||||
{
|
||||
var db = _repository.CopyNew();
|
||||
TimeTaskEntity timeTaskEntity = await db.Queryable<TimeTaskEntity>().SingleAsync(x => x.Id == timer.WorkerName);
|
||||
string url = timeTaskEntity.Description;
|
||||
if (url != null && !string.IsNullOrEmpty(url))
|
||||
{
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
//["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(url, "", header);
|
||||
Log.Error($"开始调用java接口2:{url}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Log.Error(e.Message);
|
||||
}
|
||||
|
||||
|
||||
// Log.Information("----------------------结束生成特种设备检验计划----------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace JNPF.TaskScheduler;
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// 版 本:V3.4.1
|
||||
/// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com)
|
||||
|
||||
/// 日 期:2021-06-01.
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "TaskScheduler", Name = "scheduletask", Order = 220)]
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr.Entities\Tnb.ProductionMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr.Entities\Tnb.QcMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Tnb.TaskScheduler.Interfaces\Tnb.TaskScheduler.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user