diff --git a/app/src/components/layout/scenes/functions/simulationStorage.ts b/app/src/components/layout/scenes/functions/simulationStorage.ts index 3dcced5..6af9302 100644 --- a/app/src/components/layout/scenes/functions/simulationStorage.ts +++ b/app/src/components/layout/scenes/functions/simulationStorage.ts @@ -59,7 +59,8 @@ export const saveSimulationData = async (data: any) => { } } }; -export const getSimulationData = async (data: any) => { +export const updateSimulateData = async (data: any) => { + console.log("data: update", data); try { const response = await fetch(`${url_Backend_dwinzo}/api/V1/ValidateSimulated`, { method: "POST", @@ -76,7 +77,7 @@ export const getSimulationData = async (data: any) => { localStorage.setItem("token", newAccessToken); } if (!response.ok) { - console.error("Failed to add project"); + console.error("Failed to update "); } const result = await response.json(); @@ -90,4 +91,35 @@ export const getSimulationData = async (data: any) => { } } }; -export const clearSimulationData = ({ key, data }: SimulationData) => {}; +export const getSimulationData = async (projectId: string, versionId: string, productUuid: string) => { + console.log("called"); + try { + const response = await fetch(`${url_Backend_dwinzo}/api/V1/SimulatedDatas/${projectId}/${versionId}?productUuid=${productUuid}`, { + method: "GET", + headers: { + Authorization: "Bearer ", + "Content-Type": "application/json", + token: localStorage.getItem("token") || "", + refresh_token: localStorage.getItem("refreshToken") || "", + }, + }); + + console.log("response: ", response); + + const newAccessToken = response.headers.get("x-access-token"); + if (newAccessToken) { + localStorage.setItem("token", newAccessToken); + } + + if (!response.ok) { + throw new Error("Failed to fetch simulateData"); + } + + return await response.json(); + } catch (error: any) { + console.error("Failed to get simulation data"); + console.log(error.message); + } +}; + +// export const clearSimulationData = ({ key, data }: SimulationData) => {}; diff --git a/app/src/components/layout/sidebarRight/simulation/Simulations.tsx b/app/src/components/layout/sidebarRight/simulation/Simulations.tsx index d4755b8..fa09ed1 100644 --- a/app/src/components/layout/sidebarRight/simulation/Simulations.tsx +++ b/app/src/components/layout/sidebarRight/simulation/Simulations.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useRef, useState } from "react"; -import { AddIcon, ArrowIcon, RemoveIcon, ResizeHeightIcon, } from "../../../icons/ExportCommonIcons"; +import { AddIcon, ArrowIcon, RemoveIcon, ResizeHeightIcon } from "../../../icons/ExportCommonIcons"; import RenameInput from "../../../ui/inputs/RenameInput"; import { handleResize } from "../../../../functions/handleResizePannel"; import { useMainProduct, useSelectedAsset } from "../../../../store/simulation/useSimulationStore"; @@ -13,13 +13,13 @@ import { deleteProductApi } from "../../../../services/simulation/products/delet import { renameProductApi } from "../../../../services/simulation/products/renameProductApi"; import { determineExecutionMachineSequences } from "../../../../modules/simulation/simulator/functions/determineExecutionMachineSequences"; import ComparePopUp from "../../../ui/compareVersion/Compare"; -import { useCompareStore, useSaveVersion, } from "../../../../store/builder/store"; +import { useCompareStore, useSaveVersion, useSimulateId } from "../../../../store/builder/store"; import { useToggleStore } from "../../../../store/useUIToggleStore"; import { useProductContext } from "../../../../modules/simulation/products/productContext"; import { useParams } from "react-router-dom"; import { useVersionContext } from "../../../../modules/builder/version/versionContext"; import { useSceneContext } from "../../../../modules/scene/sceneContext"; -import { getSimulationData } from "../../scenes/functions/simulationStorage"; +import { getSimulationData, updateSimulateData } from "../../scenes/functions/simulationStorage"; interface Event { modelName: string; @@ -41,7 +41,7 @@ const List: React.FC = ({ val }) => { const Simulations: React.FC = () => { const productsContainerRef = useRef(null); const { eventStore, productStore } = useSceneContext(); - const { products, addProduct, removeProduct, renameProduct, addEvent, removeEvent, getProductById, } = productStore(); + const { products, addProduct, removeProduct, renameProduct, addEvent, removeEvent, getProductById } = productStore(); const { selectedProductStore } = useProductContext(); const { selectedProduct, setSelectedProduct } = selectedProductStore(); const { getEventByModelUuid } = eventStore(); @@ -55,6 +55,7 @@ const Simulations: React.FC = () => { const { selectedVersion } = selectedVersionStore(); const { comparePopUp, setComparePopUp } = useCompareStore(); const { setIsVersionSaved } = useSaveVersion(); + const { simulateId } = useSimulateId(); const handleSaveVersion = () => { setIsVersionSaved(true); @@ -70,7 +71,7 @@ const Simulations: React.FC = () => { productName: name, productUuid: id, projectId: projectId, - versionId: selectedVersion?.versionId || '', + versionId: selectedVersion?.versionId || "", }); }; @@ -86,14 +87,8 @@ const Simulations: React.FC = () => { if (currentIndex >= updatedProducts.length) { newSelectedIndex = updatedProducts.length - 1; } - setSelectedProduct( - updatedProducts[newSelectedIndex].productUuid, - updatedProducts[newSelectedIndex].productName - ); - setMainProduct( - updatedProducts[newSelectedIndex].productUuid, - updatedProducts[newSelectedIndex].productName - ); + setSelectedProduct(updatedProducts[newSelectedIndex].productUuid, updatedProducts[newSelectedIndex].productName); + setMainProduct(updatedProducts[newSelectedIndex].productUuid, updatedProducts[newSelectedIndex].productName); } else { setSelectedProduct("", ""); setMainProduct("", ""); @@ -103,14 +98,14 @@ const Simulations: React.FC = () => { removeProduct(productUuid); deleteProductApi({ productUuid, - versionId: selectedVersion?.versionId || '', - projectId + versionId: selectedVersion?.versionId || "", + projectId, }); }; const handleRenameProduct = (productUuid: string, newName: string) => { renameProduct(productUuid, newName); - renameProductApi({ productName: newName, productUuid, projectId: projectId || '', versionId: selectedVersion?.versionId || '' }); + renameProductApi({ productName: newName, productUuid, projectId: projectId || "", versionId: selectedVersion?.versionId || "" }); if (selectedProduct.productUuid === productUuid) { setSelectedProduct(productUuid, newName); setMainProduct(productUuid, newName); @@ -119,11 +114,10 @@ const Simulations: React.FC = () => { const handleRemoveEventFromProduct = () => { if (selectedAsset) { - deleteEventDataApi({ productUuid: selectedProduct.productUuid, modelUuid: selectedAsset.modelUuid, - versionId: selectedVersion?.versionId || '', + versionId: selectedVersion?.versionId || "", projectId: projectId, }); removeEvent(selectedProduct.productUuid, selectedAsset.modelUuid); @@ -136,29 +130,37 @@ const Simulations: React.FC = () => { const selectedProductData = getProductById(selectedProduct.productUuid); if (selectedProductData) { - determineExecutionMachineSequences([selectedProductData]).then( - (sequences) => { - console.log('selectedProductData: ', selectedProductData); - sequences.forEach((sequence) => { - const events: Event[] = - sequence.map((event) => ({ - modelName: event.modelName, - modelId: event.modelUuid, - })) || []; - processes.push(events); - }); - setProcesses(processes); - } - ); + determineExecutionMachineSequences([selectedProductData]).then((sequences) => { + console.log("selectedProductData: ", selectedProductData); + sequences.forEach((sequence) => { + const events: Event[] = + sequence.map((event) => ({ + modelName: event.modelName, + modelId: event.modelUuid, + })) || []; + processes.push(events); + }); + setProcesses(processes); + }); } - }, [selectedProduct.productUuid, products]); //call when comparePopup is true useEffect(() => { if (comparePopUp || selectedProduct.productUuid) { - getSimulationData({ key: selectedProduct.productUuid }); } - }, [comparePopUp]) + }, [comparePopUp]); + + const getSimulate = async () => { + // const singleData = { + // projectId: projectId, + // versionId: selectedVersion?.versionId || "", + // productUuid: selectedProduct?.productUuid || "", + // }; + // console.log("singleData: ", singleData); + // const getData = await getSimulationData(singleData); + // console.log("getData: ", getData); + setComparePopUp(true); + }; return (
@@ -167,77 +169,41 @@ const Simulations: React.FC = () => {
Products
-
-
+
{products.map((product, index) => ( -
+
{/* eslint-disable-next-line */}
{ - setSelectedProduct(product.productUuid, product.productName) - setMainProduct(product.productUuid, product.productName) + setSelectedProduct(product.productUuid, product.productName); + setMainProduct(product.productUuid, product.productName); }} > - - - handleRenameProduct(product.productUuid, newName) - } - /> + + handleRenameProduct(product.productUuid, newName)} />
{products.length > 1 && ( - )}
))}
-
-
@@ -278,8 +247,8 @@ const Simulations: React.FC = () => { addEvent, selectedProduct, clearSelectedAsset, - projectId: projectId || '', - versionId: selectedVersion?.versionId || '', + projectId: projectId || "", + versionId: selectedVersion?.versionId || "", }); } else { handleRemoveEventFromProduct(); diff --git a/app/src/modules/simulation/simulator/SimulationHandler.tsx b/app/src/modules/simulation/simulator/SimulationHandler.tsx index 08fbfe4..b904b41 100644 --- a/app/src/modules/simulation/simulator/SimulationHandler.tsx +++ b/app/src/modules/simulation/simulator/SimulationHandler.tsx @@ -6,9 +6,10 @@ import { usePlayButtonStore } from "../../../store/usePlayButtonStore"; import { useSimulationManager } from "../../../store/rough/useSimulationManagerStore"; import { useParams } from "react-router-dom"; import { useVersionContext } from "../../builder/version/versionContext"; -import { getSimulationData, saveSimulationData } from "../../../components/layout/scenes/functions/simulationStorage"; +import { updateSimulateData, saveSimulationData, getSimulationData } from "../../../components/layout/scenes/functions/simulationStorage"; import { get } from "http"; import { set } from "immer/dist/internal"; +import { useSimulateId } from "../../../store/builder/store"; interface SimulationUsageRecord { activeTime: number; isActive: boolean; @@ -53,6 +54,7 @@ const SimulationHandler = () => { const { selectedVersionStore } = useVersionContext(); const { selectedVersion } = selectedVersionStore(); const [simulationEntry, setSimulationEntry] = useState(); + const { setSimulateId } = useSimulateId(); const COST_RATES: Record = { roboticArm: 5, vehicle: 2, @@ -121,36 +123,55 @@ const SimulationHandler = () => { return { ...m, efficiencyScore }; }); } - useEffect(() => { - const runSimulation = async () => { - console.log("simulationRecords: ", simulationRecords); - if (!projectId || !selectedVersion || !selectedProduct.productUuid || simulationRecords.length === 0) return; - const project = simulationRecords[0]; + // useEffect(() => { + // const runSimulation = async () => { + // console.log("simulationRecords: ", simulationRecords); + // if (!projectId || !selectedVersion || !selectedProduct.productUuid || simulationRecords.length === 0) return; - if (project) { - // const scores = calculateEfficiencyScores(project.versions); - // console.log("Version Comparisons:", scores); - } - console.log("simulationEntry: ", simulationEntry); - console.log("simulationEntrysaddasd: ", useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData); + // const project = simulationRecords[0]; - const data = { - projectId: projectId, - versionId: selectedVersion.versionId, - productUuid: selectedProduct.productUuid, - simulateData: useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData, - }; + // if (project) { + // // const scores = calculateEfficiencyScores(project.versions); + // // console.log("Version Comparisons:", scores); + // } + // console.log("simulationEntry: ", simulationEntry); + // console.log("simulationEntrysaddasd: ", useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData); - const simulations = await saveSimulationData(data); - if (simulations.message === "SimulatedData created Successfully") { - setSimulationEntry(simulations.data); - } - console.log("Saved simulations:", simulations); - }; + // const data = { + // projectId: projectId, + // versionId: selectedVersion.versionId, + // productUuid: selectedProduct.productUuid, + // simulateData: useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData, + // }; - runSimulation(); - }, [simulationRecords, projectId, selectedVersion, selectedProduct, simulationEntry]); + // const simulations = await saveSimulationData(data); + // console.log("simulations: ", simulations); + // const simulateId = localStorage.getItem("simulateId"); + // console.log("simulateId: ", simulateId); + // if (simulations.message === "SimulatedData created Successfully") { + // console.log("simulations.data: ", simulations.data); + // setSimulationEntry(simulations.data); + // localStorage.setItem("simulateId", simulations.data); + // setSimulateId(simulations.data); + // } + + // // else { + // // console.log("djh"); + // // const data = { + // // projectId: projectId, + // // versionId: selectedVersion.versionId, + // // productUuid: selectedProduct.productUuid, + // // simulateId: simulateId, + // // simulateData: useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData, + // // }; + // // const update = await updateSimulateData(data); + // // console.log("update: ", update); + // // } + // }; + + // runSimulation(); + // }, [simulationRecords, projectId, selectedVersion, selectedProduct]); // useEffect(() => { // console.log('simulationRecords: ', simulationRecords); @@ -173,21 +194,6 @@ const SimulationHandler = () => { // // }); // }, [simulationRecords]); - useEffect(() => { - const fetchSimulationData = async () => { - if (!projectId || !selectedVersion || !selectedProduct.productUuid) return; - const data = { - projectId: projectId, - versionId: selectedVersion.versionId, - productUuid: selectedProduct.productUuid, - simulatedId: simulationEntry, - }; - const datas = await getSimulationData(data); - console.log("datas: ", datas); - }; - fetchSimulationData(); - }, []); - useEffect(() => { let checkTimer: ReturnType; if (!projectId) return; diff --git a/app/src/modules/simulation/simulator/simulator.tsx b/app/src/modules/simulation/simulator/simulator.tsx index ddfd5b6..71acc90 100644 --- a/app/src/modules/simulation/simulator/simulator.tsx +++ b/app/src/modules/simulation/simulator/simulator.tsx @@ -1,10 +1,16 @@ -import { useEffect } from 'react'; -import { useActionHandler } from '../actions/useActionHandler'; -import { usePlayButtonStore, useResetButtonStore } from '../../../store/usePlayButtonStore'; -import { determineExecutionOrder } from './functions/determineExecutionOrder'; -import { useProductContext } from '../products/productContext'; -import { useSceneContext } from '../../scene/sceneContext'; -import SimulationHandler from './SimulationHandler'; +import { useEffect } from "react"; +import { useActionHandler } from "../actions/useActionHandler"; +import { usePlayButtonStore, useResetButtonStore } from "../../../store/usePlayButtonStore"; +import { determineExecutionOrder } from "./functions/determineExecutionOrder"; +import { useProductContext } from "../products/productContext"; +import { useSceneContext } from "../../scene/sceneContext"; +import SimulationHandler from "./SimulationHandler"; +import { getSimulationData, saveSimulationData } from "../../../components/layout/scenes/functions/simulationStorage"; +import { useParams } from "react-router-dom"; +import { useVersionContext } from "../../builder/version/versionContext"; +import { version } from "os"; +import { get } from "http"; +import { useSimulationManager } from "../../../store/rough/useSimulationManagerStore"; function Simulator() { const { selectedProductStore } = useProductContext(); @@ -14,6 +20,9 @@ function Simulator() { const { selectedProduct } = selectedProductStore(); const { isPlaying } = usePlayButtonStore(); const { isReset } = useResetButtonStore(); + const { projectId } = useParams(); + const { selectedVersionStore } = useVersionContext(); + const { selectedVersion } = selectedVersionStore(); useEffect(() => { if (!isPlaying || isReset || !selectedProduct.productUuid) return; @@ -23,22 +32,41 @@ function Simulator() { const executionOrder = determineExecutionOrder([product]); - executionOrder.forEach(action => { + executionOrder.forEach((action) => { handleAction(action); }); }, [products, isPlaying, isReset, selectedProduct]); - - + useEffect(() => { + if (!projectId || !selectedVersion || !selectedProduct?.productUuid) return; + const fetchSimulateData = async () => { + const getData = await getSimulationData(projectId, selectedVersion.versionId, selectedProduct?.productUuid); + const product = getProductById(selectedProduct.productUuid); + if (!product) return; + const products: productsSchema = [product]; + const getSimulate = getData?.data; + if (getData && getSimulate && getSimulate.productTimestamp === products[0]?.timestamp) { + return; + } else { + //call create API + const data = { + projectId: projectId, + versionId: selectedVersion.versionId, + productUuid: selectedProduct.productUuid, + simulateData: useSimulationManager.getState().getProductById(projectId, selectedVersion?.versionId, selectedProduct.productUuid)?.simulateData, + }; + const simulations = await saveSimulationData(data); + console.log("simulations: ", simulations); + echo.log("Simulation data saved successfully"); + } + }; + fetchSimulateData(); + }, []); return ( - <> - {/* */} - - ); } -export default Simulator; \ No newline at end of file +export default Simulator; diff --git a/app/src/store/builder/store.ts b/app/src/store/builder/store.ts index c7bf1a4..9064c6f 100644 --- a/app/src/store/builder/store.ts +++ b/app/src/store/builder/store.ts @@ -542,3 +542,7 @@ export const comparsionMaterialData = create((set: any) => ({ materialData: [], setMaterialData: (x: any) => set({ materialData: x }), })); +export const useSimulateId = create((set: any) => ({ + simulateId: "", + setSimulateId: (x: any) => set({ simulateId: x }), +})); diff --git a/app/src/types/simulationTypes.d.ts b/app/src/types/simulationTypes.d.ts index 93d0373..22293aa 100644 --- a/app/src/types/simulationTypes.d.ts +++ b/app/src/types/simulationTypes.d.ts @@ -14,13 +14,12 @@ interface TriggerSchema { triggerType: "onComplete" | "onStart" | "onStop" | "delay" | "onError"; delay: number; triggeredAsset: { - triggeredModel: { modelName: string, modelUuid: string }; - triggeredPoint: { pointName: string, pointUuid: string } | null; - triggeredAction: { actionName: string, actionUuid: string } | null; + triggeredModel: { modelName: string; modelUuid: string }; + triggeredPoint: { pointName: string; pointUuid: string } | null; + triggeredAction: { actionName: string; actionUuid: string } | null; } | null; } - // Actions interface ConveyorAction { @@ -41,8 +40,8 @@ interface VehicleAction { unLoadDuration: number; loadCapacity: number; steeringAngle: number; - pickUpPoint: { position: { x: number; y: number, z: number }, rotation: { x: number; y: number, z: number } } | null; - unLoadPoint: { position: { x: number; y: number, z: number }, rotation: { x: number; y: number, z: number } } | null; + pickUpPoint: { position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number } } | null; + unLoadPoint: { position: { x: number; y: number; z: number }; rotation: { x: number; y: number; z: number } } | null; paths: { initPickup: { pointId: string; @@ -50,22 +49,22 @@ interface VehicleAction { isCurved: boolean; handleA: [number, number, number] | null; handleB: [number, number, number] | null; - }[], + }[]; pickupDrop: { pointId: string; position: [number, number, number]; isCurved: boolean; handleA: [number, number, number] | null; handleB: [number, number, number] | null; - }[], + }[]; dropPickup: { pointId: string; position: [number, number, number]; isCurved: boolean; handleA: [number, number, number] | null; handleB: [number, number, number] | null; - }[], - } + }[]; + }; triggers: TriggerSchema[]; } @@ -73,7 +72,7 @@ interface RoboticArmAction { actionUuid: string; actionName: string; actionType: "pickAndPlace"; - process: { startPoint: [number, number, number] | null; endPoint: [number, number, number] | null; }; + process: { startPoint: [number, number, number] | null; endPoint: [number, number, number] | null }; triggers: TriggerSchema[]; } @@ -99,10 +98,10 @@ interface HumanAction { actionType: "worker" | "manufacturer" | "operator" | "assembler"; processTime: number; swapMaterial?: string; - manufacturePoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null; } - assemblyPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null; } - pickUpPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null; } - dropPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null; } + manufacturePoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null }; + assemblyPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null }; + pickUpPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null }; + dropPoint?: { position: [number, number, number] | null; rotation: [number, number, number] | null }; assemblyCount: number; assemblyCondition: { conditionType: "material"; @@ -111,7 +110,7 @@ interface HumanAction { sourceUuid: string; sourceActionUuid: string; }[]; - } + }; loadCount: number; manufactureCount: number; loadCapacity: number; @@ -128,7 +127,6 @@ interface CraneAction { type Action = ConveyorAction | VehicleAction | RoboticArmAction | MachineAction | StorageAction | HumanAction | CraneAction; - // Points interface ConveyorPointSchema { @@ -180,8 +178,7 @@ interface CranePointSchema { actions: CraneAction[]; } -type PointsScheme = | ConveyorPointSchema | VehiclePointSchema | RoboticArmPointSchema | MachinePointSchema | StoragePointSchema | HumanPointSchema | CranePointSchema; - +type PointsScheme = ConveyorPointSchema | VehiclePointSchema | RoboticArmPointSchema | MachinePointSchema | StoragePointSchema | HumanPointSchema | CranePointSchema; // Events @@ -194,7 +191,7 @@ interface ConveyorEventSchema extends AssetEventSchema { interface VehicleEventSchema extends AssetEventSchema { type: "vehicle"; - subType: "manual" | "automatic" | "semiAutomatic" | ''; + subType: "manual" | "automatic" | "semiAutomatic" | ""; speed: number; point: VehiclePointSchema; } @@ -230,12 +227,11 @@ interface HumanEventSchema extends AssetEventSchema { interface CraneEventSchema extends AssetEventSchema { type: "crane"; - subType: "pillarJib" | ''; + subType: "pillarJib" | ""; point: CranePointSchema; } -type EventsSchema = | ConveyorEventSchema | VehicleEventSchema | RoboticArmEventSchema | MachineEventSchema | StorageEventSchema | HumanEventSchema | CraneEventSchema; - +type EventsSchema = ConveyorEventSchema | VehicleEventSchema | RoboticArmEventSchema | MachineEventSchema | StorageEventSchema | HumanEventSchema | CraneEventSchema; // Statuses @@ -281,7 +277,7 @@ interface VehicleStatus extends VehicleEventSchema { idleTime: number; activeTime: number; currentLoad: number; - currentMaterials: { materialType: string; materialId: string; }[]; + currentMaterials: { materialType: string; materialId: string }[]; distanceTraveled: number; } @@ -291,7 +287,7 @@ interface StorageUnitStatus extends StorageEventSchema { idleTime: number; activeTime: number; currentLoad: number; - currentMaterials: { materialType: string; materialId: string; }[]; + currentMaterials: { materialType: string; materialId: string }[]; } interface HumanStatus extends HumanEventSchema { @@ -302,7 +298,7 @@ interface HumanStatus extends HumanEventSchema { idleTime: number; activeTime: number; currentLoad: number; - currentMaterials: { materialType: string; materialId: string; }[]; + currentMaterials: { materialType: string; materialId: string }[]; distanceTraveled: number; currentAction?: { actionUuid: string; @@ -319,7 +315,7 @@ interface CraneStatus extends CraneEventSchema { idleTime: number; activeTime: number; currentLoad: number; - currentMaterials: { materialType: string; materialId: string; }[]; + currentMaterials: { materialType: string; materialId: string }[]; currentAction?: { actionUuid: string; actionName: string; @@ -328,13 +324,12 @@ interface CraneStatus extends CraneEventSchema { }; } - // Event Manager type HumanEventState = { humanId: string; actionQueue: { - actionType: 'worker' | 'manufacturer' | 'operator'; + actionType: "worker" | "manufacturer" | "operator"; actionUuid: string; actionName: string; maxLoadCount: number; @@ -368,7 +363,6 @@ type CraneEventManagerState = { craneStates: CraneEventState[]; }; - // Materials interface MaterialSchema { @@ -404,16 +398,15 @@ interface MaterialSchema { type MaterialsSchema = MaterialSchema[]; - // Products type productsSchema = { productName: string; productUuid: string; eventDatas: EventsSchema[]; + timestamp?: string; }[]; - // Material History interface MaterialHistoryEntry { @@ -423,7 +416,6 @@ interface MaterialHistoryEntry { type MaterialHistorySchema = MaterialHistoryEntry[]; - // IK Constraints type Link = { @@ -447,33 +439,32 @@ type IK = { // Conveyor Spline Points type NormalConveyor = { - type: 'normal'; + type: "normal"; points: [number, number, number][][]; -} +}; type YJunctionConveyor = { - type: 'y-junction'; + type: "y-junction"; points: [number, number, number][][]; -} +}; type CurvedConveyor = { - type: 'curved'; + type: "curved"; points: [number, number, number][][]; -} +}; type ConveyorPoints = NormalConveyor | YJunctionConveyor | CurvedConveyor; - // Crane Constraints type PillarJibCrane = { trolleySpeed: number; hookSpeed: number; rotationSpeed: number; - trolleyMinOffset: number + trolleyMinOffset: number; trolleyMaxOffset: number; hookMinOffset: number; hookMaxOffset: number; -} +}; -type CraneConstraints = PillarJibCrane; \ No newline at end of file +type CraneConstraints = PillarJibCrane;