pub struct Lot {Show 20 fields
pub id: Uuid,
pub lot_number: String,
pub sku: String,
pub status: LotStatus,
pub quantity_produced: Decimal,
pub quantity_remaining: Decimal,
pub quantity_reserved: Decimal,
pub quantity_quarantined: Decimal,
pub production_date: DateTime<Utc>,
pub expiration_date: Option<DateTime<Utc>>,
pub best_before_date: Option<DateTime<Utc>>,
pub supplier_lot: Option<String>,
pub supplier_id: Option<Uuid>,
pub work_order_id: Option<Uuid>,
pub purchase_order_id: Option<Uuid>,
pub cost_per_unit: Option<Decimal>,
pub attributes: Value,
pub notes: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
A lot/batch of inventory items
Fields§
§id: Uuid§lot_number: String§sku: String§status: LotStatus§quantity_produced: Decimal§quantity_remaining: Decimal§quantity_reserved: Decimal§quantity_quarantined: Decimal§production_date: DateTime<Utc>§expiration_date: Option<DateTime<Utc>>§best_before_date: Option<DateTime<Utc>>§supplier_lot: Option<String>§supplier_id: Option<Uuid>§work_order_id: Option<Uuid>§purchase_order_id: Option<Uuid>§cost_per_unit: Option<Decimal>§attributes: Value§notes: Option<String>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Lot
impl Lot
Sourcepub fn has_available(&self) -> bool
pub fn has_available(&self) -> bool
Check if lot has available quantity
Sourcepub fn quantity_available(&self) -> Decimal
pub fn quantity_available(&self) -> Decimal
Get available quantity (not reserved or quarantined)
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if lot is expired
Sourcepub fn is_expiring_soon(&self, days: i64) -> bool
pub fn is_expiring_soon(&self, days: i64) -> bool
Check if lot is expiring soon (within days)
Sourcepub fn can_consume(&self, quantity: Decimal) -> bool
pub fn can_consume(&self, quantity: Decimal) -> bool
Check if lot can be consumed
Sourcepub fn can_reserve(&self, quantity: Decimal) -> bool
pub fn can_reserve(&self, quantity: Decimal) -> bool
Check if lot can be reserved
Sourcepub fn days_until_expiration(&self) -> Option<i64>
pub fn days_until_expiration(&self) -> Option<i64>
Get days until expiration
Sourcepub fn shelf_life_remaining(&self) -> Option<Decimal>
pub fn shelf_life_remaining(&self) -> Option<Decimal>
Get shelf life percentage remaining
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Lot
impl<'de> Deserialize<'de> for Lot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Lot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Lot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Lot
Source§impl Serialize for Lot
impl Serialize for Lot
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Lot
Auto Trait Implementations§
impl Freeze for Lot
impl RefUnwindSafe for Lot
impl Send for Lot
impl Sync for Lot
impl Unpin for Lot
impl UnsafeUnpin for Lot
impl UnwindSafe for Lot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more