ClientInfo.cs
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.Models
{
public class ClientInfo
{
/// <summary>
/// 任务来源系统标识
/// </summary>
public string sourceClient { get; set; }
private bool idleAgv = false;
/// <summary>
/// 是否有空闲AGV可用
/// </summary>
public bool hasIdleAgv {
get { return idleAgv && Online; }
set { idleAgv = value; }
}
/// <summary>
/// 在线状态
/// </summary>
public bool Online { get
{
double upInterval = (DateTime.Now - lastUpdateTime).TotalSeconds;
if (upInterval > 10)
return false;
return true;
} }
private DateTime lastUpdateTime = new DateTime();
public void SetInfo(string client,bool hasIdleAdv)
{
sourceClient = client;
this.idleAgv = hasIdleAdv;
lastUpdateTime = DateTime.Now;
}
public ClientInfo() { }
public ClientInfo(string sourceclient,bool hasidleagv)
{
sourceClient = sourceclient;
idleAgv = hasidleagv;
lastUpdateTime = DateTime.Now;
}
}
}