Fixed a bug in obj_WO_Mat_Log('Post') function that would fail to properly process transactions out of order

This commit is contained in:
Infineon\StieberD
2025-10-01 15:23:42 -07:00
parent 705237545f
commit 128bf2ef8d
6 changed files with 70 additions and 50 deletions

View File

@ -1258,10 +1258,11 @@ AddInvTrans:
END
END
OtParms = FieldStore(OtParms,@RM,4,0,WOMatRec) ;* Put record in 4th field of OtParms
Done = False$
NumAttempts = 0
OtParms = FieldStore(OtParms,@RM,4,0,WOMatRec) ;* Put record in 4th field of OtParms
LogPos = ''
ThisEntryAction = ''
Done = False$
NumAttempts = 0
Loop
NumAttempts += 1
Database_Services('WriteDataRow', 'WO_MAT', WOMatKey, WOMatRec, True$, False$, False$)
@ -1310,27 +1311,39 @@ AddInvTrans:
Logging_Services('AppendLog', objLogInvTransError, LogData, @RM, @FM)
end
WOMatRecVerify = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
LastEntryIndex = DCount(WOMatRecVerify<WO_MAT_INV_WH$>, @VM)
LastEntryAction = WOMatRecVerify<WO_MAT_INV_ACTION$, LastEntryIndex>
LastEntryLocCd = WOMatRecVerify<WO_MAT_INV_LOCATION$, LastEntryIndex>
If LastEntryAction EQ InvAction AND LastEntryLocCd = LocCd then
Done = True$
If Pos EQ -1 then
LastEntryIndex = DCount(WOMatRecVerify<WO_MAT_INV_WH$>, @VM)
LogPos = LastEntryIndex
ThisEntryAction = WOMatRecVerify<WO_MAT_INV_ACTION$, LastEntryIndex>
ThisEntryLocCd = WOMatRecVerify<WO_MAT_INV_LOCATION$, LastEntryIndex>
If ThisEntryAction EQ InvAction AND ThisEntryLocCd = LocCd then
Done = True$
end
end else
LogPos = Pos
ThisEntryAction = WOMatRecVerify<WO_MAT_INV_ACTION$, Pos>
ThisEntryLocCd = WOMatRecVerify<WO_MAT_INV_LOCATION$, Pos>
If ThisEntryAction EQ InvAction AND ThisEntryLocCd = LocCd then
Done = True$
end
end
Until ( (Done EQ True$) or (NumAttempts EQ 10) )
Repeat
If LogPos EQ '' then LogPos = DCount(WOMatRecVerify<WO_MAT_INV_DTM$>, @VM)
LogData = ''
LogData<1> = WOMatRecVerify<WO_MAT_INV_DTM$, LastEntryIndex>
LogData<1> = WOMatRecVerify<WO_MAT_INV_DTM$, LogPos>
LogData<2> = WONo
LogData<3> = CassNo
LogData<4> = WOMatRecVerify<WO_MAT_INV_USER$, LastEntryIndex>
LogData<5> = LastEntryIndex
LogData<6> = WOMatRecVerify<WO_MAT_INV_TAG$, LastEntryIndex>
LogData<7> = WOMatRecVerify<WO_MAT_INV_WH$, LastEntryIndex>
LogData<8> = WOMatRecVerify<WO_MAT_INV_LOCATION$, LastEntryIndex>
LogData<9> = LastEntryAction
LogData<10> = WOMatRecVerify<WO_MAT_INV_TOOL_ID$, LastEntryIndex>
LogData<11> = WOMatRecVerify<WO_MAT_INV_SCAN_ENTRY$, LastEntryIndex>
LogData<4> = WOMatRecVerify<WO_MAT_INV_USER$, LogPos>
LogData<5> = LogPos
LogData<6> = WOMatRecVerify<WO_MAT_INV_TAG$, LogPos>
LogData<7> = WOMatRecVerify<WO_MAT_INV_WH$, LogPos>
LogData<8> = WOMatRecVerify<WO_MAT_INV_LOCATION$, LogPos>
LogData<9> = ThisEntryAction
LogData<10> = WOMatRecVerify<WO_MAT_INV_TOOL_ID$, LogPos>
LogData<11> = WOMatRecVerify<WO_MAT_INV_SCAN_ENTRY$, LogPos>
LogData<12> = NumAttempts
Logging_Services('AppendLog', WOMatObjLog3, LogData, @RM, @FM)
@ -5735,6 +5748,3 @@ ExpCOA:
RETURN