removed the human bug, i dont know if there are any new bugs though.
This commit is contained in:
@@ -22,7 +22,7 @@ export function useTriggerHandler() {
|
||||
const { addMachineToMonitor } = useMachineEventManager();
|
||||
const { addHumanToMonitor } = useHumanEventManager();
|
||||
const { getVehicleById } = vehicleStore();
|
||||
const { getHumanById } = humanStore();
|
||||
const { getHumanById, setHumanScheduled } = humanStore();
|
||||
const { getMachineById } = machineStore();
|
||||
const { getStorageUnitById } = storageUnitStore();
|
||||
const { getMaterialById, setCurrentLocation, setNextLocation, setPreviousLocation, setIsPaused, setIsVisible, setEndTime } = materialStore();
|
||||
@@ -334,12 +334,14 @@ export function useTriggerHandler() {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addVehicleToMonitor(vehicle.modelUuid,
|
||||
() => {
|
||||
@@ -362,12 +364,14 @@ export function useTriggerHandler() {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addVehicleToMonitor(vehicle.modelUuid,
|
||||
() => {
|
||||
@@ -386,24 +390,29 @@ export function useTriggerHandler() {
|
||||
const human = getHumanById(trigger.triggeredAsset?.triggeredModel.modelUuid);
|
||||
if (human) {
|
||||
if (human.isActive === false && human.state === 'idle') {
|
||||
|
||||
if (human && human.modelUuid === "cc62adae-7000-447b-b845-6d4910de503a") {
|
||||
console.log(human);
|
||||
}
|
||||
const conveyor = getConveyorById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid);
|
||||
if (conveyor) {
|
||||
if (!conveyor.isPaused) {
|
||||
// Handle current action from vehicle
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addConveyorToMonitor(conveyor.modelUuid,
|
||||
() => {
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
handleAction(action, materialId);
|
||||
}
|
||||
setIsPaused(materialId, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
)
|
||||
}
|
||||
} else {
|
||||
setIsPaused(materialId, true);
|
||||
addHumanToMonitor(human.modelUuid, () => {
|
||||
const conveyor = getConveyorById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || '');
|
||||
if (conveyor) {
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addConveyorToMonitor(conveyor.modelUuid,
|
||||
() => {
|
||||
@@ -414,35 +423,6 @@ export function useTriggerHandler() {
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setIsPaused(materialId, true);
|
||||
addHumanToMonitor(human.modelUuid, () => {
|
||||
const conveyor = getConveyorById(action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid || '');
|
||||
if (conveyor) {
|
||||
if (!conveyor.isPaused) {
|
||||
// Handle current action from vehicle
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setIsPaused(materialId, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
|
||||
addConveyorToMonitor(conveyor.modelUuid,
|
||||
() => {
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
handleAction(action, materialId);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -457,11 +437,13 @@ export function useTriggerHandler() {
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addMachineToMonitor(machine.modelUuid,
|
||||
() => {
|
||||
@@ -483,11 +465,13 @@ export function useTriggerHandler() {
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addMachineToMonitor(machine.modelUuid,
|
||||
() => {
|
||||
@@ -536,12 +520,14 @@ export function useTriggerHandler() {
|
||||
if (action.actionType === 'worker') {
|
||||
setIsVisible(materialId, false);
|
||||
}
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
addHumanToMonitor(human.modelUuid,
|
||||
() => {
|
||||
if (action.actionType === 'worker') {
|
||||
@@ -711,7 +697,6 @@ export function useTriggerHandler() {
|
||||
|
||||
setNextLocation(material.materialId, null);
|
||||
|
||||
|
||||
if (action && human) {
|
||||
|
||||
if (human.isActive === false && human.state === 'idle') {
|
||||
@@ -719,10 +704,13 @@ export function useTriggerHandler() {
|
||||
// Handle current action from arm bot
|
||||
setIsVisible(materialId, false);
|
||||
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
addHumanToMonitor(human.modelUuid,
|
||||
() => {
|
||||
setIsVisible(materialId, false);
|
||||
@@ -879,8 +867,10 @@ export function useTriggerHandler() {
|
||||
const previousModel = getEventByModelUuid(selectedProduct.productUuid, material.previous?.modelUuid || '');
|
||||
if (previousModel) {
|
||||
if (previousModel.type === 'transfer' && previousModel.modelUuid === model.modelUuid) {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
addConveyorToMonitor(conveyor.modelUuid,
|
||||
() => {
|
||||
handleAction(action, materialId)
|
||||
@@ -888,6 +878,7 @@ export function useTriggerHandler() {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
}
|
||||
// handleAction(action, materialId)
|
||||
@@ -898,12 +889,14 @@ export function useTriggerHandler() {
|
||||
if (vehicle.isActive === false && vehicle.state === 'idle' && vehicle.isPicking && vehicle.currentLoad < vehicle.point.action.loadCapacity) {
|
||||
// Handle current action from vehicle
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addVehicleToMonitor(vehicle.modelUuid,
|
||||
() => {
|
||||
@@ -913,6 +906,7 @@ export function useTriggerHandler() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
}
|
||||
|
||||
@@ -928,8 +922,11 @@ export function useTriggerHandler() {
|
||||
const previousModel = getEventByModelUuid(selectedProduct.productUuid, material.previous?.modelUuid || '');
|
||||
if (previousModel) {
|
||||
if (previousModel.type === 'transfer' && previousModel.modelUuid === model.modelUuid) {
|
||||
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
addConveyorToMonitor(conveyor.modelUuid,
|
||||
() => {
|
||||
handleAction(action, materialId)
|
||||
@@ -937,6 +934,7 @@ export function useTriggerHandler() {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
}
|
||||
}
|
||||
@@ -946,12 +944,14 @@ export function useTriggerHandler() {
|
||||
if (vehicle.isActive === false && vehicle.state === 'idle' && vehicle.isPicking && vehicle.currentLoad < vehicle.point.action.loadCapacity) {
|
||||
// Handle current action from vehicle
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle current action using Event Manager
|
||||
setIsPaused(materialId, true);
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
|
||||
addVehicleToMonitor(vehicle.modelUuid,
|
||||
() => {
|
||||
@@ -961,6 +961,7 @@ export function useTriggerHandler() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId)
|
||||
}
|
||||
}
|
||||
@@ -1259,7 +1260,7 @@ export function useTriggerHandler() {
|
||||
|
||||
if (human) {
|
||||
|
||||
if (human.isActive === false && human.state === 'idle' && human.isPicking && human.currentLoad < human.point.action.loadCapacity) {
|
||||
if (human.isActive === false && human.state === 'idle' && !human.isScheduled && human.currentLoad < human.point.action.loadCapacity) {
|
||||
|
||||
setIsVisible(materialId, false);
|
||||
|
||||
@@ -1276,6 +1277,7 @@ export function useTriggerHandler() {
|
||||
});
|
||||
|
||||
// Handle current action from human
|
||||
setHumanScheduled(human.modelUuid, true);
|
||||
handleAction(action, materialId);
|
||||
|
||||
} else {
|
||||
@@ -1460,14 +1462,60 @@ export function useTriggerHandler() {
|
||||
actionUuid: material.current.actionUuid,
|
||||
});
|
||||
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid,
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid,
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
setIsPaused(material.materialId, true);
|
||||
setIsVisible(material.materialId, true);
|
||||
|
||||
const action = getActionByUuid(selectedProduct.productUuid, trigger.triggeredAsset.triggeredAction.actionUuid);
|
||||
|
||||
if (action && action.triggers.length > 0 &&
|
||||
action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid &&
|
||||
action.triggers[0]?.triggeredAsset?.triggeredAction?.actionUuid &&
|
||||
action.triggers[0]?.triggeredAsset?.triggeredPoint?.pointUuid) {
|
||||
const model = getEventByModelUuid(selectedProduct.productUuid, action.triggers[0]?.triggeredAsset?.triggeredModel.modelUuid);
|
||||
|
||||
if (model?.type === 'roboticArm') {
|
||||
addArmBotToMonitor(model.modelUuid, () => {
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
})
|
||||
} else if (model?.type === 'vehicle') {
|
||||
addVehicleToMonitor(model.modelUuid, () => {
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
})
|
||||
} else if (model?.type === 'transfer') {
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
} else if (model?.type === 'human') {
|
||||
addHumanToMonitor(model.modelUuid, () => {
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
})
|
||||
} else {
|
||||
setNextLocation(material.materialId, {
|
||||
modelUuid: trigger.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
})
|
||||
|
||||
setIsPaused(material.materialId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1510,8 +1558,31 @@ export function useTriggerHandler() {
|
||||
|
||||
} else {
|
||||
|
||||
// Event Manager Needed
|
||||
setIsPaused(materialId, true);
|
||||
|
||||
addVehicleToMonitor(vehicle.modelUuid,
|
||||
() => {
|
||||
setIsPaused(materialId, false);
|
||||
setIsVisible(materialId, false);
|
||||
|
||||
setPreviousLocation(material.materialId, {
|
||||
modelUuid: material.current.modelUuid,
|
||||
pointUuid: material.current.pointUuid,
|
||||
actionUuid: material.current.actionUuid,
|
||||
})
|
||||
|
||||
setCurrentLocation(material.materialId, {
|
||||
modelUuid: trigger?.triggeredAsset?.triggeredModel.modelUuid || '',
|
||||
pointUuid: trigger?.triggeredAsset?.triggeredPoint?.pointUuid || '',
|
||||
actionUuid: trigger.triggeredAsset?.triggeredAction?.actionUuid || '',
|
||||
});
|
||||
|
||||
setNextLocation(material.materialId, null);
|
||||
|
||||
// Handle current action from vehicle
|
||||
handleAction(action, materialId);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user