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