ETASCOM CRM V3 - Documentation API
    Preparing search index...
    • POST(
          request: NextRequest,
      ): Promise<
          | NextResponse<{ error: string; message: string }>
          | NextResponse<
              {
                  success: boolean;
                  message: string;
                  product: {
                      id: string;
                      name: string;
                      code: string;
                      description: string
                      | null;
                      productType: string;
                      cost: number;
                      sellingPrice: number;
                      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;
                  };
                  bom: | {
                      id: string;
                      quantity: number;
                      unit: string;
                      efficiency: number;
                      unitCost: number
                      | null;
                      calculatedCost: number | null;
                      componentPrice: number | null;
                      rawMaterial: { id: string; name: string; code: string } | null;
                      finishedProductComponent:
                          | { id: string; name: string; code: string }
                          | null;
                  }
                  | null;
                  workOrders: {
                      id: string;
                      number: string;
                      status: WorkOrderStatus;
                      priority: number;
                      plannedQuantity: number;
                      producedQuantity: number;
                      plannedStartDate: Date
                      | null;
                      plannedEndDate: Date | null;
                      actualStartDate: Date | null;
                      actualEndDate: Date | null;
                      client: { id: string; name: string; code: string } | null;
                      steps: {
                          id: string;
                          sequence: number;
                          operation: { id: string; name: string; code: string };
                          workStation: { id: string; name: string; code: string } | null;
                          status: string;
                      }[];
                      createdAt: Date;
                  }[];
                  quality: null;
                  statistics: {
                      totalProduced: number;
                      completedOrders: number;
                      totalOrders: number;
                      averageProductionTime: number;
                  };
                  alerts: never[];
                  scanInfo: {
                      scannedAt: string;
                      scannedBy: { id: string; name: string
                      | null; email: string };
                      hasPermission: boolean;
                  };
              },
          >,
      >

      API Tablette - Scanner un Produit Fini

      POST /api/tablet/products/scan

      Body:

      • code: string (code-barre du produit)
      • userId: string (ID de l'utilisateur connecté)
      • metadata?: object (données supplémentaires)

      Réponse:

      • product: object (détails du produit)
      • stock: object (informations de stock)
      • bom: object (nomenclature associée)
      • workOrders: array (ordres de fabrication)
      • quality: object (contrôles qualité)

      Parameters

      • request: NextRequest

      Returns Promise<
          | NextResponse<{ error: string; message: string }>
          | NextResponse<
              {
                  success: boolean;
                  message: string;
                  product: {
                      id: string;
                      name: string;
                      code: string;
                      description: string
                      | null;
                      productType: string;
                      cost: number;
                      sellingPrice: number;
                      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;
                  };
                  bom: | {
                      id: string;
                      quantity: number;
                      unit: string;
                      efficiency: number;
                      unitCost: number
                      | null;
                      calculatedCost: number | null;
                      componentPrice: number | null;
                      rawMaterial: { id: string; name: string; code: string } | null;
                      finishedProductComponent:
                          | { id: string; name: string; code: string }
                          | null;
                  }
                  | null;
                  workOrders: {
                      id: string;
                      number: string;
                      status: WorkOrderStatus;
                      priority: number;
                      plannedQuantity: number;
                      producedQuantity: number;
                      plannedStartDate: Date
                      | null;
                      plannedEndDate: Date | null;
                      actualStartDate: Date | null;
                      actualEndDate: Date | null;
                      client: { id: string; name: string; code: string } | null;
                      steps: {
                          id: string;
                          sequence: number;
                          operation: { id: string; name: string; code: string };
                          workStation: { id: string; name: string; code: string } | null;
                          status: string;
                      }[];
                      createdAt: Date;
                  }[];
                  quality: null;
                  statistics: {
                      totalProduced: number;
                      completedOrders: number;
                      totalOrders: number;
                      averageProductionTime: number;
                  };
                  alerts: never[];
                  scanInfo: {
                      scannedAt: string;
                      scannedBy: { id: string; name: string
                      | null; email: string };
                      hasPermission: boolean;
                  };
              },
          >,
      >