scmc.ProductionOrderAPI
global with sharing class ProductionOrderAPI
Methods
Complete
global void Complete(Id productionOrderId, String lotNumber, String[] serialNumbers)
Complete specified production order. Lot Number and Serial Numbers are assigned to the resulting products. Costs from items are rolled up from the items used up in the production order and become the cost for the resulting product.
Input Parameters
productionOrderId |
Id |
The ID of the production order to be completed. |
lotNumber |
String |
A string that indicates the lot number that is assigned to the items created by the production order. |
serialNumbers |
String[] |
A list of strings that contains the serial numbers to be assigned to the items produced by the production order. @group Inventory Management |
Exceptions Thrown
Exception |
- Exception indicating issues with the completion. |
Return Value
Does not return a value.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | List<String> serialNumberList = new List<String>{ 'serialNumber_123' };
String lotNumber = 'lotNumber_123' ;
Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1 ].Id;
new ProductionOrderAPI().Complete(productionOrderId, lotNumber, serialNumberList);
|
createProductionOrdersForSalesOrder
global List<scmc__Production_Order__c> createProductionOrdersForSalesOrder(Id salesOrderId)
Creates a production order from a sales order. The sales order usually has items on it that must be configured.
Input Parameters
salesOrderId |
Id |
The ID of the sales order that indicates what needs to be built. |
Exceptions Thrown
Exception |
- Exception indicating issues with the production order completion. |
Return Value
A list of production orders.
Sample Code
1 2 3 4 5 6 7 8 | Id salesOrderId = [SELECT Id FROM Sales_Order__c LIMIT 1 ].Id;
new ProductionOrderAPI().createProductionOrdersForSalesOrder(salesOrderId);
|
CreateRequisition
global Id CreateRequisition(Id productionOrderId)
Creates a requisition to fulfill the requirement to complete the production order.
Input Parameters
productionOrderId |
Id |
The ID of the production order that can't be fulfilled because one or more of its items are on backorder. |
Exceptions Thrown
Exception |
- Exception indicating issues when creating the requisition. |
Return Value
The ID of the requision that was created.
Sample Code
1 2 3 4 5 6 7 8 | Id productionOrderId = SELECT Id FROM Production_Order__c LIMIT 1 ].Id;
new ProductionOrderAPI().CreateRequisition(productionOrderId);
|
allocate
global void allocate(ID productionOrderId)
Allocates a production order. Checks the status on the production order to determine if it has been completely allocated or not.
Input Parameters
productionOrderId |
ID |
The ID of the production order that needs to be allocated. |
Exceptions Thrown
Exception |
- Exception indicating issues when allocating the production order. |
Return Value
There is no return.
Sample Code
1 2 3 4 5 6 7 8 | Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1 ].Id;
new ProductionOrderAPI().allocate(productionOrderId);
|
reverseAllocate
global void reverseAllocate(ID productionOrderId)
Reverses the allocation of a production order. This puts the production order back into an "Open" status and releases any inventory that was associated with the production order.
Input Parameters
productionOrderId |
ID |
The ID of the production order that needs to be reverse allocated. |
Exceptions Thrown
Exception |
- Exception indicating issues when reverse allocating the production order. |
Return Value
There is no return.
Sample Code
1 2 3 4 5 6 7 8 | Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1 ].Id;
new ProductionOrderAPI().reverseAllocate(productionOrderId);
|
|