StorageLocation.cs
2.85 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Rcs.Domain.Attributes;
namespace Rcs.Domain.Entities;
/// <summary>
/// 库位实体
/// @author zzy
/// </summary>
[Table("storage_locations")]
public class StorageLocation : Entity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column("location_id")]
public Guid LocationId { get; set; }
/// <summary>
/// 所属库区ID(外键)
/// </summary>
[Column("area_id")]
public Guid AreaId { get; set; }
/// <summary>
/// 储位类型ID(外键)
/// @author zzy
/// </summary>
[Column("location_type_id")]
public Guid? LocationTypeId { get; set; }
/// <summary>
/// 关联的地图节点ID(外键,可为空)
/// @author zzy
/// </summary>
[Column("map_node_id")]
public Guid? MapNodeId { get; set; }
/// <summary>
/// 库位编码
/// </summary>
[Required]
[Column("location_code")]
[MaxLength(50)]
public string LocationCode { get; set; }
/// <summary>
/// 库位名称
/// </summary>
[Column("location_name")]
[MaxLength(100)]
public string? LocationName { get; set; }
/// <summary>
/// 层数(用于多层货架)
/// </summary>
[Column("layer_number")]
public int? LayerNumber { get; set; }
/// <summary>
/// 库位状态
/// </summary>
[Column("status")]
public StorageLocationStatus Status { get; set; } = StorageLocationStatus.Empty;
/// <summary>
/// 是否启用
/// </summary>
[Column("is_active")]
public bool IsActive { get; set; } = true;
/// <summary>
/// 创建时间
/// </summary>
[Column("created_at", TypeName = "timestamp")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Column("updated_at", TypeName = "timestamp")]
public DateTime? UpdatedAt { get; set; }
#region 导航属性
/// <summary>
/// 所属库区
/// </summary>
[ForeignKey(nameof(AreaId))]
public virtual StorageArea StorageArea { get; set; }
/// <summary>
/// 关联的地图节点
/// @author zzy
/// </summary>
[ForeignKey(nameof(MapNodeId))]
public virtual MapNode? MapNode { get; set; }
/// <summary>
/// 储位类型
/// @author zzy
/// </summary>
[ForeignKey(nameof(LocationTypeId))]
public virtual StorageLocationType? LocationType { get; set; }
#endregion
}
/// <summary>
/// 库位状态枚举
/// @author zzy
/// </summary>
public enum StorageLocationStatus
{
[EnumDescription("空闲", "Empty")]
Empty = 0,
[EnumDescription("占用", "Occupied")]
Occupied = 1,
[EnumDescription("预占用", "Reserved")]
Reserved = 2,
[EnumDescription("禁用", "Disabled")]
Disabled = 3
}