124 lines
2.6 KiB
Plaintext
124 lines
2.6 KiB
Plaintext
COMPILE FUNCTION obj_Tool(Method,Parms)
|
|
/*
|
|
Methods for TOOL table
|
|
|
|
10/19/2007 JCH - Initial Coding
|
|
|
|
Properties:
|
|
|
|
Methods:
|
|
|
|
KeysByType() ;* Returns all kesy sorted by Tool Type
|
|
Find() ;* Lookup Tool Escalation key
|
|
|
|
|
|
*/
|
|
|
|
|
|
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box, Database_Services
|
|
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, Btree.Extract, ErrMsg
|
|
DECLARE SUBROUTINE obj_Notes, Send_Info
|
|
|
|
|
|
$INSERT TOOL_ESC_EQUATES
|
|
$INSERT TOOL_EQUATES
|
|
$INSERT MSG_EQUATES
|
|
|
|
ErrTitle = 'Error in Stored Procedure "obj_Tool"'
|
|
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 = 'KeysByType' ; GOSUB KeysByType
|
|
CASE Method = 'ModeHistory' ; GOSUB ModeHistory
|
|
|
|
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
|
|
|
|
|
|
|
|
* * * * * * *
|
|
KeysByType:
|
|
* * * * * * *
|
|
|
|
Result = Database_Services('ReadDataRow', 'APP_INFO', 'TOOL_KEYS_BY_TYPE')
|
|
|
|
* OPEN 'TOOL' TO FileIn THEN
|
|
* SELECT "TOOL" BY "TOOL_TYPE" SETTING Cursor ELSE
|
|
* Status = Set_FSError()
|
|
* ErrorMsg = 'Error performing SELECT_BY agains TOOL table.'
|
|
* RETURN
|
|
* END
|
|
* END ELSE
|
|
* ErrorMsg = 'Unable to open table "TOOL" for index lookup'
|
|
* RETURN
|
|
* END
|
|
*
|
|
* ToolIDs = ''
|
|
* Done = 0
|
|
* LOOP
|
|
* READNEXT ToolID USING Cursor ELSE Done = 1
|
|
* UNTIL Done
|
|
* READ ToolRec FROM FileIn,ToolID THEN
|
|
* // Ignore tools that are Out of Service or GaN.
|
|
* IF (ToolRec<TOOL_OUT_OF_SERVICE$> NE 1) AND (ToolRec<TOOL_TOOL_PROC$> NE 'G') AND (ToolRec<TOOL_TOOL_TYPE$> NE 'Reactor') AND (ToolRec<TOOL_TOOL_TYPE$> NE 'Bottle Change') THEN
|
|
* ToolIDs := ToolID:@VM
|
|
* END
|
|
* END
|
|
* REPEAT
|
|
*
|
|
* ToolIds[-1,1] = ''
|
|
*
|
|
* Result = ToolIDs
|
|
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
ModeHistory:
|
|
* * * * * * *
|
|
|
|
ToolID = Parms[1,@RM]
|
|
|
|
IF ToolID = '' THEN RETURN
|
|
|
|
OPEN 'DICT.TOOL_LOG' TO DictVar THEN
|
|
SearchString = 'TOOL_ID':@VM:ToolID:@FM
|
|
Option = ''
|
|
Flag = ''
|
|
|
|
Btree.Extract(SearchString, 'TOOL_LOG', DictVar, TLKeys, Option, Flag)
|
|
|
|
IF Get_Status(errCode) THEN
|
|
ErrMsg(errCode)
|
|
RETURN
|
|
END
|
|
|
|
FOR I = 1 TO COUNT(TLKeys,@VM) + (TLKeys NE '')
|
|
TLKey = TLKeys<1,I>
|
|
Result = INSERT(Result,1,1,0,TLKey) ;* List is sorted ascending - rearrange to descending
|
|
NEXT I
|
|
END
|
|
|
|
RETURN
|
|
|
|
|