feat(frontend): module Production complet (BOM, OF, cycle PLANIFIE→LANCE→TERMINE)
- Modèles ProductionOrder, BomLine - ProductionService : plan, launch, complete, getBom - ProductionProvider : load, plan, launch, complete + stats rapides - ProductionScreen : liste avec filtre statut + actions rapides sur carte - ProductionFormScreen : sélection PF, affichage BOM dynamique, vérif stock - ProductionDetailScreen : infos, lancement OF, clôture avec qté réalisée - Cycle complet : MP consommées au lancement, PF entré en stock à la clôture Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'api_client.dart';
|
||||
import '../models/production_order.dart';
|
||||
|
||||
class ProductionService {
|
||||
static Future<List<ProductionOrder>> fetchAll() async {
|
||||
final res = await ApiClient.instance.get('/production/orders');
|
||||
return (res.data as List).map((e) => ProductionOrder.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static Future<List<BomLine>> getBom(int produitFiniId) async {
|
||||
final res = await ApiClient.instance.get('/production/bom/$produitFiniId');
|
||||
return (res.data as List).map((e) => BomLine.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static Future<ProductionOrder> plan({
|
||||
required int produitFiniId,
|
||||
required double quantite,
|
||||
required String datePlanifiee,
|
||||
}) async {
|
||||
final res = await ApiClient.instance.post('/production/orders/plan', data: {
|
||||
'produitFiniId': produitFiniId,
|
||||
'quantite': quantite,
|
||||
'datePlanifiee': datePlanifiee,
|
||||
});
|
||||
return ProductionOrder.fromJson(res.data);
|
||||
}
|
||||
|
||||
static Future<ProductionOrder> launch(int id) async {
|
||||
final res = await ApiClient.instance.post('/production/orders/$id/launch');
|
||||
return ProductionOrder.fromJson(res.data);
|
||||
}
|
||||
|
||||
static Future<ProductionOrder> complete(int id, double quantiteRealisee) async {
|
||||
final res = await ApiClient.instance.post('/production/orders/$id/complete', data: {
|
||||
'quantiteRealisee': quantiteRealisee,
|
||||
});
|
||||
return ProductionOrder.fromJson(res.data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user