add backend api and socket for conveyor events

This commit is contained in:
Jerald-Golden-B 2025-04-01 18:52:21 +05:30
parent 526befad20
commit 2043712f5d
8 changed files with 15 additions and 47 deletions

View File

@ -7,8 +7,11 @@ REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000
# Base URL for the server REST API, used for HTTP requests to the backend server. # Base URL for the server REST API, used for HTTP requests to the backend server.
REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000 REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000
# REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 # Base URL for the server marketplace, used for market place model blob.
REACT_APP_SERVER_MARKETPLACE_URL=192.168.0.111:3501 REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011
# Base URL for the asset library server, used for asset library images and model blob id.
REACT_APP_SERVER_ASSET_LIBRARY_URL=192.168.0.111:3501
# base url for IoT socket server # base url for IoT socket server
REACT_APP_IOT_SOCKET_SERVER_URL =185.100.212.76:5010 REACT_APP_IOT_SOCKET_SERVER_URL =185.100.212.76:5010

View File

@ -118,7 +118,7 @@ const Data = () => {
}; };
}); });
}; };
console.log("selectedChartId", selectedChartId); // console.log("selectedChartId", selectedChartId);
return ( return (
<div className="dataSideBar"> <div className="dataSideBar">

View File

@ -148,7 +148,6 @@ async function handleModelLoad(
const organization = email ? email.split("@")[1].split(".")[0] : ""; const organization = email ? email.split("@")[1].split(".")[0] : "";
getAssetEventType(selectedItem.id, organization).then(async (res) => { getAssetEventType(selectedItem.id, organization).then(async (res) => {
console.log('res: ', res);
if (res.type === "Conveyor") { if (res.type === "Conveyor") {
const pointUUIDs = res.points.map(() => THREE.MathUtils.generateUUID()); const pointUUIDs = res.points.map(() => THREE.MathUtils.generateUUID());

View File

@ -306,8 +306,7 @@ const FloorItemsGroup = ({ itemsGroup, hoveredDeletableFloorItem, AttachedObject
}, [deleteModels, transformMode, controls, selectedItem, state.camera, state.pointer, activeTool, activeModule]); }, [deleteModels, transformMode, controls, selectedItem, state.camera, state.pointer, activeTool, activeModule]);
useEffect(() => { useEffect(() => {
// console.log('floorItems: ', floorItems);
console.log('floorItems: ', floorItems);
}, [floorItems]) }, [floorItems])
useFrame(() => { useFrame(() => {

View File

@ -19,7 +19,6 @@ async function loadInitialFloorItems(
const organization = (email!.split("@")[1]).split(".")[0]; const organization = (email!.split("@")[1]).split(".")[0];
const items = await getFloorAssets(organization); const items = await getFloorAssets(organization);
console.log('items: ', items);
localStorage.setItem("FloorItems", JSON.stringify(items)); localStorage.setItem("FloorItems", JSON.stringify(items));
await initializeDB(); await initializeDB();
@ -133,7 +132,7 @@ async function loadInitialFloorItems(
modelfileID: item.modelfileID, modelfileID: item.modelfileID,
isLocked: item.isLocked, isLocked: item.isLocked,
isVisible: item.isVisible, isVisible: item.isVisible,
eventData: item.eventData, // eventData: item.eventData,
}, },
]); ]);
} else { } else {
@ -198,7 +197,7 @@ function processLoadedModel(
modelfileID: item.modelfileID, modelfileID: item.modelfileID,
isLocked: item.isLocked, isLocked: item.isLocked,
isVisible: item.isVisible, isVisible: item.isVisible,
eventData: item.eventData, // eventData: item.eventData,
}, },
]); ]);
} else { } else {

View File

@ -11,48 +11,16 @@ function Behaviour() {
const newPaths: (Types.ConveyorEventsSchema | Types.VehicleEventsSchema)[] = []; const newPaths: (Types.ConveyorEventsSchema | Types.VehicleEventsSchema)[] = [];
floorItems.forEach((item: Types.FloorItemType) => { floorItems.forEach((item: Types.FloorItemType) => {
if (item.modelfileID === "672a090f80d91ac979f4d0bd") { // console.log('item: ', item);
const point1Position = new THREE.Vector3(0, 0.85, 2.2); if (item.eventData && item.eventData.type === 'Conveyor') {
const middlePointPosition = new THREE.Vector3(0, 0.85, 0);
const point2Position = new THREE.Vector3(0, 0.85, -2.2);
const point1UUID = THREE.MathUtils.generateUUID();
const middlePointUUID = THREE.MathUtils.generateUUID();
const point2UUID = THREE.MathUtils.generateUUID();
const newPath: Types.ConveyorEventsSchema = { const newPath: Types.ConveyorEventsSchema = {
modeluuid: item.modeluuid, modeluuid: item.modeluuid,
modelName: item.modelname, modelName: item.modelname,
type: 'Conveyor', type: 'Conveyor',
points: [ points: item.eventData.points,
{
uuid: point1UUID,
position: [point1Position.x, point1Position.y, point1Position.z],
rotation: [0, 0, 0],
actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }],
triggers: [],
connections: { source: { pathUUID: item.modeluuid, pointUUID: point1UUID }, targets: [] },
},
{
uuid: middlePointUUID,
position: [middlePointPosition.x, middlePointPosition.y, middlePointPosition.z],
rotation: [0, 0, 0],
actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }],
triggers: [],
connections: { source: { pathUUID: item.modeluuid, pointUUID: middlePointUUID }, targets: [] },
},
{
uuid: point2UUID,
position: [point2Position.x, point2Position.y, point2Position.z],
rotation: [0, 0, 0],
actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }],
triggers: [],
connections: { source: { pathUUID: item.modeluuid, pointUUID: point2UUID }, targets: [] },
},
],
position: [...item.position], position: [...item.position],
rotation: [item.rotation.x, item.rotation.y, item.rotation.z], rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
speed: 'Inherit', speed: item.eventData.speed,
}; };
newPaths.push(newPath); newPaths.push(newPath);
@ -80,7 +48,6 @@ function Behaviour() {
setSimulationPaths(newPaths); setSimulationPaths(newPaths);
}, [floorItems]); }, [floorItems]);
return null; return null;
} }

View File

@ -13,6 +13,7 @@ function Simulation() {
const [processes, setProcesses] = useState([]); const [processes, setProcesses] = useState([]);
useEffect(() => { useEffect(() => {
// console.log('simulationPaths: ', simulationPaths);
}, [simulationPaths]); }, [simulationPaths]);
// useEffect(() => { // useEffect(() => {

View File

@ -1,4 +1,4 @@
let BackEnd_url = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`; let BackEnd_url = `http://${process.env.REACT_APP_SERVER_ASSET_LIBRARY_URL}`;
export const getCategoryAsset = async (categoryName: any) => { export const getCategoryAsset = async (categoryName: any) => {
try { try {
const response = await fetch( const response = await fetch(