Home | Escopo | Processo | Design/Mockups | Gerência | Estudos | Arquitetura | Contratos | BD | Qualidade | Configuração | Instalação | Instruções | Utilização | Analytics | Infraestrutura | Dicas |
---|
Production Order - ordem de produção
fields:
export class Production {
id: number;
number: number;
description: string;
production_date: Date;
Production_Status: Production_Status;
production_items: ProductionItem[];
}
export class ProductionItem {
id: number;
production_order_id: number;
sequence: number;
final_product_id: number;
prodution_quantity_estimated: number;
production_quantity_real: number;
production_quantity_loss: number;
lote: string;
lote_expiration: string;
}
endpoints:
FindAll
GET http://localhost:3000/production/ response:
[
{
"id": 3,
"number": 3,
"description": "Production C",
"production_date": "31/12/2024 20:59:59",
"created_at": "18/10/2024 00:09:25",
"updated_at": "18/10/2024 00:09:25",
"created_by": null,
"updated_by": null,
"Production_Status": "IN_PROGRESS",
"production_item": [
{
"id": 3,
"production_order_id": 3,
"sequence": 3,
"final_product_id": 12,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteOI123",
"lote_expiration": "2024-12-31T23:59:59.000Z",
"created_at": "2024-10-18T03:09:25.922Z",
"updated_at": "2024-10-18T03:09:25.922Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 4,
"number": 4,
"description": "Production D",
"production_date": "15/12/2024 20:59:59",
"created_at": "18/10/2024 00:09:25",
"updated_at": "18/10/2024 00:09:25",
"created_by": null,
"updated_by": null,
"Production_Status": "SCHEDULED",
"production_item": [
{
"id": 4,
"production_order_id": 4,
"sequence": 4,
"final_product_id": 13,
"prodution_quantity_estimated": 2000,
"production_quantity_real": 1900,
"production_quantity_loss": 100,
"lote": "LoteB456",
"lote_expiration": "2024-12-15T23:59:59.000Z",
"created_at": "2024-10-18T03:09:25.922Z",
"updated_at": "2024-10-18T03:09:25.922Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 5,
"number": 5,
"description": "Production E",
"production_date": "31/12/2024 20:59:59",
"created_at": "18/10/2024 00:09:25",
"updated_at": "18/10/2024 00:09:25",
"created_by": null,
"updated_by": null,
"Production_Status": "OPEN",
"production_item": [
{
"id": 5,
"production_order_id": 5,
"sequence": 5,
"final_product_id": 14,
"prodution_quantity_estimated": 2000,
"production_quantity_real": 1900,
"production_quantity_loss": 100,
"lote": "LoteABC123",
"lote_expiration": "2024-12-15T23:59:59.000Z",
"created_at": "2024-10-18T03:09:25.922Z",
"updated_at": "2024-10-18T03:09:25.922Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 6,
"number": 1005,
"description": "Produção de Mandioca",
"production_date": "30/12/2024 21:00:00",
"created_at": "18/10/2024 15:29:30",
"updated_at": "18/10/2024 15:29:30",
"created_by": null,
"updated_by": null,
"Production_Status": "CREATED",
"production_item": [
{
"id": 6,
"production_order_id": 6,
"sequence": 1,
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-18T18:29:30.658Z",
"updated_at": "2024-10-18T18:29:30.658Z",
"created_by": null,
"updated_by": null
},
{
"id": 7,
"production_order_id": 6,
"sequence": 2,
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"production_quantity_loss": 50,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00.000Z",
"created_at": "2024-10-18T18:29:30.689Z",
"updated_at": "2024-10-18T18:29:30.689Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 8,
"number": 1006,
"description": "Produção de Mandioca",
"production_date": "30/12/2024 21:00:00",
"created_at": "18/10/2024 15:29:53",
"updated_at": "18/10/2024 15:29:53",
"created_by": null,
"updated_by": null,
"Production_Status": "CREATED",
"production_item": [
{
"id": 8,
"production_order_id": 8,
"sequence": 1,
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-18T18:29:53.814Z",
"updated_at": "2024-10-18T18:29:53.814Z",
"created_by": null,
"updated_by": null
},
{
"id": 9,
"production_order_id": 8,
"sequence": 2,
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"production_quantity_loss": 50,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00.000Z",
"created_at": "2024-10-18T18:29:53.830Z",
"updated_at": "2024-10-18T18:29:53.830Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 10,
"number": 1007,
"description": "Produção de Mandioca",
"production_date": "30/12/2024 21:00:00",
"created_at": "18/10/2024 15:32:54",
"updated_at": "18/10/2024 15:32:54",
"created_by": null,
"updated_by": null,
"Production_Status": "CREATED",
"production_item": [
{
"id": 10,
"production_order_id": 10,
"sequence": 1,
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-18T18:32:54.752Z",
"updated_at": "2024-10-18T18:32:54.752Z",
"created_by": null,
"updated_by": null
},
{
"id": 11,
"production_order_id": 10,
"sequence": 2,
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"production_quantity_loss": 50,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00.000Z",
"created_at": "2024-10-18T18:32:54.756Z",
"updated_at": "2024-10-18T18:32:54.756Z",
"created_by": null,
"updated_by": null
}
]
},
{
"id": 11,
"number": 1008,
"description": "Produção de Mandioca",
"production_date": "30/12/2024 21:00:00",
"created_at": "18/10/2024 15:51:33",
"updated_at": "18/10/2024 15:51:33",
"created_by": null,
"updated_by": null,
"Production_Status": "CREATED",
"production_item": [
{
"id": 14,
"production_order_id": 11,
"sequence": 1,
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-18T18:51:33.803Z",
"updated_at": "2024-10-18T18:51:33.803Z",
"created_by": null,
"updated_by": null
},
{
"id": 15,
"production_order_id": 11,
"sequence": 2,
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"production_quantity_loss": 50,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00.000Z",
"created_at": "2024-10-18T18:51:33.830Z",
"updated_at": "2024-10-18T18:51:33.830Z",
"created_by": null,
"updated_by": null
}
]
}
]
FindById
GET http://localhost:3000/production/3
response:
{
"id": 3,
"number": 3,
"description": "Production C",
"production_date": "31/12/2024 20:59:59",
"created_at": "18/10/2024 00:09:25",
"updated_at": "18/10/2024 00:09:25",
"created_by": null,
"updated_by": null,
"Production_Status": "IN_PROGRESS",
"production_item": [
{
"id": 3,
"production_order_id": 3,
"sequence": 3,
"final_product_id": 12,
"final_product_made": {
"description": "laranja descascada"
},
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteOI123",
"lote_expiration": "2024-12-31T23:59:59.000Z",
"created_at": "2024-10-18T03:09:25.922Z",
"updated_at": "2024-10-18T03:09:25.922Z",
"created_by": null,
"updated_by": null
}
]
}
Delete (remoção física)
DELETE http://localhost:3000/production/2 response:
{
"message": "Production order with ID 2 removed"
}
Create
POST http://localhost:3000/production/ request:
{
"number": 2008,
"description": "Produção de Mandioca",
"production_date": "2024-12-31T00:00:00Z",
"Production_Status": "CREATED",
"production_items": [
{
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00Z"
},
{
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00Z"
}
]
}
response:
{
"production": {
"id": 14,
"number": 2008,
"description": "Produção de Mandioca",
"production_date": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-19T07:23:36.902Z",
"updated_at": "2024-10-19T07:23:36.902Z",
"created_by": null,
"updated_by": null,
"Production_Status": "CREATED"
},
"items": [
{
"final_product_id": 10,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00Z"
},
{
"final_product_id": 11,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00Z"
}
]
}
Update
PATCH http://localhost:3000/production/3 request:
{
"number": 3,
"description": "Produção INTERNACIONAL",
"production_date": "2024-12-31T00:00:00Z",
"Production_Status": "SCHEDULED",
"production_items": [
{
"final_product_id": 7,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00Z"
},
{
"final_product_id": 8,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00Z"
}
]
}
response:
{
"production": {
"id": 3,
"description": "Produção INTERNACIONAL",
"updated_at": "2024-10-19T07:24:37.086Z",
"items": [
{
"id": 20,
"production_order_id": 3,
"sequence": 4,
"final_product_id": 7,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteTY123",
"lote_expiration": "2024-12-31T00:00:00.000Z",
"created_at": "2024-10-19T07:24:37.066Z",
"updated_at": "2024-10-19T07:24:37.066Z",
"created_by": null,
"updated_by": null
},
{
"id": 21,
"production_order_id": 3,
"sequence": 5,
"final_product_id": 8,
"prodution_quantity_estimated": 500,
"production_quantity_real": 450,
"production_quantity_loss": 50,
"lote": "LoteTY456",
"lote_expiration": "2025-01-31T00:00:00.000Z",
"created_at": "2024-10-19T07:24:37.068Z",
"updated_at": "2024-10-19T07:24:37.068Z",
"created_by": null,
"updated_by": null
},
{
"id": 3,
"production_order_id": 3,
"sequence": 3,
"final_product_id": 12,
"prodution_quantity_estimated": 1000,
"production_quantity_real": 950,
"production_quantity_loss": 50,
"lote": "LoteOI123",
"lote_expiration": "2024-12-31T23:59:59.000Z",
"created_at": "2024-10-18T03:09:25.922Z",
"updated_at": "2024-10-18T03:09:25.922Z",
"created_by": null,
"updated_by": null
}
]
}
}