COMPILE FUNCTION obj_React_Reads(Method,Parms)

/*
	Methods for REACT_READS table
    
	09/25/2009 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    Create(DataStruct)		;* Create new record
	
	
*/


DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey,  obj_Prod_Spec, Send_Dyn
DECLARE FUNCTION obj_RDS_Test
DECLARE SUBROUTINE  Set_Status, Msg, obj_Tables, Send_Dyn, obj_WO_Step, obj_RDS_Layer, obj_RDS_Test, obj_WM_In
DECLARE SUBROUTINE ErrMsg, obj_Reactor, obj_Post_Log

$INSERT MSG_EQUATES
$INSERT DICT_EQUATES

$INSERT REACT_READS_EQUATES
$INSERT REACTOR_EQUATES


EQU CRLF$	TO \0D0A\
EQU TAB$	TO CHAR(9)

$INSERT PRS_LAYER_EQU	;* Used to return obj_Prod_Spec_CI values

ErrTitle = 'Error in Stored Procedure "obj_React_Reads"'
ErrorMsg = ''

IF NOT(ASSIGNED(Method))	THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms))		THEN Parms = ''

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

Result = ''

BEGIN CASE
	CASE Method = 'Create'			; GOSUB Create
	
	CASE 1
		

END CASE

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
END

RETURN Result




* * * * * * *
Create:
* * * * * * *

ReactNo			= Parms[1,@RM]
ReadBy			= Parms[COL2()+1,@RM]
ReadDTM			= Parms[COL2()+1,@RM]
ReadWaferCnt	= Parms[COL2()+1,@RM]

IF ReactNo = ''		THEN ErrorMsg = 'Null Parameter "ReactNo" passed to routine. (':Method:')'
IF ReadBy = ''		THEN ErrorMsg = 'Null Parameter "ReadBy" passed to routine. (':Method:')'
IF ReadDTM = ''		THEN ErrorMsg = 'Null Parameter "ReadDTM" passed to routine. (':Method:')'

IF ErrorMsg NE '' THEN RETURN

thisReadDTM = ICONV(ReadDTM,'DT')

IF thisReadDTM = '' THEN
	ErrorMsg = 'Invalid parameter ReadDTM ':QUOTE(ReadDTM):' passed to routine. (':Method:')'
	RETURN
END

* Create and write the REACT_READS record *

RRKey = ReactNo:'*':thisReadDTM

ReactReadRec = ''

ReactReadRec<REACT_READS_WAFER_CNT$>	= ReadWaferCnt
ReactReadRec<REACT_READS_READ_BY$>		= ReadBy

obj_Tables('WriteRec','REACT_READS':@RM:RRKey:@RM:@RM:ReactReadRec)


* Add last read data to REACTOR record *

FieldNos = ''
FieldVals = ''

IF ReadWaferCnt NE '' THEN
	FieldNos<1,-1>	= REACTOR_LAST_READ_WFRS_DTM$
	FieldVals<1,-1> = thisReadDTM
END

oPLParms  = 'REACTOR':@RM
oPLParms := ReactNo:@RM
oPLParms := FieldNos:@RM
oPLParms := FieldVals
	
obj_Post_Log('Create',oPLParms)		;* Place update data into POST_LOG input queue
	
IF Get_Status(errCode) THEN ErrMsg(errCode)

RETURN



