Model 31
Model 31 Description
Model 31 calls a stored procedure on a database in the server defined by the ODBC ConnectString property at a specific interval (specified by the TINT property). Each row returned from the stored procedure named in the SpName (NewEvents) property is created as a new production event. These rows have to be in a specific format. The row ID of each row that is successfully processed is then used as a parameter into the stored procedure named in the SpName (RemoveEvents) property. Product changes can be automatically created if a new production event has different grade than the previous production event by turning on the Grade Changes parameter.
The functionality in this model is available only if you have purchased the Quality Module.
IMPORTANT: The ODB connection must NOT have the parameter "Enable Lazy Close Support" selected to avoid locking the Plant Applications tables.
Model 31 Properties
The following Model properties are set up using the Plant Applications Administrator:
Property |
Description |
Maximum Run Time (Seconds) |
optional: Type the number of seconds you want the model to run. The default is 0 (zero), which means the model will not time out. Typically, you will want to limit the run time of the model only if troubleshooting the model (for example, one of the stored procedures is in an infinite loop). |
Model Processing Group |
Used for multithreading. See the Multithreading topic for more information. |
TINT:(Interval) Minutes |
Interval at which the SpName (NewEvents) stored procedure is called on the server named in the ODBCConnectString |
ODBC Connect String |
DSN=xx;UID=yyy; PWD=zzz; |
Machine |
This is a unique production unit number – not necessarily the PU_Id but just a unique number in the system. The value of this property is passed in to the stored procedure named in the NewEvents. This property allows you use the same server and stored procedure for multiple events in Plant Applications. |
Tappi Begin |
This value is used as the 1st characters of the Tappi or Event Number and is passed into the NewEvents stored procedure. |
SpName (NewEvents) |
Stored Procedure used to create new production events. The header prototype for this stored procedure must look like this: CREATE PROCEDURE spLocal_NewEvents @ TappiBegin varchar(30), --value of the property TappiBegin @machnum varchar(30), --value of the property Machine @misc varchar(30) -- value of the property Misc AS |
SpName (RemoveEvent) |
Stored Procedure used to mark the events on the remote system as processed. The header prototype for this stored procedure must look like this: CREATE PROCEDURE spLocal_EventProcessed @ UniqueRowID int --from result set from NewEvents stored procedure AS |
Log Only (TRUE) |
Set to TRUE if you just want to test the stored procedure calls. |
Misc |
The value of this property is passed into the NewEvents stored procedure. |
Grade Changes (TRUE) |
Set to TRUE to have the product changed if the new event is a different product than the previous one. Set to FALSE to ignore product changes. |
The result set of this stored procedure must look like this:
Declare ResultsSet31 Table(
UniqueRowId int,
PlantApplicationsEventNum varchar(50),
TimestampYear int,
TimestampMonth int,
TimestampDay int,
TimestampHour int,
TimestampMinute int,
TimestampSecond int,
TransType int DEFAULT(1), --means ”r;Insert”
ProdCode varchar(25) DEFAULT(''),-- Set this to do a product change
SourceEventNum varchar(50) )
Select * from ResultSet31