COMPILE FUNCTION obj_MUWafers(Method,Parms)
/*
	Methods for MakeUp Wafers 
    
	11/29/2007 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    AvailWafers()					;* Returns Qty and RDSNos of available wafers
    MUWfrInventory()				;* Returns list of WO_MAT keys for all available M/U wafers in the FAB
    
   
	
*/
#pragma precomp SRP_PreCompiler


DECLARE FUNCTION    Get_Status, Msg, Utility, obj_Tables, Dialog_Box, obj_RDS, obj_Rds_Makeup, Popup, Material_Services
DECLARE SUBROUTINE  Set_Status, Msg, obj_Tables, Send_Dyn, Btree.Extract, ErrMsg
DECLARE SUBROUTINE  Send_Info, Utility

$insert LOGICAL
$INSERT WO_LOG_EQU
$INSERT WO_STEP_EQU
$INSERT RDS_EQU
$INSERT WO_MAT_EQUATES
$INSERT WM_OUT_EQUATES
$INSERT PROD_SPEC_EQU
$INSERT POPUP_EQUATES

ErrTitle = 'Error in Stored Procedure "obj_MUWafers"'
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 = 'AvailWafers'		; GOSUB AvailWafers
	
	CASE 1
		ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.'

END CASE

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

RETURN Result


* * * * * * *
AvailWafers:
* * * * * * *

    WONo		= Parms[1,@RM]
    WOLogRec	= Parms[COL2()+1,@RM]
    RetKeys		= Parms[COL2()+1,@RM]		;* Flag to return keys or just total number of wafers
    UseWOMat	= Parms[COL2()+1,@RM]

    IF WONo		= '' THEN RETURN

    MakeupWafers    = Material_Services('GetAvailableMakeupWafers', WONo, RetKeys)<1>
    If RetKeys EQ True$ then
        Result  = MakeupWafers
    end else
        Result          = 0
        For Each MakeupWaferDetail in MakeupWafers using @VM
            Result += MakeupWaferDetail<0, 0, 6>
        Next MakeupWaferDetail
    end

Return


* * * * * * *
MUWfrInventory:
* * * * * * *







RETURN
