mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 03:54:17 +02:00
Material number as a first-class spool field (#2994)
This commit is contained in:
@@ -3658,6 +3658,9 @@ export interface InventorySpool {
|
||||
// User-defined category + per-spool low-stock threshold override (#729).
|
||||
category: string | null;
|
||||
low_stock_threshold_pct: number | null;
|
||||
// Internal material / article number (#2870) — the purchasing identifier
|
||||
// shared by all spools of the same product.
|
||||
material_number: string | null;
|
||||
k_profiles?: SpoolKProfile[];
|
||||
storage_location?: string | null;
|
||||
location_id?: number | null;
|
||||
@@ -3718,6 +3721,15 @@ export interface SupplierStats {
|
||||
cost: number;
|
||||
}
|
||||
|
||||
/** Per-material-number inventory aggregate (#2870). */
|
||||
export interface MaterialNumberStats {
|
||||
material_number: string;
|
||||
spool_count: number;
|
||||
remaining_g: number;
|
||||
consumed_g: number;
|
||||
cost: number;
|
||||
}
|
||||
|
||||
export interface SpoolmanBulkCreateResult {
|
||||
created: InventorySpool[];
|
||||
requested_count: number;
|
||||
@@ -6798,6 +6810,15 @@ export const api = {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
// Per-material-number inventory aggregate (#2870). The date range narrows
|
||||
// the usage half only — stock is point-in-time.
|
||||
getMaterialNumberStats: (options?: { dateFrom?: string; dateTo?: string }) => {
|
||||
const params = new URLSearchParams();
|
||||
if (options?.dateFrom) params.set('date_from', options.dateFrom);
|
||||
if (options?.dateTo) params.set('date_to', options.dateTo);
|
||||
const qs = params.toString();
|
||||
return request<MaterialNumberStats[]>(`/inventory/stats/material-numbers${qs ? `?${qs}` : ''}`);
|
||||
},
|
||||
getSpoolUsageHistory: (spoolId: number, limit = 50) =>
|
||||
request<SpoolUsageRecord[]>(`/inventory/spools/${spoolId}/usage?limit=${limit}`),
|
||||
getAllUsageHistory: (limit = 100, printerId?: number) =>
|
||||
|
||||
Reference in New Issue
Block a user