COMPILE FUNCTION obj_Recipe(Method,Parms)
/*
	Methods for Recipe table
	Used to wrap messy original file in something cleaner while working on a transistion
    
	02/09/2006 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    GetSpecs(RecipeNo,LayerSet)					;* Returns MinMax values
	
*/


DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box
DECLARE SUBROUTINE  Set_Status, Msg, obj_Tables, Make.List, Btree.Extract

$INSERT MSG_EQUATES
$INSERT RECIPE_EQUATES
$INSERT RECIPE_PARMS_EQU
$INSERT RECIPE_LAYER_INFO_EQU
						

ErrTitle = 'Error in Stored Procedure "obj_Recipe"'
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 = 'GetLimits'	; GOSUB GetLimits
	
	CASE 1

END CASE

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

RETURN Result


* * * * * * *
GetLimits:
* * * * * * *

* This is NON-STANDARD - Data is returned in internal format

RecipeNo		= Parms[1,@RM]
PsnID			= Parms[COL2()+1,@RM]
LayerSet		= Parms[COL2()+1,@RM]

IF RecipeNo = '' THEN RETURN
IF PsnID	= '' THEN RETURN
IF LayerSet = '' THEN RETURN

LayerNo	= LayerSet<1,1>		;* Start out here

IF INDEX(LayerNo,'L',1) THEN
	CONVERT 'L' TO '' IN LayerNo
END ELSE
	LayerNo += 1
END


RecipeRec = XLATE( 'RECIPE', RecipeNo, '', 'X' )

IF LayerNo = 1 THEN

	LOCATE PSNId IN RecipeRec<RECIPE_PROD_SPEC_IDS$> USING @VM SETTING RPos ELSE
		RPos = 1
	END
	
	Result<RP_DEPOSIT_TIME_MIN$>	= RecipeRec<RECIPE_DEP_TIME_MIN$,RPos>
	Result<RP_DEPOSIT_TIME_MAX$>	= RecipeRec<RECIPE_DEP_TIME_MAX$,RPos>
	
	Result<RP_DILUENT_FLOW_MIN$>	= RecipeRec<RECIPE_DILUENT_MIN$,RPos>
	Result<RP_DILUENT_FLOW_MAX$>	= RecipeRec<RECIPE_DILUENT_MAX$,RPos>
	
	Result<RP_DOPANT_FLOW_MIN$>		= RecipeRec<RECIPE_DOPANT_FLOW_MIN$,RPos>
	Result<RP_DOPANT_FLOW_MAX$>		= RecipeRec<RECIPE_DOPANT_FLOW_MAX$,RPos>
	
	Result<RP_HCL_FLOW_MIN$>		= RecipeRec<RECIPE_HCL_FLOW_MIN$,RPos>
	Result<RP_HCL_FLOW_MAX$>		= RecipeRec<RECIPE_HCL_FLOW_MAX$,RPos>
	
	Result<RP_BAKE_TIME_MIN$>		= RecipeRec<RECIPE_BAKE_TIME_MIN$,RPos>
	Result<RP_BAKE_TIME_MAX$>		= RecipeRec<RECIPE_BAKE_TIME_MAX$,RPos>
	
	Result<RP_H2_FLOW_MIN$>			= RecipeRec<RECIPE_H2_FLOW_MIN$,RPos>
	Result<RP_H2_FLOW_MAX$>			= RecipeRec<RECIPE_H2_FLOW_MAX$,RPos>
	
	Result<RP_TCS_FLOW_MIN$>		= RecipeRec<RECIPE_TCS_FLOW_MIN$,RPos>
	Result<RP_TCS_FLOW_MAX$>		= RecipeRec<RECIPE_TCS_FLOW_MAX$,RPos>
	
	Result<RP_DCS_FLOW_MIN$>		= RecipeRec<RECIPE_DCS_FLOW_MIN$,RPos>
	Result<RP_DCS_FLOW_MAX$>		= RecipeRec<RECIPE_DCS_FLOW_MAX$,RPos>
	
	Result<RP_AUX1_FLOW_MIN$>		= RecipeRec<RECIPE_AUX1_MIN$,RPos>
	Result<RP_AUX1_FLOW_MAX$>		= RecipeRec<RECIPE_AUX1_MAX$,RPos>
	
	Result<RP_AUX2_FLOW_MIN$>		= RecipeRec<RECIPE_AUX2_MIN$,RPos>
	Result<RP_AUX2_FLOW_MAX$>		= RecipeRec<RECIPE_AUX2_MAX$,RPos>
	
	Result<RP_FOFFSET_MIN$>			= RecipeRec<RECIPE_F_OFFSET_MIN$,RPos>
	Result<RP_FOFFSET_MAX$>			= RecipeRec<RECIPE_F_OFFSET_MAX$,RPos>
	
	Result<RP_SOFFSET_MIN$>			= RecipeRec<RECIPE_S_OFFSET_MIN$,RPos>
	Result<RP_SOFFSET_MAX$>			= RecipeRec<RECIPE_S_OFFSET_MAX$,RPos>
	
	Result<RP_ROFFSET_MIN$>			= RecipeRec<RECIPE_R_OFFSET_MIN$,RPos>
	Result<RP_ROFFSET_MAX$>			= RecipeRec<RECIPE_R_OFFSET_MAX$,RPos>
	
	Result<RP_ETCH1_MIN$>			= RecipeRec<RECIPE_ETCH1_MIN$,RPos>
	Result<RP_ETCH1_MAX$>			= RecipeRec<RECIPE_ETCH1_MAX$,RPos>
	
	Result<RP_ETCH2_MIN$>			= RecipeRec<RECIPE_ETCH2_MIN$,RPos>
	Result<RP_ETCH2_MAX$>			= RecipeRec<RECIPE_ETCH2_MAX$,RPos>
	
	Result<RP_ETCH3_MIN$> = RecipeRec<RECIPE_ETCH3_MIN$,RPos>
	Result<RP_ETCH3_MAX$> = RecipeRec<RECIPE_ETCH3_MAX$,RPos>
	
	Result<RP_DOPANT$>				= RecipeRec<RECIPE_EPI_DOPANT$>
	Result<RP_EPI_DILUENT$>			= RecipeRec<RECIPE_EPI_DILUENT$>
	
	Result<RP_SUSC_ETCH_MIN$>		= RecipeRec<RECIPE_SUSC_ETCH_MIN$,RPos>
	Result<RP_SUSC_ETCH_MAX$>		= RecipeRec<RECIPE_SUSC_ETCH_MAX$,RPos>

	Result<RP_UL_TEMP_MIN$>		    = RecipeRec<RECIPE_UL_TEMP_MIN$,RPos>
	Result<RP_UL_TEMP_MAX$>		    = RecipeRec<RECIPE_UL_TEMP_MAX$,RPos>

END ELSE
	RecipeLayerInfo = RecipeRec<RECIPE_LAYER_INFO$>
	
	CONVERT CHAR(248) TO @FM IN RecipeLayerInfo
	
	Dopant			= RecipeLayerInfo<LayerNo - 1,RecLEpiDopant$>				
	DepTimeMin		= RecipeLayerInfo<LayerNo - 1,RecLEpiDepTimeMin$>
	DepTimeMax		= RecipeLayerInfo<LayerNo - 1,RecLEpiDepTimeMax$> 
	Diluent			= RecipeLayerInfo<LayerNo - 1,RecLEpiDiluent$>
	DopantFlowMin	= RecipeLayerInfo<LayerNo - 1,RecLEpiDopantFlowMin$>
	DopantFlowMax	= RecipeLayerInfo<LayerNo - 1,RecLEpiDopantFlowMax$>
	FrontOffsetMin  = RecipeLayerInfo<LayerNo - 1,RecLEpiFrontOffestMin$>
	FrontOffsetMax  = RecipeLayerInfo<LayerNo - 1,RecLEpiFrontOffestMax$>
	SideOffsetMin   = RecipeLayerInfo<LayerNo - 1,RecLEpiSideOffestMin$>
	SideOffsetMax   = RecipeLayerInfo<LayerNo - 1,RecLEpiSideOffestMax$>
	RearOffsetMin   = RecipeLayerInfo<LayerNo - 1,RecLEpiRearOffestMin$>
	RearOffsetMax   = RecipeLayerInfo<LayerNo - 1,RecLEpiRearOffestMax$>
	H2FlowMin   	= RecipeLayerInfo<LayerNo - 1,RecLEpiH2FlowMin$>
	H2FlowMax   	= RecipeLayerInfo<LayerNo - 1,RecLEpiH2FlowMax$>
	TCSFlowMin   	= RecipeLayerInfo<LayerNo - 1,RecLEpiTCSFlowMin$>
	TCSFlowMax   	= RecipeLayerInfo<LayerNo - 1,RecLEpiTCSFlowMax$>
				
	Result<RP_DEPOSIT_TIME_MIN$>	= DepTimeMin
	Result<RP_DEPOSIT_TIME_MAX$>	= DepTimeMax
	Result<RP_DOPANT_FLOW_MIN$> 	= DopantFlowMin
	Result<RP_DOPANT_FLOW_MAX$> 	= DopantFlowMax
	Result<RP_DOPANT$>				= Dopant	
	Result<RP_EPI_DILUENT$>			= Diluent
	Result<RP_FOFFSET_MIN$> 		= FrontOffsetMin
	Result<RP_FOFFSET_MAX$> 		= FrontOffsetMax
	Result<RP_SOFFSET_MIN$> 		= SideOffsetMin
	Result<RP_SOFFSET_MAX$> 		= SideOffsetMax
	Result<RP_ROFFSET_MIN$> 		= RearOffsetMin
	Result<RP_ROFFSET_MAX$> 		= RearOffsetMax
	Result<RP_H2_FLOW_MIN$> 		= H2FlowMin
	Result<RP_H2_FLOW_MAX$> 		= H2FlowMax
	Result<RP_TCS_FLOW_MIN$>		= TCSFlowMin
	Result<RP_TCS_FLOW_MAX$>		= TCSFlowMax

END

RETURN

