LocationTreeNodeVM.cs
5.0 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// 修改点:给节点增加 CatalogueType / WarehouseCode / LayerCode,Level 支持到 3(货架层)
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
namespace IndustrialControl.Models;
public partial class LocationTreeNodeVM : ObservableObject
{
public LocationTreeNodeVM(string name, int level, string path,
string? catalogueType = null, string? warehouseCode = null, string? layerCode = null)
{
Name = name;
Level = level;
Path = path;
CatalogueType = catalogueType ?? "";
WarehouseCode = warehouseCode ?? "";
LayerCode = layerCode ?? "";
Indent = new Thickness(level * 16, 0, 0, 0);
}
[ObservableProperty] private string name;
[ObservableProperty] private bool isExpanded;
public int Level { get; } // 0 仓库 / 1 区域 / 2 货架 / 3 货架层
public string Path { get; } // 例:仓库/区域/货架/层
public string CatalogueType { get; } // warehouse/area/storage_rack/storage_rack_layer
public string WarehouseCode { get; } // FFLK
public string LayerCode { get; } // A1-1(用于 pageLocationQuery 的 layer 参数)
public Thickness Indent { get; }
public ObservableCollection<LocationTreeNodeVM> Children { get; } = new();
public string ToggleIcon => Children.Count == 0 ? "" : (IsExpanded ? "▾" : "▸");
}
// ↓ DTO 保持不变
public class LocationNodeDto
{
public string? id { get; set; }
public string? warehouseCode { get; set; }
public string? warehouseName { get; set; }
public string? parentCode { get; set; }
public string? parentName { get; set; }
public string? catalogueCode { get; set; }
public string? catalogueName { get; set; }
public string? catalogueType { get; set; } // warehouse/area/storage_rack/storage_rack_layer
public string? catalogueTypeName { get; set; }
public string? location { get; set; }
public List<LocationNodeDto> children { get; set; } = new();
}
public class BinInfo
{
public string Id { get; set; } = string.Empty;
public string FactoryCode { get; set; } = string.Empty;
public string FactoryName { get; set; } = string.Empty;
public string WarehouseCode { get; set; } = string.Empty;
public string WarehouseName { get; set; } = string.Empty;
public string ZoneCode { get; set; } = string.Empty;
public string ZoneName { get; set; } = string.Empty;
public string RackCode { get; set; } = string.Empty;
public string RackName { get; set; } = string.Empty;
public string LayerCode { get; set; } = string.Empty;
public string LayerName { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty;
/// <summary>
/// 库存状态:true=instock, false=unstocked
/// </summary>
public bool InStock { get; set; }
public string InventoryStatus { get; set; } = string.Empty;
public int Status { get; set; } // 0=正常,1=启用/其它
public string Memo { get; set; } = string.Empty;
public bool DelStatus { get; set; }
public string Creator { get; set; } = string.Empty;
public DateTime? CreatedTime { get; set; }
public string Modifier { get; set; } = string.Empty;
public DateTime? ModifiedTime { get; set; }
}
public class InStockLocationResp
{
public bool? success { get; set; }
public int? code { get; set; }
public string? message { get; set; }
public LocationNodeDto? result { get; set; } // 注意:是单个对象,不是 List
}
public class PageLocationResp
{
public bool? success { get; set; }
public int? code { get; set; }
public string? message { get; set; }
public PageLocationResult? result { get; set; }
public int? costTime { get; set; }
}
public class PageLocationResult
{
public int? pageNo { get; set; }
public int? pageSize { get; set; }
public int? total { get; set; }
public List<PageLocationRecord>? records { get; set; }
}
public class PageLocationRecord
{
public string? id { get; set; }
public string? factoryCode { get; set; }
public string? factoryName { get; set; }
public string? warehouseCode { get; set; }
public string? warehouseName { get; set; }
public string? zone { get; set; }
public string? zoneName { get; set; }
public string? rack { get; set; }
public string? rackName { get; set; }
public string? layer { get; set; }
public string? layerName { get; set; }
public string? location { get; set; }
// "instock" / "unstocked"
public string? inventoryStatus { get; set; }
// 返回里是 "1"(字符串),先用 string? 接;若你想要 int?,请确保 JsonOptions 允许字符串数字
public string? status { get; set; }
public string? memo { get; set; }
public bool? delStatus { get; set; }
public string? creator { get; set; }
public string? createdTime { get; set; }
public string? modifier { get; set; }
public string? modifiedTime { get; set; }
}