rtip event creation in pa

Upload: sap2kish6552

Post on 08-Jan-2016

20 views

Category:

Documents


3 download

DESCRIPTION

abcd

TRANSCRIPT

Proof Of Concept Template

GE Fanuc Automation Solutions Europe S.A.Technical Paper

Using Proficy Real-time Information Portal for Event Creation in Proficy Plant Applications

Software

EUROPE

18/07/2005

Version: 1.0

This Technical Paper describes a method to use Proficy Real-time Information Portal for Event Creation in Proficy Plant Applications.

Revision History

Table - Revision Status lists the latest version and date for the various sections of the specification.

Versions 0.X are prerelease draft versions.

Versions 1.X to X.X are post release versions.

The number to the left of the decimal in the version number indicates the major version number. The number to the right of the decimal in the version number indicates the minor version number.

The major version number will change for the following reasons:

Information added to document.

Information removed from document.

Rearrangement of sections in the document.

Revisions to the scope or purpose of the document.

The minor version number will change for the following reasons:

Spelling corrections.

Page layout or formatting corrections.

Minor changes that do not affect the scope or purpose of the document.

VersionDateDescription

1.018.07.2005Initial release

Table 0 Revision Status

Table of Contents

51Introduction

2Overview63Creating Local Result Set Tables104Creating 601 Models in PA115Creating the SQL Historian86Controls and Statements within RTIP136.1Define RTIP Controls136.1.1Production Unit136.1.2Production Line136.1.3Department136.1.4Batch Number146.2Create Statement14

1 Introduction

This document describes a method step-by-step to use Proficy Real Time Information Portal (from now on RTIP) as a front end for Proficy Plant Applications (from now on PA). The versions used are RTIP version 2.5 build 2107 and PA version 4.1.

It is assumed that the reader is experienced in configuring and setup PA, including experience with SQL Stored Procedures and Result Sets.

2 Overview

This method utilize the messaging system employed by PA, that allow safe updates of the database and notify the standard thick PA clients about the changes made. Result Sets allow you to add real time messages to Model based custom SQL Stored Procedures and to Plant Applications Variable Stored Procedure Calculations. The Models are triggered by the Event Manager service and the Calculations are triggered by the Calculation Manager service So it has to be one of these services that sends out a result set for having the PA messaging system recognize it as an update of the PA database and to ensure updates of the standard thick PA clients. These services are not directly accessible from within RTIP.

One of the great features within RTIP is the possibility to write SQL statements, including end-user selections as inputs. These statements can be select, insert, update or delete statements, but it can also be a call statement that can execute a stored procedure. This method is utilizing this feature: the stored procedure executes logic that transforms the end-user selections into the type of data needed for a specific result set and the data is then inserted into a local Result Set table. The columns and order of the local Result Set table are equivalent with the parameters and order of the specific result set.

There is a one-to-one relation between the type of events that should be created, updated or deleted from RTIP and different local Result Set tables.

The stored procedure executed from within RTIP is also updating a tag within a SQL based historian. This is done since RTIP do not have directly access to the Event Manager service or the Calculation Manager service. The SQL Historian includes tags for each different event type that needs to be created, updated or deleted from within RTIP. Using the generic 601 model, PA can be configured to have the Event Manager service executing a stored procedure, when a tag in the SQL based historian is changing value. The stored procedure (executed by the Event Manager service) is taking data from the local Result Set table and sends it out as a result set the PA database will then be updated and the standard thick PA clients will be notified about the changes.

Figure 1 below visualizes the method. The stored procedures and table on the PA side (the blue dotted box on the right side of the figure) will be the same for each project and site, and only the configuration of the pages and the statements on the RTIP side will differ which is bringing the implementation time down.

Figure 1The following sections will go step-by-step through Figure 1 (from right to left), starting with how to create the SQL Historian, how to create the local Result Set tables, how to set up the 601 models and finalizing with a section with an example on how to create statements in RTIP and linking end-user selection with the statements.

The document includes import files and stored procedures that will cover most of the actions that needs to be done, and the steps on the PA side will be equivalent for all projects including a RTIP as front-end of PA scope.

This document includes result sets for Production Events, Variable Values, Grade Change, Downtime Events, User Defined Events, Waste Events and Production Plan. It should be easy to use the attached examples to extend the functionality to cover other Events than the one provided.

3 Creating the SQL Historian

The configuration of the SQL Historian is build up by two parts:

Implementation of a SQL table for the tags and their values

Configuration of the Historian in PA

3.1 Implementation of a Historian SQL table

The table can be created executing the following script.

3.2 Configuration of the Historian in PA

Select SQL Server as the Historian Type requires a number of option values to be set. The option values can be set as (please insert the IP address of the server instead of XXX for the Connection String):

BrowseSQLSelect convert(varchar(20),Tag_Id) as TagID, sDescription, sEngUnits, 'Float' from Local_SQLHistorian where convert(varchar(20),Tag_Id) like ?TagId

Connection StringDRIVER={SQL Server}; Server=XXX;Database=GBDB;UID=sa;PWD=sa

DeleteSQLDelete from Local_SQLHistorian where tTimeStamp = ?TimeStamp and Tag_Id = convert(int,?TagId) and IMilisecond is null

ExecDirectFlagFalse

InsertSQL

ReadAfterSQLSet RowCount ?NumValues; Select tTimestamp, value = case when sValue is null then convert(varchar(20), dValue) else sValue end, status = case when dQuality = 0 then 'Good' else 'Bad' end from Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp > ?TimeStamp order by tTimeStamp

ReadBeforeSQLSet RowCount ?NumValues; Select tTimestamp, value = case when sValue is null then convert(varchar(20), dValue) else sValue end, status = case when dQuality = 0 then 'Good' else 'Bad' end from Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp < ?TimeStamp order by tTimeStamp desc

ReadBetweenSQLSet RowCount ?NumValues; Select tTimestamp, value = case when sValue is null then convert(varchar(20), dValue) else sValue end, status = case when dQuality = 0 then 'Good' else 'Bad' end from Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp > ?StartTime and tTimeStamp < ?EndTime order by tTimeStamp

TimeSQLSelect getdate() as CurTime

More information about SQL Historian can be found in the Proficy Plant Applications Administrator Documentation.

The Tag-Ids is the number of the Result Set Example: A value change for the tag with Tag-Id equals 1 will activate the 601 model for the Production Event.

Remark that it is needed to fill in a tag value for each tag in the SQL Historian before the tag can be seen from a browse tag window in PA administrator. The scripts in Insert Tag Values zip file can be used to insert the first values for Production Events, Variable Values, Grade Change, Downtime Events, User Defined Events, Waste Events and Production Plan.

4 Creating Local Result Set Tables

The local Result Set tables is following the structure of the Result Set for the Event and are all called Local_RTIPXXX, where XXX is the Event type. Each local Result Set table includes a last column with the header Flag. This is used by the 601 Model stored procedure to indicate and delete processed rows. The zip-file below includes the local Result Set tables for Production Events, Variable Values, Grade Change, Downtime Events, User Defined Events, Waste Events and Production Plan.

5 Creating 601 Models in PA

The 601 models can be imported from Administer Models in the Global Configuration folder in the Proficy Plant Applications Administrator, using the files included in the zip-file below. The model number for the different models is 1000XX where XX is the Result Set Number (Example: 100001 is the model number of the 601 model used for Production Events).

The different models are triggering a stored procedure when a value change occurs for a specific tag in the SQL Historian. The stored procedure follows the structure below (this example is using the Production Event. The Local_RTIPProductionEvents is the local Result Set table and the Local_SQLHistorian is the SQL Historian table):

CREATE Procedure spLocal_TriggerRTIPProductionEvents

@ReturnStatus int OUTPUT,

@ReturnMessage varchar(255) OUTPUT,

@EC_Id int,

@TriggerTimestamp datetime

AS

Declare

@MaxTimeStamp DateTime

-- In case a end-user inserts a new row during the execution of this SP

Update Local_RTIPProductionEvents Set Flag = 1 Where Flag = 0

-- Select * from local Result Set table

Select 1, Id, Transaction_Type, Event_Id, Event_Num, PU_Id, Convert(VarChar(30),TimeStamp,120),

Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update, Conformance,

TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId, EntryOn,

ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId, ExtendedInfo

From Local_RTIPProductionEvents Where Flag = 1

-- Deletes processed rows from the local Result Set table

Delete From Local_RTIPProductionEvents Where Flag = 1

-- Set @MaxTimeStamp to the latest time where the specific tag in the SQL Historian was changed

Select @MaxTimeStamp = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 1

-- Delete all tag changes from the SQL Historian but the last

Delete From Local_SQLHistorian Where Tag_Id = 1 and tTimeStamp @MaxTimeStamp

The zip file below includes the stored procedures for Production Events, Variable Values, Grade Change, Downtime Events, User Defined Events, Waste Events and Production Plan. These scripts need to be executed within a SQL Query Analyzer.

The model has to be set up at any production unit in the Plant Model (one unit could be created only for this purpose). The models can be configured importing the Excel sheet below. Remember to substitute the Production Line, Production Unit, Event Subtype and name of the SQL Historian.

Activate the models in the Proficy Plant Applications Administrator. Navigate to the unit where the Models have been attached. Select Configure Events, select the Configure Event Detection Models and active the models one-by-one.

6 Controls and Statements within RTIP

The following will focus on the left side of figure 1 the RTIP side. There are 3 steps that need to be fulfilled on the RTIP side in order to create PA Events from within RTIP. These are:

1. Define RTIP controls that should be used as inputs for the PA Event (examples: start time, production event number, process order number, reasons )

2. Create Statement used to insert data into the local Result Set table and update the SQL Historian table

3. Create link between the RTIP controls and the Statement

6.1 Define RTIP Controls

The following example will create a batch on a specific unit. The input that should be given is the production unit and Batch Number the time when it is created in RTIP will be the time attached to the Batch. The Production Unit can be selected using the Plant Applications Collector within RTIP. In this example the end-user should first select Department, then Production Line and finally the Production Unit.

6.1.1 Production Unit

1. The Production Unit control has been dragged from the system tree (see figure

2. The Object Type has been selected as a combo box

3. Both Unit Description and Unit Id columns has been displayed

4. Selected Item Column is Unit Description

5. Selected Value Column is Unit Id

6.1.2 Production Line

1. The Production Line control has been dragged from the system tree

2. The Object Type has been selected as a combo box

3. Both Line Description and Line Id columns has been displayed

4. Selected Item Column is Line Description

5. Selected Value Column is Line Id

6. The Select Value Property has been linked to the Line Id of the Production Unit control

6.1.3 Department

1. The Department control has been dragged from the system tree

2. The Object Type has been selected as a combo box

3. Both Department Description and Department Id columns has been displayed

4. Selected Item Column is Department Description

5. Selected Value Column is Department Id

6. The Select Value Property has been linked to the Department Id of the Production Line control

Figure 26.1.4 Batch Number

1. Add a textbox for the Batch Number input

Figure 36.2 Create Statement

The only task for the statement used from RTIP to Create, Update or Delete an event in PA is to insert the parameter values into the local Result Set table. This is done using a Call statement, executing a stored procedure. The Call statement will include input values coming from the end-user selections (in our example this will be the Production Unit Id and Batch Number). These input values can now be used directly as parameter values into the local Result Set table or used to derive other parameter values.

In our example the stored procedure looks as follows:

CREATE PROCEDURE spLocal_InsertBatch

@BatchNum VarChar(25),

@PUId Int

AS

Declare

@Max int,

@BatchExist int,

@Timestamp VarChar(30),

@Event_Id int

-- If no Batch Number has not been transferred to the SP, error message and return

If @BatchNum is Null

Begin

Select 'No Batch Number' as Message

Return

End

-- If no Production Unit has not been transferred to the SP, error message and return

If @PUId is Null

Begin

Select 'No Production Unit' as Message

Return

End

-- Does the Batch already exist in the PA database

Select @BatchExist = Count(*) From Events where Event_Num = @BatchNum and PU_Id = @PUId

-- Create the batch if it does not exist in the PA database

If @BatchExist = 0

Begin

Select @Timestamp = Convert(VarChar(30),GetDate(),120)

-- Hot insert, inserts the Batch directly in the database

Execute spServer_DBMgrUpdEvent @Event_Id OUTPUT, @BatchNum, @PUId, @Timestamp, Null,

Null, 26, 1, 0, 6, Null, Null, Null, Null, Null, 0

--Send insert to bus (post = 1, Pre = 0)

-- Sends the Batch to the client (Post_Update = 1)

Insert into Local_RTIPProductionEvents (Id, Transaction_Type, Event_Id, Event_Num, PU_Id,

TimeStamp, Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update,

Conformance, TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId,

EntryOn, ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId,

ExtendedInfo, Flag)

Values(1,1,@Event_Id,@BatchNum,@PUId,@Timestamp,Null, Null, 5, Null, 8, 1, Null, Null, Null, Null,

Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, 0)

-- Increment the tag value for the Production Event tag

Select @Max = Max(dValue) From Local_SQLHistorian Where Tag_Id = '1'

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue,

dQuality)

Values('1','Production Events',Null, Null, Getdate(),Null,@Max+1,0)

End

-- If the Batch already exists, send error message and return

If @BatchExist 0

Begin

Select 'Batch already exists' as Message

Return

End

-- Send success message

Select 'Success Updating: ' + @BatchNum as Message

This script needs to be executed in a SQL Query Analyzer and can be found in the zip-file below:

Before using the stored procedure in a Call statement it has to be included in a Schema (see RTIP documentation for how to create Schemas). Select the Schema where you want to include the stored procedure in the SQL Statement Builder, right click and select Add Table etc..

Figure 4Select that the Schema contains Procedures. Click Next >.

Figure 5Select the stored procedures that should be added to the Schema. Click Next > and Finish, and the stored procedure are now included.

Select New Statement in the SQL Statement Builder and select Call as the type of SQL statement. Hereafter drag the stored procedure from the Schema folder into the empty Table Diagram frame.

Figure 6Save the Statement and give it a name.

RTIP has already built the Statement in the SQL Statement frame, and has selected names for the input parameters (par0_@BatchNum and par1_@PUId). RTIP concludes these input parameters by looking at the header of the stored procedure, but it is needed to execute the stored procedure from inside RTIP for RTIP to know what type of output it should expect. Execute Statement will prompt for values for the input parameters.

Figure 7Click OK.

Figure 8The result frame displays the output of the stored procedure (Message: Success Updating: ABC002).

Return to the configure mode of the display with the input parameter, select the Data Source tab in the System Tree and drag the Statement just created into the display. Select the Object Type as Text Box and select to display the message column.

Figure 9Select the Production Unit Combo Box and link the Selected Value property to the Message Text Box par1_@PUId.

Figure 10Select the Batch Number Text Box and link the Text property to the Message Text Box par0_@BatchNum.

Figure 11Now the two input values are linked to the input parameter of the statement. The last thing is a button to execute the statement. Insert the button and link the control to the Text Box Insert Batch (the Message Text Box).

Figure 12Thats it. Now change the display to Run Mode and Select Department, Production Line, Production Unit and Insert Batch Number and Click on the Create Batch button to create a new Batch within the Proficy Plant Applications Database.

Figure 13

_1183210922/Local Result Set Tables.zip

Local_RTIPDowntimeEvents.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPDowntimeEvents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPDowntimeEvents]GO

CREATE TABLE [dbo].[Local_RTIPDowntimeEvents] ([PUId] [int] NULL ,[SourcePUId] [int] NULL ,[StatusId] [int] NULL ,[FaultId] [int] NULL ,[Reason1] [int] NULL ,[Reason2] [int] NULL ,[Reason3] [int] NULL ,[Reason4] [int] NULL ,[ProdRate] [int] NULL ,[Duration] [float] NULL ,[Transaction_Type] [int] NULL ,[StartTime] [datetime] NULL ,[EndTime] [datetime] NULL ,[TEDET_Id] [int] NULL ,[PostDB] [tinyint] NULL ,[TransNum] [tinyint] NULL ,[Action1] [int] NULL ,[Action2] [int] NULL ,[Action3] [int] NULL ,[Action4] [int] NULL ,[ActionCommentId] [int] NULL ,[ResearchCommentId] [int] NULL ,[ResearchStatusId] [int] NULL ,[ResearchOpenDate] [int] NULL ,[ResearchCloseDate] [datetime] NULL ,[CommentId] [int] NULL ,[TargetProdRate] [float] NULL ,[DimensionX1] [float] NULL ,[DimensionX2] [float] NULL ,[DimensionY1] [float] NULL ,[DimensionY2] [float] NULL ,[DimensionZ1] [float] NULL ,[DimensionZ2] [float] NULL ,[ResearchUserId] [int] NULL ,[RsnTreeDataId] [int] NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPDowntimeEvents] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPDowntimeEvents] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPDowntimeEvents] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPDowntimeEvents] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPDowntimeEvents] TO [ProficyConnect]GO

Local_RTIPProductionEvents.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPProductionEvents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPProductionEvents]GO

CREATE TABLE [dbo].[Local_RTIPProductionEvents] ([Id] [int] NULL ,[Transaction_Type] [int] NULL ,[Event_Id] [int] NULL ,[Event_Num] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[PU_Id] [int] NULL ,[TimeStamp] [datetime] NULL ,[Applied_Product] [int] NULL ,[Source_Event] [int] NULL ,[Event_Status] [int] NULL ,[Confirmed] [int] NULL ,[User_Id] [int] NULL ,[Post_Update] [int] NULL ,[Conformance] [tinyint] NULL ,[TestPctComplete] [tinyint] NULL ,[StartTime] [datetime] NULL ,[TransNum] [tinyint] NULL ,[TestingStatus] [int] NULL ,[CommentId] [int] NULL ,[EventSubTypeId] [int] NULL ,[EntryOn] [datetime] NULL ,[ApprovedUserId] [int] NULL ,[SecondUserId] [int] NULL ,[ApprovedReasonId] [int] NULL ,[UserReasonId] [int] NULL ,[UserSignOffId] [int] NULL ,[ExtendedInfo] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionEvents] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionEvents] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionEvents] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionEvents] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionEvents] TO [ProficyConnect]GO

Local_RTIPProductionPlan.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPProductionPlan]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPProductionPlan]GO

CREATE TABLE [dbo].[Local_RTIPProductionPlan] ([PreDB] [int] NULL ,[TransType] [int] NULL ,[TransNum] [int] NULL ,[PathId] [int] NULL ,[PPId] [int] NULL ,[CommentId] [int] NULL ,[ProdID] [int] NULL ,[ImpliedSequence] [int] NULL ,[PPStatusID] [int] NULL ,[PPTypeId] [int] NULL ,[SourcePPId] [int] NULL ,[UserId] [int] NULL ,[ParentPPId] [int] NULL ,[ControlType] [int] NULL ,[ForecastStartTime] [datetime] NULL ,[ForecastEndTime] [datetime] NULL ,[EntryOn] [datetime] NULL ,[ForecastQuantity] [float] NULL ,[ProductionRate] [float] NULL ,[AdjustedQuantity] [float] NULL ,[BlockNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[ProcessOrder] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[TransactionTime] [datetime] NULL ,[Misc1] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Misc2] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Misc3] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Misc4] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionPlan] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionPlan] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionPlan] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionPlan] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPProductionPlan] TO [ProficyConnect]GO

Local_RTIPVariableValues.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPVariableValues]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPVariableValues]GO

CREATE TABLE [dbo].[Local_RTIPVariableValues] ([Var_Id] [int] NULL ,[PU_Id] [int] NULL ,[User_Id] [int] NULL ,[Canceled] [int] NULL ,[Result] [varchar] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Result_On] [datetime] NULL ,[Transaction_Type] [int] NULL ,[PostUpdate] [int] NULL ,[SecondUser_Id] [int] NULL ,[TransNum] [int] NULL ,[Event_Id] [int] NULL ,[Array_Id] [int] NULL ,[Comment_Id] [int] NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPVariableValues] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPVariableValues] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPVariableValues] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPVariableValues] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPVariableValues] TO [ProficyConnect]GO

Local_RTIPWasteEvents.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPWasteEvents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPWasteEvents]GO

CREATE TABLE [dbo].[Local_RTIPWasteEvents] ([PreDB] [tinyint] NULL ,[TransNum] [int] NULL ,[UserId] [int] NULL ,[TransType] [int] NULL ,[WasteEventId] [int] NULL ,[PUId] [int] NULL ,[SourcePUId] [int] NULL ,[TypeId] [int] NULL ,[MeasId] [int] NULL ,[Reason1] [int] NULL ,[Reason2] [int] NULL ,[Reason3] [int] NULL ,[Reason4] [int] NULL ,[EventId] [int] NULL ,[Amount] [int] NULL ,[Marker1] [int] NULL ,[Marker2] [int] NULL ,[TimeStamp] [int] NULL ,[Action1] [int] NULL ,[Action2] [int] NULL ,[Action3] [int] NULL ,[Action4] [int] NULL ,[ActionCommentId] [int] NULL ,[ResearchCommentId] [int] NULL ,[ResearchStatusId] [int] NULL ,[ResearchOpenDate] [datetime] NULL ,[ResearchCloseDate] [datetime] NULL ,[CommentId] [int] NULL ,[TargetProdRate] [int] NULL ,[ResearchUserId] [int] NULL ,[FaultId] [int] NULL ,[RsnTreeDataId] [int] NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPWasteEvents] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPWasteEvents] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPWasteEvents] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPWasteEvents] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPWasteEvents] TO [ProficyConnect]GO

Local_RTIPUDEvents.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPUDEvents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPUDEvents]GO

CREATE TABLE [dbo].[Local_RTIPUDEvents] ([PreDB] [tinyint] NULL ,[UDEId] [int] NULL ,[UDENum] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[PUId] [int] NULL ,[EventSubtypeId] [int] NULL ,[StartTime] [datetime] NULL ,[EndTime] [datetime] NULL ,[Duration] [int] NULL ,[Ack] [bit] NULL ,[AckOn] [datetime] NULL ,[AckBy] [int] NULL ,[Cause1] [int] NULL ,[Cause2] [int] NULL ,[Cause3] [int] NULL ,[Cause4] [int] NULL ,[CauseCommentId] [int] NULL ,[Action1] [int] NULL ,[Action2] [int] NULL ,[Action3] [int] NULL ,[Action4] [int] NULL ,[ActionCommentId] [int] NULL ,[ResearchUserId] [int] NULL ,[ResearchStatusId] [int] NULL ,[ResearchOpenDate] [datetime] NULL ,[ResearchCloseDate] [datetime] NULL ,[ResearchCommentId] [int] NULL ,[UDECommentId] [int] NULL ,[TransType] [tinyint] NULL ,[EventSubTypeDesc] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[TransNum] [int] NULL ,[UserId] [int] NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPUDEvents] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPUDEvents] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPUDEvents] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPUDEvents] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPUDEvents] TO [ProficyConnect]GO

Local_RTIPGradeChange.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_RTIPGradeChange]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_RTIPGradeChange]GO

CREATE TABLE [dbo].[Local_RTIPGradeChange] ([StartId] [int] NULL ,[PU_Id] [int] NULL ,[ProdId] [int] NULL ,[StartTime] [datetime] NULL ,[PostDB] [tinyint] NULL ,[UserId] [int] NULL ,[SecondUserId] [int] NULL ,[TransType] [int] NULL ,[Flag] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPGradeChange] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPGradeChange] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPGradeChange] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPGradeChange] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_RTIPGradeChange] TO [ProficyConnect]GO

_1183211835/601 Models.zip

RTIP Variable Update.edg

"--""100002_model_data.edm""100002_model_text.edm""100002_field_2_data.edm""100002_field_1_data.edm""--""[ED_Model]""model_num :> 100002""modelnum :> 100002""model_desc :> RTIP Variable Update""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 7""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Variable Update"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP Production Events.edg

"--""100001_model_data.edm""100001_model_text.edm""100001_field_2_data.edm""100001_field_1_data.edm""--""[ED_Model]""model_num :> 100001""modelnum :> 100001""model_desc :> RTIP Production Events""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 1""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Production Events"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP Downtime.edg

"--""100005_model_data.edm""100005_model_text.edm""100005_field_2_data.edm""100005_field_1_data.edm""--""[ED_Model]""model_num :> 100005""modelnum :> 100005""model_desc :> RTIP Downtime""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 2""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Downtime"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP Waste Events.edg

"--""100009_model_data.edm""100009_model_text.edm""100009_field_2_data.edm""100009_field_1_data.edm""--""[ED_Model]""model_num :> 100009""modelnum :> 100009""model_desc :> RTIP Waste Events""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 3""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Waste Events"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP Production Plan.edg

"--""100015_model_data.edm""100015_model_text.edm""100015_field_2_data.edm""100015_field_1_data.edm""--""[ED_Model]""model_num :> 100015""modelnum :> 100015""model_desc :> RTIP Production Plan""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 19""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Production Plan"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP UD Events.edg

"--""100008_model_data.edm""100008_model_text.edm""100008_field_2_data.edm""100008_field_1_data.edm""--""[ED_Model]""model_num :> 100008""modelnum :> 100008""model_desc :> RTIP UD Events""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 14""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP UD Events"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

RTIP Grade Change.edg

"--""100003_model_data.edm""100003_model_text.edm""100003_field_2_data.edm""100003_field_1_data.edm""--""[ED_Model]""model_num :> 100003""modelnum :> 100003""model_desc :> RTIP Grade Change""derived_from :> 601""installed_on :> (NULL)""server_ver :> 4.2B63""model_version:> 1.0""interval_base:> 0""locked :> 0""user_defined :> 0""et_id :> 4""comment_id :> (NULL)""num_of_fields:> 2""--"RTIP Grade Change"--""[ED_Field]""field_desc :> Local spName""ed_field_type:> 51""max_instances:> 1""derived_from :> 1363""optional :> 0""locked :> 0""field order :> 2""--""[ED_Field]""field_desc :> PT:TiggerTag""ed_field_type:> 3""max_instances:> 1""derived_from :> 1362""optional :> 0""locked :> 0""field order :> 1"

_1183211914/601 SPs.zip

spLocal_TriggerRTIPProductionPlan.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPProductionPlan]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPProductionPlan]GO

CREATE Procedure spLocal_TriggerRTIPProductionPlan@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @Max DateTime

Update Local_RTIPProductionPlan Set Flag = 1 Where Flag = 0

Select 15,PreDB, TransType, TransNum, PathId, PPId, CommentId, ProdID, ImpliedSequence, PPStatusID, PPTypeId, SourcePPId, UserId, ParentPPId, ControlType, ForecastStartTime, ForecastEndTime, EntryOn, ForecastQuantity, ProductionRate, AdjustedQuantity, BlockNumber, ProcessOrder, TransactionTime, Misc1, Misc2, Misc3, Misc4, Flag From Local_RTIPProductionPlan Where Flag = 1

Delete From Local_RTIPProductionPlan Where Flag = 1

Select @Max = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 15

Delete From Local_SQLHistorian Where Tag_Id = 15 and tTimeStamp @Max

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionPlan] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionPlan] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionPlan] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionPlan] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionPlan] TO [ProficyConnect]GO

spLocal_TriggerRTIPProductionEvents.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPProductionEvents]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPProductionEvents]GO

CREATE Procedure spLocal_TriggerRTIPProductionEvents@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @MaxTimeStamp DateTime

Update Local_RTIPProductionEvents Set Flag = 1 Where Flag = 0

Select 1, Id, Transaction_Type, Event_Id, Event_Num, PU_Id, Convert(VarChar(30),TimeStamp,120), Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update, Conformance, TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId, EntryOn,ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId, ExtendedInfo From Local_RTIPProductionEvents Where Flag = 1

Delete From Local_RTIPProductionEvents Where Flag = 1

Select @MaxTimeStamp = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 1

Delete From Local_SQLHistorian Where Tag_Id = 1 and tTimeStamp @MaxTimeStamp

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionEvents] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionEvents] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionEvents] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionEvents] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPProductionEvents] TO [ProficyConnect]GO

spLocal_TriggerRTIPVariableValues.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPVariableValues]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPVariableValues]GO

CREATE Procedure spLocal_TriggerRTIPVariableValues@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @MaxTimestamp DateTime

Update Local_RTIPVariableValues Set Flag = 1 Where Flag = 0

Select 2, Var_Id,PU_Id,User_Id,Canceled,Result,Convert(VarChar(30),Result_On,120),Transaction_Type, PostUpdate,SecondUser_Id,TransNum,Event_Id,Array_Id,Comment_Id From Local_RTIPVariableValues Where Flag = 1

Delete From Local_RTIPVariableValues Where Flag = 1

Select @MaxTimestamp = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 2

Delete From Local_SQLHistorian Where Tag_Id = 2 and tTimeStamp @MaxTimestamp

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPVariableValues] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPVariableValues] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPVariableValues] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPVariableValues] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPVariableValues] TO [ProficyConnect]GO

spLocal_TriggerRTIPDowntimeEvents.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPDowntimeEvents]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPDowntimeEvents]GO

CREATE Procedure spLocal_TriggerRTIPDowntimeEvents@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @Max DateTime

Update Local_RTIPDowntimeEvents Set Flag = 1 Where Flag = 0

Select 5, PUId, SourcePUId, StatusId, FaultId, Reason1, Reason2, Reason3, Reason4, ProdRate, Duration, Transaction_Type, StartTime, EndTime, TEDET_Id, PostDB, TransNum, Action1, Action2, Action3, Action4, ActionCommentId, ResearchCommentId, ResearchStatusId, ResearchOpenDate, ResearchCloseDate, CommentId, TargetProdRate, DimensionX1, DimensionX2, DimensionY1, DimensionY2, DimensionZ1, DimensionZ2, ResearchUserId, RsnTreeDataId From Local_RTIPDowntimeEvents Where Flag = 1

Delete From Local_RTIPDowntimeEvents Where Flag = 1

Select @Max = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 5

Delete From Local_SQLHistorian Where Tag_Id = 5 and tTimeStamp @Max

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPDowntimeEvents] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPDowntimeEvents] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPDowntimeEvents] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPDowntimeEvents] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPDowntimeEvents] TO [ProficyConnect]GO

spLocal_TriggerRTIPGradeChange.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPGradeChange]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPGradeChange]GO

CREATE Procedure spLocal_TriggerRTIPGradeChange@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @Max DateTime

Update Local_RTIPGradeChange Set Flag = 1 Where Flag = 0

Select 3, StartId, PU_Id, ProdId, StartTime, PostDB, UserId, SecondUserId, TransType From Local_RTIPGradeChange Where Flag = 1

Delete From Local_RTIPGradeChange Where Flag = 1

Select @Max = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 3

Delete From Local_SQLHistorian Where Tag_Id = 3 and tTimeStamp @Max

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPGradeChange] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPGradeChange] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPGradeChange] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPGradeChange] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPGradeChange] TO [ProficyConnect]GO

spLocal_TriggerRTIPUDEvents.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPUDEvents]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPUDEvents]GO

CREATE Procedure spLocal_TriggerRTIPUDEvents@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @Max DateTime

Update Local_RTIPUDEvents Set Flag = 1 Where Flag = 0

Select 8, PreDB, UDEId, UDENum, PUId, EventSubtypeId, StartTime, EndTime, Duration, Ack, AckOn, AckBy, Cause1, Cause2, Cause3, Cause4, CauseCommentId, Action1, Action2, Action3, Action4, ActionCommentId, ResearchUserId, ResearchStatusId, ResearchOpenDate, ResearchCloseDate, ResearchCommentId, UDECommentId, TransType, EventSubTypeDesc, TransNum, UserId From Local_RTIPUDEvents Where Flag = 1

Delete From Local_RTIPUDEvents Where Flag = 1

Select @Max = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 8

Delete From Local_SQLHistorian Where Tag_Id = 8 and tTimeStamp @Max

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPUDEvents] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPUDEvents] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPUDEvents] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPUDEvents] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPUDEvents] TO [ProficyConnect]GO

spLocal_TriggerRTIPWasteEvents.sql

SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_TriggerRTIPWasteEvents]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_TriggerRTIPWasteEvents]GO

CREATE Procedure spLocal_TriggerRTIPWasteEvents@ReturnStatus int OUTPUT,@ReturnMessage varchar(255) OUTPUT,@EC_Id int,@TriggerTimestamp datetimeAS

Declare @Max DateTime

Update Local_RTIPWasteEvents Set Flag = 1 Where Flag = 0

Select 9, PreDB TransNum, UserId, TransType, WasteEventId, PUId, SourcePUId, TypeId, MeasId, Reason1, Reason2, Reason3, Reason4, EventId, Amount, Marker1, Marker2, TimeStamp, Action1, Action2, Action3, Action4, ActionCommentId, ResearchCommentId, ResearchStatusId, ResearchOpenDate, ResearchCloseDate, CommentId, TargetProdRate, ResearchUserId, FaultId, RsnTreeDataId From Local_RTIPWasteEvents Where Flag = 1

Delete From Local_RTIPWasteEvents Where Flag = 1

Select @Max = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 9

Delete From Local_SQLHistorian Where Tag_Id = 9 and tTimeStamp @Max

Select @ReturnMessage = ''Select @ReturnStatus = 1

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPWasteEvents] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPWasteEvents] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPWasteEvents] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPWasteEvents] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_TriggerRTIPWasteEvents] TO [ProficyConnect]GO

_1183211197/Insert Tag Values.zip

Insert Tag Values.sql

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('1','Production Events',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('2','Variable Values',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('3','Grade Change',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('5','DownTime Events',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('8','UD Event',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('9','Waste Events',Null, Null, Getdate(),Null,0,0)

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality)Values('15','Production Plan',Null, Null, Getdate(),Null,0,0)

_1183199357/Configure Models.zip

Configure Models.xls

Events-3

Events

Return MessagesSelectedProduction LineProduction UnitEvent TypeEvent SubTypeEvent DescriptionExtended InfoExclusionsCommentInputModel Number

xRTIPRTIPProduction EventBatch100001

xRTIPRTIPDowntime100005

xRTIPRTIPImport100002

xRTIPRTIPProcess Order100015

(X) to Select

EventConfigurationProperties-4

EventConfigurationProperties

Return MessagesSelectedProduction LineProduction UnitEvent TypeInput NameModel NumberLocationFieldOrderTypeAliasTriggerAttributeSampling TypeSampling OffsetPrecisionValueProduction UnitVariable Desc

xRTIPRTIPProduction Event100001RTIPPT:TiggerTag1Tag0PT:\\SQLBASED\1

xRTIPRTIPProduction Event100001RTIPLocal spName2spLocal - Stored Procedure Name0spLocal_TriggerRTIPProductionEvents

xRTIPRTIPImport100002RTIPPT:TiggerTag1Tag0PT:\\SQLBASED\2

xRTIPRTIPImport100002RTIPLocal spName2spLocal - Stored Procedure Name0spLocal_TriggerRTIPVariableValues

xRTIPRTIPDowntime100005RTIPPT:TiggerTag1Tag0PT:\\SQLBASED\5

xRTIPRTIPDowntime100005RTIPLocal spName2spLocal - Stored Procedure Name0spLocal_TriggerRTIPDowntimeEvents

xRTIPRTIPProcess Order100015RTIPPT:TiggerTag1Tag0PT:\\SQLBASED\15

xRTIPRTIPProcess Order100015RTIPLocal spName2spLocal - Stored Procedure Name0spLocal_TriggerRTIPProductionPlan

(X) to Select

Max Length(50)

Max Length(50)

DowntimeInput GenealogyProcess OrderProcess Order/TimeProduct ChangeProduct/TimeProduction EventTimeUptimeUser-Defined EventWaste

TimestampValue

% In Reject% In WarningAverageBase TimeStamp - InterpolatedBase TimeStamp - Last Good ValueBase TimeStamp - Next Good ValueClosest Good ValueCountCpkEvent TimeStampIncreaseInterpolatedLast Good ValueMaximumMaximum TimeStampMinimumMinimum TimeStampNext Good ValueRaw AverageRaw CountRaw IncreaseRaw MaximumRaw MinimumRaw Standard DeviationRaw TotalRaw Unique CountRaw ValuesStandard DeviationTotal

for unit and variable id

for variable id

_1183202252/Insert Batch.zip

Insert Batch.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLocal_InsertBatch]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[spLocal_InsertBatch]GO

SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

CREATE PROCEDURE spLocal_InsertBatch@BatchNum VarChar(25),@PUId IntAS

Declare@Max int,@BatchExist int,@Timestamp VarChar(30),@Event_Id int

-- If no Batch Number has not been transferred to the SP, error message and returnIf @BatchNum is NullBegin Select 'No Batch Number' as Message ReturnEnd

-- If no Production Unit has not been transferred to the SP, error message and returnIf @PUId is NullBegin Select 'No Production Unit' as Message ReturnEnd

-- Does the Batch allready exist in the PA databaseSelect @BatchExist = Count(*) From Events where Event_Num = @BatchNum and PU_Id = @PUId

-- Create the batch if it does not exist in the PA databaseIf @BatchExist = 0Begin Select @Timestamp = Convert(VarChar(30),GetDate(),120)

-- Hot insert, inserts the Batch directly in the database Execute spServer_DBMgrUpdEvent @Event_Id OUTPUT, @BatchNum, @PUId, @Timestamp, Null, Null, 26, 1, 0, 6, Null, Null, Null, Null, Null, 0 --Send insert to bus (post = 1, Pre = 0)

-- Sends the Batch to the client (Post_Update = 1) Insert into Local_RTIPProductionEvents (Id, Transaction_Type, Event_Id, Event_Num, PU_Id, TimeStamp, Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update, Conformance, TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId, EntryOn, ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId, ExtendedInfo, Flag) Values(1,1,@Event_Id,@BatchNum,@PUId,@Timestamp,Null, Null, 5, Null, 8, 1, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, 0) -- Increment the tag value for the Production Event tag Select @Max = Max(dValue) From Local_SQLHistorian Where Tag_Id = '1'

Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue, dQuality) Values('1','Production Events',Null, Null, Getdate(),Null,@Max+1,0)End

-- If the Batch allready exist, send error message and returnIf @BatchExist 0Begin Select 'Batch allready exists' as Message ReturnEnd

-- Send success messageSelect 'Success Updating: ' + @BatchNum as Message

GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO

GRANT EXECUTE ON [dbo].[spLocal_InsertBatch] TO [public]GO

GRANT EXECUTE ON [dbo].[spLocal_InsertBatch] TO [ProficyDBO]GO

GRANT EXECUTE ON [dbo].[spLocal_InsertBatch] TO [comxclient]GO

GRANT EXECUTE ON [dbo].[spLocal_InsertBatch] TO [ProficyDBO2]GO

GRANT EXECUTE ON [dbo].[spLocal_InsertBatch] TO [ProficyConnect]GO

_1183198606/SQL Historian.zip

SQL Historian.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Local_SQLHistorian]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[Local_SQLHistorian]GO

CREATE TABLE [dbo].[Local_SQLHistorian] ([Tag_Id] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[sDescription] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[sEngUnits] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[Float] [float] NULL ,[tTimeStamp] [datetime] NULL ,[sValue] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,[dValue] [float] NULL ,[dQuality] [int] NULL ) ON [PRIMARY]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_SQLHistorian] TO [public]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_SQLHistorian] TO [ProficyDBO]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_SQLHistorian] TO [comxclient]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_SQLHistorian] TO [ProficyDBO2]GO

GRANT REFERENCES , SELECT , UPDATE , INSERT , DELETE ON [dbo].[Local_SQLHistorian] TO [ProficyConnect]GO