Skip to main content
InSource Solutions

TN MES108 Example API Call to Add Inventory in Wonderware MES

insource logo large.jpg

 

Description

This article from InSource Provides example script using Stateless API call to add inventory in Wonderware MES. 

 

  • Author: Michael Walker
  • Published: 09/25/2015
  • Applies to: Wonderware MES 2014

 

 

Details

Below is an example script calling the aaStorageExec.AddInv method in the stateless API.  Note that the Me.<Attributes>  relative references need to be configured within the Application Server object for this example to function properly. 

 

dim Result as aaMES.Result;
dim rowID as integer;
dim DT as aaMES.aaDBDateTime;
dim lotNo as aaMES.aaDBString;
dim testlotNo as String;

 

testLotNo=me.lotNo;
lotNo= new aaMES.aaDBString(testlotNo);

 

Result= aaMES.EnProd.aaStorageExec.AddInv(me.sessionId,me.entityName,"",me.itemId,"GoodGrade","GoodState",me.GoodQty,lotNo,Null,Null,Null,DT,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,rowId);

 

If Result.Success then
    me.ResultText="successfully Added Inventory to entity: "+me.EntityName+". And received RowID: "+rowID;
else
    me.resultText="Add Inventory Failed: "+result.Exception.Message;
endif;