mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 10:29:35 +01:00
feat(inventory): Tui Inventur anlegen, starten, zählen, abschließen
This commit is contained in:
parent
ae95a0284f
commit
85a3f634fd
11 changed files with 804 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ export { createProductionOrdersResource } from './resources/production-orders.js
|
|||
export { createStocksResource } from './resources/stocks.js';
|
||||
export { createStockMovementsResource } from './resources/stock-movements.js';
|
||||
export { createCountriesResource } from './resources/countries.js';
|
||||
export { createInventoryCountsResource } from './resources/inventory-counts.js';
|
||||
export {
|
||||
ApiError,
|
||||
AuthenticationError,
|
||||
|
|
@ -116,6 +117,11 @@ export type {
|
|||
StockMovementDTO,
|
||||
RecordStockMovementRequest,
|
||||
CountryDTO,
|
||||
InventoryCountDTO,
|
||||
CountItemDTO,
|
||||
InventoryCountStatus,
|
||||
CreateInventoryCountRequest,
|
||||
RecordCountItemRequest,
|
||||
} from '@effigenix/types';
|
||||
|
||||
// Resource types (runtime, stay in resource files)
|
||||
|
|
@ -149,6 +155,8 @@ export type { StocksResource, BatchType, StockBatchStatus, StockFilter, Referenc
|
|||
export type { StockMovementsResource, MovementType, MovementDirection, StockMovementFilter } from './resources/stock-movements.js';
|
||||
export { MOVEMENT_TYPE_LABELS, MOVEMENT_DIRECTION_LABELS } from './resources/stock-movements.js';
|
||||
export type { CountriesResource } from './resources/countries.js';
|
||||
export type { InventoryCountsResource, InventoryCountFilter } from './resources/inventory-counts.js';
|
||||
export { INVENTORY_COUNT_STATUS_LABELS } from './resources/inventory-counts.js';
|
||||
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS, REFERENCE_TYPE_LABELS, RESERVATION_PRIORITY_LABELS } from './resources/stocks.js';
|
||||
|
||||
import { createApiClient } from './client.js';
|
||||
|
|
@ -166,6 +174,7 @@ import { createProductionOrdersResource } from './resources/production-orders.js
|
|||
import { createStocksResource } from './resources/stocks.js';
|
||||
import { createStockMovementsResource } from './resources/stock-movements.js';
|
||||
import { createCountriesResource } from './resources/countries.js';
|
||||
import { createInventoryCountsResource } from './resources/inventory-counts.js';
|
||||
import type { TokenProvider } from './token-provider.js';
|
||||
import type { ApiConfig } from '@effigenix/config';
|
||||
|
||||
|
|
@ -194,6 +203,7 @@ export function createEffigenixClient(
|
|||
stocks: createStocksResource(axiosClient),
|
||||
stockMovements: createStockMovementsResource(axiosClient),
|
||||
countries: createCountriesResource(axiosClient),
|
||||
inventoryCounts: createInventoryCountsResource(axiosClient),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
/** Inventory Counts resource – Inventory BC. */
|
||||
|
||||
import type { AxiosInstance } from 'axios';
|
||||
import type {
|
||||
InventoryCountDTO,
|
||||
CreateInventoryCountRequest,
|
||||
RecordCountItemRequest,
|
||||
InventoryCountStatus,
|
||||
} from '@effigenix/types';
|
||||
|
||||
export type { InventoryCountDTO, CreateInventoryCountRequest, RecordCountItemRequest, InventoryCountStatus };
|
||||
|
||||
export const INVENTORY_COUNT_STATUS_LABELS: Record<InventoryCountStatus, string> = {
|
||||
OPEN: 'Offen',
|
||||
COUNTING: 'In Zählung',
|
||||
COMPLETED: 'Abgeschlossen',
|
||||
CANCELLED: 'Abgebrochen',
|
||||
};
|
||||
|
||||
export interface InventoryCountFilter {
|
||||
storageLocationId?: string;
|
||||
}
|
||||
|
||||
const BASE = '/api/inventory/inventory-counts';
|
||||
|
||||
export function createInventoryCountsResource(client: AxiosInstance) {
|
||||
return {
|
||||
async list(filter?: InventoryCountFilter): Promise<InventoryCountDTO[]> {
|
||||
const params: Record<string, string> = {};
|
||||
if (filter?.storageLocationId) params.storageLocationId = filter.storageLocationId;
|
||||
const res = await client.get<InventoryCountDTO[]>(BASE, { params });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getById(id: string): Promise<InventoryCountDTO> {
|
||||
const res = await client.get<InventoryCountDTO>(`${BASE}/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async create(request: CreateInventoryCountRequest): Promise<InventoryCountDTO> {
|
||||
const res = await client.post<InventoryCountDTO>(BASE, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async start(id: string): Promise<InventoryCountDTO> {
|
||||
const res = await client.patch<InventoryCountDTO>(`${BASE}/${id}/start`);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async recordItem(countId: string, itemId: string, request: RecordCountItemRequest): Promise<InventoryCountDTO> {
|
||||
const res = await client.patch<InventoryCountDTO>(`${BASE}/${countId}/items/${itemId}`, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async complete(id: string): Promise<InventoryCountDTO> {
|
||||
const res = await client.post<InventoryCountDTO>(`${BASE}/${id}/complete`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type InventoryCountsResource = ReturnType<typeof createInventoryCountsResource>;
|
||||
|
|
@ -18,6 +18,7 @@ export * from './customer';
|
|||
export * from './inventory';
|
||||
export * from './production';
|
||||
export * from './country';
|
||||
export * from './inventory-count';
|
||||
|
||||
// Re-export generated types for advanced usage
|
||||
export type { components, paths } from './generated/api';
|
||||
|
|
|
|||
36
frontend/packages/types/src/inventory-count.ts
Normal file
36
frontend/packages/types/src/inventory-count.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Inventory Count types (manual – not in OpenAPI spec)
|
||||
*/
|
||||
|
||||
export type InventoryCountStatus = 'OPEN' | 'COUNTING' | 'COMPLETED' | 'CANCELLED';
|
||||
|
||||
export interface CountItemDTO {
|
||||
id: string;
|
||||
articleId: string;
|
||||
expectedQuantityAmount: string;
|
||||
expectedQuantityUnit: string;
|
||||
actualQuantityAmount: string | null;
|
||||
actualQuantityUnit: string | null;
|
||||
deviation: string | null;
|
||||
}
|
||||
|
||||
export interface InventoryCountDTO {
|
||||
id: string;
|
||||
storageLocationId: string;
|
||||
countDate: string;
|
||||
initiatedBy: string;
|
||||
completedBy: string | null;
|
||||
status: InventoryCountStatus;
|
||||
createdAt: string;
|
||||
countItems: CountItemDTO[];
|
||||
}
|
||||
|
||||
export interface CreateInventoryCountRequest {
|
||||
storageLocationId: string;
|
||||
countDate: string;
|
||||
}
|
||||
|
||||
export interface RecordCountItemRequest {
|
||||
actualQuantityAmount: string;
|
||||
actualQuantityUnit: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue