User Tools

Site Tools


en:api_materialdis

Material Distribution

API to submit Material Distribution. Supported method is: PUT

url: ~/material_distribution/purchase/<order_no>/<material_class>/<material_code>

JSON structure

Material class & material code

Document type and match condition

List of distribution

JSON Schema

Other reference json schema: object_distribution

{
"$id": "https://www.igarment.net/schema/json/v1-0/material-distribution",
"title": "Material requirement distribution",
"type": "object",
"properties": {
  "material": {
    "type": "object",
    "properties": {
      "class": { "type": "string" },
      "code":  { "type": "string" }
    }
  },
  //define the type of distribution, and each type has its own match rule
  "reference": {
    "oneOf": [
      {
        "type": "object",
        "properties": {
          "type":     { "const": "purchase" },
          "order_no": { "type": "string" }
        }
      },
      {
        "type": "object",
        "properties": {
          "type":     { "const": "receive" },
          "supplier": { "type": "string" },
          "delivery_note": { "type": "string" }
        }
      },
      {
        "type": "object",
        "properties": {
          "type":   { "const": "stock" },
          "lot_no": { "type": "string" }
        }
      }
    ]
  },
  // distribute details
  "distributions": { "$ref": "object-variance.json#/$defs/distribution" }
}
} 

JSON Example

type of distrubition = purchase

{
  "material": {
      "class": "00",
      "code": "00-0001"
  },
  "reference":{
      "type": "purchase",
      "order_no": "PO23-200"
  },
  "distributions": [
      {
          "style": "FP6222CY",
          "job_order": "ALLI-0015",
          "color": "BLACK",
          "size": "10Y",
          "qty": 100.0
      },
      {
          "style": "FP6222CY",
          "job_order": "ALLI-0015",
          "color": "GREY MARLE",
          "size": "",
          "qty": 2.0
      }
  ]
}
en/api_materialdis.txt · Last modified: by administrator