From 17c0f3212efe8926bcea0b2a6ff200d7696fbff7 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Wed, 6 Sep 2023 10:50:43 +0800 Subject: [PATCH] 1 --- EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs | 6 +++++- taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs index 9490814b..1df9f805 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs @@ -24,6 +24,7 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.CSharp.Syntax; using SqlSugar; @@ -72,6 +73,8 @@ namespace Tnb.EquipMgr toolMoldMaintainRule.mode = input.data["mode"].ToString(); toolMoldMaintainRule.cycle = cycle; toolMoldMaintainRule.startandend_date = startTime.ToString("yyyy-MM-dd HH:mm:ss"); + toolMoldMaintainRule.create_id = _userManager.UserId; + toolMoldMaintainRule.create_time=DateTime.Now; await _db.Insertable(toolMoldMaintainRule).ExecuteCommandAsync(); if (toolMoldMaintainRule.mode == "27118635748885") { @@ -83,7 +86,8 @@ namespace Tnb.EquipMgr comtentModel.parameter = new List(); comtentModel.parameter!.Add(new InterfaceParameter() { field = "id", value = id, defaultValue = "" }); comtentModel.localHostTaskId = "MoldMaintainTask/CreateTask"; - comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); + DateTimeOffset dateTimeOffset = new DateTimeOffset(startTime); + comtentModel.startTime = dateTimeOffset.ToUnixTimeMilliseconds(); comtentModel.TenantId = _userManager?.TenantId!; comtentModel.TenantDbName = _userManager?.TenantDbName!; comtentModel.ConnectionConfig = _userManager?.ConnectionConfig!; diff --git a/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs b/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs index 6bcbd9ff..ea0da118 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs @@ -16,7 +16,7 @@ using Tnb.QcMgr.Entities.Entity; namespace Tnb.TaskScheduler.Listener { - internal class MoldMaintainTask : ISpareTimeWorker + public class MoldMaintainTask : ISpareTimeWorker { private ISqlSugarRepository repository => App.GetService>(); [SpareTime("0 0 0 * * ?", "生成模具保养任务", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] @@ -41,6 +41,8 @@ namespace Tnb.TaskScheduler.Listener toolMoldMaintainPlan.plan_code = "JHDM" + now.ToString("yyyyMMdd") + rNum.Next(1000, 9999).ToString(); toolMoldMaintainPlan.mode = ToolMoldMaintainRule.mode; toolMoldMaintainPlan.status = "UnMaintain"; + toolMoldMaintainPlan.create_id = ToolMoldMaintainRule.create_id; + toolMoldMaintainPlan.create_time = now; toolMoldMaintainPlan.plan_start_date = now; toolMoldMaintainPlan.plan_end_date = now.AddDays((double)ToolMoldMaintainRule.cycle!); List toolMoldMaintainPlanRelations = new List();