> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vinmake.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Suggest Issue Lots

> READ-ONLY lot-allocation suggestions for an issue (backlog item 1 —
services/batch_serial.py FEFO/FIFO wired over the org's live lots).

Given an item (material/SKU/style) + qty (+ optional location), runs the
pure FEFO (default) or FIFO engine over the live (lot, location) balances
— qty_available (net of reservations) from stock_balance, expires_at /
received_at / quality_status from stock_lot, org-scoped, soft-deletes
excluded — and returns the suggested allocations soonest-expiry-first.
Expired and non-quality-passed lots are skipped by the engine. When stock
cannot cover the request the best PARTIAL allocation is returned with the
shortfall (never a 400). Nothing is written: actual issuing stays with
POST /stock/movements.



## OpenAPI

````yaml /api/openapi-cutmake.json post /stock/issue-suggestions
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /stock/issue-suggestions:
    post:
      tags:
        - Stock
      summary: Suggest Issue Lots
      description: >-
        READ-ONLY lot-allocation suggestions for an issue (backlog item 1 —

        services/batch_serial.py FEFO/FIFO wired over the org's live lots).


        Given an item (material/SKU/style) + qty (+ optional location), runs the

        pure FEFO (default) or FIFO engine over the live (lot, location)
        balances

        — qty_available (net of reservations) from stock_balance, expires_at /

        received_at / quality_status from stock_lot, org-scoped, soft-deletes

        excluded — and returns the suggested allocations soonest-expiry-first.

        Expired and non-quality-passed lots are skipped by the engine. When
        stock

        cannot cover the request the best PARTIAL allocation is returned with
        the

        shortfall (never a 400). Nothing is written: actual issuing stays with

        POST /stock/movements.
      operationId: suggest_issue_lots_stock_issue_suggestions_post
      parameters:
        - name: X-Org-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Org-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StockIssueSuggestionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StockIssueSuggestionResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    StockIssueSuggestionRequest:
      properties:
        materialId:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialid
        materialSkuId:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialskuid
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        styleSkuId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleskuid
        stockLocationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Stocklocationid
        stockDomain:
          anyOf:
            - type: string
            - type: 'null'
          title: Stockdomain
        qty:
          type: number
          title: Qty
        method:
          anyOf:
            - type: string
            - type: 'null'
          title: Method
      type: object
      required:
        - qty
      title: StockIssueSuggestionRequest
    StockIssueSuggestionResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/StockIssueSuggestionLine'
          type: array
          title: Data
        method:
          type: string
          title: Method
        requestedQty:
          type: number
          title: Requestedqty
        suggestedQty:
          type: number
          title: Suggestedqty
        shortfallQty:
          type: number
          title: Shortfallqty
        satisfied:
          type: boolean
          title: Satisfied
      type: object
      required:
        - data
        - method
        - requestedQty
        - suggestedQty
        - shortfallQty
        - satisfied
      title: StockIssueSuggestionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StockIssueSuggestionLine:
      properties:
        stockLotId:
          type: string
          title: Stocklotid
        stockLotDocumentId:
          anyOf:
            - type: string
            - type: 'null'
          title: Stocklotdocumentid
        stockLocationId:
          type: string
          title: Stocklocationid
        stockLocationName:
          anyOf:
            - type: string
            - type: 'null'
          title: Stocklocationname
        qtySuggested:
          type: number
          title: Qtysuggested
        qtyAvailable:
          type: number
          title: Qtyavailable
        uom:
          anyOf:
            - type: string
            - type: 'null'
          title: Uom
        expiresAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Expiresat
        receivedAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Receivedat
      type: object
      required:
        - stockLotId
        - stockLocationId
        - qtySuggested
        - qtyAvailable
      title: StockIssueSuggestionLine
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/login

````