added LSL2 stored procedures
This commit is contained in:
241
LSL2/STPROC/TEST_OBJ_WO_REACT.txt
Normal file
241
LSL2/STPROC/TEST_OBJ_WO_REACT.txt
Normal file
@ -0,0 +1,241 @@
|
||||
COMPILE ROUTINE TEST_OBJ_WO_REACT(Dummy)
|
||||
ROWDEF(CHARSTR)
|
||||
|
||||
DECLARE SUBROUTINE Set_Status, Send_Info, Send_Dyn, ErrMsg, obj_WO_React, obj_WO_Mat_QA,Rlist
|
||||
DECLARE FUNCTION Get_Status,obj_WO_Log, Send_Dyn, obj_WO_Mat, obj_Tables, obj_WO_React,Collect.IXVals
|
||||
|
||||
$INSERT WO_REACT_EQUATES
|
||||
$INSERT RDS_EQUATES
|
||||
$INSERT WO_LOG_EQUATES
|
||||
|
||||
EQU TARGET_ACTIVELIST$ TO 5
|
||||
|
||||
OPEN 'WO_REACT' TO WOReactTable ELSE
|
||||
DEBUG
|
||||
GOTO Bail
|
||||
END
|
||||
|
||||
OPEN 'WO_MAT_QA' TO WOMatQATable ELSE
|
||||
DEBUG
|
||||
GOTO Bail
|
||||
END
|
||||
|
||||
|
||||
|
||||
WONo = 159870
|
||||
|
||||
|
||||
SelectSent = 'SELECT WO_MAT WITH MET_PROFILE NE "" BY WO_NO'
|
||||
|
||||
RList(SelectSent,TARGET_ACTIVELIST$)
|
||||
|
||||
IF Get_Status(errCode) THEN
|
||||
DEBUG
|
||||
GOTO Bail
|
||||
END
|
||||
|
||||
ExistWONos = Collect.IXVals('WO_MAT_QA','WO_NO')
|
||||
|
||||
|
||||
Done = 0
|
||||
RecCnt = 1
|
||||
|
||||
|
||||
WONos = ''
|
||||
WOCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT WOMatKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
WONo = WOMatKey[1,'*']
|
||||
LOCATE WONo IN WONos BY 'DR' USING @VM SETTING Pos ELSE
|
||||
LOCATE WONo IN ExistWONos USING @FM SETTING EPos ELSE
|
||||
* Not in WONos and not in ExistWONos -> OK to add to list
|
||||
WONos = INSERT(WONos,1,Pos,0,WONo)
|
||||
WOCnt += 1
|
||||
END
|
||||
END
|
||||
RecCnt += 1
|
||||
Send_Info(RecCnt:' ':WONo)
|
||||
|
||||
REPEAT
|
||||
|
||||
|
||||
|
||||
cntWO = COUNT(WONos,@VM) + (WONos NE '')
|
||||
|
||||
DEBUG
|
||||
|
||||
FOR N = 1 TO cntWO
|
||||
|
||||
WONo = WONos<1,N>
|
||||
|
||||
Send_Info(N:' ':WONo)
|
||||
|
||||
|
||||
|
||||
* * * Clear the WO_REACT records for this WO * * *
|
||||
|
||||
RList('SELECT WO_REACT WITH WO_NO ':QUOTE(WONo),TARGET_ACTIVELIST$)
|
||||
|
||||
Done = 0
|
||||
RecCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT WOReactKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ WOReactRec FROM WOReactTable,WOReactKey THEN
|
||||
|
||||
DELETE WOReactTable,WOReactKey THEN
|
||||
Send_Dyn('Cleared WO_React: ':WOReactKey)
|
||||
END
|
||||
|
||||
END ;* End of WOReactRec read
|
||||
|
||||
REPEAT
|
||||
|
||||
* * * Clear the WO_MAT_QA records for this WO * * *
|
||||
|
||||
|
||||
|
||||
RList('SELECT WO_MAT_QA WITH WO_NO ':QUOTE(WONo),TARGET_ACTIVELIST$)
|
||||
|
||||
Done = 0
|
||||
RecCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT WOMatQAKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ WOMatQARec FROM WOMatQATable,WOMatQAKey THEN
|
||||
|
||||
DELETE WOMatQATable,WOMatQAKey THEN
|
||||
Send_Dyn('Cleared WO_Mat_QA: ':WOMatQAKey)
|
||||
END
|
||||
|
||||
END ;* End of WOReactRec read
|
||||
|
||||
REPEAT
|
||||
|
||||
|
||||
|
||||
* * * Rebuild WO scheduled WO_Mat_QA records * * *
|
||||
|
||||
|
||||
WOMatKeys = XLATE('WO_LOG',WONo,WO_LOG_WO_MAT_KEY$,'X')
|
||||
|
||||
womCnt = COUNT(WOMatKeys,@VM) + (WOMatKeys NE '')
|
||||
|
||||
FOR I = 1 TO womCnt
|
||||
|
||||
WOMatKey = WOMatKeys<1,I>
|
||||
CassNo = WOMatKey[-1,'B*']
|
||||
|
||||
Send_Dyn('Build QAMet ':WOMatKey:' ':WOMatKey)
|
||||
|
||||
obj_WO_Mat_QA('Create',WONo:@RM:CassNo)
|
||||
|
||||
IF Get_Status(errCode) THEN
|
||||
DEBUG
|
||||
END
|
||||
|
||||
|
||||
NEXT I
|
||||
|
||||
|
||||
|
||||
RList('SELECT RDS WITH WO ':QUOTE(WONo):' BY CASS_NO',TARGET_ACTIVELIST$)
|
||||
|
||||
|
||||
Done = 0
|
||||
RecCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT RDSNo ELSE Done = 1
|
||||
UNTIL Done
|
||||
RDSRec = XLATE('RDS',RDSNo,'','X')
|
||||
|
||||
StepNo = 1
|
||||
ReactNo = RDSRec<RDS_REACTOR$>
|
||||
CassNo = RDSRec<RDS_CASS_NO$>
|
||||
|
||||
IF ReactNo NE '' THEN
|
||||
|
||||
Send_Dyn(WONo:' ':StepNo:' ':ReactNo:' ':RDSNo:' ':CassNo)
|
||||
owmParms = WONo:@RM:StepNo:@RM:ReactNo:@RM:RDSNo:@RM:CassNo
|
||||
Log = obj_WO_React('AddRdsNo',owmParms)
|
||||
|
||||
IF Get_Status(errCode) THEN
|
||||
DEBUG
|
||||
ErrMsg(errCode)
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
REPEAT
|
||||
|
||||
NEXT N
|
||||
|
||||
|
||||
GOTO Bail
|
||||
|
||||
* * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* * * * * * *
|
||||
Bail:
|
||||
* * * * * * *
|
||||
|
||||
|
||||
END
|
||||
|
||||
/*
|
||||
|
||||
* * * Clear the WO_REACT records for this WO * * *
|
||||
|
||||
RList('SELECT WO_REACT WITH WO_NO ':QUOTE(WONo),TARGET_ACTIVELIST$)
|
||||
|
||||
Done = 0
|
||||
RecCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT WOReactKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ WOReactRec FROM WOReactTable,WOReactKey THEN
|
||||
|
||||
DELETE WOReactTable,WOReactKey THEN
|
||||
Send_Dyn('Cleared WO_React: ':WOReactKey)
|
||||
END
|
||||
|
||||
END ;* End of WOReactRec read
|
||||
|
||||
REPEAT
|
||||
|
||||
* * * Clear the WO_MAT_QA records for this WO * * *
|
||||
|
||||
|
||||
|
||||
RList('SELECT WO_MAT_QA WITH WO_NO ':QUOTE(WONo),TARGET_ACTIVELIST$)
|
||||
|
||||
Done = 0
|
||||
RecCnt = 0
|
||||
|
||||
LOOP
|
||||
READNEXT WOMatQAKey ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ WOMatQARec FROM WOMatQATable,WOMatQAKey THEN
|
||||
|
||||
DELETE WOMatQATable,WOMatQAKey THEN
|
||||
Send_Dyn('Cleared WO_Mat_QA: ':WOMatQAKey)
|
||||
END
|
||||
|
||||
END ;* End of WOReactRec read
|
||||
|
||||
REPEAT
|
||||
|
||||
|
||||
*/
|
||||
|
Reference in New Issue
Block a user