ContainerInfo.cs
2.9 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 容器信息
/// </summary>
public class ContainerInfo
{
public ContainerInfo(string containerCode, ContainerType inOrOut, string slotCode, int deviceId = 0)
{
ContainerCode = containerCode;
this.InOrOutStore = inOrOut;
this.inoutPar = new InOutParam();
inoutPar.slotCode = slotCode;
inoutPar.DeviceId = deviceId;
}
public ContainerInfo()
{
this.inoutPar = new InOutParam();
}
public string ToStr()
{
return JsonHelper.SerializeObject(this);
}
/// <summary>
/// 容器编号
/// </summary>
public string ContainerCode = "";
/// <summary>
/// 容器有效码不带A/B字符
/// </summary>
public string ContainerValidCode
{
get
{
if (ContainerCode.EndsWith("A") || ContainerCode.EndsWith("B"))
{
return ContainerCode.Substring(0, ContainerCode.Length - 1);
}
//else if (ContainerCode.StartsWith("C") && ContainerCode.Length == 6)
// return ContainerCode;
else
return ContainerCode;
}
}
/// <summary>
/// 出库还是入库
/// </summary>
public ContainerType InOrOutStore { get; set; } = ContainerType.None;
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; } = TaskStatus.WAIT;
public string TaskCode { get; set; }
public void UpdateStatus(string status,string loc="")
{
Status = status;
CurLoc = loc;
LastUpdateTime = DateTime.Now;
}
/// <summary>
/// 当前位置
/// </summary>
public string CurLoc { get; set; } = "";
public DateTime LastUpdateTime { get; set; } = DateTime.Now;
private InOutParam inoutPar = null;
public InOutParam InoutParam
{
get
{
if (inoutPar == null)
{
inoutPar = new InOutParam();
}
return inoutPar;
}
set
{
this.inoutPar = value;
}
}
}
/// <summary>
/// 容器的物料的类型
/// </summary>
public enum ContainerType
{
/// <summary>
/// 无操作
/// </summary>
None,
/// <summary>
/// 入库物料
/// </summary>
InStore = 1,
/// <summary>
/// 仓储出库物料
/// </summary>
OutStore = 2
}
}