@newpeak/barista-cli 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +714 -0
- package/README.ja.md +708 -0
- package/README.md +68 -0
- package/README.vi.md +714 -0
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +4 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/materials/create.d.ts.map +1 -1
- package/dist/commands/liberica/materials/create.js +35 -9
- package/dist/commands/liberica/materials/create.js.map +1 -1
- package/dist/commands/liberica/orgs/index.d.ts.map +1 -1
- package/dist/commands/liberica/orgs/index.js.map +1 -1
- package/dist/commands/liberica/users/create.d.ts.map +1 -1
- package/dist/commands/liberica/users/create.js +1 -0
- package/dist/commands/liberica/users/create.js.map +1 -1
- package/dist/commands/liberica/warehouses/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/create.js +196 -0
- package/dist/commands/liberica/warehouses/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/delete.js +111 -0
- package/dist/commands/liberica/warehouses/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/disable.js +173 -0
- package/dist/commands/liberica/warehouses/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/enable.js +173 -0
- package/dist/commands/liberica/warehouses/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/get.js +90 -0
- package/dist/commands/liberica/warehouses/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/index.js +23 -0
- package/dist/commands/liberica/warehouses/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/list.js +101 -0
- package/dist/commands/liberica/warehouses/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.js +199 -0
- package/dist/commands/liberica/warehouses/locations/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.js +115 -0
- package/dist/commands/liberica/warehouses/locations/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.js +73 -0
- package/dist/commands/liberica/warehouses/locations/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.js +21 -0
- package/dist/commands/liberica/warehouses/locations/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.js +104 -0
- package/dist/commands/liberica/warehouses/locations/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.js +128 -0
- package/dist/commands/liberica/warehouses/locations/update.js.map +1 -0
- package/dist/commands/liberica/warehouses/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/update.js +143 -0
- package/dist/commands/liberica/warehouses/update.js.map +1 -0
- package/dist/core/api/client.d.ts +16 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +286 -0
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/location.d.ts +53 -0
- package/dist/types/location.d.ts.map +1 -0
- package/dist/types/location.js +2 -0
- package/dist/types/location.js.map +1 -0
- package/dist/types/warehouse.d.ts +68 -0
- package/dist/types/warehouse.d.ts.map +1 -0
- package/dist/types/warehouse.js +2 -0
- package/dist/types/warehouse.js.map +1 -0
- package/docs/commands/liberica/locations/create.md +195 -0
- package/docs/commands/liberica/locations/list.md +171 -0
- package/docs/commands/liberica/warehouses/create.md +222 -0
- package/docs/commands/liberica/warehouses/list.md +184 -0
- package/package.json +1 -1
- package/src/commands/liberica/index.ts +4 -0
- package/src/commands/liberica/materials/create.ts +32 -9
- package/src/commands/liberica/orgs/index.ts +0 -1
- package/src/commands/liberica/users/create.ts +1 -0
- package/src/commands/liberica/warehouses/create.ts +204 -0
- package/src/commands/liberica/warehouses/delete.ts +112 -0
- package/src/commands/liberica/warehouses/disable.ts +174 -0
- package/src/commands/liberica/warehouses/enable.ts +174 -0
- package/src/commands/liberica/warehouses/get.ts +101 -0
- package/src/commands/liberica/warehouses/index.ts +25 -0
- package/src/commands/liberica/warehouses/list.ts +136 -0
- package/src/commands/liberica/warehouses/locations/create.ts +209 -0
- package/src/commands/liberica/warehouses/locations/delete.ts +116 -0
- package/src/commands/liberica/warehouses/locations/disable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/enable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/get.ts +84 -0
- package/src/commands/liberica/warehouses/locations/index.ts +23 -0
- package/src/commands/liberica/warehouses/locations/list.ts +140 -0
- package/src/commands/liberica/warehouses/locations/update.ts +135 -0
- package/src/commands/liberica/warehouses/update.ts +142 -0
- package/src/core/api/client.ts +396 -0
- package/src/index.ts +1 -3
- package/src/types/index.ts +4 -4
- package/src/types/location.ts +66 -0
- package/src/types/warehouse.ts +82 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# barista liberica locations create
|
|
2
|
+
|
|
3
|
+
Create a new warehouse location.
|
|
4
|
+
|
|
5
|
+
## 2.1 Command Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|------|-----|
|
|
9
|
+
| Full Command | `barista liberica locations create` |
|
|
10
|
+
| Description | Create a new warehouse location |
|
|
11
|
+
| HTTP Method | POST |
|
|
12
|
+
| Requires Authentication | Yes |
|
|
13
|
+
| Supports Dry-Run | Yes |
|
|
14
|
+
|
|
15
|
+
## 2.2 Backend API Reference
|
|
16
|
+
|
|
17
|
+
### Controller Location
|
|
18
|
+
```
|
|
19
|
+
coffee-liberica-end/
|
|
20
|
+
└── facade/liberica-facade-enterprise/
|
|
21
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/stock/
|
|
22
|
+
└── EnterpriseWarehouseLocationController.java
|
|
23
|
+
└── add(@PostResource(path = "/add", requiredPermission = true, requirePermissionCode = MasterWarehouseLocationPermissionConstants.ADD_MASTER_WAREHOUSE_LOCATION))
|
|
24
|
+
└── public ResponseData<MasterWarehouseLocationResponse> add(
|
|
25
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
26
|
+
@RequestBody @Validated(BaseRequest.add.class) MasterWarehouseLocationRequest masterWarehouseLocationRequest
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Request DTO Location
|
|
31
|
+
```
|
|
32
|
+
coffee-liberica-end/
|
|
33
|
+
└── business/liberica-business-master/master-api/
|
|
34
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/request/
|
|
35
|
+
└── MasterWarehouseLocationRequest.java
|
|
36
|
+
├── warehouseId: Long (@NotNull on add)
|
|
37
|
+
├── warehouseLocationCode: String (@NotBlank on add, max=255)
|
|
38
|
+
├── warehouseLocationName: String (max=255)
|
|
39
|
+
├── statusFlag: Integer
|
|
40
|
+
└── remark: String (max=255)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Response DTO Location
|
|
44
|
+
```
|
|
45
|
+
coffee-liberica-end/
|
|
46
|
+
└── business/liberica-business-master/master-api/
|
|
47
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/response/
|
|
48
|
+
└── MasterWarehouseLocationResponse.java
|
|
49
|
+
├── warehouseLocationId: Long
|
|
50
|
+
├── warehouseId: Long
|
|
51
|
+
├── warehouseLocationCode: String
|
|
52
|
+
├── warehouseLocationName: String
|
|
53
|
+
├── statusFlag: Integer (1=enable, 2=disable)
|
|
54
|
+
└── remark: String
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 2.3 CLI Parameter Design
|
|
58
|
+
|
|
59
|
+
### Command Structure
|
|
60
|
+
```
|
|
61
|
+
barista liberica locations create [options]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Global Options
|
|
65
|
+
| Option | Type | Description |
|
|
66
|
+
|------|------|------|
|
|
67
|
+
| `--env` | string | Target environment (dev\|test\|prod-cn\|prod-jp) |
|
|
68
|
+
| `--tenant` | string | Tenant code |
|
|
69
|
+
| `--dry-run` | boolean | Preview mode (no actual API call) |
|
|
70
|
+
| `--json` | boolean | JSON output |
|
|
71
|
+
|
|
72
|
+
### Command Options
|
|
73
|
+
| Option | Short | Type | Required | Default | Description | Maps to DTO Field |
|
|
74
|
+
|------|--------|------|------|--------|------|-------------|
|
|
75
|
+
| --warehouse-id | -w | string | Yes | - | Parent warehouse ID | warehouseId |
|
|
76
|
+
| --code | -c | string | Yes | - | Location code | warehouseLocationCode |
|
|
77
|
+
| --name | -n | string | Yes | - | Location name | warehouseLocationName |
|
|
78
|
+
| --status | -s | number | No | 1 | Status (1=enable, 2=disable) | statusFlag |
|
|
79
|
+
| --remark | -r | string | No | - | Remarks | remark |
|
|
80
|
+
|
|
81
|
+
## 2.4 Field Mapping Table
|
|
82
|
+
|
|
83
|
+
| CLI Parameter | DTO Field | Type Conversion | Validation Rule |
|
|
84
|
+
|---------|---------|----------|----------|
|
|
85
|
+
| --warehouse-id / -w | warehouseId | string | @NotNull, max=255 |
|
|
86
|
+
| --code / -c | warehouseLocationCode | Direct | @NotBlank, max=255, unique per warehouse |
|
|
87
|
+
| --name / -n | warehouseLocationName | Direct | max=255 |
|
|
88
|
+
| --status / -s | statusFlag | number | 1 or 2 |
|
|
89
|
+
| --remark / -r | remark | Direct | max=255 |
|
|
90
|
+
|
|
91
|
+
**Auto-Generated Fields:**
|
|
92
|
+
| Field | Value |
|
|
93
|
+
|------|-----|
|
|
94
|
+
| tenantId | From JWT token (do NOT pass X-TENANT-ID header) |
|
|
95
|
+
| statusFlag | Default 1 (enabled) when not provided |
|
|
96
|
+
|
|
97
|
+
## 2.5 Error Code Reference
|
|
98
|
+
|
|
99
|
+
### ExceptionEnum Location
|
|
100
|
+
```
|
|
101
|
+
coffee-liberica-end/
|
|
102
|
+
└── business/liberica-business-master/master-api/
|
|
103
|
+
└── src/main/java/com/newpeak/liberica/master/api/exception/enums/
|
|
104
|
+
└── MasterWarehouseLocationExceptionEnum.java
|
|
105
|
+
├── MASTER_WAREHOUSE_LOCATION_NOT_EXIST("01001380001", "租户仓位不存在")
|
|
106
|
+
├── MASTER_WAREHOUSE_LOCATION_CODE_FORMAT_CANNOT_EMPTY("01001380002", "仓位编码规则不能为空")
|
|
107
|
+
└── MASTER_WAREHOUSE_LOCATION_CODE_FORMAT_NOT_CORRECT("01001380003", "仓位编码规则格式不正确")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Known Error Codes
|
|
111
|
+
| Error Code | Error Message | Trigger Condition |
|
|
112
|
+
|--------|----------|----------|
|
|
113
|
+
| 01001380001 | Location does not exist | Edit/detail with non-existent ID |
|
|
114
|
+
| 01001380002 | Location code format cannot be empty | Auto-generation rule not configured |
|
|
115
|
+
| 01001380003 | Location code format incorrect | Invalid code format pattern |
|
|
116
|
+
|
|
117
|
+
## 2.6 Permission Check
|
|
118
|
+
|
|
119
|
+
| Check Item | Location | Description |
|
|
120
|
+
|--------|------|------|
|
|
121
|
+
| PermissionConstants | `MasterWarehouseLocationPermissionConstants.ADD_MASTER_WAREHOUSE_LOCATION` | Controller layer `@PostResource(requirePermissionCode = "ADD_MASTER_WAREHOUSE_LOCATION")` |
|
|
122
|
+
|
|
123
|
+
## 2.7 Implementation Notes
|
|
124
|
+
|
|
125
|
+
1. **Required Fields**: `--warehouse-id`, `--code`, and `--name` must be provided.
|
|
126
|
+
2. **Manual Code**: `warehouseLocationCode` is NOT auto-generated. Must be unique within the warehouse.
|
|
127
|
+
3. **Dry-Run Support**: Use `--dry-run` to preview request without calling API.
|
|
128
|
+
4. **Status Default**: `--status` defaults to 1 (enabled).
|
|
129
|
+
5. **No Batch Create**: This command does NOT support batch creation (one location per call). Use `barista liberica locations batch-create` for bulk operations if implemented separately.
|
|
130
|
+
6. **BigInteger IDs**: `warehouseLocationId` and `warehouseId` in response must be parsed as `string` in TypeScript to avoid precision loss.
|
|
131
|
+
|
|
132
|
+
## 2.8 Example Usage
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Create with minimal required fields
|
|
136
|
+
barista liberica locations create \
|
|
137
|
+
--warehouse-id "1234567890123456789" \
|
|
138
|
+
--code "A-01-01" \
|
|
139
|
+
--name "Shelf A-01-01"
|
|
140
|
+
|
|
141
|
+
# Create with all options
|
|
142
|
+
barista liberica locations create \
|
|
143
|
+
--warehouse-id "1234567890123456789" \
|
|
144
|
+
--code "B-02-03" \
|
|
145
|
+
--name "Bin B-02-03" \
|
|
146
|
+
--status 1 \
|
|
147
|
+
--remark "High-priority picking zone"
|
|
148
|
+
|
|
149
|
+
# Create disabled location
|
|
150
|
+
barista liberica locations create \
|
|
151
|
+
--warehouse-id "1234567890123456789" \
|
|
152
|
+
--code "C-99-99" \
|
|
153
|
+
--name "Reserved" \
|
|
154
|
+
--status 2
|
|
155
|
+
|
|
156
|
+
# Dry-run to preview
|
|
157
|
+
barista liberica locations create \
|
|
158
|
+
--warehouse-id "1234567890123456789" \
|
|
159
|
+
--code "TEST-01" \
|
|
160
|
+
--name "Test Location" \
|
|
161
|
+
--dry-run
|
|
162
|
+
|
|
163
|
+
# JSON output
|
|
164
|
+
barista liberica locations create \
|
|
165
|
+
--warehouse-id "1234567890123456789" \
|
|
166
|
+
--code "D-04-01" \
|
|
167
|
+
--name "Dock D-04-01" \
|
|
168
|
+
--json
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 2.9 Request Body Structure
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"warehouseId": "1234567890123456789",
|
|
176
|
+
"warehouseLocationCode": "A-01-01",
|
|
177
|
+
"warehouseLocationName": "Shelf A-01-01",
|
|
178
|
+
"statusFlag": 1,
|
|
179
|
+
"remark": "High-priority picking zone"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 2.10 API Path
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
POST /api/enterprise/purchases/warehouse/location/add
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Headers:**
|
|
190
|
+
```
|
|
191
|
+
Authorization: <token> (No "Bearer " prefix)
|
|
192
|
+
Content-Type: application/json
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Note**: Do NOT include `X-TENANT-ID` header. Tenant is extracted from JWT token.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# barista liberica locations list
|
|
2
|
+
|
|
3
|
+
List warehouse locations with pagination.
|
|
4
|
+
|
|
5
|
+
## 2.1 Command Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|------|-----|
|
|
9
|
+
| Full Command | `barista liberica locations list` |
|
|
10
|
+
| Description | List warehouse locations with pagination |
|
|
11
|
+
| HTTP Method | GET |
|
|
12
|
+
| Requires Authentication | Yes |
|
|
13
|
+
| Supports Dry-Run | No |
|
|
14
|
+
|
|
15
|
+
## 2.2 Backend API Reference
|
|
16
|
+
|
|
17
|
+
### Controller Location
|
|
18
|
+
```
|
|
19
|
+
coffee-liberica-end/
|
|
20
|
+
└── facade/liberica-facade-enterprise/
|
|
21
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/stock/
|
|
22
|
+
└── EnterpriseWarehouseLocationController.java
|
|
23
|
+
└── page(@GetResource(path = "/page"))
|
|
24
|
+
└── public ResponseData<PageResult<MasterWarehouseLocationResponse>> page(
|
|
25
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
26
|
+
@ParameterObject MasterWarehouseLocationRequest masterWarehouseLocationRequest
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Request DTO Location
|
|
31
|
+
```
|
|
32
|
+
coffee-liberica-end/
|
|
33
|
+
└── business/liberica-business-master/master-api/
|
|
34
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/request/
|
|
35
|
+
└── MasterWarehouseLocationRequest.java
|
|
36
|
+
├── warehouseId: Long
|
|
37
|
+
├── warehouseLocationCode: String
|
|
38
|
+
├── warehouseLocationName: String
|
|
39
|
+
├── statusFlag: Integer
|
|
40
|
+
└── remark: String
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Response DTO Location
|
|
44
|
+
```
|
|
45
|
+
coffee-liberica-end/
|
|
46
|
+
└── business/liberica-business-master/master-api/
|
|
47
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/response/
|
|
48
|
+
└── MasterWarehouseLocationResponse.java
|
|
49
|
+
├── warehouseLocationId: Long
|
|
50
|
+
├── warehouseId: Long
|
|
51
|
+
├── warehouseLocationCode: String
|
|
52
|
+
├── warehouseLocationName: String
|
|
53
|
+
├── statusFlag: Integer (1=enable, 2=disable)
|
|
54
|
+
└── remark: String
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 2.3 CLI Parameter Design
|
|
58
|
+
|
|
59
|
+
### Command Structure
|
|
60
|
+
```
|
|
61
|
+
barista liberica locations list [options]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Global Options
|
|
65
|
+
| Option | Type | Description |
|
|
66
|
+
|------|------|------|
|
|
67
|
+
| `--env` | string | Target environment (dev\|test\|prod-cn\|prod-jp) |
|
|
68
|
+
| `--tenant` | string | Tenant code |
|
|
69
|
+
| `--json` | boolean | JSON output |
|
|
70
|
+
|
|
71
|
+
### Command Options
|
|
72
|
+
| Option | Short | Type | Required | Default | Description | Maps to Query Param |
|
|
73
|
+
|------|--------|------|------|--------|------|-------------|
|
|
74
|
+
| --page | -p | number | No | 1 | Page number (CLI 1-based) | pageNo (0-based) |
|
|
75
|
+
| --size | -s | number | No | 20 | Page size | pageSize |
|
|
76
|
+
| --warehouse-id | -w | string | No | - | Filter by parent warehouse ID | warehouseId |
|
|
77
|
+
| --status | — | number | No | - | Status filter (1=enable, 2=disable) | statusFlag |
|
|
78
|
+
| --keyword | -k | string | No | - | Keyword search (warehouseLocationName and warehouseLocationCode) | warehouseLocationName / warehouseLocationCode |
|
|
79
|
+
|
|
80
|
+
## 2.4 Field Mapping Table
|
|
81
|
+
|
|
82
|
+
| CLI Parameter | Query Param / DTO Field | Type Conversion | Validation Rule |
|
|
83
|
+
|---------|---------|----------|----------|
|
|
84
|
+
| --page / -p | pageNo | number, CLI page - 1 | >= 0 |
|
|
85
|
+
| --size / -s | pageSize | number | > 0 |
|
|
86
|
+
| --warehouse-id / -w | warehouseId | string | - |
|
|
87
|
+
| --status | statusFlag | number | 1 or 2 |
|
|
88
|
+
| --keyword / -k | warehouseLocationName / warehouseLocationCode | Direct | max=255 |
|
|
89
|
+
|
|
90
|
+
## 2.5 Error Code Reference
|
|
91
|
+
|
|
92
|
+
### ExceptionEnum Location
|
|
93
|
+
```
|
|
94
|
+
coffee-liberica-end/
|
|
95
|
+
└── business/liberica-business-master/master-api/
|
|
96
|
+
└── src/main/java/com/newpeak/liberica/master/api/exception/enums/
|
|
97
|
+
└── MasterWarehouseLocationExceptionEnum.java
|
|
98
|
+
├── MASTER_WAREHOUSE_LOCATION_NOT_EXIST("01001380001", "租户仓位不存在")
|
|
99
|
+
├── MASTER_WAREHOUSE_LOCATION_CODE_FORMAT_CANNOT_EMPTY("01001380002", "仓位编码规则不能为空")
|
|
100
|
+
└── MASTER_WAREHOUSE_LOCATION_CODE_FORMAT_NOT_CORRECT("01001380003", "仓位编码规则格式不正确")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Known Error Codes
|
|
104
|
+
| Error Code | Error Message | Trigger Condition |
|
|
105
|
+
|--------|----------|----------|
|
|
106
|
+
| 01001380001 | Location does not exist | Detail query with non-existent ID |
|
|
107
|
+
|
|
108
|
+
## 2.6 Permission Check
|
|
109
|
+
|
|
110
|
+
| Check Item | Location | Description |
|
|
111
|
+
|--------|------|------|
|
|
112
|
+
| Page Query | No specific permission code on `@GetResource(path = "/page")` | Available to authenticated users |
|
|
113
|
+
|
|
114
|
+
## 2.7 Implementation Notes
|
|
115
|
+
|
|
116
|
+
1. **Pagination**: CLI uses 1-based page numbers. API uses 0-based. Convert: `pageNo = options.page - 1`.
|
|
117
|
+
2. **Response Fields**: Backend returns `rows`, `pageNo`, `pageSize`, `totalRows`. Do NOT use `records` or `total`.
|
|
118
|
+
3. **Warehouse Filter**: `--warehouse-id` is optional but commonly used to list locations within a specific warehouse.
|
|
119
|
+
4. **Keyword Search**: When `--keyword` is provided, send it as both `warehouseLocationName` and `warehouseLocationCode` query params.
|
|
120
|
+
5. **BigInteger IDs**: `warehouseLocationId` and `warehouseId` in response rows must be kept as `string` in TypeScript.
|
|
121
|
+
6. **Table Output**: Default columns: Location ID, Warehouse ID, Code, Name, Status.
|
|
122
|
+
7. **JSON Output**: When `--json` is used, wrap response with standardized pagination object.
|
|
123
|
+
|
|
124
|
+
## 2.8 Example Usage
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# List all locations (first page, 20 per page)
|
|
128
|
+
barista liberica locations list
|
|
129
|
+
|
|
130
|
+
# List locations for a specific warehouse
|
|
131
|
+
barista liberica locations list --warehouse-id "1234567890123456789"
|
|
132
|
+
|
|
133
|
+
# List with pagination
|
|
134
|
+
barista liberica locations list --warehouse-id "1234567890123456789" --page 2 --size 50
|
|
135
|
+
|
|
136
|
+
# Filter by status
|
|
137
|
+
barista liberica locations list --status 1
|
|
138
|
+
|
|
139
|
+
# Keyword search
|
|
140
|
+
barista liberica locations list --keyword "A-01"
|
|
141
|
+
|
|
142
|
+
# JSON output
|
|
143
|
+
barista liberica locations list --json
|
|
144
|
+
|
|
145
|
+
# Combine filters
|
|
146
|
+
barista liberica locations list \
|
|
147
|
+
--warehouse-id "1234567890123456789" \
|
|
148
|
+
--page 1 \
|
|
149
|
+
--size 10 \
|
|
150
|
+
--status 1 \
|
|
151
|
+
--keyword "Shelf" \
|
|
152
|
+
--json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 2.9 API Path
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
GET /api/enterprise/purchases/warehouse/location/page
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Query Parameters:**
|
|
162
|
+
```
|
|
163
|
+
?pageNo=0&pageSize=20&warehouseId=1234567890123456789&statusFlag=1&warehouseLocationCode=Shelf&warehouseLocationName=Shelf
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Headers:**
|
|
167
|
+
```
|
|
168
|
+
Authorization: <token> (No "Bearer " prefix)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Note**: Do NOT include `X-TENANT-ID` header. Tenant is extracted from JWT token.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# barista liberica warehouses create
|
|
2
|
+
|
|
3
|
+
Create a new warehouse.
|
|
4
|
+
|
|
5
|
+
## 2.1 Command Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|------|-----|
|
|
9
|
+
| Full Command | `barista liberica warehouses create` |
|
|
10
|
+
| Description | Create a new warehouse |
|
|
11
|
+
| HTTP Method | POST |
|
|
12
|
+
| Requires Authentication | Yes |
|
|
13
|
+
| Supports Dry-Run | Yes |
|
|
14
|
+
|
|
15
|
+
## 2.2 Backend API Reference
|
|
16
|
+
|
|
17
|
+
### Controller Location
|
|
18
|
+
```
|
|
19
|
+
coffee-liberica-end/
|
|
20
|
+
└── facade/liberica-facade-enterprise/
|
|
21
|
+
└── src/main/java/com/newpeak/liberica/facade/enterprise/controller/stock/
|
|
22
|
+
└── EnterpriseWarehouseController.java
|
|
23
|
+
└── add(@PostResource(path = "/add", requiredPermission = true, requirePermissionCode = MasterWarehousePermissionConstants.ADD_MASTER_WAREHOUSE))
|
|
24
|
+
└── public ResponseData<MasterWarehouseResponse> add(
|
|
25
|
+
@RequestHeader("X-TENANT-ID") Long tenantId,
|
|
26
|
+
@RequestBody @Validated(BaseRequest.add.class) MasterWarehouseRequest masterWarehouseRequest
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Request DTO Location
|
|
31
|
+
```
|
|
32
|
+
coffee-liberica-end/
|
|
33
|
+
└── business/liberica-business-master/master-api/
|
|
34
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/request/
|
|
35
|
+
└── MasterWarehouseRequest.java
|
|
36
|
+
├── warehouseCode: String (@NotBlank on add, max=255)
|
|
37
|
+
├── warehouseName: String (max=255)
|
|
38
|
+
├── warehouseClasses: String (max=255)
|
|
39
|
+
├── manager: String (max=255)
|
|
40
|
+
├── warehouseTelephone: String (max=256)
|
|
41
|
+
├── warehouseFax: String (max=256)
|
|
42
|
+
├── warehouseAddress: String (max=512)
|
|
43
|
+
├── enableLocation: String (@NotBlank on add, max=1, Y/N)
|
|
44
|
+
├── enableNegativeInventory: String (max=1, Y/N)
|
|
45
|
+
├── statusFlag: Integer
|
|
46
|
+
└── remark: String (max=255)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Response DTO Location
|
|
50
|
+
```
|
|
51
|
+
coffee-liberica-end/
|
|
52
|
+
└── business/liberica-business-master/master-api/
|
|
53
|
+
└── src/main/java/com/newpeak/liberica/master/api/pojo/response/
|
|
54
|
+
└── MasterWarehouseResponse.java
|
|
55
|
+
├── warehouseId: Long
|
|
56
|
+
├── warehouseCode: String
|
|
57
|
+
├── warehouseName: String
|
|
58
|
+
├── warehouseClasses: String
|
|
59
|
+
├── manager: String
|
|
60
|
+
├── warehouseTelephone: String
|
|
61
|
+
├── warehouseFax: String
|
|
62
|
+
├── warehouseAddress: String
|
|
63
|
+
├── enableLocation: String (Y/N)
|
|
64
|
+
├── enableNegativeInventory: String (Y/N)
|
|
65
|
+
├── statusFlag: Integer (1=enable, 2=disable)
|
|
66
|
+
├── remark: String
|
|
67
|
+
└── locations: List<MasterWarehouseLocationResponse>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 2.3 CLI Parameter Design
|
|
71
|
+
|
|
72
|
+
### Command Structure
|
|
73
|
+
```
|
|
74
|
+
barista liberica warehouses create [options]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Global Options
|
|
78
|
+
| Option | Type | Description |
|
|
79
|
+
|------|------|------|
|
|
80
|
+
| `--env` | string | Target environment (dev\|test\|prod-cn\|prod-jp) |
|
|
81
|
+
| `--tenant` | string | Tenant code |
|
|
82
|
+
| `--dry-run` | boolean | Preview mode (no actual API call) |
|
|
83
|
+
| `--json` | boolean | JSON output |
|
|
84
|
+
|
|
85
|
+
### Command Options
|
|
86
|
+
| Option | Short | Type | Required | Default | Description | Maps to DTO Field |
|
|
87
|
+
|------|--------|------|------|--------|------|-------------|
|
|
88
|
+
| --code | -c | string | Yes | - | Warehouse code | warehouseCode |
|
|
89
|
+
| --name | -n | string | Yes | - | Warehouse name | warehouseName |
|
|
90
|
+
| --classes | — | string | No | - | Warehouse class/category | warehouseClasses |
|
|
91
|
+
| --manager | -m | string | No | - | Warehouse manager | manager |
|
|
92
|
+
| --phone | — | string | No | - | Warehouse telephone | warehouseTelephone |
|
|
93
|
+
| --fax | — | string | No | - | Warehouse fax | warehouseFax |
|
|
94
|
+
| --address | -a | string | No | - | Warehouse address | warehouseAddress |
|
|
95
|
+
| --enable-location | — | boolean | Yes | true | Enable location management | enableLocation |
|
|
96
|
+
| --enable-negative-inventory | — | boolean | No | false | Allow negative inventory | enableNegativeInventory |
|
|
97
|
+
| --remark | -r | string | No | - | Remarks | remark |
|
|
98
|
+
|
|
99
|
+
## 2.4 Field Mapping Table
|
|
100
|
+
|
|
101
|
+
| CLI Parameter | DTO Field | Type Conversion | Validation Rule |
|
|
102
|
+
|---------|---------|----------|----------|
|
|
103
|
+
| --code / -c | warehouseCode | Direct | @NotBlank, max=255, unique per tenant |
|
|
104
|
+
| --name / -n | warehouseName | Direct | max=255 |
|
|
105
|
+
| --classes | warehouseClasses | Direct | max=255 |
|
|
106
|
+
| --manager / -m | manager | Direct | max=255 |
|
|
107
|
+
| --phone | warehouseTelephone | Direct | max=256 |
|
|
108
|
+
| --fax | warehouseFax | Direct | max=256 |
|
|
109
|
+
| --address / -a | warehouseAddress | Direct | max=512 |
|
|
110
|
+
| --enable-location | enableLocation | boolean->String (Y/N) | @NotBlank, max=1 |
|
|
111
|
+
| --enable-negative-inventory | enableNegativeInventory | boolean->String (Y/N) | max=1 |
|
|
112
|
+
| --remark / -r | remark | Direct | max=255 |
|
|
113
|
+
|
|
114
|
+
**Auto-Generated Fields:**
|
|
115
|
+
| Field | Value |
|
|
116
|
+
|------|-----|
|
|
117
|
+
| tenantId | From JWT token (do NOT pass X-TENANT-ID header) |
|
|
118
|
+
| statusFlag | Default 1 (enabled) |
|
|
119
|
+
|
|
120
|
+
## 2.5 Error Code Reference
|
|
121
|
+
|
|
122
|
+
### ExceptionEnum Location
|
|
123
|
+
```
|
|
124
|
+
coffee-liberica-end/
|
|
125
|
+
└── business/liberica-business-master/master-api/
|
|
126
|
+
└── src/main/java/com/newpeak/liberica/master/api/exception/enums/
|
|
127
|
+
└── MasterWarehouseExceptionEnum.java
|
|
128
|
+
├── MASTER_WAREHOUSE_NOT_EXIST("01001370001", "租户仓库不存在")
|
|
129
|
+
├── MASTER_WAREHOUSE_CODE_FORMAT_CANNOT_EMPTY("01001370002", "仓库编码规则不能为空")
|
|
130
|
+
└── MASTER_WAREHOUSE_CODE_FORMAT_NOT_CORRECT("01001370003", "仓库编码规则格式不正确")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Known Error Codes
|
|
134
|
+
| Error Code | Error Message | Trigger Condition |
|
|
135
|
+
|--------|----------|----------|
|
|
136
|
+
| 01001370001 | Warehouse does not exist | Edit/detail with non-existent ID |
|
|
137
|
+
| 01001370002 | Warehouse code format cannot be empty | Auto-generation rule not configured |
|
|
138
|
+
| 01001370003 | Warehouse code format incorrect | Invalid code format pattern |
|
|
139
|
+
|
|
140
|
+
## 2.6 Permission Check
|
|
141
|
+
|
|
142
|
+
| Check Item | Location | Description |
|
|
143
|
+
|--------|------|------|
|
|
144
|
+
| PermissionConstants | `MasterWarehousePermissionConstants.ADD_MASTER_WAREHOUSE` | Controller layer `@PostResource(requirePermissionCode = "ADD_MASTER_WAREHOUSE")` |
|
|
145
|
+
|
|
146
|
+
## 2.7 Implementation Notes
|
|
147
|
+
|
|
148
|
+
1. **Required Fields**: `--code` and `--name` must be provided. `--enable-location` defaults to true.
|
|
149
|
+
2. **Manual Code**: `warehouseCode` is NOT auto-generated. User must provide a unique code.
|
|
150
|
+
3. **Dry-Run Support**: Use `--dry-run` to preview request without calling API.
|
|
151
|
+
4. **Boolean Flags**: `--enable-location` defaults to `true` (Y), `--enable-negative-inventory` defaults to `false` (N).
|
|
152
|
+
5. **No Batch Create**: This command does NOT support batch creation (one warehouse per call).
|
|
153
|
+
6. **BigInteger ID**: `warehouseId` in response must be parsed as `string` in TypeScript to avoid precision loss.
|
|
154
|
+
|
|
155
|
+
## 2.8 Example Usage
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Create with minimal required fields
|
|
159
|
+
barista liberica warehouses create --code "WH-001" --name "Main Warehouse"
|
|
160
|
+
|
|
161
|
+
# Create with all common options
|
|
162
|
+
barista liberica warehouses create \
|
|
163
|
+
--code "WH-002" \
|
|
164
|
+
--name "East Storage" \
|
|
165
|
+
--classes "FINISHED_GOOD" \
|
|
166
|
+
--manager "John Doe" \
|
|
167
|
+
--phone "021-12345678" \
|
|
168
|
+
--address "123 Industrial Road" \
|
|
169
|
+
--enable-location \
|
|
170
|
+
--enable-negative-inventory \
|
|
171
|
+
--remark "Primary finished goods storage"
|
|
172
|
+
|
|
173
|
+
# Disable location management
|
|
174
|
+
barista liberica warehouses create \
|
|
175
|
+
--code "WH-003" \
|
|
176
|
+
--name "Bulk Storage" \
|
|
177
|
+
--no-enable-location
|
|
178
|
+
|
|
179
|
+
# Dry-run to preview
|
|
180
|
+
barista liberica warehouses create \
|
|
181
|
+
--code "WH-004" \
|
|
182
|
+
--name "Test Warehouse" \
|
|
183
|
+
--dry-run
|
|
184
|
+
|
|
185
|
+
# JSON output
|
|
186
|
+
barista liberica warehouses create \
|
|
187
|
+
--code "WH-005" \
|
|
188
|
+
--name "New Warehouse" \
|
|
189
|
+
--json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 2.9 Request Body Structure
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"warehouseCode": "WH-001",
|
|
197
|
+
"warehouseName": "Main Warehouse",
|
|
198
|
+
"warehouseClasses": "FINISHED_GOOD",
|
|
199
|
+
"manager": "John Doe",
|
|
200
|
+
"warehouseTelephone": "021-12345678",
|
|
201
|
+
"warehouseFax": "021-87654321",
|
|
202
|
+
"warehouseAddress": "123 Industrial Road",
|
|
203
|
+
"enableLocation": "Y",
|
|
204
|
+
"enableNegativeInventory": "N",
|
|
205
|
+
"statusFlag": 1,
|
|
206
|
+
"remark": "Primary storage"
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 2.10 API Path
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
POST /api/enterprise/purchases/warehouse/add
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Headers:**
|
|
217
|
+
```
|
|
218
|
+
Authorization: <token> (No "Bearer " prefix)
|
|
219
|
+
Content-Type: application/json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Note**: Do NOT include `X-TENANT-ID` header. Tenant is extracted from JWT token.
|