ETASCOM CRM V3 - Documentation API
    Preparing search index...
    • POST(
          request: NextRequest,
      ): Promise<
          | NextResponse<{ error: string; message: string }>
          | NextResponse<
              {
                  success: boolean;
                  message: string;
                  material: {
                      id: string;
                      name: string;
                      code: string;
                      description: string
                      | null;
                      productType: string;
                      materialType: string;
                      cost: number;
                      sellingPrice: number;
                      minStockLevel: number;
                      maxStockLevel: number | null;
                      reorderPoint: number;
                      wastePercentage: number | null;
                      isActive: boolean;
                      createdAt: Date;
                      updatedAt: Date;
                  };
                  category: { id: string; name: string; code: string | null }
                  | null;
                  unitOfMeasure:
                      | { id: string; name: string; code: string; symbol: string
                      | null }
                      | null;
                  stock: {
                      totalQuantity: number;
                      totalValue: number;
                      averageCost: number;
                      movements: {
                          id: string;
                          type: StockMovementType;
                          quantity: number;
                          warehouse:
                              | {
                                  id: string;
                                  name: string;
                                  code: string;
                                  address: string
                                  | null;
                                  city: string | null;
                              }
                              | null;
                          date: Date;
                      }[];
                      status: string;
                  };
                  suppliers: {
                      id: string;
                      name: string;
                      code: string;
                      email: string
                      | null;
                      phone: string | null;
                      isPreferred: boolean;
                      supplierCode: string | null;
                      moqTiers: {
                          minQuantity: number;
                          unitPrice: number;
                          leadTime: number | null;
                      }[];
                  }[];
                  usage: {
                      id: string;
                      finishedProduct: { id: string; name: string; code: string };
                      quantity: number;
                      unit: string;
                      unitCost: number | null;
                      calculatedCost: number | null;
                      componentPrice: number | null;
                  }[];
                  quality: null;
                  alerts: { type: string; message: string; severity: string }[];
                  scanInfo: {
                      scannedAt: string;
                      scannedBy: { id: string; name: string | null; email: string };
                      hasPermission: boolean;
                  };
              },
          >,
      >

      API Tablette - Scanner une Matière Première

      POST /api/tablet/materials/scan

      Body:

      • code: string (code-barre de la matière)
      • userId: string (ID de l'utilisateur connecté)
      • metadata?: object (données supplémentaires)

      Réponse:

      • material: object (détails de la matière)
      • stock: object (informations de stock)
      • suppliers: array (fournisseurs)
      • usage: array (utilisations dans les nomenclatures)
      • quality: object (contrôles qualité)

      Parameters

      • request: NextRequest

      Returns Promise<
          | NextResponse<{ error: string; message: string }>
          | NextResponse<
              {
                  success: boolean;
                  message: string;
                  material: {
                      id: string;
                      name: string;
                      code: string;
                      description: string
                      | null;
                      productType: string;
                      materialType: string;
                      cost: number;
                      sellingPrice: number;
                      minStockLevel: number;
                      maxStockLevel: number | null;
                      reorderPoint: number;
                      wastePercentage: number | null;
                      isActive: boolean;
                      createdAt: Date;
                      updatedAt: Date;
                  };
                  category: { id: string; name: string; code: string | null }
                  | null;
                  unitOfMeasure:
                      | { id: string; name: string; code: string; symbol: string
                      | null }
                      | null;
                  stock: {
                      totalQuantity: number;
                      totalValue: number;
                      averageCost: number;
                      movements: {
                          id: string;
                          type: StockMovementType;
                          quantity: number;
                          warehouse:
                              | {
                                  id: string;
                                  name: string;
                                  code: string;
                                  address: string
                                  | null;
                                  city: string | null;
                              }
                              | null;
                          date: Date;
                      }[];
                      status: string;
                  };
                  suppliers: {
                      id: string;
                      name: string;
                      code: string;
                      email: string
                      | null;
                      phone: string | null;
                      isPreferred: boolean;
                      supplierCode: string | null;
                      moqTiers: {
                          minQuantity: number;
                          unitPrice: number;
                          leadTime: number | null;
                      }[];
                  }[];
                  usage: {
                      id: string;
                      finishedProduct: { id: string; name: string; code: string };
                      quantity: number;
                      unit: string;
                      unitCost: number | null;
                      calculatedCost: number | null;
                      componentPrice: number | null;
                  }[];
                  quality: null;
                  alerts: { type: string; message: string; severity: string }[];
                  scanInfo: {
                      scannedAt: string;
                      scannedBy: { id: string; name: string | null; email: string };
                      hasPermission: boolean;
                  };
              },
          >,
      >