@fmsim/machine 2.0.0-beta.10 → 2.0.0-beta.100
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/dist/agv.js +6 -2
- package/dist/agv.js.map +1 -1
- package/dist/carrier-manager.js +183 -0
- package/dist/carrier-manager.js.map +1 -0
- package/dist/carrier.js +99 -9
- package/dist/carrier.js.map +1 -1
- package/dist/conveyor-join.js +8 -2
- package/dist/conveyor-join.js.map +1 -1
- package/dist/conveyor.js +8 -0
- package/dist/conveyor.js.map +1 -1
- package/dist/crane.js +144 -1
- package/dist/crane.js.map +1 -1
- package/dist/factories/agv-3d.js +8 -9
- package/dist/factories/agv-3d.js.map +1 -1
- package/dist/factories/conveyor-3d.js +168 -81
- package/dist/factories/conveyor-3d.js.map +1 -1
- package/dist/factories/crane-3d.js +48 -12
- package/dist/factories/crane-3d.js.map +1 -1
- package/dist/factories/crane-rail-3d.js +6 -6
- package/dist/factories/crane-rail-3d.js.map +1 -1
- package/dist/factories/machine-3d.js +527 -181
- package/dist/factories/machine-3d.js.map +1 -1
- package/dist/factories/oht-3d.js +20 -20
- package/dist/factories/oht-3d.js.map +1 -1
- package/dist/factories/shuttle-3d.js +2 -5
- package/dist/factories/shuttle-3d.js.map +1 -1
- package/dist/factories/z-priority-defaults.js +33 -0
- package/dist/factories/z-priority-defaults.js.map +1 -0
- package/dist/factories/z-priority.js +54 -0
- package/dist/factories/z-priority.js.map +1 -0
- package/dist/features/conveyor-mixin.js.map +1 -1
- package/dist/features/mcs-status-default.js +15 -1
- package/dist/features/mcs-status-default.js.map +1 -1
- package/dist/features/mcs-status-mixin.js +22 -0
- package/dist/features/mcs-status-mixin.js.map +1 -1
- package/dist/features/mcs-zone-mixin.js.map +1 -1
- package/dist/features/parent-object-mixin.js +15 -7
- package/dist/features/parent-object-mixin.js.map +1 -1
- package/dist/floating-container.js +5 -0
- package/dist/floating-container.js.map +1 -1
- package/dist/index.js +52 -34
- package/dist/index.js.map +1 -1
- package/dist/mcs-carrier-holder.js +56 -22
- package/dist/mcs-carrier-holder.js.map +1 -1
- package/dist/mcs-machine.js +39 -0
- package/dist/mcs-machine.js.map +1 -1
- package/dist/mcs-unit.js +20 -0
- package/dist/mcs-unit.js.map +1 -1
- package/dist/mcs-vehicle.js +8 -3
- package/dist/mcs-vehicle.js.map +1 -1
- package/dist/node.js +10 -3
- package/dist/node.js.map +1 -1
- package/dist/oht.js +4 -0
- package/dist/oht.js.map +1 -1
- package/dist/port-flow.js +4 -0
- package/dist/port-flow.js.map +1 -1
- package/dist/port.js +4 -0
- package/dist/port.js.map +1 -1
- package/dist/scanner.js +30 -0
- package/dist/scanner.js.map +1 -0
- package/dist/scene/root-container-override.js +160 -96
- package/dist/scene/root-container-override.js.map +1 -1
- package/dist/shelf.js +4 -0
- package/dist/shelf.js.map +1 -1
- package/dist/static-container.js +5 -0
- package/dist/static-container.js.map +1 -1
- package/dist/stocker-abnormal-bar.js +5 -1
- package/dist/stocker-abnormal-bar.js.map +1 -1
- package/dist/stocker-capacity-bar.js +253 -6
- package/dist/stocker-capacity-bar.js.map +1 -1
- package/dist/stocker-carrier-bar.js +5 -1
- package/dist/stocker-carrier-bar.js.map +1 -1
- package/dist/stocker.js +6 -0
- package/dist/stocker.js.map +1 -1
- package/dist/templates/backdrop.js +30 -0
- package/dist/templates/backdrop.js.map +1 -0
- package/dist/templates/decal.js +21 -0
- package/dist/templates/decal.js.map +1 -0
- package/dist/templates/index.js +7 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/scanner.js +20 -0
- package/dist/templates/scanner.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/crane-position.js +83 -0
- package/dist/utils/crane-position.js.map +1 -0
- package/dist/utils/data-value.js +21 -0
- package/dist/utils/data-value.js.map +1 -0
- package/dist/utils/fit-gauge-scale.js +28 -0
- package/dist/utils/fit-gauge-scale.js.map +1 -0
- package/dist/utils/get-value-on-ranges.js +2 -4
- package/dist/utils/get-value-on-ranges.js.map +1 -1
- package/dist/utils/stocker-gauge.js +78 -0
- package/dist/utils/stocker-gauge.js.map +1 -0
- package/dist/zone-capacity-bar.js +3 -3
- package/dist/zone-capacity-bar.js.map +1 -1
- package/icons/backdrop.png +0 -0
- package/icons/decal.png +0 -0
- package/jest.config.js +10 -0
- package/package.json +4 -3
- package/src/agv.ts +7 -2
- package/src/carrier-manager.ts +223 -0
- package/src/carrier.ts +103 -10
- package/src/conveyor-join.ts +5 -2
- package/src/conveyor.ts +8 -0
- package/src/crane.ts +181 -1
- package/src/factories/agv-3d.ts +9 -10
- package/src/factories/conveyor-3d.ts +171 -84
- package/src/factories/crane-3d.ts +53 -12
- package/src/factories/crane-rail-3d.ts +8 -7
- package/src/factories/machine-3d.ts +616 -191
- package/src/factories/oht-3d.ts +20 -20
- package/src/factories/shuttle-3d.ts +2 -6
- package/src/factories/z-priority-defaults.ts +38 -0
- package/src/factories/z-priority.ts +60 -0
- package/src/features/conveyor-mixin.ts +1 -1
- package/src/features/mcs-status-default.ts +15 -1
- package/src/features/mcs-status-mixin.ts +26 -4
- package/src/features/mcs-zone-mixin.ts +1 -1
- package/src/features/parent-object-mixin.ts +17 -8
- package/src/floating-container.ts +5 -0
- package/src/index.ts +58 -34
- package/src/mcs-carrier-holder.ts +57 -34
- package/src/mcs-machine.ts +42 -0
- package/src/mcs-unit.ts +24 -1
- package/src/mcs-vehicle.ts +9 -6
- package/src/node.ts +9 -3
- package/src/oht.ts +6 -1
- package/src/port-flow.ts +5 -0
- package/src/port.ts +5 -0
- package/src/scanner.ts +29 -0
- package/src/scene/root-container-override.ts +154 -103
- package/src/shelf.ts +5 -0
- package/src/static-container.ts +5 -0
- package/src/stocker-abnormal-bar.ts +6 -1
- package/src/stocker-capacity-bar.ts +298 -7
- package/src/stocker-carrier-bar.ts +6 -1
- package/src/stocker.ts +7 -0
- package/src/templates/backdrop.ts +30 -0
- package/src/templates/decal.ts +21 -0
- package/src/templates/index.ts +7 -1
- package/src/templates/scanner.ts +20 -0
- package/src/utils/crane-position.ts +105 -0
- package/src/utils/data-value.ts +19 -0
- package/src/utils/fit-gauge-scale.ts +35 -0
- package/src/utils/get-value-on-ranges.ts +2 -4
- package/src/utils/stocker-gauge.ts +111 -0
- package/src/zone-capacity-bar.ts +3 -3
- package/translations/en.json +26 -1
- package/translations/ja.json +26 -1
- package/translations/ko.json +26 -1
- package/translations/ms.json +26 -1
- package/translations/zh.json +26 -1
package/src/factories/oht-3d.ts
CHANGED
|
@@ -30,9 +30,9 @@ export class OHT3D extends RealObjectGroup {
|
|
|
30
30
|
return depth || TRANSPORT_SURFACE_HEIGHT
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/** 천장 레일 높이에 배치 */
|
|
33
|
+
/** 천장 레일 높이에 배치 (center origin 기준: 레일 높이 + 볼륨 중심 반깊이) */
|
|
34
34
|
protected get syncZPosOffset(): number {
|
|
35
|
-
return OHT_RAIL_HEIGHT
|
|
35
|
+
return OHT_RAIL_HEIGHT + this.effectiveDepth / 2
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
private resolveColor(): number {
|
|
@@ -83,7 +83,7 @@ export class OHT3D extends RealObjectGroup {
|
|
|
83
83
|
metalness: 0.4,
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
-
// ── 1. 하단 그리퍼 바 (캐리어를 집는 가로 바) ──
|
|
86
|
+
// ── 1. 하단 그리퍼 바 (캐리어를 집는 가로 바 — 이동 방향과 직교) ──
|
|
87
87
|
const gripperBarW = w * 0.7
|
|
88
88
|
const gripperBarD = h * 0.15
|
|
89
89
|
const gripperGeo = new THREE.BoxGeometry(gripperBarW, gripperBarH, gripperBarD)
|
|
@@ -91,21 +91,21 @@ export class OHT3D extends RealObjectGroup {
|
|
|
91
91
|
gripperMesh.position.y = gripperBarH / 2
|
|
92
92
|
gripperMesh.castShadow = true
|
|
93
93
|
|
|
94
|
-
// ── 2. 호이스트 암 (
|
|
94
|
+
// ── 2. 호이스트 암 (전후 수직 기둥 + 하단 연결 바) ──
|
|
95
95
|
const armBaseY = gripperBarH
|
|
96
96
|
const armGeometries: THREE.BufferGeometry[] = []
|
|
97
97
|
|
|
98
|
-
//
|
|
99
|
-
for (const
|
|
98
|
+
// 전후 수직 기둥 (레일 방향 = Z축)
|
|
99
|
+
for (const zSign of [-1, 1]) {
|
|
100
100
|
const pillar = new THREE.BoxGeometry(armThickness, armH, armThickness)
|
|
101
|
-
pillar.translate(
|
|
101
|
+
pillar.translate(0, armBaseY + armH / 2, zSign * (h * 0.3))
|
|
102
102
|
armGeometries.push(pillar)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// 하단
|
|
106
|
-
const
|
|
105
|
+
// 하단 연결 바 (레일 방향으로 연결)
|
|
106
|
+
const crossBarD = h * 0.6 + armThickness
|
|
107
107
|
const crossBarH = armThickness * 0.6
|
|
108
|
-
const crossBar = new THREE.BoxGeometry(
|
|
108
|
+
const crossBar = new THREE.BoxGeometry(armThickness, crossBarH, crossBarD)
|
|
109
109
|
crossBar.translate(0, armBaseY + crossBarH / 2, 0)
|
|
110
110
|
armGeometries.push(crossBar)
|
|
111
111
|
|
|
@@ -126,10 +126,10 @@ export class OHT3D extends RealObjectGroup {
|
|
|
126
126
|
bodyMesh.castShadow = true
|
|
127
127
|
bodyMesh.receiveShadow = true
|
|
128
128
|
|
|
129
|
-
// ── 4. 상단 트롤리 플레이트 (
|
|
129
|
+
// ── 4. 상단 트롤리 플레이트 (레일 방향으로 길게 — Z축) ──
|
|
130
130
|
const trolleyBaseY = bodyBaseY + bodyH + gap
|
|
131
|
-
const trolleyW = w *
|
|
132
|
-
const trolleyD = h *
|
|
131
|
+
const trolleyW = w * 0.6
|
|
132
|
+
const trolleyD = h * 1.15
|
|
133
133
|
const trolleyGeo = new THREE.BoxGeometry(trolleyW, trolleyH, trolleyD)
|
|
134
134
|
const trolleyMat = new THREE.MeshStandardMaterial({
|
|
135
135
|
color: TROLLEY_COLOR,
|
|
@@ -140,29 +140,29 @@ export class OHT3D extends RealObjectGroup {
|
|
|
140
140
|
trolleyMesh.position.y = trolleyBaseY + trolleyH / 2
|
|
141
141
|
trolleyMesh.castShadow = true
|
|
142
142
|
|
|
143
|
-
// ── 5.
|
|
143
|
+
// ── 5. 전후 바퀴 (트롤리 위, 레일 방향 = Z축) ──
|
|
144
144
|
const wheelBaseY = trolleyBaseY + trolleyH
|
|
145
145
|
const wheelRadius = wheelH / 2
|
|
146
|
-
const wheelDepth =
|
|
146
|
+
const wheelDepth = w * 0.2
|
|
147
147
|
const wheelMeshes: THREE.Mesh[] = []
|
|
148
|
-
for (const
|
|
148
|
+
for (const zSign of [-1, 1]) {
|
|
149
149
|
const wheelGeo = new THREE.CylinderGeometry(wheelRadius, wheelRadius, wheelDepth, 12)
|
|
150
|
-
wheelGeo.
|
|
150
|
+
wheelGeo.rotateZ(Math.PI / 2)
|
|
151
151
|
const wheelMesh = new THREE.Mesh(wheelGeo, trolleyMat)
|
|
152
|
-
wheelMesh.position.set(
|
|
152
|
+
wheelMesh.position.set(0, wheelBaseY + wheelRadius, zSign * (trolleyD * 0.35))
|
|
153
153
|
wheelMesh.castShadow = true
|
|
154
154
|
wheelMeshes.push(wheelMesh)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
this._ownMeshes = [gripperMesh, armMesh, bodyMesh, trolleyMesh, ...wheelMeshes]
|
|
158
|
-
for (const m of this._ownMeshes) this.
|
|
158
|
+
for (const m of this._ownMeshes) this.components3D.add(m)
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
updateDimension() {}
|
|
162
162
|
|
|
163
163
|
update() {
|
|
164
164
|
for (const m of this._ownMeshes) {
|
|
165
|
-
this.
|
|
165
|
+
this.components3D.remove(m)
|
|
166
166
|
disposeObject3D(m)
|
|
167
167
|
}
|
|
168
168
|
this._ownMeshes = []
|
|
@@ -27,10 +27,6 @@ export class Shuttle3D extends RealObjectGroup {
|
|
|
27
27
|
return depth || TRANSPORT_SURFACE_HEIGHT
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
protected get syncZPosOffset(): number {
|
|
31
|
-
return 0
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
private resolveColor(): number {
|
|
35
31
|
const comp = this.component as any
|
|
36
32
|
|
|
@@ -142,14 +138,14 @@ export class Shuttle3D extends RealObjectGroup {
|
|
|
142
138
|
forkMesh.castShadow = true
|
|
143
139
|
|
|
144
140
|
this._ownMeshes = [baseMesh, mastMesh, forkMesh]
|
|
145
|
-
for (const m of this._ownMeshes) this.
|
|
141
|
+
for (const m of this._ownMeshes) this.components3D.add(m)
|
|
146
142
|
}
|
|
147
143
|
|
|
148
144
|
updateDimension() {}
|
|
149
145
|
|
|
150
146
|
update() {
|
|
151
147
|
for (const m of this._ownMeshes) {
|
|
152
|
-
this.
|
|
148
|
+
this.components3D.remove(m)
|
|
153
149
|
disposeObject3D(m)
|
|
154
150
|
}
|
|
155
151
|
this._ownMeshes = []
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 기본 factory (RealObjectDomTexture) 를 쓰는 컴포넌트들에 대한 zPriority override.
|
|
3
|
+
*
|
|
4
|
+
* `factories/machine-3d.ts`, `conveyor-3d.ts`, `crane-rail-3d.ts` 등에 등록된
|
|
5
|
+
* 커스텀 RealObject 들은 자기 클래스에서 `get zPriority()` override. 그 외 컴포넌트는
|
|
6
|
+
* 기본 RealObjectDomTexture 를 쓰는데, 이 파일이 그것들도 priority 갖도록 등록.
|
|
7
|
+
*
|
|
8
|
+
* 패턴: registerRealObjectFactory(type, (component) => withZ(new RealObjectDomTexture(...), N))
|
|
9
|
+
*/
|
|
10
|
+
import { registerRealObjectFactory, RealObjectDomTexture } from '@hatiolab/things-scene'
|
|
11
|
+
import type { Component } from '@hatiolab/things-scene'
|
|
12
|
+
import { Z_FMSIM } from './z-priority'
|
|
13
|
+
|
|
14
|
+
/** 주어진 RealObject 의 zPriority getter 를 override (instance level). */
|
|
15
|
+
function withZ<T extends RealObjectDomTexture>(ro: T, zPriority: number): T {
|
|
16
|
+
Object.defineProperty(ro, 'zPriority', {
|
|
17
|
+
get: () => zPriority,
|
|
18
|
+
configurable: true
|
|
19
|
+
})
|
|
20
|
+
return ro
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** RealObjectDomTexture 기반 컴포넌트에 priority 일괄 등록 helper. */
|
|
24
|
+
function registerWithPriority(type: string, zPriority: number) {
|
|
25
|
+
registerRealObjectFactory(type, (component: Component) =>
|
|
26
|
+
withZ(new RealObjectDomTexture(component), zPriority)
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ── 미등록 컴포넌트들 ──────────────────────────────────────
|
|
31
|
+
registerWithPriority('ConveyorJoin', Z_FMSIM.CONVEYOR_JOIN)
|
|
32
|
+
registerWithPriority('NodePath', Z_FMSIM.NODE_PATH)
|
|
33
|
+
registerWithPriority('container', Z_FMSIM.STATIC_CONTAINER)
|
|
34
|
+
registerWithPriority('FloatingContainer', Z_FMSIM.FLOATING_CONTAINER)
|
|
35
|
+
registerWithPriority('popup', Z_FMSIM.POPUP)
|
|
36
|
+
registerWithPriority('confidential-overlay', Z_FMSIM.CONFIDENTIAL_OVERLAY)
|
|
37
|
+
registerWithPriority('StockerAbnormalBar', Z_FMSIM.STOCKER_ABNORMAL_BAR)
|
|
38
|
+
registerWithPriority('StockerCarrierBar', Z_FMSIM.STOCKER_CARRIER_BAR)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* fmsim 컴포넌트별 z-priority 상수.
|
|
3
|
+
*
|
|
4
|
+
* 같은 평면에 겹친 *다른 type 의* mesh 들이 GPU depth test 에서 결정적으로 정렬되도록
|
|
5
|
+
* 각 컴포넌트 type 마다 unique polygonOffset 값을 부여. 각 RealObject 가 자기 클래스에서
|
|
6
|
+
* `get zPriority(): number` override 로 이 상수 중 하나를 반환.
|
|
7
|
+
*
|
|
8
|
+
* 위치 (geometry vertex, object3d.position) 는 변경하지 않음 — depth buffer 의 fragment
|
|
9
|
+
* depth 값에만 미세 bias.
|
|
10
|
+
*
|
|
11
|
+
* 컨벤션 (높은 값 = 뒤로, 낮은 값 = 앞으로):
|
|
12
|
+
*
|
|
13
|
+
* [14~17] 바닥 paths/lines (가장 뒤)
|
|
14
|
+
* [11~13] 큰 영역 시각화 (container, 흐름 영역)
|
|
15
|
+
* [10] zone capacity bar (영역 표시)
|
|
16
|
+
* [1~9] 바닥 설비 (facility)
|
|
17
|
+
* [0] 이동 entity (AGV/OHT/Crane/Shuttle/Carrier) — default OBJECTS
|
|
18
|
+
* [-1~-4] 설비 위 indicator bar (decal)
|
|
19
|
+
* [-9~-10] overlay / popup (가장 앞)
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export const Z_FMSIM = {
|
|
23
|
+
// ── Floor paths (가장 뒤 — 바닥에 그려지는 선) ──────────────
|
|
24
|
+
AGV_LINE: 17,
|
|
25
|
+
OHT_LINE: 16,
|
|
26
|
+
CRANE_RAIL: 15,
|
|
27
|
+
NODE_PATH: 14,
|
|
28
|
+
PORT_FLOW: 13,
|
|
29
|
+
|
|
30
|
+
// ── Container 영역 ────────────────────────────────────────
|
|
31
|
+
STATIC_CONTAINER: 12,
|
|
32
|
+
FLOATING_CONTAINER: 11,
|
|
33
|
+
|
|
34
|
+
// ── Zone 표시 ─────────────────────────────────────────────
|
|
35
|
+
ZONE_CAPACITY_BAR: 10,
|
|
36
|
+
|
|
37
|
+
// ── 바닥 설비 (facility) ──────────────────────────────────
|
|
38
|
+
NODE: 9,
|
|
39
|
+
SCANNER: 8,
|
|
40
|
+
PORT: 7,
|
|
41
|
+
SHELF: 6,
|
|
42
|
+
STOCKER: 5,
|
|
43
|
+
CONVEYOR: 4,
|
|
44
|
+
CONVEYOR_JOIN: 3,
|
|
45
|
+
BUFFER: 2,
|
|
46
|
+
EQUIPMENT: 1,
|
|
47
|
+
|
|
48
|
+
// ── 이동 entity — priority 0 (default OBJECTS), polygonOffset 미적용 ──
|
|
49
|
+
// AGV, OHT, Crane, Shuttle, Carrier — override 안 함
|
|
50
|
+
|
|
51
|
+
// ── 설비 위 status indicator bar (decal) ─────────────────
|
|
52
|
+
MCS_GAUGE_CAPACITY_BAR: -1,
|
|
53
|
+
STOCKER_CAPACITY_BAR: -2,
|
|
54
|
+
STOCKER_CARRIER_BAR: -3,
|
|
55
|
+
STOCKER_ABNORMAL_BAR: -4,
|
|
56
|
+
|
|
57
|
+
// ── Overlay / popup (가장 앞) ──────────────────────────────
|
|
58
|
+
POPUP: -9,
|
|
59
|
+
CONFIDENTIAL_OVERLAY: -10
|
|
60
|
+
} as const
|
|
@@ -50,7 +50,7 @@ function pattern(component: any) {
|
|
|
50
50
|
return component._pattern
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export function ConveyorMixin<TBase extends
|
|
53
|
+
export function ConveyorMixin<TBase extends new (...args: any[]) => any>(Base: TBase): any {
|
|
54
54
|
const A = class extends Base {
|
|
55
55
|
_pattern
|
|
56
56
|
|
|
@@ -61,10 +61,24 @@ export const LEGEND_CARRIER: Legend = {
|
|
|
61
61
|
default: '#F0F0F0'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* carrier legend(테마) 해석 — carrier 컴포넌트(carrier.ts get legend)와 동일 로직 단일 소스.
|
|
66
|
+
* parent 에 carrierLegendName 이 지정되면 그 style 을, 아니면 board 전역 carrierLegendTheme,
|
|
67
|
+
* 둘 다 없으면 LEGEND_CARRIER 기본값. carrier 컴포넌트·스토커 게이지(2D/3D)가 공유한다.
|
|
68
|
+
*/
|
|
69
|
+
export function resolveCarrierLegend(component: any): Legend {
|
|
70
|
+
const carrierLegendName = component?.parent?.state?.carrierLegendName
|
|
71
|
+
if (carrierLegendName) {
|
|
72
|
+
return (component.root as any)?.style?.[carrierLegendName] || LEGEND_CARRIER
|
|
73
|
+
}
|
|
74
|
+
return (component.root as any)?.carrierLegendTheme || LEGEND_CARRIER
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
export const LEGEND_CAPACITY: Legend = {
|
|
65
78
|
'0~20': '#5630D0',
|
|
66
79
|
'20~80': '#8BDA5B',
|
|
67
|
-
'80~
|
|
80
|
+
'80~': '#FD9B00', // 80% 이상 (= 100% 초과도 포함). 'from~' 형식이라
|
|
81
|
+
// getValueOnRanges 가 value >= 80 매칭.
|
|
68
82
|
default: '#F0F0F0'
|
|
69
83
|
}
|
|
70
84
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Component } from '@hatiolab/things-scene'
|
|
2
|
+
import { themesColorMap } from '@fmsim/api'
|
|
3
|
+
import { LEGEND_NULL } from './mcs-status-default'
|
|
4
|
+
|
|
1
5
|
type Constructor<T = {}> = new (...args: any[]) => T
|
|
2
6
|
|
|
3
7
|
interface Legend {
|
|
4
8
|
[key: string]: string
|
|
5
9
|
}
|
|
6
10
|
|
|
7
|
-
import { themesColorMap } from '@fmsim/api'
|
|
8
|
-
import { LEGEND_NULL } from './mcs-status-default'
|
|
9
|
-
|
|
10
11
|
export const MCSStatusMixinProperties = [
|
|
11
12
|
{
|
|
12
13
|
type: 'select',
|
|
@@ -18,7 +19,7 @@ export const MCSStatusMixinProperties = [
|
|
|
18
19
|
}
|
|
19
20
|
]
|
|
20
21
|
|
|
21
|
-
export function MCSStatusMixin<TBase extends Constructor
|
|
22
|
+
export function MCSStatusMixin<TBase extends Constructor<Component>>(Base: TBase): any {
|
|
22
23
|
return class extends Base {
|
|
23
24
|
isLVComponent() {
|
|
24
25
|
return true
|
|
@@ -53,5 +54,26 @@ export function MCSStatusMixin<TBase extends Constructor>(Base: TBase) {
|
|
|
53
54
|
|
|
54
55
|
return (status && legend && (legend[status] || legend[status!] || legend.default)) || legend?.default
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 데이터 변경 시 status 기반 색상을 state.fillStyle 로 반영.
|
|
60
|
+
* things-scene 표준 경로(updateFillStyle)가 2D/3D 모두 자동 갱신하도록 유도.
|
|
61
|
+
*
|
|
62
|
+
* 주의: state.fillStyle 이 runtime 색상으로 덮어써짐. 모델 저장 시 status 색상이
|
|
63
|
+
* 남을 수 있는 트레이드오프가 있음 (data-driven 컴포넌트의 fillStyle 은 의미상
|
|
64
|
+
* 초기값일 뿐 항상 status 가 덮어쓰는 것이 자연스러움).
|
|
65
|
+
*/
|
|
66
|
+
onchangeData(after: any, before: any) {
|
|
67
|
+
// Base (mixin 인자) 의 onchangeData 를 렉시컬하게 호출.
|
|
68
|
+
// Object.getPrototypeOf(this) 는 leaf 를 가리켜 무한재귀되므로 Base.prototype 직접 사용.
|
|
69
|
+
const baseOnchange = (Base.prototype as any).onchangeData
|
|
70
|
+
if (typeof baseOnchange === 'function') {
|
|
71
|
+
baseOnchange.call(this, after, before)
|
|
72
|
+
}
|
|
73
|
+
const color = this.statusColor
|
|
74
|
+
if (color && color !== (this as any).state?.fillStyle) {
|
|
75
|
+
;(this as any).setState('fillStyle', color)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
56
78
|
}
|
|
57
79
|
}
|
|
@@ -10,7 +10,7 @@ export const MCSZoneMixinProperties = [
|
|
|
10
10
|
}
|
|
11
11
|
]
|
|
12
12
|
|
|
13
|
-
export function MCSZoneMixin<TBase extends Constructor<MCSUnit>>(Base: TBase) {
|
|
13
|
+
export function MCSZoneMixin<TBase extends Constructor<MCSUnit>>(Base: TBase): any {
|
|
14
14
|
return class extends Base {
|
|
15
15
|
get zone(): string | undefined {
|
|
16
16
|
return
|
|
@@ -4,15 +4,14 @@ import { Component } from '@hatiolab/things-scene'
|
|
|
4
4
|
import MCSMachine from '../mcs-machine'
|
|
5
5
|
import MCSUnit from '../mcs-unit'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
]
|
|
7
|
+
/**
|
|
8
|
+
* parentObjectId 는 generic property builder 가 아니라 property-sidebar 의 모델 참조
|
|
9
|
+
* 룩업(ox-input-entity-id, parentObjectTypes 기준 씬 머신/유닛 선택)으로 렌더한다.
|
|
10
|
+
* 따라서 NATURE 속성 목록에서는 제외 — 빈 배열.
|
|
11
|
+
*/
|
|
12
|
+
export const ParentObjectMixinProperties: any[] = []
|
|
14
13
|
|
|
15
|
-
export function ParentObjectMixin<TBase extends Constructor<Component>>(Base: TBase) {
|
|
14
|
+
export function ParentObjectMixin<TBase extends Constructor<Component>>(Base: TBase): any {
|
|
16
15
|
return class extends Base {
|
|
17
16
|
get parentObject(): MCSMachine | MCSUnit | undefined {
|
|
18
17
|
const { id, parentObjectId } = this.state
|
|
@@ -32,5 +31,15 @@ export function ParentObjectMixin<TBase extends Constructor<Component>>(Base: TB
|
|
|
32
31
|
return parent
|
|
33
32
|
}
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* parentObjectId 가 참조하는 모델 컴포넌트 타입들 — parentObject 후보를 모델(씬)에서
|
|
37
|
+
* 수집할 때 이 타입들로 거른다 (머신/유닛 무관, 복수 허용).
|
|
38
|
+
* 빈 배열(기본) 이면 모델의 모든 머신 (폴백). 참조 타입이 정해진 컴포넌트는 override:
|
|
39
|
+
* AGV→['AGVLine'], OHT→['OHTLine'], Crane/Shelf→['STOCKER'], PortFlow→['Port'].
|
|
40
|
+
*/
|
|
41
|
+
get parentObjectTypes(): string[] {
|
|
42
|
+
return []
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
}
|
|
@@ -42,6 +42,11 @@ const NATURE = {
|
|
|
42
42
|
}
|
|
43
43
|
@sceneComponent('FloatingContainer')
|
|
44
44
|
export default class FloatingContainer extends Container {
|
|
45
|
+
// things-scene 의 `declare const Container_base` 패턴이 base 인스턴스 타입의 accessor
|
|
46
|
+
// 정보를 object-type property 로 평탄화하여 TS2611 발생. 동일 위치를 override 하는
|
|
47
|
+
// 케이스가 operato-scene 엔 없어 fmsim 만 영향. things-scene 측 mixin 타입 패턴이
|
|
48
|
+
// 개선되면 제거.
|
|
49
|
+
// @ts-expect-error TS2611
|
|
45
50
|
get position() {
|
|
46
51
|
return this.app?.isViewMode ? 'absolute' : 'static'
|
|
47
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,55 +1,74 @@
|
|
|
1
1
|
// ── side-effect: scene override ──
|
|
2
|
-
import './scene/root-container-override
|
|
2
|
+
import './scene/root-container-override'
|
|
3
3
|
|
|
4
4
|
// ── side-effect: 3D factories ──
|
|
5
|
-
import './factories/machine-3d
|
|
6
|
-
import './factories/conveyor-3d
|
|
7
|
-
import './factories/agv-3d
|
|
8
|
-
import './factories/oht-3d
|
|
9
|
-
import './factories/shuttle-3d
|
|
10
|
-
import './factories/crane-3d
|
|
11
|
-
import './factories/crane-rail-3d
|
|
5
|
+
import './factories/machine-3d'
|
|
6
|
+
import './factories/conveyor-3d'
|
|
7
|
+
import './factories/agv-3d'
|
|
8
|
+
import './factories/oht-3d'
|
|
9
|
+
import './factories/shuttle-3d'
|
|
10
|
+
import './factories/crane-3d'
|
|
11
|
+
import './factories/crane-rail-3d'
|
|
12
|
+
// 기본 factory (RealObjectDomTexture) 쓰는 컴포넌트들의 z-priority override
|
|
13
|
+
import './factories/z-priority-defaults'
|
|
12
14
|
|
|
13
15
|
// ── side-effect: @sceneComponent 등록 (tree-shaking 방지) ──
|
|
14
|
-
|
|
15
|
-
import './
|
|
16
|
-
import './stocker-
|
|
17
|
-
import './stocker-
|
|
18
|
-
import './
|
|
19
|
-
import './
|
|
20
|
-
import './buffer.js'
|
|
21
|
-
import './conveyor.js'
|
|
22
|
-
import './conveyor-join.js'
|
|
23
|
-
import './equipment.js'
|
|
24
|
-
import './oht-line.js'
|
|
25
|
-
import './stocker.js'
|
|
26
|
-
import './crane-rail.js'
|
|
27
|
-
import './agv.js'
|
|
28
|
-
import './oht.js'
|
|
29
|
-
import './shuttle.js'
|
|
30
|
-
import './port.js'
|
|
31
|
-
import './crane.js'
|
|
32
|
-
import './shelf.js'
|
|
33
|
-
import './carrier.js'
|
|
34
|
-
import './node.js'
|
|
35
|
-
import './node-path.js'
|
|
36
|
-
import './floating-container.js'
|
|
37
|
-
import './static-container.js'
|
|
38
|
-
import './clickable-popup.js'
|
|
16
|
+
// bars & overlays
|
|
17
|
+
import './zone-capacity-bar'
|
|
18
|
+
import './stocker-capacity-bar'
|
|
19
|
+
import './stocker-carrier-bar'
|
|
20
|
+
import './stocker-abnormal-bar'
|
|
21
|
+
import './port-flow'
|
|
39
22
|
|
|
23
|
+
// facilities
|
|
24
|
+
import './agv-line'
|
|
25
|
+
import './buffer'
|
|
26
|
+
import './conveyor'
|
|
27
|
+
import './conveyor-join'
|
|
28
|
+
import './equipment'
|
|
29
|
+
import './oht-line'
|
|
30
|
+
import './stocker'
|
|
31
|
+
import './crane-rail'
|
|
32
|
+
import './scanner'
|
|
33
|
+
|
|
34
|
+
// vehicles
|
|
35
|
+
import './agv'
|
|
36
|
+
import './oht'
|
|
37
|
+
import './shuttle'
|
|
38
|
+
|
|
39
|
+
// units
|
|
40
|
+
import './port'
|
|
41
|
+
import './crane'
|
|
42
|
+
import './shelf'
|
|
43
|
+
import './carrier'
|
|
44
|
+
|
|
45
|
+
// topology
|
|
46
|
+
import './node'
|
|
47
|
+
import './node-path'
|
|
48
|
+
|
|
49
|
+
// containers
|
|
50
|
+
import './floating-container'
|
|
51
|
+
import './static-container'
|
|
52
|
+
import './clickable-popup'
|
|
53
|
+
|
|
54
|
+
// ── groups ──
|
|
40
55
|
export { default as MachineGroups } from './groups'
|
|
41
56
|
|
|
57
|
+
// ── base classes ──
|
|
42
58
|
export { default as MCSMachine } from './mcs-machine'
|
|
43
59
|
export { default as MCSUnit } from './mcs-unit'
|
|
44
60
|
export { default as MCSCarrierHolder } from './mcs-carrier-holder'
|
|
45
61
|
export { default as MCSVehicle } from './mcs-vehicle'
|
|
46
62
|
export { default as MCSTransport } from './mcs-transport'
|
|
63
|
+
|
|
64
|
+
// ── bars & overlays ──
|
|
47
65
|
export { default as ZoneCapacityBar } from './zone-capacity-bar'
|
|
48
66
|
export { default as StockerCapacityBar } from './stocker-capacity-bar'
|
|
49
67
|
export { default as StockerCarrierBar } from './stocker-carrier-bar'
|
|
50
68
|
export { default as StockerAbnormalBar } from './stocker-abnormal-bar'
|
|
51
69
|
export { default as PortFlow } from './port-flow'
|
|
52
70
|
|
|
71
|
+
// ── facilities ──
|
|
53
72
|
export { default as AGVLine } from './agv-line'
|
|
54
73
|
export { default as Buffer } from './buffer'
|
|
55
74
|
export { default as Conveyor } from './conveyor'
|
|
@@ -58,19 +77,24 @@ export { default as Equipment } from './equipment'
|
|
|
58
77
|
export { default as OHTLine } from './oht-line'
|
|
59
78
|
export { default as Stocker } from './stocker'
|
|
60
79
|
export { default as CraneRail } from './crane-rail'
|
|
80
|
+
export { default as Scanner } from './scanner'
|
|
61
81
|
|
|
82
|
+
// ── vehicles ──
|
|
62
83
|
export { default as AGV } from './agv'
|
|
63
84
|
export { default as OHT } from './oht'
|
|
64
85
|
export { default as Shuttle } from './shuttle'
|
|
65
86
|
|
|
87
|
+
// ── units ──
|
|
66
88
|
export { default as Port } from './port'
|
|
67
89
|
export { default as Crane } from './crane'
|
|
68
90
|
export { default as Shelf } from './shelf'
|
|
69
91
|
export { default as Carrier } from './carrier'
|
|
70
92
|
|
|
93
|
+
// ── topology ──
|
|
71
94
|
export { default as Node } from './node'
|
|
72
95
|
export { default as NodePath } from './node-path'
|
|
73
96
|
|
|
97
|
+
// ── containers ──
|
|
74
98
|
export { default as FloatingContainer } from './floating-container'
|
|
75
|
-
export { default as StaticContainer } from './static-container
|
|
99
|
+
export { default as StaticContainer } from './static-container'
|
|
76
100
|
export { default as ClickablePopup } from './clickable-popup'
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import { Model, Properties } from '@hatiolab/things-scene'
|
|
2
1
|
import { themesColorMap, themesAnimationMap } from '@fmsim/api'
|
|
3
2
|
import MCSUnit from './mcs-unit.js'
|
|
4
|
-
import
|
|
3
|
+
import { parseIfJsonString } from './utils/data-value'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Holder.data 변경 감지 시 carrierManager 에 전달할 4 키 묶음 + multiCarriers 배열.
|
|
7
|
+
* 비교 결과 단 하나라도 다르면 carrierManager.update 호출.
|
|
8
|
+
* (데이터 키는 모두 대문자 전제 — 케이스 정규화 없이 직접 읽는다)
|
|
9
|
+
*/
|
|
10
|
+
const CARRIER_DATA_KEYS = ['CARRIERNAME', 'CARRIERTYPE', 'EMPTYTYPE', 'CARRIERSTATUS'] as const
|
|
11
|
+
|
|
12
|
+
function multiCarriersChanged(a: any, b: any): boolean {
|
|
13
|
+
// MULTICARRIERS 값이 JSON 문자열로 올 수 있어 파싱 후 비교. shallow JSON 비교로 충분 —
|
|
14
|
+
// 각 항목이 4 키 primitive 만 가짐. 빈/누락은 같은 '[]' 직렬화로 동치 취급.
|
|
15
|
+
return (
|
|
16
|
+
JSON.stringify(parseIfJsonString(a?.MULTICARRIERS) ?? []) !==
|
|
17
|
+
JSON.stringify(parseIfJsonString(b?.MULTICARRIERS) ?? [])
|
|
18
|
+
)
|
|
19
|
+
}
|
|
5
20
|
|
|
6
21
|
export default class MCSCarrierHolder extends MCSUnit {
|
|
7
22
|
static get properties(): any {
|
|
@@ -28,55 +43,63 @@ export default class MCSCarrierHolder extends MCSUnit {
|
|
|
28
43
|
label: 'show-carrier-text',
|
|
29
44
|
name: 'showCarrierText'
|
|
30
45
|
}
|
|
46
|
+
// 적층 두께는 carrier 측 (Carrier.added) 에서 자기 default depth 를 결정.
|
|
47
|
+
// holder 측에는 별도 carrierDepth 속성을 두지 않는다.
|
|
31
48
|
]
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
super.ready()
|
|
51
|
+
get showOverflow() {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
get hierarchy() {
|
|
56
|
+
return {
|
|
57
|
+
...super.hierarchy,
|
|
58
|
+
components: []
|
|
41
59
|
}
|
|
42
|
-
|
|
43
|
-
const { width, height } = this.state
|
|
44
|
-
|
|
45
|
-
this.carrier = Model.compile(
|
|
46
|
-
{
|
|
47
|
-
type: 'Carrier',
|
|
48
|
-
left: 0,
|
|
49
|
-
top: 0,
|
|
50
|
-
width,
|
|
51
|
-
height,
|
|
52
|
-
showText: this.getState('showCarrierText') || false
|
|
53
|
-
},
|
|
54
|
-
this.root.app
|
|
55
|
-
) as any
|
|
56
|
-
|
|
57
|
-
this.addComponent(this.carrier!)
|
|
58
|
-
|
|
59
|
-
this.carrier!.data = this.data
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
dispose(): void {
|
|
63
|
-
this.
|
|
64
|
-
|
|
63
|
+
;(this.root as any)?.carrierManager?.update(this, {}, this.data)
|
|
65
64
|
super.dispose()
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
async ready() {
|
|
68
|
+
super.ready()
|
|
69
|
+
|
|
70
|
+
if (this._hasCarrierData(this.data)) {
|
|
71
|
+
;(this.root as any).carrierManager.update(this, this.data || {}, undefined)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
onchangeData(after: Record<string, any>, before: Record<string, any>): void {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const afterData = after.data || {}
|
|
77
|
+
const beforeData = before.data || {}
|
|
78
|
+
|
|
79
|
+
let changed = false
|
|
80
|
+
for (const k of CARRIER_DATA_KEYS) {
|
|
81
|
+
if (afterData[k] !== beforeData[k]) {
|
|
82
|
+
changed = true
|
|
83
|
+
break
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!changed) {
|
|
87
|
+
changed = multiCarriersChanged(afterData, beforeData)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (changed) {
|
|
91
|
+
;(this.root as any).carrierManager.update(this, afterData, beforeData)
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
super.onchangeData(after, before)
|
|
81
95
|
}
|
|
96
|
+
|
|
97
|
+
/** data 안에 carrier 정보 (대표 또는 multiCarriers) 가 하나라도 있는지. */
|
|
98
|
+
private _hasCarrierData(data: any): boolean {
|
|
99
|
+
if (!data) return false
|
|
100
|
+
if (data.CARRIERNAME) return true
|
|
101
|
+
const list = parseIfJsonString(data.MULTICARRIERS)
|
|
102
|
+
if (Array.isArray(list) && list.some((a: any) => a?.CARRIERNAME)) return true
|
|
103
|
+
return false
|
|
104
|
+
}
|
|
82
105
|
}
|