v2-ui #83
|
@ -549,7 +549,7 @@ const ZoneGroup: React.FC = () => {
|
||||||
const midpoint = new THREE.Vector3(
|
const midpoint = new THREE.Vector3(
|
||||||
(point1.x + point2.x) / 2,
|
(point1.x + point2.x) / 2,
|
||||||
CONSTANTS.zoneConfig.height / 2 +
|
CONSTANTS.zoneConfig.height / 2 +
|
||||||
(zone.layer - 1) * CONSTANTS.zoneConfig.height,
|
(zone.layer - 1) * CONSTANTS.zoneConfig.height,
|
||||||
(point1.z + point2.z) / 2
|
(point1.z + point2.z) / 2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ export function useTravelHandler() {
|
||||||
if (!modelUuid) return;
|
if (!modelUuid) return;
|
||||||
|
|
||||||
incrementVehicleLoad(modelUuid, 1);
|
incrementVehicleLoad(modelUuid, 1);
|
||||||
console.log('material: ', material);
|
|
||||||
addCurrentMaterial(modelUuid, material.materialType, material.materialId);
|
addCurrentMaterial(modelUuid, material.materialType, material.materialId);
|
||||||
|
|
||||||
travelLogStatus(material.materialId, `is triggering travel from ${modelUuid}`);
|
travelLogStatus(material.materialId, `is triggering travel from ${modelUuid}`);
|
||||||
|
|
|
@ -85,37 +85,10 @@ function MaterialInstance({ material }: { material: MaterialSchema }) {
|
||||||
|
|
||||||
const callTrigger = () => {
|
const callTrigger = () => {
|
||||||
if (!material.next) return;
|
if (!material.next) return;
|
||||||
const fromModel = getEventByModelUuid(selectedProduct.productId, material.next.modelUuid);
|
const action = getActionByPointUuid(selectedProduct.productId, material.next.pointUuid);
|
||||||
if (!fromModel) return;
|
if (action) {
|
||||||
const fromPoint = getPointByUuid(selectedProduct.productId, fromModel.modelUuid, material.next.pointUuid);
|
triggerPointActions(action, material.materialId);
|
||||||
if (!fromPoint) return;
|
|
||||||
|
|
||||||
if (fromModel.type === 'transfer') {
|
|
||||||
const toModel = getEventByModelUuid(selectedProduct.productId, material.next.modelUuid);
|
|
||||||
if (!toModel) return;
|
|
||||||
if (toModel.type === 'transfer') {
|
|
||||||
const action = getActionByPointUuid(selectedProduct.productId, material.next.pointUuid);
|
|
||||||
if (action) {
|
|
||||||
triggerPointActions(action, material.materialId);
|
|
||||||
}
|
|
||||||
} else if (toModel?.type === 'vehicle') {
|
|
||||||
// Transfer to Vehicle
|
|
||||||
|
|
||||||
} else if (toModel?.type === 'machine') {
|
|
||||||
// Transfer to Machine
|
|
||||||
|
|
||||||
} else if (toModel?.type === 'roboticArm') {
|
|
||||||
// Transfer to Robotic Arm
|
|
||||||
|
|
||||||
} else if (toModel?.type === 'storageUnit') {
|
|
||||||
// Transfer to Storage Unit
|
|
||||||
}
|
|
||||||
} else if (fromModel.type === 'vehicle') {
|
|
||||||
} else if (fromModel.type === 'machine') {
|
|
||||||
} else if (fromModel.type === 'roboticArm') {
|
|
||||||
} else if (fromModel.type === 'storageUnit') {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -199,6 +199,41 @@ export function useTriggerHandler() {
|
||||||
|
|
||||||
} else if (toEvent?.type === 'vehicle') {
|
} else if (toEvent?.type === 'vehicle') {
|
||||||
// Robotic Arm to Vehicle
|
// Robotic Arm to Vehicle
|
||||||
|
if (trigger.triggeredAsset && trigger.triggeredAsset.triggeredPoint && trigger.triggeredAsset.triggeredAction) {
|
||||||
|
const material = getMaterialById(materialId);
|
||||||
|
if (material) {
|
||||||
|
const action = getActionByUuid(selectedProduct.productId, trigger.triggeredAsset.triggeredAction.actionUuid);
|
||||||
|
const vehicle = getVehicleById(trigger.triggeredAsset?.triggeredModel.modelUuid);
|
||||||
|
|
||||||
|
setCurrentLocation(material.materialId, {
|
||||||
|
modelUuid: trigger.triggeredAsset.triggeredModel.modelUuid,
|
||||||
|
pointUuid: trigger.triggeredAsset.triggeredPoint.pointUuid,
|
||||||
|
actionUuid: trigger.triggeredAsset?.triggeredAction?.actionUuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
setNextLocation(material.materialId, null);
|
||||||
|
|
||||||
|
if (action) {
|
||||||
|
|
||||||
|
if (vehicle) {
|
||||||
|
|
||||||
|
if (vehicle.isActive === false && vehicle.state === 'idle' && vehicle.currentLoad < vehicle.point.action.loadCapacity) {
|
||||||
|
|
||||||
|
setIsVisible(materialId, false);
|
||||||
|
|
||||||
|
// Handle current action from vehicle
|
||||||
|
handleAction(action, materialId);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Event Manager Needed
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if (toEvent?.type === 'machine') {
|
} else if (toEvent?.type === 'machine') {
|
||||||
// Robotic Arm to Machine
|
// Robotic Arm to Machine
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default function ZoneAssets() {
|
||||||
const { zoneAssetId, setZoneAssetId } = useZoneAssetId();
|
const { zoneAssetId, setZoneAssetId } = useZoneAssetId();
|
||||||
const { setSelectedFloorItem } = useSelectedFloorItem();
|
const { setSelectedFloorItem } = useSelectedFloorItem();
|
||||||
const { raycaster, controls, scene }: any = useThree();
|
const { raycaster, controls, scene }: any = useThree();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('zoneAssetId: ', zoneAssetId);
|
// console.log('zoneAssetId: ', zoneAssetId);
|
||||||
if (!zoneAssetId) return
|
if (!zoneAssetId) return
|
||||||
|
@ -70,8 +71,6 @@ export default function ZoneAssets() {
|
||||||
}
|
}
|
||||||
}, [zoneAssetId, scene, controls])
|
}, [zoneAssetId, scene, controls])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -13,8 +13,6 @@ export default function ZoneCentreTarget() {
|
||||||
const { zoneTarget, setZoneTarget } = usezoneTarget();
|
const { zoneTarget, setZoneTarget } = usezoneTarget();
|
||||||
const { Edit, setEdit } = useEditPosition();
|
const { Edit, setEdit } = useEditPosition();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
selectedZone.zoneViewPortTarget &&
|
selectedZone.zoneViewPortTarget &&
|
||||||
|
|
Loading…
Reference in New Issue