From 11c0994833773dcf70cad0f0c9a90dd103125228 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Wed, 20 Aug 2025 17:00:27 +0530 Subject: [PATCH] schema change --- app/package-lock.json | 85 +++++++++ app/package.json | 1 + .../eventProperties/actions/StorageAction.tsx | 74 ++++---- .../mechanics/storageMechanics.tsx | 172 +++++++++++------- app/src/modules/builder/asset/assetsGroup.tsx | 4 +- .../builder/asset/functions/addAssetModel.ts | 4 +- .../selection3D/copyPasteControls3D.tsx | 4 +- .../selection3D/duplicationControls3D.tsx | 4 +- app/src/modules/scene/helpers/StatsHelper.tsx | 5 +- app/src/modules/scene/scene.tsx | 2 - app/src/modules/scene/setup/setup.tsx | 6 +- app/src/modules/scene/tools/autoRotate.tsx | 47 +++++ .../instance/actions/workerInstance.tsx | 2 +- .../modules/simulation/products/products.tsx | 9 +- .../triggerHandler/useTriggerHandler.ts | 6 +- .../simulation/ui3d/StorageContentUi.tsx | 2 +- .../instances/instance/vehicleInstance.tsx | 2 +- .../store/simulation/useStorageUnitStore.ts | 2 +- app/src/types/simulationTypes.d.ts | 5 +- 19 files changed, 304 insertions(+), 132 deletions(-) create mode 100644 app/src/modules/scene/tools/autoRotate.tsx diff --git a/app/package-lock.json b/app/package-lock.json index b5a2eda..a1bf231 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -38,6 +38,7 @@ "mqtt": "^5.10.4", "postprocessing": "^6.36.4", "prompt-sync": "^4.2.0", + "r3f-perf": "^7.2.3", "react": "^18.3.1", "react-chartjs-2": "^5.3.0", "react-dom": "^18.3.1", @@ -3371,6 +3372,15 @@ "react-dom": "^16.8 || ^17.0 || ^18.0" } }, + "node_modules/@radix-ui/react-icons": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.2.tgz", + "integrity": "sha512-fyQIhGDhzfc9pK2kH6Pl9c4BDJGfMkPqkyIgYDthyNYoNg3wVhoJMMh19WS4Up/1KMPFVpNsT2q3WmXn2N1m6g==", + "license": "MIT", + "peerDependencies": { + "react": "^16.x || ^17.x || ^18.x || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/@radix-ui/react-id": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.0.0.tgz", @@ -7073,6 +7083,23 @@ "react": ">= 16.8.0" } }, + "node_modules/@utsubo/events": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/@utsubo/events/-/events-0.1.7.tgz", + "integrity": "sha512-WB/GEj/0h27Bz8rJ0+CBtNz5mLT79ne1OjB7PUM4n0qLBqEDwm6yBzZC3j6tasHjlBPJDYZiBVIA1glaMlgZ5g==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.7" + }, + "peerDependencies": { + "react": ">=16.8.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", @@ -17894,6 +17921,64 @@ "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", "license": "ISC" }, + "node_modules/r3f-perf": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/r3f-perf/-/r3f-perf-7.2.3.tgz", + "integrity": "sha512-4+P/N/bnO9D8nzdm3suL/NjPZK/HHdjwpvajhi8j7eB41i2ECN6lX9RXiKSpHzpsDi2ui1tBj6q7/sz5opoqXw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-icons": "^1.3.0", + "@react-three/drei": "^9.103.0", + "@stitches/react": "^1.2.8", + "@utsubo/events": "^0.1.7", + "zustand": "~4.5.2" + }, + "peerDependencies": { + "@react-three/fiber": ">=8.0", + "react": ">=18.0", + "react-dom": ">=18.0", + "three": ">=0.133" + }, + "peerDependenciesMeta": { + "@react-three/fiber": { + "optional": true + }, + "dom": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/r3f-perf/node_modules/zustand": { + "version": "4.5.7", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz", + "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==", + "license": "MIT", + "dependencies": { + "use-sync-external-store": "^1.2.2" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0.6", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } + }, "node_modules/raf": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", diff --git a/app/package.json b/app/package.json index 16c4ac0..aec1d38 100644 --- a/app/package.json +++ b/app/package.json @@ -33,6 +33,7 @@ "mqtt": "^5.10.4", "postprocessing": "^6.36.4", "prompt-sync": "^4.2.0", + "r3f-perf": "^7.2.3", "react": "^18.3.1", "react-chartjs-2": "^5.3.0", "react-dom": "^18.3.1", diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/actions/StorageAction.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/actions/StorageAction.tsx index 4d280d2..4046d89 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/actions/StorageAction.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/actions/StorageAction.tsx @@ -3,53 +3,51 @@ import InputWithDropDown from "../../../../../ui/inputs/InputWithDropDown"; import LabledDropdown from "../../../../../ui/inputs/LabledDropdown"; interface StorageActionProps { - type: "store" | "spawn" | "default"; - value: string; + maxCapacity: string; + spawnedCount: string; min: number; max?: number; - defaultValue: string; + maxCapacityDefault: string; + spawnedCountCefault: string; currentMaterialType: string; handleCapacityChange: (value: string) => void; + handleSpawnCountChange: (value: string) => void; handleMaterialTypeChange: (value: string) => void; } -const StorageAction: React.FC = ({ type, value, min, max, defaultValue, currentMaterialType, handleCapacityChange, handleMaterialTypeChange }) => { +const StorageAction: React.FC = ({ maxCapacity, spawnedCount, min, max, maxCapacityDefault, spawnedCountCefault, currentMaterialType, handleCapacityChange, handleSpawnCountChange, handleMaterialTypeChange }) => { return ( <> - {type === 'store' && - { }} - onChange={handleCapacityChange} - /> - } - {type === 'spawn' && - <> - { }} - onChange={handleCapacityChange} - /> - - - } + { }} + onChange={handleCapacityChange} + /> + { }} + onChange={handleSpawnCountChange} + /> + ); }; diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx index 796dbc5..e69ceba 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx @@ -14,10 +14,13 @@ import { useSceneContext } from "../../../../../../modules/scene/sceneContext"; function StorageMechanics() { const [activeOption, setActiveOption] = useState<"default" | "store" | "spawn">("default"); + const [currentCapacity, setCurrentCapacity] = useState("1"); + const [spawnedCount, setSpawnedCount] = useState("0"); + const [spawnedMaterial, setSpawnedMaterial] = useState("Default material"); const [selectedPointData, setSelectedPointData] = useState(); const { selectedEventData } = useSelectedEventData(); const { productStore } = useSceneContext(); - const { getPointByUuid, updateAction } = productStore(); + const { getPointByUuid, updateAction, updateEvent, getEventByModelUuid } = productStore(); const { selectedProductStore } = useProductContext(); const { selectedProduct } = selectedProductStore(); const { setSelectedAction, clearSelectedAction } = useSelectedAction(); @@ -52,6 +55,24 @@ function StorageMechanics() { setSelectedPointData(point); const uiOption = point.action.actionType === "retrieve" ? "spawn" : point.action.actionType; setActiveOption(uiOption as "store" | "spawn"); + setCurrentCapacity( + (getEventByModelUuid( + selectedProduct.productUuid, + selectedEventData.data.modelUuid + ) as StorageEventSchema | undefined)?.storageCapacity?.toString() || "1" + ); + setSpawnedCount( + (getEventByModelUuid( + selectedProduct.productUuid, + selectedEventData.data.modelUuid + ) as StorageEventSchema | undefined)?.storageCount?.toString() || "0" + ) + setSpawnedMaterial( + (getEventByModelUuid( + selectedProduct.productUuid, + selectedEventData.data.modelUuid + ) as StorageEventSchema | undefined)?.materialType?.toString() || "Default material" + ) setSelectedAction(point.action.actionUuid, point.action.actionName); } } else { @@ -95,29 +116,55 @@ function StorageMechanics() { } }; - const handleRenameAction = (newName: string) => { - if (!selectedPointData) return; - const event = updateAction(selectedProduct.productUuid, selectedPointData.action.actionUuid, { actionName: newName }); - - if (event) { - updateBackend( - selectedProduct.productName, - selectedProduct.productUuid, - projectId || '', - event - ); - updateSelectedPointData(); - } - }; - const handleCapacityChange = (value: string) => { if (!selectedEventData || !selectedPointData) return; - const newCapacity = parseInt(value); - const event = updateAction(selectedProduct.productUuid, selectedPointData.action.actionUuid, { - storageCapacity: newCapacity, + const newCapacity = parseInt(value); + let updatedEvent: EventsSchema | undefined; + + updatedEvent = updateEvent( + selectedProduct.productUuid, + selectedEventData.data.modelUuid, + { storageCapacity: newCapacity } + ); + + const currentCount = parseInt(spawnedCount); + if (currentCount > newCapacity) { + updatedEvent = updateEvent( + selectedProduct.productUuid, + selectedEventData.data.modelUuid, + { storageCount: newCapacity } + ); + setSpawnedCount(newCapacity.toString()); + } + + setCurrentCapacity(value); + + if (updatedEvent) { + updateBackend( + selectedProduct.productName, + selectedProduct.productUuid, + projectId || '', + updatedEvent + ); + updateSelectedPointData(); + } + }; + + const handleSpawnCountChange = (value: string) => { + if (!selectedEventData || !selectedPointData) return; + + const newCount = parseInt(value); + const maxCapacity = parseInt(currentCapacity); + + if (newCount > maxCapacity) return; + + const event = updateEvent(selectedProduct.productUuid, selectedEventData.data.modelUuid, { + storageCount: newCount, }); + setSpawnedCount(value); + if (event) { updateBackend( selectedProduct.productName, @@ -129,19 +176,10 @@ function StorageMechanics() { } }; - const createNewMaterial = (materialType: string): { materialType: string; materialId: string } | null => { - if (!selectedEventData || !selectedPointData) return null; - const materialId = THREE.MathUtils.generateUUID(); - return { - materialType, - materialId - }; - }; - const handleMaterialTypeChange = (value: string) => { if (!selectedEventData || !selectedPointData) return; - const event = updateAction(selectedProduct.productUuid, selectedPointData.action.actionUuid, { + const event = updateEvent(selectedProduct.productUuid, selectedEventData.data.modelUuid, { materialType: value, }); @@ -161,16 +199,6 @@ function StorageMechanics() { [selectedPointData] ); - const currentCapacity = useMemo(() => - selectedPointData ? selectedPointData.action.storageCapacity.toString() : "0", - [selectedPointData] - ); - - const currentMaterialType = useMemo(() => - selectedPointData?.action.materialType || "Default material", - [selectedPointData] - ); - const availableActions = { defaultOption: "store", options: ["store", "spawn"], @@ -184,38 +212,44 @@ function StorageMechanics() { return ( <> {selectedEventData && ( -
- -
-
- + <> +
+ +
+
+ +
+
+ +
+
+ +
-
- - +
+
-
-
- -
-
+
+ )} ); diff --git a/app/src/modules/builder/asset/assetsGroup.tsx b/app/src/modules/builder/asset/assetsGroup.tsx index 072c9a7..dbab693 100644 --- a/app/src/modules/builder/asset/assetsGroup.tsx +++ b/app/src/modules/builder/asset/assetsGroup.tsx @@ -232,6 +232,9 @@ function AssetsGroup({ plane }: { readonly plane: RefMesh }) { rotation: [item.rotation.x, item.rotation.y, item.rotation.z], state: "idle", type: "storageUnit", + storageCapacity: 10, + storageCount: 10, + materialType: "Default material", subType: item.eventData.subType || '', point: { uuid: item.eventData.point?.uuid || THREE.MathUtils.generateUUID(), @@ -241,7 +244,6 @@ function AssetsGroup({ plane }: { readonly plane: RefMesh }) { actionUuid: THREE.MathUtils.generateUUID(), actionName: "Action 1", actionType: "store", - storageCapacity: 10, triggers: [] } } diff --git a/app/src/modules/builder/asset/functions/addAssetModel.ts b/app/src/modules/builder/asset/functions/addAssetModel.ts index c64064a..fca0426 100644 --- a/app/src/modules/builder/asset/functions/addAssetModel.ts +++ b/app/src/modules/builder/asset/functions/addAssetModel.ts @@ -345,6 +345,9 @@ async function handleModelLoad( rotation: newFloorItem.rotation, state: "idle", type: "storageUnit", + storageCapacity: 10, + storageCount: 10, + materialType: "Default material", subType: selectedItem.subType || '', point: { uuid: THREE.MathUtils.generateUUID(), @@ -354,7 +357,6 @@ async function handleModelLoad( actionUuid: THREE.MathUtils.generateUUID(), actionName: "Action 1", actionType: "store", - storageCapacity: 10, triggers: [], }, }, diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx index e9d7bc3..5b5eb6b 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/copyPasteControls3D.tsx @@ -375,6 +375,9 @@ const CopyPasteControls3D = ({ rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z], state: "idle", type: "storageUnit", + storageCapacity: 10, + storageCount: 10, + materialType: "Default material", subType: pastedAsset.userData.eventData.subType || '', point: { uuid: THREE.MathUtils.generateUUID(), @@ -384,7 +387,6 @@ const CopyPasteControls3D = ({ actionUuid: THREE.MathUtils.generateUUID(), actionName: "Action 1", actionType: "store", - storageCapacity: 10, triggers: [] } } diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx index fcac600..8f47996 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/duplicationControls3D.tsx @@ -445,6 +445,9 @@ const DuplicationControls3D = ({ rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z], state: "idle", type: "storageUnit", + storageCapacity: 10, + storageCount: 10, + materialType: "Default material", subType: duplicatedAsset.userData.eventData.subType || '', point: { uuid: THREE.MathUtils.generateUUID(), @@ -454,7 +457,6 @@ const DuplicationControls3D = ({ actionUuid: THREE.MathUtils.generateUUID(), actionName: "Action 1", actionType: "store", - storageCapacity: 10, triggers: [] } } diff --git a/app/src/modules/scene/helpers/StatsHelper.tsx b/app/src/modules/scene/helpers/StatsHelper.tsx index 486488b..7414b70 100644 --- a/app/src/modules/scene/helpers/StatsHelper.tsx +++ b/app/src/modules/scene/helpers/StatsHelper.tsx @@ -1,7 +1,8 @@ import { useEffect, useState } from "react"; -import { Stats } from "@react-three/drei"; import { detectModifierKeys } from "../../../utils/shortcutkeys/detectModifierKeys"; +import { Perf } from 'r3f-perf'; + export default function StatsHelper() { const [visible, setVisible] = useState(false); @@ -18,5 +19,5 @@ export default function StatsHelper() { return () => window.removeEventListener("keydown", handleKeyDown); }, []); - return visible ? : null; + return visible ? : null; } diff --git a/app/src/modules/scene/scene.tsx b/app/src/modules/scene/scene.tsx index feddc2c..b5e6739 100644 --- a/app/src/modules/scene/scene.tsx +++ b/app/src/modules/scene/scene.tsx @@ -14,7 +14,6 @@ import { getAllProjects } from "../../services/dashboard/getAllProjects"; import { getUserData } from "../../functions/getUserData"; import { useLoadingProgress, useSocketStore } from "../../store/builder/store"; import { Color, SRGBColorSpace } from "three"; -import StatsHelper from "./helpers/StatsHelper"; export default function Scene({ layout }: { readonly layout: "Main Layout" | "Comparison Layout"; }) { const map = useMemo(() => [ @@ -72,7 +71,6 @@ export default function Scene({ layout }: { readonly layout: "Main Layout" | "Co - ); diff --git a/app/src/modules/scene/setup/setup.tsx b/app/src/modules/scene/setup/setup.tsx index 71dcce7..16011f1 100644 --- a/app/src/modules/scene/setup/setup.tsx +++ b/app/src/modules/scene/setup/setup.tsx @@ -1,11 +1,11 @@ import Sun from '../environment/sky' import Shadows from '../environment/shadow' import PostProcessing from '../postProcessing/postProcessing' +import StatsHelper from '../helpers/StatsHelper'; import Controls from '../controls/controls'; import { AdaptiveDpr, AdaptiveEvents, Environment } from '@react-three/drei' import background from "../../../assets/textures/hdr/mudroadpuresky2k.hdr"; -// import { Perf } from 'r3f-perf'; function Setup() { return ( @@ -18,12 +18,12 @@ function Setup() { - {/* */} - {/* */} + + diff --git a/app/src/modules/scene/tools/autoRotate.tsx b/app/src/modules/scene/tools/autoRotate.tsx new file mode 100644 index 0000000..f0ff7a0 --- /dev/null +++ b/app/src/modules/scene/tools/autoRotate.tsx @@ -0,0 +1,47 @@ +import { useEffect, useRef, useState } from 'react' +import { useThree, useFrame } from '@react-three/fiber' +import type CameraControlsImpl from 'camera-controls' + +export default function AutoRotate() { + const { gl, controls } = useThree() + const [isIdle, setIsIdle] = useState(false) + const idleTimeout = useRef(null) + const lastInteractionTime = useRef(Date.now()) + + const cameraControls = controls as CameraControlsImpl | null + + const resetIdleTimer = () => { + lastInteractionTime.current = Date.now() + if (isIdle) setIsIdle(false) + if (idleTimeout.current) clearTimeout(idleTimeout.current) + idleTimeout.current = setTimeout(() => { + setIsIdle(true) + }, 30_000) + } + + useEffect(() => { + const dom = gl.domElement + const listener = () => resetIdleTimer() + + dom.addEventListener('pointerdown', listener) + dom.addEventListener('wheel', listener) + window.addEventListener('keydown', listener) + + resetIdleTimer() + + return () => { + dom.removeEventListener('pointerdown', listener) + dom.removeEventListener('wheel', listener) + window.removeEventListener('keydown', listener) + } + }, [gl]) + + useFrame((_, delta) => { + if (isIdle && cameraControls) { + cameraControls.rotate(delta * 0.1, 0, true) + cameraControls.update(delta) + } + }) + + return null +} diff --git a/app/src/modules/simulation/human/instances/instance/actions/workerInstance.tsx b/app/src/modules/simulation/human/instances/instance/actions/workerInstance.tsx index c5645af..558401c 100644 --- a/app/src/modules/simulation/human/instances/instance/actions/workerInstance.tsx +++ b/app/src/modules/simulation/human/instances/instance/actions/workerInstance.tsx @@ -238,7 +238,7 @@ function WorkerInstance({ human }: { human: HumanStatus }) { human.modelUuid, human.currentLoad, model.modelUuid, - model.point.action.storageCapacity, + model.storageCapacity, (action as HumanAction) ); } diff --git a/app/src/modules/simulation/products/products.tsx b/app/src/modules/simulation/products/products.tsx index f65e33f..f90c26a 100644 --- a/app/src/modules/simulation/products/products.tsx +++ b/app/src/modules/simulation/products/products.tsx @@ -136,15 +136,14 @@ function Products() { if (event.type === 'storageUnit') { addStorageUnit(selectedProduct.productUuid, event); - if (event.point.action.actionType === 'retrieve') { - const storageAction = event.point.action; - const materials = Array.from({ length: storageAction.storageCapacity }, () => ({ - materialType: storageAction.materialType || 'Default material', + if (event.storageCount > 0) { + const materials = Array.from({ length: event.storageCount }, () => ({ + materialType: event.materialType || 'Default material', materialId: THREE.MathUtils.generateUUID() })); setCurrentMaterials(event.modelUuid, materials); - updateCurrentLoad(event.modelUuid, storageAction.storageCapacity); + updateCurrentLoad(event.modelUuid, event.storageCount); } else { setCurrentMaterials(event.modelUuid, []); updateCurrentLoad(event.modelUuid, 0); diff --git a/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts b/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts index 9660a6d..5cee999 100644 --- a/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts +++ b/app/src/modules/simulation/triggers/triggerHandler/useTriggerHandler.ts @@ -575,7 +575,7 @@ export function useTriggerHandler() { if (action && storageUnit) { - if (storageUnit.currentLoad < storageUnit.point.action.storageCapacity) { + if (storageUnit.currentLoad < storageUnit.storageCapacity) { // Handle current action from vehicle handleAction(action, materialId); @@ -1135,7 +1135,7 @@ export function useTriggerHandler() { if (action && storageUnit) { - if (storageUnit.currentLoad < storageUnit.point.action.storageCapacity) { + if (storageUnit.currentLoad < storageUnit.storageCapacity) { // Handle current action from vehicle handleAction(action, materialId); @@ -1782,7 +1782,7 @@ export function useTriggerHandler() { if (action && storageUnit) { - if (storageUnit.currentLoad < storageUnit.point.action.storageCapacity) { + if (storageUnit.currentLoad < storageUnit.storageCapacity) { // Handle current action from vehicle handleAction(action, materialId); diff --git a/app/src/modules/simulation/ui3d/StorageContentUi.tsx b/app/src/modules/simulation/ui3d/StorageContentUi.tsx index 38f62dc..7d02932 100644 --- a/app/src/modules/simulation/ui3d/StorageContentUi.tsx +++ b/app/src/modules/simulation/ui3d/StorageContentUi.tsx @@ -31,7 +31,7 @@ const StorageContentUi: React.FC = ({ storageUnit }) => { status={storageUnit.state} count={storageUnit.currentLoad} enableStatue={false} - totalCapacity={storageUnit.point.action.storageCapacity} + totalCapacity={storageUnit.storageCapacity} /> ); diff --git a/app/src/modules/simulation/vehicle/instances/instance/vehicleInstance.tsx b/app/src/modules/simulation/vehicle/instances/instance/vehicleInstance.tsx index 0466ba2..89f6bfb 100644 --- a/app/src/modules/simulation/vehicle/instances/instance/vehicleInstance.tsx +++ b/app/src/modules/simulation/vehicle/instances/instance/vehicleInstance.tsx @@ -394,7 +394,7 @@ function VehicleInstance({ agvDetail }: Readonly<{ agvDetail: VehicleStatus }>) agvDetail.currentLoad, agvDetail.point.action.unLoadDuration, model.modelUuid, - model.point.action.storageCapacity, + model.storageCapacity, agvDetail.point.action ); } diff --git a/app/src/store/simulation/useStorageUnitStore.ts b/app/src/store/simulation/useStorageUnitStore.ts index c89e643..deae86a 100644 --- a/app/src/store/simulation/useStorageUnitStore.ts +++ b/app/src/store/simulation/useStorageUnitStore.ts @@ -205,7 +205,7 @@ export const createStorageUnitStore = () => { getFullStorageUnits: () => { return get().storageUnits.filter( - s => s.currentLoad >= s.point.action.storageCapacity + s => s.currentLoad >= s.storageCapacity ); }, diff --git a/app/src/types/simulationTypes.d.ts b/app/src/types/simulationTypes.d.ts index ae6c55a..0110fcd 100644 --- a/app/src/types/simulationTypes.d.ts +++ b/app/src/types/simulationTypes.d.ts @@ -90,8 +90,6 @@ interface StorageAction { actionUuid: string; actionName: string; actionType: "store" | "retrieve"; - materialType?: string; - storageCapacity: number; triggers: TriggerSchema[]; } @@ -207,6 +205,9 @@ interface MachineEventSchema extends AssetEventSchema { interface StorageEventSchema extends AssetEventSchema { type: "storageUnit"; subType: string; + storageCapacity: number; + storageCount: number; + materialType: string; point: StoragePointSchema; }