scmc.ProductionOrderAPIglobal with sharing class ProductionOrderAPI Methods
Completeglobal 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
Exceptions Thrown
Return ValueDoes not return a value. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //A list of strings that contains the serial numbers to be assigned to the items produced by the production order. //If the item needs no serial number, an empty list should be used. List<String> serialNumberList = new List<String>{'serialNumber_123'}; //A string that indicates the lot number that is assigned to the items created by the production order. String lotNumber = 'lotNumber_123'; //The ID of the production order to be completed. Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1].Id; new ProductionOrderAPI().Complete(productionOrderId, lotNumber, serialNumberList); createProductionOrdersForSalesOrderglobal 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
Exceptions Thrown
Return ValueA list of production orders. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //The ID of the sales order that indicates what needs to be built. The sales order usually has items on it that must be configured. Id salesOrderId = [SELECT Id FROM Sales_Order__c LIMIT 1].Id; new ProductionOrderAPI().createProductionOrdersForSalesOrder(salesOrderId); CreateRequisitionglobal Id CreateRequisition(Id productionOrderId) Creates a requisition to fulfill the requirement to complete the production order. Input Parameters
Exceptions Thrown
Return ValueThe ID of the requision that was created. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //The ID of the production order that can't be fulfilled because one or more of its items are on backorder. Id productionOrderId = SELECT Id FROM Production_Order__c LIMIT 1].Id; new ProductionOrderAPI().CreateRequisition(productionOrderId); allocateglobal 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
Exceptions Thrown
Return ValueThere is no return. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //The ID of the production order that needs to be allocated. Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1].Id; new ProductionOrderAPI().allocate(productionOrderId); reverseAllocateglobal 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
Exceptions Thrown
Return ValueThere is no return. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. //The ID of the production order needs to be reverse allocated. Id productionOrderId = [SELECT Id FROM Production_Order__c LIMIT 1].Id; new ProductionOrderAPI().reverseAllocate(productionOrderId); |