@operato/scene-storage 10.0.0-beta.33 → 10.0.0-beta.34
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/CHANGELOG.md +14 -0
- package/dist/crane-3d.d.ts +14 -0
- package/dist/crane-3d.js +238 -0
- package/dist/crane-3d.js.map +1 -0
- package/dist/crane.d.ts +157 -0
- package/dist/crane.js +440 -0
- package/dist/crane.js.map +1 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/mobile-storage-rack.d.ts +17 -0
- package/dist/mobile-storage-rack.js +55 -0
- package/dist/mobile-storage-rack.js.map +1 -0
- package/dist/rack-column.d.ts +35 -0
- package/dist/rack-column.js +258 -0
- package/dist/rack-column.js.map +1 -0
- package/dist/rack-grid-3d.d.ts +13 -0
- package/dist/rack-grid-3d.js +94 -0
- package/dist/rack-grid-3d.js.map +1 -0
- package/dist/rack-grid-cell.d.ts +341 -0
- package/dist/rack-grid-cell.js +321 -0
- package/dist/rack-grid-cell.js.map +1 -0
- package/dist/rack-grid-helpers.d.ts +28 -0
- package/dist/rack-grid-helpers.js +71 -0
- package/dist/rack-grid-helpers.js.map +1 -0
- package/dist/rack-grid-location.d.ts +37 -0
- package/dist/rack-grid-location.js +227 -0
- package/dist/rack-grid-location.js.map +1 -0
- package/dist/rack-grid.d.ts +80 -0
- package/dist/rack-grid.js +829 -0
- package/dist/rack-grid.js.map +1 -0
- package/dist/stock.d.ts +78 -0
- package/dist/stock.js +333 -0
- package/dist/stock.js.map +1 -0
- package/dist/{rack-cell-3d.d.ts → storage-cell-3d.d.ts} +1 -1
- package/dist/{rack-cell-3d.js → storage-cell-3d.js} +3 -3
- package/dist/storage-cell-3d.js.map +1 -0
- package/dist/{rack-cell.d.ts → storage-cell.d.ts} +12 -6
- package/dist/{rack-cell.js → storage-cell.js} +9 -9
- package/dist/storage-cell.js.map +1 -0
- package/dist/{asrs-rack-3d.d.ts → storage-rack-3d.d.ts} +1 -1
- package/dist/{asrs-rack-3d.js → storage-rack-3d.js} +4 -4
- package/dist/storage-rack-3d.js.map +1 -0
- package/dist/{asrs-rack.d.ts → storage-rack.d.ts} +22 -16
- package/dist/{asrs-rack.js → storage-rack.js} +32 -26
- package/dist/storage-rack.js.map +1 -0
- package/dist/templates/index.d.ts +60 -0
- package/dist/templates/index.js +59 -17
- package/dist/templates/index.js.map +1 -1
- package/package.json +2 -2
- package/src/crane-3d.ts +273 -0
- package/src/crane.ts +538 -0
- package/src/index.ts +13 -6
- package/src/mobile-storage-rack.ts +56 -0
- package/src/rack-column.ts +340 -0
- package/src/rack-grid-3d.ts +128 -0
- package/src/rack-grid-cell.ts +404 -0
- package/src/rack-grid-helpers.ts +77 -0
- package/src/rack-grid-location.ts +286 -0
- package/src/rack-grid.ts +994 -0
- package/src/stock.ts +426 -0
- package/src/{rack-cell-3d.ts → storage-cell-3d.ts} +2 -2
- package/src/{rack-cell.ts → storage-cell.ts} +19 -13
- package/src/{asrs-rack-3d.ts → storage-rack-3d.ts} +3 -3
- package/src/{asrs-rack.ts → storage-rack.ts} +31 -25
- package/src/templates/index.ts +59 -17
- package/test/test-rack-grid-crane.ts +212 -0
- package/test/test-rack-grid.ts +77 -0
- package/test/{test-asrs-crane.ts → test-storage-rack-crane.ts} +8 -8
- package/translations/en.json +55 -7
- package/translations/ja.json +52 -4
- package/translations/ko.json +52 -4
- package/translations/ms.json +55 -7
- package/translations/zh.json +52 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/asrs-crane-3d.d.ts +0 -17
- package/dist/asrs-crane-3d.js +0 -181
- package/dist/asrs-crane-3d.js.map +0 -1
- package/dist/asrs-crane.d.ts +0 -98
- package/dist/asrs-crane.js +0 -216
- package/dist/asrs-crane.js.map +0 -1
- package/dist/asrs-rack-3d.js.map +0 -1
- package/dist/asrs-rack.js.map +0 -1
- package/dist/rack-cell-3d.js.map +0 -1
- package/dist/rack-cell.js.map +0 -1
- package/src/asrs-crane-3d.ts +0 -211
- package/src/asrs-crane.ts +0 -275
- /package/icons/{asrs-crane.png → crane.png} +0 -0
- /package/icons/{asrs-rack.png → storage-rack.png} +0 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* RackGrid location management utilities.
|
|
5
|
+
* Extracted from rack-table.ts for separation of concerns.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { RackGridCell } from './rack-grid-cell.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Classify cells by their row index.
|
|
12
|
+
*/
|
|
13
|
+
export function classifyByRow(cells: RackGridCell[]): RackGridCell[][] {
|
|
14
|
+
const classified: RackGridCell[][] = []
|
|
15
|
+
|
|
16
|
+
cells.forEach(c => {
|
|
17
|
+
const { row, column } = c.index
|
|
18
|
+
|
|
19
|
+
if (!classified[row]) {
|
|
20
|
+
classified[row] = []
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
classified[row][column] = c
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return classified
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Find aisle rows (rows where all cells are empty).
|
|
31
|
+
*/
|
|
32
|
+
export function findAisle(rows?: RackGridCell[][]): RackGridCell[][] {
|
|
33
|
+
if (!rows) {
|
|
34
|
+
return []
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return rows.filter(r => {
|
|
38
|
+
return r[0] && r[0].isAisle
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get indices of aisle rows.
|
|
44
|
+
*/
|
|
45
|
+
export function getAisleRowIndices(rows: RackGridCell[][]): number[] {
|
|
46
|
+
const aisles = findAisle(rows)
|
|
47
|
+
const aisleRowIndices: number[] = []
|
|
48
|
+
|
|
49
|
+
aisles.forEach(aisle => {
|
|
50
|
+
aisleRowIndices.push(rows.indexOf(aisle))
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return aisleRowIndices
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Classify rows into sections separated by aisle rows.
|
|
58
|
+
*/
|
|
59
|
+
export function classifyCellsBySection(
|
|
60
|
+
rows: RackGridCell[][],
|
|
61
|
+
aisleRowIndices: number[]
|
|
62
|
+
): RackGridCell[][][] {
|
|
63
|
+
const sections: RackGridCell[][][] = []
|
|
64
|
+
let wasAisle = false
|
|
65
|
+
let section!: RackGridCell[][]
|
|
66
|
+
|
|
67
|
+
rows.forEach((row, i) => {
|
|
68
|
+
const isAisle = aisleRowIndices.indexOf(i) > -1
|
|
69
|
+
|
|
70
|
+
if (!(wasAisle || isAisle)) {
|
|
71
|
+
section = []
|
|
72
|
+
sections.push(section)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
wasAisle = isAisle
|
|
76
|
+
|
|
77
|
+
section.push(row)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return sections
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Rearrange cells by aisle direction pattern.
|
|
85
|
+
*/
|
|
86
|
+
export function rearrangeByAisle(type: string, sections: RackGridCell[][][]): RackGridCell[][][] {
|
|
87
|
+
const rearranged: RackGridCell[][][] = []
|
|
88
|
+
|
|
89
|
+
switch (type.toLowerCase()) {
|
|
90
|
+
case 'cw': {
|
|
91
|
+
let reverse = false
|
|
92
|
+
sections.forEach(rows => {
|
|
93
|
+
const section: RackGridCell[][] = []
|
|
94
|
+
rearranged.push(section)
|
|
95
|
+
rows.forEach((r, i) => {
|
|
96
|
+
if (reverse) r.reverse()
|
|
97
|
+
|
|
98
|
+
if (i % 2 === 0) {
|
|
99
|
+
section.push(r)
|
|
100
|
+
reverse = !reverse
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
break
|
|
105
|
+
}
|
|
106
|
+
case 'ccw': {
|
|
107
|
+
let reverse = true
|
|
108
|
+
sections.forEach(rows => {
|
|
109
|
+
const section: RackGridCell[][] = []
|
|
110
|
+
rearranged.push(section)
|
|
111
|
+
rows.forEach((r, i) => {
|
|
112
|
+
if (reverse) r.reverse()
|
|
113
|
+
|
|
114
|
+
if (i % 2 === 0) {
|
|
115
|
+
section.push(r)
|
|
116
|
+
reverse = !reverse
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
break
|
|
121
|
+
}
|
|
122
|
+
case 'zigzag':
|
|
123
|
+
sections.forEach(rows => {
|
|
124
|
+
const section: RackGridCell[][] = []
|
|
125
|
+
|
|
126
|
+
rows.forEach((r, i) => {
|
|
127
|
+
if (i % 2 === 0) {
|
|
128
|
+
section.push(r)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const sectionLength = section.length
|
|
133
|
+
const tempRow: RackGridCell[] = []
|
|
134
|
+
const tempSection: RackGridCell[][] = []
|
|
135
|
+
|
|
136
|
+
section.forEach((row, rowIdx) => {
|
|
137
|
+
row.forEach((cell, idx) => {
|
|
138
|
+
tempRow[rowIdx + idx * section.length] = cell
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const chunkSize = tempRow.length / sectionLength
|
|
143
|
+
for (let idx = 0; idx < sectionLength; idx++) {
|
|
144
|
+
tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize))
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
rearranged.push(tempSection)
|
|
148
|
+
})
|
|
149
|
+
break
|
|
150
|
+
case 'zigzag-reverse':
|
|
151
|
+
sections.forEach(rows => {
|
|
152
|
+
const section: RackGridCell[][] = []
|
|
153
|
+
|
|
154
|
+
rows.forEach((r, i) => {
|
|
155
|
+
if (i % 2 === 0) {
|
|
156
|
+
r.reverse()
|
|
157
|
+
section.push(r)
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
const sectionLength = section.length
|
|
162
|
+
const tempRow: RackGridCell[] = []
|
|
163
|
+
const tempSection: RackGridCell[][] = []
|
|
164
|
+
|
|
165
|
+
section.forEach((row, rowIdx) => {
|
|
166
|
+
row.forEach((cell, idx) => {
|
|
167
|
+
tempRow[rowIdx + idx * section.length] = cell
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const chunkSize = tempRow.length / sectionLength
|
|
172
|
+
for (let idx = 0; idx < sectionLength; idx++) {
|
|
173
|
+
tempSection.push(tempRow.slice(idx * chunkSize, (idx + 1) * chunkSize))
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
rearranged.push(tempSection)
|
|
177
|
+
})
|
|
178
|
+
break
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return rearranged
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Remove empty cells from sections.
|
|
186
|
+
*/
|
|
187
|
+
export function removeEmptyCells(sections: RackGridCell[][][]): RackGridCell[][][] {
|
|
188
|
+
const newSections: RackGridCell[][][] = []
|
|
189
|
+
sections.forEach(rows => {
|
|
190
|
+
const newRows: RackGridCell[][] = []
|
|
191
|
+
newSections.push(newRows)
|
|
192
|
+
rows.forEach(row => {
|
|
193
|
+
const newRow: RackGridCell[] = []
|
|
194
|
+
newRows.push(newRow)
|
|
195
|
+
row.forEach(c => {
|
|
196
|
+
if (!c.isEmpty) newRow.push(c)
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
return newSections
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Merge section rows into flat arrays.
|
|
206
|
+
*/
|
|
207
|
+
export function mergeRows(sections: RackGridCell[][][]): RackGridCell[][] {
|
|
208
|
+
const merged: RackGridCell[][] = []
|
|
209
|
+
|
|
210
|
+
sections.forEach(section => {
|
|
211
|
+
let newSection: RackGridCell[] = []
|
|
212
|
+
|
|
213
|
+
section.forEach(rows => {
|
|
214
|
+
let mergedRow: RackGridCell[] = []
|
|
215
|
+
rows.forEach(row => {
|
|
216
|
+
mergedRow = mergedRow.concat(row)
|
|
217
|
+
})
|
|
218
|
+
newSection = newSection.concat(mergedRow)
|
|
219
|
+
})
|
|
220
|
+
merged.push(newSection)
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
return merged
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Set section/unit location on cells.
|
|
228
|
+
*/
|
|
229
|
+
export function setLocations(
|
|
230
|
+
sections: RackGridCell[][],
|
|
231
|
+
startSection: number,
|
|
232
|
+
startUnit: number,
|
|
233
|
+
sectionDigits: number,
|
|
234
|
+
unitDigits: number
|
|
235
|
+
) {
|
|
236
|
+
let sectionNumber = Number(startSection) || 1
|
|
237
|
+
|
|
238
|
+
sections.forEach(section => {
|
|
239
|
+
let unitNumber = Number(startUnit) || 1
|
|
240
|
+
section.forEach(c => {
|
|
241
|
+
if (!c.isEmpty) {
|
|
242
|
+
c.set('section', String(sectionNumber).padStart(sectionDigits, '0'))
|
|
243
|
+
c.set('unit', String(unitNumber).padStart(unitDigits, '0'))
|
|
244
|
+
} else {
|
|
245
|
+
c.set('section', null)
|
|
246
|
+
c.set('unit', null)
|
|
247
|
+
}
|
|
248
|
+
unitNumber++
|
|
249
|
+
})
|
|
250
|
+
sectionNumber++
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Run the full location increase flow.
|
|
256
|
+
*/
|
|
257
|
+
export function increaseLocation(
|
|
258
|
+
selectedCells: RackGridCell[],
|
|
259
|
+
type: string,
|
|
260
|
+
skipNumbering: boolean,
|
|
261
|
+
startSection: number,
|
|
262
|
+
startUnit: number,
|
|
263
|
+
sectionDigits: number,
|
|
264
|
+
unitDigits: number
|
|
265
|
+
) {
|
|
266
|
+
// step 1: classify cells by row
|
|
267
|
+
const classified = classifyByRow(selectedCells)
|
|
268
|
+
|
|
269
|
+
// step 2: find aisle row indices
|
|
270
|
+
const aisleRowIndices = getAisleRowIndices(classified)
|
|
271
|
+
|
|
272
|
+
// step 3: classify cells by section
|
|
273
|
+
const sections = classifyCellsBySection(classified, aisleRowIndices)
|
|
274
|
+
|
|
275
|
+
// step 4: rearrange by aisle
|
|
276
|
+
let rearranged = rearrangeByAisle(type, sections)
|
|
277
|
+
|
|
278
|
+
// step 5: if skip numbering, remove empty cells
|
|
279
|
+
if (skipNumbering) rearranged = removeEmptyCells(rearranged)
|
|
280
|
+
|
|
281
|
+
// step 6: merge rows
|
|
282
|
+
const merged = mergeRows(rearranged)
|
|
283
|
+
|
|
284
|
+
// step 7: set location
|
|
285
|
+
setLocations(merged, startSection, startUnit, sectionDigits, unitDigits)
|
|
286
|
+
}
|