mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 12:09:35 +01:00
feat(tui): Create-Screen für Produktionsaufträge
Types, API-Client Resource, Hook und TUI-Screen für den neuen POST /api/production/production-orders Endpoint. Menüeintrag im Produktionsmenü ergänzt.
This commit is contained in:
parent
2938628db4
commit
fb8387c10e
10 changed files with 381 additions and 2 deletions
|
|
@ -51,6 +51,7 @@ import { BatchDetailScreen } from './components/production/BatchDetailScreen.js'
|
||||||
import { BatchPlanScreen } from './components/production/BatchPlanScreen.js';
|
import { BatchPlanScreen } from './components/production/BatchPlanScreen.js';
|
||||||
import { RecordConsumptionScreen } from './components/production/RecordConsumptionScreen.js';
|
import { RecordConsumptionScreen } from './components/production/RecordConsumptionScreen.js';
|
||||||
import { CompleteBatchScreen } from './components/production/CompleteBatchScreen.js';
|
import { CompleteBatchScreen } from './components/production/CompleteBatchScreen.js';
|
||||||
|
import { ProductionOrderCreateScreen } from './components/production/ProductionOrderCreateScreen.js';
|
||||||
import { StockListScreen } from './components/inventory/StockListScreen.js';
|
import { StockListScreen } from './components/inventory/StockListScreen.js';
|
||||||
import { StockDetailScreen } from './components/inventory/StockDetailScreen.js';
|
import { StockDetailScreen } from './components/inventory/StockDetailScreen.js';
|
||||||
import { StockCreateScreen } from './components/inventory/StockCreateScreen.js';
|
import { StockCreateScreen } from './components/inventory/StockCreateScreen.js';
|
||||||
|
|
@ -133,6 +134,7 @@ function ScreenRouter() {
|
||||||
{current === 'batch-plan' && <BatchPlanScreen />}
|
{current === 'batch-plan' && <BatchPlanScreen />}
|
||||||
{current === 'batch-record-consumption' && <RecordConsumptionScreen />}
|
{current === 'batch-record-consumption' && <RecordConsumptionScreen />}
|
||||||
{current === 'batch-complete' && <CompleteBatchScreen />}
|
{current === 'batch-complete' && <CompleteBatchScreen />}
|
||||||
|
{current === 'production-order-create' && <ProductionOrderCreateScreen />}
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ interface MenuItem {
|
||||||
const MENU_ITEMS: MenuItem[] = [
|
const MENU_ITEMS: MenuItem[] = [
|
||||||
{ label: 'Rezepte', screen: 'recipe-list', description: 'Rezepte anlegen und verwalten' },
|
{ label: 'Rezepte', screen: 'recipe-list', description: 'Rezepte anlegen und verwalten' },
|
||||||
{ label: 'Chargen', screen: 'batch-list', description: 'Produktionschargen planen, starten und abschließen' },
|
{ label: 'Chargen', screen: 'batch-list', description: 'Produktionschargen planen, starten und abschließen' },
|
||||||
|
{ label: 'Produktionsaufträge', screen: 'production-order-create', description: 'Produktionsauftrag anlegen' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function ProductionMenu() {
|
export function ProductionMenu() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Box, Text, useInput } from 'ink';
|
||||||
|
import { useNavigation } from '../../state/navigation-context.js';
|
||||||
|
import { useProductionOrders } from '../../hooks/useProductionOrders.js';
|
||||||
|
import { useRecipes } from '../../hooks/useRecipes.js';
|
||||||
|
import { FormInput } from '../shared/FormInput.js';
|
||||||
|
import { LoadingSpinner } from '../shared/LoadingSpinner.js';
|
||||||
|
import { ErrorDisplay } from '../shared/ErrorDisplay.js';
|
||||||
|
import { UOM_VALUES, UOM_LABELS, PRIORITY_LABELS } from '@effigenix/api-client';
|
||||||
|
import type { UoM, Priority, RecipeSummaryDTO } from '@effigenix/api-client';
|
||||||
|
|
||||||
|
type Field = 'recipe' | 'quantity' | 'unit' | 'plannedDate' | 'priority' | 'notes';
|
||||||
|
const FIELDS: Field[] = ['recipe', 'quantity', 'unit', 'plannedDate', 'priority', 'notes'];
|
||||||
|
|
||||||
|
const FIELD_LABELS: Record<Field, string> = {
|
||||||
|
recipe: 'Rezept (↑↓ auswählen)',
|
||||||
|
quantity: 'Geplante Menge *',
|
||||||
|
unit: 'Mengeneinheit * (←→ wechseln)',
|
||||||
|
plannedDate: 'Geplantes Datum * (YYYY-MM-DD)',
|
||||||
|
priority: 'Priorität (←→ wechseln)',
|
||||||
|
notes: 'Notizen (optional)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const PRIORITY_VALUES: Priority[] = ['LOW', 'NORMAL', 'HIGH', 'URGENT'];
|
||||||
|
|
||||||
|
export function ProductionOrderCreateScreen() {
|
||||||
|
const { back } = useNavigation();
|
||||||
|
const { createProductionOrder, loading, error, clearError } = useProductionOrders();
|
||||||
|
const { recipes, fetchRecipes } = useRecipes();
|
||||||
|
|
||||||
|
const [quantity, setQuantity] = useState('');
|
||||||
|
const [uomIdx, setUomIdx] = useState(0);
|
||||||
|
const [plannedDate, setPlannedDate] = useState('');
|
||||||
|
const [priorityIdx, setPriorityIdx] = useState(1); // NORMAL default
|
||||||
|
const [notes, setNotes] = useState('');
|
||||||
|
const [recipeIdx, setRecipeIdx] = useState(0);
|
||||||
|
const [activeField, setActiveField] = useState<Field>('recipe');
|
||||||
|
const [fieldErrors, setFieldErrors] = useState<Partial<Record<Field, string>>>({});
|
||||||
|
const [success, setSuccess] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void fetchRecipes('ACTIVE');
|
||||||
|
}, [fetchRecipes]);
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
const errors: Partial<Record<Field, string>> = {};
|
||||||
|
if (recipes.length === 0) errors.recipe = 'Kein aktives Rezept verfügbar.';
|
||||||
|
if (!quantity.trim()) errors.quantity = 'Menge ist erforderlich.';
|
||||||
|
if (!plannedDate.trim() || !/^\d{4}-\d{2}-\d{2}$/.test(plannedDate)) errors.plannedDate = 'Format: YYYY-MM-DD';
|
||||||
|
setFieldErrors(errors);
|
||||||
|
if (Object.keys(errors).length > 0) return;
|
||||||
|
|
||||||
|
const recipe = recipes[recipeIdx] as RecipeSummaryDTO;
|
||||||
|
const result = await createProductionOrder({
|
||||||
|
recipeId: recipe.id,
|
||||||
|
plannedQuantity: quantity.trim(),
|
||||||
|
plannedQuantityUnit: UOM_VALUES[uomIdx] as string,
|
||||||
|
plannedDate: plannedDate.trim(),
|
||||||
|
priority: PRIORITY_VALUES[priorityIdx] as string,
|
||||||
|
...(notes.trim() ? { notes: notes.trim() } : {}),
|
||||||
|
});
|
||||||
|
if (result) setSuccess(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFieldSubmit = (field: Field) => (_value: string) => {
|
||||||
|
const idx = FIELDS.indexOf(field);
|
||||||
|
if (idx < FIELDS.length - 1) {
|
||||||
|
setActiveField(FIELDS[idx + 1] ?? field);
|
||||||
|
} else {
|
||||||
|
void handleSubmit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useInput((_input, key) => {
|
||||||
|
if (loading) return;
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
if (key.return || key.escape) back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeField === 'recipe') {
|
||||||
|
if (key.upArrow) setRecipeIdx((i) => Math.max(0, i - 1));
|
||||||
|
if (key.downArrow) setRecipeIdx((i) => Math.min(recipes.length - 1, i + 1));
|
||||||
|
if (key.return || key.tab) setActiveField('quantity');
|
||||||
|
if (key.escape) back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeField === 'unit') {
|
||||||
|
if (key.leftArrow || key.rightArrow) {
|
||||||
|
const dir = key.rightArrow ? 1 : -1;
|
||||||
|
setUomIdx((i) => (i + dir + UOM_VALUES.length) % UOM_VALUES.length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key.return) {
|
||||||
|
handleFieldSubmit('unit')('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeField === 'priority') {
|
||||||
|
if (key.leftArrow || key.rightArrow) {
|
||||||
|
const dir = key.rightArrow ? 1 : -1;
|
||||||
|
setPriorityIdx((i) => (i + dir + PRIORITY_VALUES.length) % PRIORITY_VALUES.length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (key.return) {
|
||||||
|
handleFieldSubmit('priority')('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.tab || key.downArrow) {
|
||||||
|
setActiveField((f) => {
|
||||||
|
const idx = FIELDS.indexOf(f);
|
||||||
|
return FIELDS[(idx + 1) % FIELDS.length] ?? f;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (key.upArrow) {
|
||||||
|
setActiveField((f) => {
|
||||||
|
const idx = FIELDS.indexOf(f);
|
||||||
|
return FIELDS[(idx - 1 + FIELDS.length) % FIELDS.length] ?? f;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (key.escape) back();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<Box flexDirection="column" alignItems="center" paddingY={2}>
|
||||||
|
<LoadingSpinner label="Produktionsauftrag wird erstellt..." />
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
return (
|
||||||
|
<Box flexDirection="column" gap={1} paddingY={1}>
|
||||||
|
<Text color="green" bold>Produktionsauftrag erfolgreich erstellt!</Text>
|
||||||
|
<Text color="gray" dimColor>Enter/Escape zum Zurückkehren</Text>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const uomLabel = UOM_LABELS[UOM_VALUES[uomIdx] as UoM] ?? UOM_VALUES[uomIdx];
|
||||||
|
const priorityLabel = PRIORITY_LABELS[PRIORITY_VALUES[priorityIdx] as Priority] ?? PRIORITY_VALUES[priorityIdx];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box flexDirection="column" gap={1}>
|
||||||
|
<Text color="cyan" bold>Neuen Produktionsauftrag anlegen</Text>
|
||||||
|
{error && <ErrorDisplay message={error} onDismiss={clearError} />}
|
||||||
|
|
||||||
|
<Box flexDirection="column" gap={1} width={60}>
|
||||||
|
{/* Recipe selector */}
|
||||||
|
<Box flexDirection="column">
|
||||||
|
<Text color={activeField === 'recipe' ? 'cyan' : 'gray'}>{FIELD_LABELS.recipe}</Text>
|
||||||
|
{fieldErrors.recipe && <Text color="red">{fieldErrors.recipe}</Text>}
|
||||||
|
<Box flexDirection="column" borderStyle="round" borderColor={activeField === 'recipe' ? 'cyan' : 'gray'} paddingX={1}>
|
||||||
|
{recipes.length === 0 ? (
|
||||||
|
<Text color="gray" dimColor>Keine aktiven Rezepte gefunden.</Text>
|
||||||
|
) : (
|
||||||
|
recipes.slice(Math.max(0, recipeIdx - 3), recipeIdx + 4).map((r, i) => {
|
||||||
|
const actualIdx = Math.max(0, recipeIdx - 3) + i;
|
||||||
|
const isSelected = actualIdx === recipeIdx;
|
||||||
|
return (
|
||||||
|
<Text key={r.id} color={isSelected ? 'cyan' : 'white'}>
|
||||||
|
{isSelected ? '▶ ' : ' '}{r.name} (v{r.version})
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{/* Quantity */}
|
||||||
|
<FormInput
|
||||||
|
label={FIELD_LABELS.quantity}
|
||||||
|
value={quantity}
|
||||||
|
onChange={setQuantity}
|
||||||
|
onSubmit={handleFieldSubmit('quantity')}
|
||||||
|
focus={activeField === 'quantity'}
|
||||||
|
{...(fieldErrors.quantity ? { error: fieldErrors.quantity } : {})}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Unit */}
|
||||||
|
<Box flexDirection="column">
|
||||||
|
<Text color={activeField === 'unit' ? 'cyan' : 'gray'}>
|
||||||
|
{FIELD_LABELS.unit}: <Text bold color="white">{activeField === 'unit' ? `< ${uomLabel} >` : uomLabel}</Text>
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{/* Planned Date */}
|
||||||
|
<FormInput
|
||||||
|
label={FIELD_LABELS.plannedDate}
|
||||||
|
value={plannedDate}
|
||||||
|
onChange={setPlannedDate}
|
||||||
|
onSubmit={handleFieldSubmit('plannedDate')}
|
||||||
|
focus={activeField === 'plannedDate'}
|
||||||
|
placeholder="2026-03-01"
|
||||||
|
{...(fieldErrors.plannedDate ? { error: fieldErrors.plannedDate } : {})}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Priority */}
|
||||||
|
<Box flexDirection="column">
|
||||||
|
<Text color={activeField === 'priority' ? 'cyan' : 'gray'}>
|
||||||
|
{FIELD_LABELS.priority}: <Text bold color="white">{activeField === 'priority' ? `< ${priorityLabel} >` : priorityLabel}</Text>
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
{/* Notes */}
|
||||||
|
<FormInput
|
||||||
|
label={FIELD_LABELS.notes}
|
||||||
|
value={notes}
|
||||||
|
onChange={setNotes}
|
||||||
|
onSubmit={handleFieldSubmit('notes')}
|
||||||
|
focus={activeField === 'notes'}
|
||||||
|
placeholder="Optionale Notizen..."
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box marginTop={1}>
|
||||||
|
<Text color="gray" dimColor>
|
||||||
|
Tab/↑↓ Feld wechseln · ←→ Einheit/Priorität · Enter bestätigen/speichern · Escape Abbrechen
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
43
frontend/apps/cli/src/hooks/useProductionOrders.ts
Normal file
43
frontend/apps/cli/src/hooks/useProductionOrders.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { useState, useCallback } from 'react';
|
||||||
|
import type { ProductionOrderDTO, CreateProductionOrderRequest } from '@effigenix/api-client';
|
||||||
|
import { client } from '../utils/api-client.js';
|
||||||
|
|
||||||
|
interface ProductionOrdersState {
|
||||||
|
productionOrder: ProductionOrderDTO | null;
|
||||||
|
loading: boolean;
|
||||||
|
error: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorMessage(err: unknown): string {
|
||||||
|
return err instanceof Error ? err.message : 'Unbekannter Fehler';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useProductionOrders() {
|
||||||
|
const [state, setState] = useState<ProductionOrdersState>({
|
||||||
|
productionOrder: null,
|
||||||
|
loading: false,
|
||||||
|
error: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const createProductionOrder = useCallback(async (request: CreateProductionOrderRequest) => {
|
||||||
|
setState((s) => ({ ...s, loading: true, error: null }));
|
||||||
|
try {
|
||||||
|
const productionOrder = await client.productionOrders.create(request);
|
||||||
|
setState({ productionOrder, loading: false, error: null });
|
||||||
|
return productionOrder;
|
||||||
|
} catch (err) {
|
||||||
|
setState((s) => ({ ...s, loading: false, error: errorMessage(err) }));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const clearError = useCallback(() => {
|
||||||
|
setState((s) => ({ ...s, error: null }));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
createProductionOrder,
|
||||||
|
clearError,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -50,7 +50,8 @@ export type Screen =
|
||||||
| 'batch-detail'
|
| 'batch-detail'
|
||||||
| 'batch-plan'
|
| 'batch-plan'
|
||||||
| 'batch-record-consumption'
|
| 'batch-record-consumption'
|
||||||
| 'batch-complete';
|
| 'batch-complete'
|
||||||
|
| 'production-order-create';
|
||||||
|
|
||||||
interface NavigationState {
|
interface NavigationState {
|
||||||
current: Screen;
|
current: Screen;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -25,6 +25,7 @@ export { createCustomersResource } from './resources/customers.js';
|
||||||
export { createStorageLocationsResource } from './resources/storage-locations.js';
|
export { createStorageLocationsResource } from './resources/storage-locations.js';
|
||||||
export { createRecipesResource } from './resources/recipes.js';
|
export { createRecipesResource } from './resources/recipes.js';
|
||||||
export { createBatchesResource } from './resources/batches.js';
|
export { createBatchesResource } from './resources/batches.js';
|
||||||
|
export { createProductionOrdersResource } from './resources/production-orders.js';
|
||||||
export { createStocksResource } from './resources/stocks.js';
|
export { createStocksResource } from './resources/stocks.js';
|
||||||
export {
|
export {
|
||||||
ApiError,
|
ApiError,
|
||||||
|
|
@ -98,6 +99,8 @@ export type {
|
||||||
CompleteBatchRequest,
|
CompleteBatchRequest,
|
||||||
RecordConsumptionRequest,
|
RecordConsumptionRequest,
|
||||||
CancelBatchRequest,
|
CancelBatchRequest,
|
||||||
|
ProductionOrderDTO,
|
||||||
|
CreateProductionOrderRequest,
|
||||||
StockDTO,
|
StockDTO,
|
||||||
CreateStockRequest,
|
CreateStockRequest,
|
||||||
CreateStockResponse,
|
CreateStockResponse,
|
||||||
|
|
@ -132,6 +135,8 @@ export type { RecipesResource, RecipeType, RecipeStatus, UoM } from './resources
|
||||||
export { RECIPE_TYPE_LABELS, UOM_VALUES, UOM_LABELS } from './resources/recipes.js';
|
export { RECIPE_TYPE_LABELS, UOM_VALUES, UOM_LABELS } from './resources/recipes.js';
|
||||||
export type { BatchesResource, BatchStatus } from './resources/batches.js';
|
export type { BatchesResource, BatchStatus } from './resources/batches.js';
|
||||||
export { BATCH_STATUS_LABELS } 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 type { StocksResource, BatchType, StockBatchStatus, StockFilter } from './resources/stocks.js';
|
||||||
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS } from './resources/stocks.js';
|
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS } from './resources/stocks.js';
|
||||||
|
|
||||||
|
|
@ -146,6 +151,7 @@ import { createCustomersResource } from './resources/customers.js';
|
||||||
import { createStorageLocationsResource } from './resources/storage-locations.js';
|
import { createStorageLocationsResource } from './resources/storage-locations.js';
|
||||||
import { createRecipesResource } from './resources/recipes.js';
|
import { createRecipesResource } from './resources/recipes.js';
|
||||||
import { createBatchesResource } from './resources/batches.js';
|
import { createBatchesResource } from './resources/batches.js';
|
||||||
|
import { createProductionOrdersResource } from './resources/production-orders.js';
|
||||||
import { createStocksResource } from './resources/stocks.js';
|
import { createStocksResource } from './resources/stocks.js';
|
||||||
import type { TokenProvider } from './token-provider.js';
|
import type { TokenProvider } from './token-provider.js';
|
||||||
import type { ApiConfig } from '@effigenix/config';
|
import type { ApiConfig } from '@effigenix/config';
|
||||||
|
|
@ -171,6 +177,7 @@ export function createEffigenixClient(
|
||||||
storageLocations: createStorageLocationsResource(axiosClient),
|
storageLocations: createStorageLocationsResource(axiosClient),
|
||||||
recipes: createRecipesResource(axiosClient),
|
recipes: createRecipesResource(axiosClient),
|
||||||
batches: createBatchesResource(axiosClient),
|
batches: createBatchesResource(axiosClient),
|
||||||
|
productionOrders: createProductionOrdersResource(axiosClient),
|
||||||
stocks: createStocksResource(axiosClient),
|
stocks: createStocksResource(axiosClient),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/** Production Orders resource – Production BC. */
|
||||||
|
|
||||||
|
import type { AxiosInstance } from 'axios';
|
||||||
|
import type { ProductionOrderDTO, CreateProductionOrderRequest } from '@effigenix/types';
|
||||||
|
|
||||||
|
export type Priority = 'LOW' | 'NORMAL' | 'HIGH' | 'URGENT';
|
||||||
|
|
||||||
|
export const PRIORITY_LABELS: Record<Priority, string> = {
|
||||||
|
LOW: 'Niedrig',
|
||||||
|
NORMAL: 'Normal',
|
||||||
|
HIGH: 'Hoch',
|
||||||
|
URGENT: 'Dringend',
|
||||||
|
};
|
||||||
|
|
||||||
|
export type { ProductionOrderDTO, CreateProductionOrderRequest };
|
||||||
|
|
||||||
|
const BASE = '/api/production/production-orders';
|
||||||
|
|
||||||
|
export function createProductionOrdersResource(client: AxiosInstance) {
|
||||||
|
return {
|
||||||
|
async create(request: CreateProductionOrderRequest): Promise<ProductionOrderDTO> {
|
||||||
|
const res = await client.post<ProductionOrderDTO>(BASE, request);
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ProductionOrdersResource = ReturnType<typeof createProductionOrdersResource>;
|
||||||
|
|
@ -436,6 +436,22 @@ export interface paths {
|
||||||
patch?: never;
|
patch?: never;
|
||||||
trace?: never;
|
trace?: never;
|
||||||
};
|
};
|
||||||
|
"/api/production/production-orders": {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
get?: never;
|
||||||
|
put?: never;
|
||||||
|
post: operations["createProductionOrder"];
|
||||||
|
delete?: never;
|
||||||
|
options?: never;
|
||||||
|
head?: never;
|
||||||
|
patch?: never;
|
||||||
|
trace?: never;
|
||||||
|
};
|
||||||
"/api/production/batches": {
|
"/api/production/batches": {
|
||||||
parameters: {
|
parameters: {
|
||||||
query?: never;
|
query?: never;
|
||||||
|
|
@ -1459,6 +1475,30 @@ export interface components {
|
||||||
subRecipeId?: string;
|
subRecipeId?: string;
|
||||||
substitutable?: boolean;
|
substitutable?: boolean;
|
||||||
};
|
};
|
||||||
|
CreateProductionOrderRequest: {
|
||||||
|
recipeId: string;
|
||||||
|
plannedQuantity: string;
|
||||||
|
plannedQuantityUnit: string;
|
||||||
|
/** Format: date */
|
||||||
|
plannedDate: string;
|
||||||
|
priority: string;
|
||||||
|
notes?: string;
|
||||||
|
};
|
||||||
|
ProductionOrderResponse: {
|
||||||
|
id?: string;
|
||||||
|
recipeId?: string;
|
||||||
|
status?: string;
|
||||||
|
plannedQuantity?: string;
|
||||||
|
plannedQuantityUnit?: string;
|
||||||
|
/** Format: date */
|
||||||
|
plannedDate?: string;
|
||||||
|
priority?: string;
|
||||||
|
notes?: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
createdAt?: string;
|
||||||
|
/** Format: date-time */
|
||||||
|
updatedAt?: string;
|
||||||
|
};
|
||||||
PlanBatchRequest: {
|
PlanBatchRequest: {
|
||||||
recipeId: string;
|
recipeId: string;
|
||||||
plannedQuantity: string;
|
plannedQuantity: string;
|
||||||
|
|
@ -2755,6 +2795,30 @@ export interface operations {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
createProductionOrder: {
|
||||||
|
parameters: {
|
||||||
|
query?: never;
|
||||||
|
header?: never;
|
||||||
|
path?: never;
|
||||||
|
cookie?: never;
|
||||||
|
};
|
||||||
|
requestBody: {
|
||||||
|
content: {
|
||||||
|
"application/json": components["schemas"]["CreateProductionOrderRequest"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
responses: {
|
||||||
|
/** @description OK */
|
||||||
|
200: {
|
||||||
|
headers: {
|
||||||
|
[name: string]: unknown;
|
||||||
|
};
|
||||||
|
content: {
|
||||||
|
"*/*": components["schemas"]["ProductionOrderResponse"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
listBatches: {
|
listBatches: {
|
||||||
parameters: {
|
parameters: {
|
||||||
query?: {
|
query?: {
|
||||||
|
|
|
||||||
|
|
@ -26,3 +26,7 @@ export type PlanBatchRequest = components['schemas']['PlanBatchRequest'];
|
||||||
export type CompleteBatchRequest = components['schemas']['CompleteBatchRequest'];
|
export type CompleteBatchRequest = components['schemas']['CompleteBatchRequest'];
|
||||||
export type RecordConsumptionRequest = components['schemas']['RecordConsumptionRequest'];
|
export type RecordConsumptionRequest = components['schemas']['RecordConsumptionRequest'];
|
||||||
export type CancelBatchRequest = components['schemas']['CancelBatchRequest'];
|
export type CancelBatchRequest = components['schemas']['CancelBatchRequest'];
|
||||||
|
|
||||||
|
// Production Order types
|
||||||
|
export type ProductionOrderDTO = components['schemas']['ProductionOrderResponse'];
|
||||||
|
export type CreateProductionOrderRequest = components['schemas']['CreateProductionOrderRequest'];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue