Model 29

Model 29 Description

Model 29 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 and, if named, link this new event to another 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. Use this model over Model 30 or 31 if you need to send customer/shipment information and/or link the event to be created with another event.

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 29 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.

SpName (NewEvents)

Stored Procedure used to create new events. The header prototype for this stored procedure must look like:

CREATE PROCEDURE spLocal_NewEvents29

@machnum varchar(30),  -- comes from the Machine property

@misc varchar(30) -- comes from the Misc property

AS

SpName (RemoveEvents)

Stored Procedure used to remove events. The header prototype for this stored procedure must look like:

CREATE PROCEDURE spLocal_EventProcessed

@ UniqueRowID int --from result set from NewEvents stored procedure

AS

Misc

The value of this property will be sent in to the stored procedure defined in the NewEvents property.

The result set of this stored procedure must look like this:

Declare @ResultSet29 Table(

    UniqueRowID int,

    PlantAppsEventNumber varcahr(25),

    TimestampYear int,

    TimestampMonth int,

    TimestampDay int,

    TimestampHour int,

    TimestampMinute int,

    TimestampSecond int,

    CustomerName varchar(50),  --Leave Null if not using customer/shipment information

    CustomerOrderNumber varchar(25), --Leave Null if not using customer/shipment information

    OrderStatus varchar(10), --Leave Null if not using customer/shipment information

    DimX int, --Leave Null if not using customer/shipment information

    DimA int, --Leave Null if not using customer/shipment information

    DimY int, --Leave Null if not using customer/shipment information

    DimZ int, --Leave Null if not using customer/shipment information

    ProdCode varchar(25), --Leave Null if not using customer/shipment information

    LotNumber varchar(10), --Leave Null if not using customer/shipment information

     ShippedYear int, --Leave Null if not using customer/shipment information

    ShippedMonth int, --Leave Null if not using customer/shipment information

    ShippedDay int, --Leave Null if not using customer/shipment information

    ShippedHour int, --Leave Null if not using customer/shipment information

    ShippedMinute int, --Leave Null if not using customer/shipment information

    ShippedSecond int, --Leave Null if not using customer/shipment information

    ParentPlantAppsEventNum varchar(25) --Leave NULL if not linking to parent production event)

Select * from @ResultSet29

See Also