feat(frontend): Lagerverwaltung-Ansicht (Modul 12)
/storage mit Lagerbehälter- und Lagerartikelverwaltung inkl. Bestandsbewegungen (Zugang/Abgang/Umlagerung/Korrektur).
This commit is contained in:
1 parent
15b6ea4edb
commit
7ec20199d3
8 files changed
+559
-1
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { apiFetch } from "@/lib/auth/api-client";
|
||||
import {
|
||||
CreateStockItemInput,
|
||||
CreateStockMovementInput,
|
||||
CreateStorageContainerInput,
|
||||
StockItem,
|
||||
StorageContainer,
|
||||
} from "./types";
|
||||
|
||||
export function fetchStorageContainers(): Promise<StorageContainer[]> {
|
||||
return apiFetch<StorageContainer[]>("/storage-containers");
|
||||
}
|
||||
|
||||
export function createStorageContainer(
|
||||
input: CreateStorageContainerInput,
|
||||
): Promise<StorageContainer> {
|
||||
return apiFetch<StorageContainer>("/storage-containers", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchStockItems(): Promise<StockItem[]> {
|
||||
return apiFetch<StockItem[]>("/stock-items");
|
||||
}
|
||||
|
||||
export function createStockItem(input: CreateStockItemInput): Promise<StockItem> {
|
||||
return apiFetch<StockItem>("/stock-items", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function addStockMovement(
|
||||
id: string,
|
||||
input: CreateStockMovementInput,
|
||||
): Promise<StockItem> {
|
||||
return apiFetch<StockItem>(`/stock-items/${id}/movements`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
export type StockCategory = "HONEY" | "CONSUMABLE" | "EQUIPMENT_MATERIAL";
|
||||
export type StockMovementType = "IN" | "OUT" | "TRANSFER" | "ADJUSTMENT";
|
||||
export type StorageContainerStatus = "EMPTY" | "FILLED" | "CLEANING" | "OUT_OF_SERVICE";
|
||||
|
||||
export interface StorageContainer {
|
||||
id: string;
|
||||
code: string;
|
||||
containerType: string | null;
|
||||
capacity: number | null;
|
||||
currentAmount: number | null;
|
||||
location: string | null;
|
||||
status: StorageContainerStatus;
|
||||
}
|
||||
|
||||
export interface StockMovement {
|
||||
id: string;
|
||||
stockItemId: string;
|
||||
type: StockMovementType;
|
||||
quantity: number;
|
||||
date: string;
|
||||
relatedType: string | null;
|
||||
relatedId: string | null;
|
||||
notes: string | null;
|
||||
}
|
||||
|
||||
export interface StockItem {
|
||||
id: string;
|
||||
name: string;
|
||||
category: StockCategory;
|
||||
unit: string;
|
||||
quantity: number;
|
||||
minThreshold: number | null;
|
||||
notes: string | null;
|
||||
movements?: StockMovement[];
|
||||
}
|
||||
|
||||
export interface CreateStorageContainerInput {
|
||||
code: string;
|
||||
containerType?: string;
|
||||
capacity?: number;
|
||||
location?: string;
|
||||
}
|
||||
|
||||
export interface CreateStockItemInput {
|
||||
name: string;
|
||||
category: StockCategory;
|
||||
unit: string;
|
||||
quantity?: number;
|
||||
minThreshold?: number;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export interface CreateStockMovementInput {
|
||||
type: StockMovementType;
|
||||
quantity: number;
|
||||
notes?: string;
|
||||
}
|
||||
Reference in new issue
Block a user