feat: Add state filtering methods for ArmBot, Conveyor, Machine, StorageUnit, and Vehicle stores
This commit is contained in:
parent
7907bbab0a
commit
83ee14e9c7
|
@ -33,6 +33,7 @@ interface ArmBotStore {
|
||||||
|
|
||||||
getArmBotById: (modelUuid: string) => ArmBotStatus | undefined;
|
getArmBotById: (modelUuid: string) => ArmBotStatus | undefined;
|
||||||
getArmBotsByProduct: (productId: string) => ArmBotStatus[];
|
getArmBotsByProduct: (productId: string) => ArmBotStatus[];
|
||||||
|
getArmBotsByState: (state: string) => ArmBotStatus[];
|
||||||
getActiveArmBots: () => ArmBotStatus[];
|
getActiveArmBots: () => ArmBotStatus[];
|
||||||
getIdleArmBots: () => ArmBotStatus[];
|
getIdleArmBots: () => ArmBotStatus[];
|
||||||
getArmBotsByCurrentAction: (actionUuid: string) => ArmBotStatus[];
|
getArmBotsByCurrentAction: (actionUuid: string) => ArmBotStatus[];
|
||||||
|
@ -141,6 +142,10 @@ export const useArmBotStore = create<ArmBotStore>()(
|
||||||
return get().armBots.filter(a => a.productId === productId);
|
return get().armBots.filter(a => a.productId === productId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getArmBotsByState: (state) => {
|
||||||
|
return get().armBots.filter(a => a.state === state);
|
||||||
|
},
|
||||||
|
|
||||||
getActiveArmBots: () => {
|
getActiveArmBots: () => {
|
||||||
return get().armBots.filter(a => a.isActive);
|
return get().armBots.filter(a => a.isActive);
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,6 +26,7 @@ interface ConveyorStore {
|
||||||
|
|
||||||
getConveyorById: (modelUuid: string) => ConveyorStatus | undefined;
|
getConveyorById: (modelUuid: string) => ConveyorStatus | undefined;
|
||||||
getConveyorsByProduct: (productId: string) => ConveyorStatus[];
|
getConveyorsByProduct: (productId: string) => ConveyorStatus[];
|
||||||
|
getConveyorsByState: (state: string) => ConveyorStatus[];
|
||||||
getActiveConveyors: () => ConveyorStatus[];
|
getActiveConveyors: () => ConveyorStatus[];
|
||||||
getIdleConveyors: () => ConveyorStatus[];
|
getIdleConveyors: () => ConveyorStatus[];
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,10 @@ export const useConveyorStore = create<ConveyorStore>()(
|
||||||
return get().conveyors.filter(c => c.productId === productId);
|
return get().conveyors.filter(c => c.productId === productId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getConveyorsByState: (state) => {
|
||||||
|
return get().conveyors.filter(c => c.state === state);
|
||||||
|
},
|
||||||
|
|
||||||
getActiveConveyors: () => {
|
getActiveConveyors: () => {
|
||||||
return get().conveyors.filter(c => c.isActive);
|
return get().conveyors.filter(c => c.isActive);
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,6 +30,7 @@ interface MachineStore {
|
||||||
// Helpers
|
// Helpers
|
||||||
getMachineById: (modelUuid: string) => MachineStatus | undefined;
|
getMachineById: (modelUuid: string) => MachineStatus | undefined;
|
||||||
getMachinesByProduct: (productId: string) => MachineStatus[];
|
getMachinesByProduct: (productId: string) => MachineStatus[];
|
||||||
|
getMachinesBystate: (state: string) => MachineStatus[];
|
||||||
getActiveMachines: () => MachineStatus[];
|
getActiveMachines: () => MachineStatus[];
|
||||||
getIdleMachines: () => MachineStatus[];
|
getIdleMachines: () => MachineStatus[];
|
||||||
}
|
}
|
||||||
|
@ -114,6 +115,10 @@ export const useMachineStore = create<MachineStore>()(
|
||||||
return get().machines.filter(m => m.productId === productId);
|
return get().machines.filter(m => m.productId === productId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getMachinesBystate: (state) => {
|
||||||
|
return get().machines.filter(m => m.state === state);
|
||||||
|
},
|
||||||
|
|
||||||
getActiveMachines: () => {
|
getActiveMachines: () => {
|
||||||
return get().machines.filter(m => m.isActive);
|
return get().machines.filter(m => m.isActive);
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,6 +34,7 @@ interface StorageUnitStore {
|
||||||
// Helpers
|
// Helpers
|
||||||
getStorageUnitById: (modelUuid: string) => StorageUnitStatus | undefined;
|
getStorageUnitById: (modelUuid: string) => StorageUnitStatus | undefined;
|
||||||
getStorageUnitsByProduct: (productId: string) => StorageUnitStatus[];
|
getStorageUnitsByProduct: (productId: string) => StorageUnitStatus[];
|
||||||
|
getStorageUnitsBystate: (state: string) => StorageUnitStatus[];
|
||||||
getActiveStorageUnits: () => StorageUnitStatus[];
|
getActiveStorageUnits: () => StorageUnitStatus[];
|
||||||
getIdleStorageUnits: () => StorageUnitStatus[];
|
getIdleStorageUnits: () => StorageUnitStatus[];
|
||||||
getFullStorageUnits: () => StorageUnitStatus[];
|
getFullStorageUnits: () => StorageUnitStatus[];
|
||||||
|
@ -131,6 +132,10 @@ export const useStorageUnitStore = create<StorageUnitStore>()(
|
||||||
return get().storageUnits.filter(s => s.productId === productId);
|
return get().storageUnits.filter(s => s.productId === productId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getStorageUnitsBystate: (state) => {
|
||||||
|
return get().storageUnits.filter(s => s.state === state);
|
||||||
|
},
|
||||||
|
|
||||||
getActiveStorageUnits: () => {
|
getActiveStorageUnits: () => {
|
||||||
return get().storageUnits.filter(s => s.isActive);
|
return get().storageUnits.filter(s => s.isActive);
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,6 +28,7 @@ interface VehiclesStore {
|
||||||
|
|
||||||
getVehicleById: (modelUuid: string) => VehicleStatus | undefined;
|
getVehicleById: (modelUuid: string) => VehicleStatus | undefined;
|
||||||
getVehiclesByProduct: (productId: string) => VehicleStatus[];
|
getVehiclesByProduct: (productId: string) => VehicleStatus[];
|
||||||
|
getVehiclesByState: (state: string) => VehicleStatus[];
|
||||||
getActiveVehicles: () => VehicleStatus[];
|
getActiveVehicles: () => VehicleStatus[];
|
||||||
getIdleVehicles: () => VehicleStatus[];
|
getIdleVehicles: () => VehicleStatus[];
|
||||||
}
|
}
|
||||||
|
@ -118,6 +119,10 @@ export const useVehicleStore = create<VehiclesStore>()(
|
||||||
return get().vehicles.filter(v => v.productId === productId);
|
return get().vehicles.filter(v => v.productId === productId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getVehiclesByState: (state) => {
|
||||||
|
return get().vehicles.filter(v => v.state === state);
|
||||||
|
},
|
||||||
|
|
||||||
getActiveVehicles: () => {
|
getActiveVehicles: () => {
|
||||||
return get().vehicles.filter(v => v.isActive);
|
return get().vehicles.filter(v => v.isActive);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue