mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 19:00:23 +01:00
feat(tui): neue Backend-Features anbinden und Status-Werte korrigieren
TUI-Anbindung für Reservierung bestätigen (US-4.3), Produktionsauftrag
umterminieren und filtern (US-P17). Status-Werte CREATED→PLANNED und
IN_PRODUCTION→IN_PROGRESS korrigiert. Fehlenden GET /{id} Endpoint für
Produktionsaufträge im Backend ergänzt.
This commit is contained in:
parent
8a84bf5f25
commit
417f8fcdae
14 changed files with 467 additions and 27 deletions
|
|
@ -144,7 +144,7 @@ export type { RecipesResource, RecipeType, RecipeStatus, UoM } from './resources
|
|||
export { RECIPE_TYPE_LABELS, UOM_VALUES, UOM_LABELS } from './resources/recipes.js';
|
||||
export type { BatchesResource, BatchStatus } from './resources/batches.js';
|
||||
export { BATCH_STATUS_LABELS } from './resources/batches.js';
|
||||
export type { ProductionOrdersResource, Priority, ProductionOrderStatus } from './resources/production-orders.js';
|
||||
export type { ProductionOrdersResource, Priority, ProductionOrderStatus, ProductionOrderFilter, RescheduleProductionOrderRequest } from './resources/production-orders.js';
|
||||
export { PRIORITY_LABELS, PRODUCTION_ORDER_STATUS_LABELS } from './resources/production-orders.js';
|
||||
export type { StocksResource, BatchType, StockBatchStatus, StockFilter, ReferenceType, ReservationPriority } from './resources/stocks.js';
|
||||
export type { StockMovementsResource, MovementType, MovementDirection, StockMovementFilter } from './resources/stock-movements.js';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/** Production Orders resource – Production BC. */
|
||||
|
||||
import type { AxiosInstance } from 'axios';
|
||||
import type { ProductionOrderDTO, CreateProductionOrderRequest, StartProductionOrderRequest } from '@effigenix/types';
|
||||
import type { ProductionOrderDTO, CreateProductionOrderRequest, StartProductionOrderRequest, RescheduleProductionOrderRequest } from '@effigenix/types';
|
||||
|
||||
export type Priority = 'LOW' | 'NORMAL' | 'HIGH' | 'URGENT';
|
||||
|
||||
|
|
@ -12,24 +12,34 @@ export const PRIORITY_LABELS: Record<Priority, string> = {
|
|||
URGENT: 'Dringend',
|
||||
};
|
||||
|
||||
export type ProductionOrderStatus = 'CREATED' | 'RELEASED' | 'IN_PRODUCTION' | 'COMPLETED' | 'CANCELLED';
|
||||
export type ProductionOrderStatus = 'PLANNED' | 'RELEASED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED';
|
||||
|
||||
export const PRODUCTION_ORDER_STATUS_LABELS: Record<ProductionOrderStatus, string> = {
|
||||
CREATED: 'Erstellt',
|
||||
PLANNED: 'Geplant',
|
||||
RELEASED: 'Freigegeben',
|
||||
IN_PRODUCTION: 'In Produktion',
|
||||
IN_PROGRESS: 'In Produktion',
|
||||
COMPLETED: 'Abgeschlossen',
|
||||
CANCELLED: 'Storniert',
|
||||
};
|
||||
|
||||
export type { ProductionOrderDTO, CreateProductionOrderRequest, StartProductionOrderRequest };
|
||||
export interface ProductionOrderFilter {
|
||||
status?: ProductionOrderStatus;
|
||||
dateFrom?: string;
|
||||
dateTo?: string;
|
||||
}
|
||||
|
||||
export type { ProductionOrderDTO, CreateProductionOrderRequest, StartProductionOrderRequest, RescheduleProductionOrderRequest };
|
||||
|
||||
const BASE = '/api/production/production-orders';
|
||||
|
||||
export function createProductionOrdersResource(client: AxiosInstance) {
|
||||
return {
|
||||
async list(): Promise<ProductionOrderDTO[]> {
|
||||
const res = await client.get<ProductionOrderDTO[]>(BASE);
|
||||
async list(filter?: ProductionOrderFilter): Promise<ProductionOrderDTO[]> {
|
||||
const params: Record<string, string> = {};
|
||||
if (filter?.status) params.status = filter.status;
|
||||
if (filter?.dateFrom) params.dateFrom = filter.dateFrom;
|
||||
if (filter?.dateTo) params.dateTo = filter.dateTo;
|
||||
const res = await client.get<ProductionOrderDTO[]>(BASE, { params });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
|
|
@ -52,6 +62,11 @@ export function createProductionOrdersResource(client: AxiosInstance) {
|
|||
const res = await client.post<ProductionOrderDTO>(`${BASE}/${id}/start`, request);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async reschedule(id: string, request: RescheduleProductionOrderRequest): Promise<ProductionOrderDTO> {
|
||||
const res = await client.post<ProductionOrderDTO>(`${BASE}/${id}/reschedule`, request);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ export function createStocksResource(client: AxiosInstance) {
|
|||
async releaseReservation(stockId: string, reservationId: string): Promise<void> {
|
||||
await client.delete(`${BASE}/${stockId}/reservations/${reservationId}`);
|
||||
},
|
||||
|
||||
async confirmReservation(stockId: string, reservationId: string): Promise<void> {
|
||||
await client.post(`${BASE}/${stockId}/reservations/${reservationId}/confirm`);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue