137 lines
4.1 KiB
Plaintext
137 lines
4.1 KiB
Plaintext
COMPILE FUNCTION obj_ADCSVR(Method,Parms)
|
|
|
|
/*
|
|
Methods for Interfacing with Metrology Data
|
|
|
|
Properties:
|
|
|
|
Methods:
|
|
|
|
GetOrder() ;* GetOrder from buffer
|
|
|
|
*/
|
|
|
|
|
|
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box, obj_WO_Log, NextKey, obj_Shipment, obj_WO_Mat, Error_Services, Metrology_Services,RenameFile
|
|
Declare function Database_Services, Environment_Services
|
|
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, Set_Property, obj_Order, Yield, Clear_Table, RList, obj_Notes
|
|
DECLARE SUBROUTINE Send_Info, Send_Event, Post_Event, obj_Notes, SetInitDirOptions, Send_Info, obj_Shipment, obj_Post_Log
|
|
DECLARE SUBROUTINE SRP_RUN_COMMAND, Error_Services, Database_Services, RTI_Set_Debugger
|
|
|
|
$INSERT MSG_EQUATES
|
|
$INSERT NOTIFICATION_EQU
|
|
$Insert LOGICAL
|
|
|
|
EQU CRCRLF$ TO \0D0D0A\
|
|
EQU CRLF$ TO \0D0A\
|
|
EQU TAB$ TO \09\
|
|
|
|
|
|
ErrTitle = 'Error in Stored Procedure "obj_ADCSVR"'
|
|
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 = 'MetrologyData' ;
|
|
*GOSUB MetrologyData
|
|
|
|
|
|
* 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
|
|
|
|
**************
|
|
MetrologyData:
|
|
**************
|
|
|
|
// Turn on debugger intercept mode.
|
|
RTI_Set_Debugger(2, 'ERROR_SERVICES')
|
|
|
|
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
|
ServiceKeyID = 'Obj_AdcSvr*MetrologyData'
|
|
Lock hSysLists, ServiceKeyID then
|
|
|
|
|
|
********************************
|
|
* Verify Metrology data folder *
|
|
********************************
|
|
DataPath = Environment_Services('GetApplicationRootPath') : '\Metrology\Data\'
|
|
InitDir DataPath:'*.txt'
|
|
FileList = DirList()
|
|
FileNames = ''
|
|
LOOP
|
|
FileName = FileList[1,@FM]
|
|
FileList[1,Col2()] = ""
|
|
|
|
LOCATE FileName IN FileNames BY 'AR' USING @FM SETTING Pos ELSE
|
|
FileNames = INSERT(FileNames,Pos,0,0,FileName)
|
|
END
|
|
UNTIL FileList = ""
|
|
REPEAT
|
|
IF FileNames[-1,1] = @FM THEN
|
|
FileNames[-1,1] = ''
|
|
END
|
|
|
|
FileCnt = COUNT(FileNames,@FM) + (FileNames NE '')
|
|
FOR FileLoopIndex = 1 TO FileCnt
|
|
***********************
|
|
* Read metrology file *
|
|
***********************
|
|
FileName = FileNames<FileLoopIndex>
|
|
OSREAD FileIn FROM DataPath:FileName THEN
|
|
SWAP '|' WITH @VM IN FileIn
|
|
SWAP CRLF$ WITH @FM IN FileIn
|
|
|
|
LOOP
|
|
LastChar = FileIn[-1,1]
|
|
UNTIL LastChar NE @FM
|
|
FileIn[-1,1] = ''
|
|
REPEAT
|
|
|
|
|
|
*************************
|
|
* Import metrology data *
|
|
*************************
|
|
|
|
|
|
Continue = Metrology_Services('ImportMetrologyRunData', FileIn)
|
|
|
|
******************************
|
|
* Delete metrology data file *
|
|
******************************
|
|
If (Continue) then
|
|
OSDELETE DataPath:FileName ;* Deletes local copy of data file
|
|
END else
|
|
ErrorMessage = Error_Services('GetMessage')
|
|
MetrologyLog = Database_Services('ReadDataRow', 'SYSLISTS', 'METROLOGY_LOG')
|
|
MetrologyLog := ErrorMessage : @FM
|
|
Database_Services('WriteDataRow', 'SYSLISTS', 'METROLOGY_LOG', MetrologyLog, True$)
|
|
end
|
|
END
|
|
NEXT FileLoopIndex
|
|
|
|
Unlock hSysLists, ServiceKeyID else Null
|
|
end
|
|
|
|
// Return to enabled debugger mode.
|
|
RTI_Set_Debugger(1)
|
|
|
|
RETURN
|