1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 10:29:35 +01:00

feat(tui): TUI für Produktionsauftrag-Freigabe, Bestandsreservierung und Reservierungs-Freigabe

- ProductionOrderCreateScreen: Nach Anlage Freigabe per [F] mit Statusanzeige
- StockDetailScreen: Reservierungen-Tabelle, Menü für Reservieren/Freigeben
- ReserveStockScreen: Neues Formular (Referenztyp, Referenz-ID, Menge, Einheit, Priorität)
- API-Client: release(), reserveStock(), releaseReservation() Methoden
- Hooks: releaseProductionOrder(), reserveStock(), releaseReservation()
- Types: ReservationDTO, StockBatchAllocationDTO, ReserveStockRequest exportiert
- DB: Migration 027 erweitert chk_production_order_status um RELEASED
This commit is contained in:
Sebastian Frick 2026-02-24 00:57:40 +01:00
parent fb8387c10e
commit 376557925a
15 changed files with 585 additions and 13 deletions

View file

@ -108,6 +108,9 @@ export type {
RemoveStockBatchRequest,
BlockStockBatchRequest,
MinimumLevelDTO,
ReservationDTO,
StockBatchAllocationDTO,
ReserveStockRequest,
} from '@effigenix/types';
// Resource types (runtime, stay in resource files)
@ -137,8 +140,8 @@ export type { BatchesResource, BatchStatus } from './resources/batches.js';
export { BATCH_STATUS_LABELS } from './resources/batches.js';
export type { ProductionOrdersResource, Priority } from './resources/production-orders.js';
export { PRIORITY_LABELS } from './resources/production-orders.js';
export type { StocksResource, BatchType, StockBatchStatus, StockFilter } from './resources/stocks.js';
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS } from './resources/stocks.js';
export type { StocksResource, BatchType, StockBatchStatus, StockFilter, ReferenceType, ReservationPriority } from './resources/stocks.js';
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS, REFERENCE_TYPE_LABELS, RESERVATION_PRIORITY_LABELS } from './resources/stocks.js';
import { createApiClient } from './client.js';
import { createAuthResource } from './resources/auth.js';

View file

@ -22,6 +22,11 @@ export function createProductionOrdersResource(client: AxiosInstance) {
const res = await client.post<ProductionOrderDTO>(BASE, request);
return res.data;
},
async release(id: string): Promise<ProductionOrderDTO> {
const res = await client.post<ProductionOrderDTO>(`${BASE}/${id}/release`);
return res.data;
},
};
}

View file

@ -10,6 +10,8 @@ import type {
UpdateStockRequest,
RemoveStockBatchRequest,
BlockStockBatchRequest,
ReservationDTO,
ReserveStockRequest,
} from '@effigenix/types';
export type BatchType = 'PURCHASED' | 'PRODUCED';
@ -28,6 +30,23 @@ export const STOCK_BATCH_STATUS_LABELS: Record<StockBatchStatus, string> = {
BLOCKED: 'Gesperrt',
};
export type ReferenceType = 'PRODUCTION_ORDER' | 'SALES_ORDER' | 'TRANSFER';
export const REFERENCE_TYPE_LABELS: Record<ReferenceType, string> = {
PRODUCTION_ORDER: 'Produktionsauftrag',
SALES_ORDER: 'Kundenauftrag',
TRANSFER: 'Umlagerung',
};
export type ReservationPriority = 'LOW' | 'NORMAL' | 'HIGH' | 'URGENT';
export const RESERVATION_PRIORITY_LABELS: Record<ReservationPriority, string> = {
LOW: 'Niedrig',
NORMAL: 'Normal',
HIGH: 'Hoch',
URGENT: 'Dringend',
};
export type {
StockDTO,
StockBatchDTO,
@ -37,6 +56,8 @@ export type {
UpdateStockRequest,
RemoveStockBatchRequest,
BlockStockBatchRequest,
ReservationDTO,
ReserveStockRequest,
};
export interface StockFilter {
@ -89,6 +110,15 @@ export function createStocksResource(client: AxiosInstance) {
async unblockBatch(stockId: string, batchId: string): Promise<void> {
await client.post(`${BASE}/${stockId}/batches/${batchId}/unblock`);
},
async reserveStock(stockId: string, request: ReserveStockRequest): Promise<ReservationDTO> {
const res = await client.post<ReservationDTO>(`${BASE}/${stockId}/reservations`, request);
return res.data;
},
async releaseReservation(stockId: string, reservationId: string): Promise<void> {
await client.delete(`${BASE}/${stockId}/reservations/${reservationId}`);
},
};
}

View file

@ -452,6 +452,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/production/production-orders/{id}/release": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["releaseProductionOrder"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/production/batches": {
parameters: {
query?: never;
@ -564,6 +580,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/inventory/stocks/{stockId}/reservations": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["reserveStock"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/inventory/stocks/{stockId}/batches": {
parameters: {
query?: never;
@ -1016,6 +1048,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/inventory/stocks/{stockId}/reservations/{reservationId}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post?: never;
delete: operations["releaseReservation"];
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/customers/{id}/delivery-addresses/{label}": {
parameters: {
query?: never;
@ -1201,6 +1249,22 @@ export interface components {
amount: number;
unit: string;
} | null;
ReservationResponse: {
id?: string;
referenceType?: string;
referenceId?: string;
quantityAmount?: number;
quantityUnit?: string;
priority?: string;
/** Format: date-time */
reservedAt?: string;
allocations?: components["schemas"]["StockBatchAllocationResponse"][];
};
StockBatchAllocationResponse: {
stockBatchId?: string;
allocatedQuantityAmount?: number;
allocatedQuantityUnit?: string;
};
StockBatchResponse: {
id?: string;
batchId?: string;
@ -1224,6 +1288,7 @@ export interface components {
totalQuantity: number;
quantityUnit?: string | null;
availableQuantity: number;
reservations: components["schemas"]["ReservationResponse"][];
};
UpdateCustomerRequest: {
name?: string;
@ -1582,6 +1647,13 @@ export interface components {
/** Format: int32 */
minimumShelfLifeDays?: number | null;
};
ReserveStockRequest: {
referenceType: string;
referenceId: string;
quantityAmount: string;
quantityUnit: string;
priority: string;
};
AddStockBatchRequest: {
batchId: string;
batchType: string;
@ -2819,6 +2891,28 @@ export interface operations {
};
};
};
releaseProductionOrder: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["ProductionOrderResponse"];
};
};
};
};
listBatches: {
parameters: {
query?: {
@ -3061,6 +3155,32 @@ export interface operations {
};
};
};
reserveStock: {
parameters: {
query?: never;
header?: never;
path: {
stockId: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["ReserveStockRequest"];
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["ReservationResponse"];
};
};
};
};
addBatch: {
parameters: {
query?: never;
@ -3809,6 +3929,27 @@ export interface operations {
};
};
};
releaseReservation: {
parameters: {
query?: never;
header?: never;
path: {
stockId: string;
reservationId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content?: never;
};
};
};
removeDeliveryAddress: {
parameters: {
query?: never;

View file

@ -25,3 +25,8 @@ export type CreateStockResponse = components['schemas']['CreateStockResponse'];
export type UpdateStockRequest = components['schemas']['UpdateStockRequest'];
export type RemoveStockBatchRequest = components['schemas']['RemoveStockBatchRequest'];
export type BlockStockBatchRequest = components['schemas']['BlockStockBatchRequest'];
// Reservation types
export type ReservationDTO = components['schemas']['ReservationResponse'];
export type StockBatchAllocationDTO = components['schemas']['StockBatchAllocationResponse'];
export type ReserveStockRequest = components['schemas']['ReserveStockRequest'];