updated WO_MAT and WM_IN actions to mark cassettes as processed when cassettes have a quantity of zero
This commit is contained in:
@ -117,160 +117,160 @@ RETURN Result
|
||||
* * * * * * *
|
||||
OpenTable:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
OPEN TableName TO TableVar THEN
|
||||
Result = TableVar
|
||||
Parms = FieldStore(Parms,@RM,3,1,TableVar) ;* Added 1/22/2007 JCH
|
||||
END ELSE
|
||||
ErrorMsg = 'Unable to open Table ':QUOTE(TableName)
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
OPEN TableName TO TableVar THEN
|
||||
Result = TableVar
|
||||
Parms = FieldStore(Parms,@RM,3,1,TableVar) ;* Added 1/22/2007 JCH
|
||||
END ELSE
|
||||
ErrorMsg = 'Unable to open Table ':QUOTE(TableName)
|
||||
END
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
* * * * * * *
|
||||
ReadRec:
|
||||
* * * * * * *
|
||||
|
||||
GOSUB LockRec
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
|
||||
* * * * * * *
|
||||
|
||||
GOSUB LockRec
|
||||
|
||||
IF ErrorMsg NE '' THEN RETURN
|
||||
|
||||
* * * * * * *
|
||||
ReadOnlyRec:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN
|
||||
GOSUB OpenTable
|
||||
IF ErrorMsg THEN RETURN
|
||||
END
|
||||
|
||||
READ TableRec FROM TableVar,TableKey THEN
|
||||
Result = TableRec
|
||||
END ELSE
|
||||
// Log failure to read
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = @User4
|
||||
LogData<3> = Method
|
||||
LogData<4> = TableName
|
||||
LogData<5> = TableKey
|
||||
LogData<6> = 'Error code: ':@FILE_ERROR<1>:' Error message: ':@FILE_ERROR<2>:' Error detail: ':@FILE_ERROR<3>
|
||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||
|
||||
IF @FILE_ERROR<1> = 100 THEN
|
||||
* Record doesn't exist
|
||||
* 04/20/2021 - DJS - Moved unlock call outside of this specific error condition so that the record is always
|
||||
* unlocked if the record fails to be read.
|
||||
* GOSUB UnlockRec
|
||||
Null
|
||||
END ELSE
|
||||
Set_FSError()
|
||||
ErrorMsg = 'Record ':QUOTE(TableKey):' not found in Table ':QUOTE(TableName)
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN
|
||||
GOSUB OpenTable
|
||||
IF ErrorMsg THEN RETURN
|
||||
END
|
||||
Result = ''
|
||||
|
||||
If ( (TableName NE '') and (TableKey NE '') ) then
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
end
|
||||
|
||||
END
|
||||
|
||||
|
||||
READ TableRec FROM TableVar,TableKey THEN
|
||||
Result = TableRec
|
||||
END ELSE
|
||||
// Log failure to read
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDTM
|
||||
LogData<2> = @User4
|
||||
LogData<3> = Method
|
||||
LogData<4> = TableName
|
||||
LogData<5> = TableKey
|
||||
LogData<6> = 'Error code: ':@FILE_ERROR<1>:' Error message: ':@FILE_ERROR<2>:' Error detail: ':@FILE_ERROR<3>
|
||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||
|
||||
IF @FILE_ERROR<1> = 100 THEN
|
||||
* Record doesn't exist
|
||||
* 04/20/2021 - DJS - Moved unlock call outside of this specific error condition so that the record is always
|
||||
* unlocked if the record fails to be read.
|
||||
* GOSUB UnlockRec
|
||||
Null
|
||||
END ELSE
|
||||
Set_FSError()
|
||||
ErrorMsg = 'Record ':QUOTE(TableKey):' not found in Table ':QUOTE(TableName)
|
||||
END
|
||||
Result = ''
|
||||
|
||||
If ( (TableName NE '') and (TableKey NE '') ) then
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
end
|
||||
|
||||
END
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
WriteRec:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
|
||||
TestRec = TableRec
|
||||
|
||||
CONVERT @SVM:@VM:@FM TO '' IN TestRec
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF TestRec = '' THEN
|
||||
DELETE TableVar,TableKey ELSE Null
|
||||
* ErrorMsg = 'Blank table rec with ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'; *added 4/9/21 for debugging
|
||||
* Set_FSError()
|
||||
END ELSE
|
||||
Set_Status(0)
|
||||
rv = Get_Status(errCode)
|
||||
WRITE TableRec ON TableVar,TableKey THEN
|
||||
rv = Get_Status(errCode)
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
|
||||
TestRec = TableRec
|
||||
|
||||
CONVERT @SVM:@VM:@FM TO '' IN TestRec
|
||||
|
||||
IF TestRec = '' THEN
|
||||
DELETE TableVar,TableKey ELSE Null
|
||||
* ErrorMsg = 'Blank table rec with ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'; *added 4/9/21 for debugging
|
||||
* Set_FSError()
|
||||
END ELSE
|
||||
ErrorMsg = 'Unable to write ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'
|
||||
Set_Status(0)
|
||||
rv = Get_Status(errCode)
|
||||
WRITE TableRec ON TableVar,TableKey THEN
|
||||
rv = Get_Status(errCode)
|
||||
END ELSE
|
||||
ErrorMsg = 'Unable to write ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
If ( (TableName NE '') and (TableKey NE '') ) then
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
end
|
||||
|
||||
END
|
||||
|
||||
If ( (TableName NE '') and (TableKey NE '') ) then
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
end
|
||||
|
||||
END
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
WriteOnlyRec:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
|
||||
TestRec = TableRec
|
||||
|
||||
CONVERT @SVM:@VM:@FM TO '' IN TestRec
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF TestRec = '' THEN
|
||||
DELETE TableVar,TableKey ELSE Null
|
||||
END ELSE
|
||||
WRITE TableRec ON TableVar,TableKey ELSE
|
||||
ErrorMsg = 'Unable to write ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
|
||||
TestRec = TableRec
|
||||
|
||||
CONVERT @SVM:@VM:@FM TO '' IN TestRec
|
||||
|
||||
IF TestRec = '' THEN
|
||||
DELETE TableVar,TableKey ELSE Null
|
||||
END ELSE
|
||||
WRITE TableRec ON TableVar,TableKey ELSE
|
||||
ErrorMsg = 'Unable to write ':QUOTE(TableKey):' on ':QUOTE(TableName):' table.'
|
||||
END
|
||||
END
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
DeleteRec:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
DELETE TableVar,TableKey THEN
|
||||
GOSUB UnlockRec
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF ErrorMsg = '' THEN
|
||||
DELETE TableVar,TableKey THEN
|
||||
GOSUB UnlockRec
|
||||
END
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
@ -278,117 +278,114 @@ RETURN
|
||||
* * * * * * *
|
||||
LockRec:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
LockData = ''
|
||||
Locked = FALSE$
|
||||
RetryCnt = 0
|
||||
|
||||
LOOP
|
||||
|
||||
LOCK TableVar,TableKey THEN
|
||||
Locked = TRUE$
|
||||
END ELSE
|
||||
|
||||
BEGIN CASE
|
||||
CASE @FILE_ERROR NE ''
|
||||
Set_FSError()
|
||||
ErrorMsg = 'Unable to Lock ':QUOTE(TableKey):' in Table ':QUOTE(TableName)
|
||||
|
||||
CASE Get_Status(errCode)
|
||||
ErrorMsg = QUOTE(TableKey):' in Table ':QUOTE(TableName):' Locked by another workstation.'
|
||||
|
||||
CASE 1
|
||||
ErrorMsg = QUOTE(TableKey):' in Table ':QUOTE(TableName):' Locked by This workstation.'
|
||||
|
||||
END CASE
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
LockData = ''
|
||||
Locked = FALSE$
|
||||
RetryCnt = 0
|
||||
|
||||
LOOP
|
||||
|
||||
RetryCnt += 1
|
||||
END
|
||||
|
||||
UNTIL Locked OR RetryCnt = 10 REPEAT
|
||||
|
||||
|
||||
LOCK TableVar,TableKey THEN
|
||||
Locked = TRUE$
|
||||
END ELSE
|
||||
|
||||
BEGIN CASE
|
||||
CASE @FILE_ERROR NE ''
|
||||
Set_FSError()
|
||||
ErrorMsg = 'Unable to Lock ':QUOTE(TableKey):' in Table ':QUOTE(TableName)
|
||||
|
||||
CASE Get_Status(errCode)
|
||||
ErrorMsg = QUOTE(TableKey):' in Table ':QUOTE(TableName):' Locked by another workstation.'
|
||||
|
||||
CASE 1
|
||||
ErrorMsg = QUOTE(TableKey):' in Table ':QUOTE(TableName):' Locked by This workstation.'
|
||||
|
||||
END CASE
|
||||
|
||||
RetryCnt += 1
|
||||
END
|
||||
|
||||
UNTIL Locked OR RetryCnt = 10 REPEAT
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
UnlockRec:
|
||||
* * * * * * *
|
||||
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
|
||||
|
||||
RecordLocked = Database_Services('IsKeyIDLocked', TableName, TableKey, False$)
|
||||
If RecordLocked EQ True$ then Database_Services('ReleaseKeyIDLock', TableName, TableKey)
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
LockSet:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
TableKeys = TableKey ;* Pass in @VM'd list of keys In TableKey
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF TableKeys = '' THEN RETURN
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
LockedTableKeys = ''
|
||||
|
||||
FOR I = 1 TO COUNT(TableKeys,@VM) + (TableKeys NE '')
|
||||
TableKey = TableKeys<1,I>
|
||||
GOSUB LockRec
|
||||
|
||||
If Locked THEN
|
||||
LockedTableKeys<1,-1> = TableKey
|
||||
End ELSE
|
||||
For N = 1 To Count(LockedTableKeys,@VM) + (LockedTableKeys NE '')
|
||||
TableKey = LockedTableKeys<1,N>
|
||||
Gosub UnlockRec
|
||||
Next N
|
||||
End
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN GOSUB OpenTable
|
||||
|
||||
TableKeys = TableKey ;* Pass in @VM'd list of keys In TableKey
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF TableKeys = '' THEN RETURN
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
LockedTableKeys = ''
|
||||
|
||||
FOR I = 1 TO COUNT(TableKeys,@VM) + (TableKeys NE '')
|
||||
TableKey = TableKeys<1,I>
|
||||
GOSUB LockRec
|
||||
|
||||
If Locked THEN
|
||||
LockedTableKeys<1,-1> = TableKey
|
||||
End ELSE
|
||||
For N = 1 To Count(LockedTableKeys,@VM) + (LockedTableKeys NE '')
|
||||
TableKey = LockedTableKeys<1,N>
|
||||
Gosub UnlockRec
|
||||
Next N
|
||||
End
|
||||
|
||||
NEXT I
|
||||
|
||||
Result = TableVar
|
||||
|
||||
NEXT I
|
||||
|
||||
Result = TableVar
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
UnlockSet:
|
||||
* * * * * * *
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN ErrorMsg = 'Null parameter "TableVar" passed to subroutine'
|
||||
|
||||
LockedTableKeys = TableKey ;* Pass in @VM'd list of keys In TableKey
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF LockedTableKeys = '' THEN RETURN
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
|
||||
FOR I = 1 TO COUNT(LockedTableKeys,@VM) + (LockedTableKeys NE '')
|
||||
TableKey = LockedTableKeys<1,I>
|
||||
GOSUB UnlockRec
|
||||
NEXT I
|
||||
|
||||
|
||||
IF TableName = '' THEN ErrorMsg = 'Null parameter "TableName" passed to subroutine'
|
||||
IF TableKey = '' THEN ErrorMsg = 'Null parameter "TableKey" passed to subroutine'
|
||||
IF TableVar = '' THEN ErrorMsg = 'Null parameter "TableVar" passed to subroutine'
|
||||
|
||||
LockedTableKeys = TableKey ;* Pass in @VM'd list of keys In TableKey
|
||||
|
||||
IF ErrorMsg THEN RETURN
|
||||
|
||||
IF LockedTableKeys = '' THEN RETURN
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
|
||||
FOR I = 1 TO COUNT(LockedTableKeys,@VM) + (LockedTableKeys NE '')
|
||||
TableKey = LockedTableKeys<1,I>
|
||||
GOSUB UnlockRec
|
||||
NEXT I
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user