63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using DeviceRepair.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using TsSFCDevice.Client.Biz.Impl;
|
|
|
|
namespace TsSFCDevice.Client.Biz
|
|
{
|
|
public class Scheduler
|
|
{
|
|
public delegate void CallBackEventHandler(string args, object value);
|
|
public event CallBackEventHandler CallBack;
|
|
|
|
private static Scheduler manager;
|
|
public static Scheduler Instance
|
|
{
|
|
get
|
|
{
|
|
if (manager == null)
|
|
manager = new Scheduler();
|
|
return manager;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 启动
|
|
/// </summary>
|
|
public void Run()
|
|
{
|
|
Task.Run(() =>
|
|
{
|
|
while (true)
|
|
{
|
|
Console.WriteLine(DateTime.Now.ToLongTimeString());
|
|
GetSchedulerPlanTips();
|
|
Task.Delay(3000).Wait();
|
|
}
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取当年度 - 当月待保养计划 - 数量
|
|
/// </summary>
|
|
protected void GetSchedulerPlanTips()
|
|
{
|
|
try
|
|
{
|
|
IList<View_CurrentMonthPlanTips> lst = PlanRepository.Instance.Get_PM_PLAN_CurrentMonth();
|
|
CallBack?.Invoke("SchedulerPlanTips", (lst?.Count ?? 00));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CallBack?.Invoke("SchedulerPlanTips", ex.Message);
|
|
}
|
|
}
|
|
|
|
//
|
|
|
|
}
|
|
}
|