You will need to get the following data points from your ERP system:
You will need to keep in mind the dependencies of Product Codes to Work Orders and Lines.
Product Codes need to be created and then enabled for the specific line(s) they will run on. If you already have your product codes defined then you do not need to worry about it.
If not, you can use the script functions to create and enable product codes for a line.
To create a new Product Code
system.production.addProductCode() for gateway or
system.production.utils.addProductCode() for client,
To enable the product code for a line:
system.production.updateProductCodeLineStatus() for gateway or
system.production.utils.updateProductCodeLineStatus() for client,
Then a work order is just an entry in the WorkOrder table that contains these fields:
WorkOrder - name of the work order
ProductCode - name of the product code associated with the work order
Quantity - quantity desired to be produced
TimeStamp - record creation date
Closed = 0
Hide = 0
Now you can add a schedule entry to the Schedule Table:
LineID - internal line id that this run will be on. use the script function: system.production.getLineID(“OEEDemo”, linePath)
WorkOrderID - the row id of the work order you want to run
ScheduleType - 0 for production runs
Note - (optional)
StartDateTime - The time that the run will start and begin changeover
RunStartDateTime - the time that the actual run will be started, can be the same as StartDateTime if no changeover is desired.
FinishDateTime - the time that the run is assumed to complete with the quantity desired
Quantity - quantity desired for this run
The demo project has a script module called “AutoSchedule” that shows how to do the scheduling.