From 128bf2ef8dc2f23ccdce077c043dac9ac6d1faae Mon Sep 17 00:00:00 2001 From: "Infineon\\StieberD" Date: Wed, 1 Oct 2025 15:23:42 -0700 Subject: [PATCH] Fixed a bug in obj_WO_Mat_Log('Post') function that would fail to properly process transactions out of order --- LSL2/STPROC/NICA_ORDERS_SERVICES.txt | 3 +- LSL2/STPROC/OBJ_WO_MAT.txt | 52 +++++++++++++++++----------- LSL2/STPROC/OI_WIZARD_ACTIONS.txt | 24 +++++++------ LSL2/STPROC/OI_WIZARD_SERVICES.txt | 21 ++++------- LSL2/STPROC/REACTOR_SERVICES.txt | 3 +- LSL2/STPROCINS/TIME_INSERTS.txt | 17 +++++++++ 6 files changed, 70 insertions(+), 50 deletions(-) create mode 100644 LSL2/STPROCINS/TIME_INSERTS.txt diff --git a/LSL2/STPROC/NICA_ORDERS_SERVICES.txt b/LSL2/STPROC/NICA_ORDERS_SERVICES.txt index fbced53..0bbdcbd 100644 --- a/LSL2/STPROC/NICA_ORDERS_SERVICES.txt +++ b/LSL2/STPROC/NICA_ORDERS_SERVICES.txt @@ -30,8 +30,7 @@ $Insert NICA_ORDERS_EQUATES $Insert NICA_CHECKLISTS_EQUATES $Insert NICA_ORDERS_CHECKLISTS_EQUATES $Insert RLIST_EQUATES - -Equ SECONDS_IN_DAY$ to 86400 +$Insert TIME_INSERTS Declare function Environment_Services, Database_Services, Error_Services, Logging_Services, Nica_Orders_Services Declare function Httpclient_Services, SRP_JSON, Reactor_Services, Reactor_Log_Services, SRP_Array, Datetime diff --git a/LSL2/STPROC/OBJ_WO_MAT.txt b/LSL2/STPROC/OBJ_WO_MAT.txt index 17e6f3d..3d99f85 100644 --- a/LSL2/STPROC/OBJ_WO_MAT.txt +++ b/LSL2/STPROC/OBJ_WO_MAT.txt @@ -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, @VM) - LastEntryAction = WOMatRecVerify - LastEntryLocCd = WOMatRecVerify - If LastEntryAction EQ InvAction AND LastEntryLocCd = LocCd then - Done = True$ + If Pos EQ -1 then + LastEntryIndex = DCount(WOMatRecVerify, @VM) + LogPos = LastEntryIndex + ThisEntryAction = WOMatRecVerify + ThisEntryLocCd = WOMatRecVerify + If ThisEntryAction EQ InvAction AND ThisEntryLocCd = LocCd then + Done = True$ + end + end else + LogPos = Pos + ThisEntryAction = WOMatRecVerify + ThisEntryLocCd = WOMatRecVerify + 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, @VM) + LogData = '' - LogData<1> = WOMatRecVerify + LogData<1> = WOMatRecVerify LogData<2> = WONo LogData<3> = CassNo - LogData<4> = WOMatRecVerify - LogData<5> = LastEntryIndex - LogData<6> = WOMatRecVerify - LogData<7> = WOMatRecVerify - LogData<8> = WOMatRecVerify - LogData<9> = LastEntryAction - LogData<10> = WOMatRecVerify - LogData<11> = WOMatRecVerify + LogData<4> = WOMatRecVerify + LogData<5> = LogPos + LogData<6> = WOMatRecVerify + LogData<7> = WOMatRecVerify + LogData<8> = WOMatRecVerify + LogData<9> = ThisEntryAction + LogData<10> = WOMatRecVerify + LogData<11> = WOMatRecVerify LogData<12> = NumAttempts Logging_Services('AppendLog', WOMatObjLog3, LogData, @RM, @FM) @@ -5735,6 +5748,3 @@ ExpCOA: RETURN - - - diff --git a/LSL2/STPROC/OI_WIZARD_ACTIONS.txt b/LSL2/STPROC/OI_WIZARD_ACTIONS.txt index 02c513b..91730e6 100644 --- a/LSL2/STPROC/OI_WIZARD_ACTIONS.txt +++ b/LSL2/STPROC/OI_WIZARD_ACTIONS.txt @@ -41,9 +41,11 @@ Function OI_Wizard_Actions(Action, CalcColName, FSList, Handle, Name, FMC, Recor ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler -$insert LOGICAL -$insert FILE.SYSTEM.EQUATES -$insert ACTION_SETUP +$Insert LOGICAL +$Insert FILE.SYSTEM.EQUATES +$Insert ACTION_SETUP +$Insert OI_WIZARD_EQUATES +$Insert TIME_INSERTS Declare function UCase, Utility_DotNet, Database_Services, Error_Services, Datetime @@ -140,12 +142,10 @@ VALID: LastDate = {CREATED_DATE} LastTime = {CREATED_TIME} end - lastDateTime = Iconv(Oconv(LastDate, 'D4/') : ' ' : Oconv(LastTime, 'MTS'), 'DTS') - SessionAge = (Datetime() - lastDateTime) * 86400 - // 600 seconds = 10 minutes - If SessionAge LT 600 then - Valid = True$ - end + LastDateTime = Iconv(Oconv(LastDate, 'D4/') : ' ' : Oconv(LastTime, 'MTS'), 'DTS') + SessionAge = (Datetime() - LastDateTime) * SECONDS_IN_DAY$ + MaxAge = HOUR_IN_SECONDS$ * 12 + If SessionAge LT MaxAge then Valid = True$ end ActionFlow = Valid @@ -164,8 +164,9 @@ EXPIRY: LastTime = {CREATED_TIME} end lastDateTime = Iconv(Oconv(LastDate, 'D4/') : ' ' : Oconv(LastTime, 'MTS'), 'DTS') - // Set expiry to last updated datetime (i.e. last time the session was updated/validated) plus 10 minutes - Expiry = lastDateTime + (600 / 86400) + // Set expiry to last updated datetime (i.e. last time the session was updated/validated) + // plus 12 hours (0.5 of a day). + Expiry = lastDateTime + 0.5 end ActionFlow = Expiry @@ -288,3 +289,4 @@ Restore_System_Variables: @FILE.ERROR = OrigFileError return + diff --git a/LSL2/STPROC/OI_WIZARD_SERVICES.txt b/LSL2/STPROC/OI_WIZARD_SERVICES.txt index 3732f72..7804739 100644 --- a/LSL2/STPROC/OI_WIZARD_SERVICES.txt +++ b/LSL2/STPROC/OI_WIZARD_SERVICES.txt @@ -1,9 +1,10 @@ Compile function OI_Wizard_Services(@Service, @Params) #pragma precomp SRP_PreCompiler -$insert LOGICAL -$insert OI_WIZARD_EQUATES -$insert OI_WIZARD_TRANSACTIONS_EQUATES +$Insert LOGICAL +$Insert OI_WIZARD_EQUATES +$Insert OI_WIZARD_TRANSACTIONS_EQUATES $Insert REACT_MODE_NG_EQUATES +$Insert TIME_INSERTS Declare function RTI_CreateGUID, Database_Services, Error_Services, SRP_Json, MemberOf Declare function OI_Wizard_Services, Reactor_Services, Reactor_Modes_Services, Datetime @@ -198,9 +199,9 @@ Service ValidateSession(OIWizardID) LastTime = OIWizardRec end lastDateTime = Iconv(Oconv(LastDate, 'D4/') : ' ' : Oconv(LastTime, 'MTS'), 'DTS') - SessionAge = (Datetime() - lastDateTime) * 86400 - // 600 seconds = 10 minutes - If SessionAge LT 600 then + SessionAge = (Datetime() - lastDateTime) * SECONDS_IN_DAY$ + MaxAge = HOUR_IN_SECONDS$ * 12 + If SessionAge LT MaxAge then OIWizardRec = Date() OIWizardRec = Time() Database_Services('WriteDataRow', 'OI_WIZARD', OIWizardID, OIWizardRec) @@ -498,11 +499,3 @@ Service ConvertMVTransactionToJSON(TransactionID, mvTransaction, itemURL) end service - - - - - - - - diff --git a/LSL2/STPROC/REACTOR_SERVICES.txt b/LSL2/STPROC/REACTOR_SERVICES.txt index 658909b..cc568a2 100644 --- a/LSL2/STPROC/REACTOR_SERVICES.txt +++ b/LSL2/STPROC/REACTOR_SERVICES.txt @@ -58,9 +58,9 @@ $Insert NICA_ORDERS_EQUATES $Insert REACTOR_INJECTOR_SETTINGS_EQUATES $Insert REACTOR_RATIOS_EQUATES $Insert REACT_STATE_EQUATES +$Insert TIME_INSERTS Equ WOCust$ to 2 -Equ SECONDS_IN_DAY$ to 86400 // Uptime Percentage Equates Equ PRODUCTIVE$ to 1 @@ -4515,4 +4515,3 @@ ClearCursors: return - diff --git a/LSL2/STPROCINS/TIME_INSERTS.txt b/LSL2/STPROCINS/TIME_INSERTS.txt new file mode 100644 index 0000000..54820d7 --- /dev/null +++ b/LSL2/STPROCINS/TIME_INSERTS.txt @@ -0,0 +1,17 @@ +Compile Insert TIME_INSERTS +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +#IFNDEF _TIME_INSERTS_ +#DEFINE _TIME_INSERTS_ +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + + Equ SECONDS_IN_DAY$ to 86400 + Equ HOUR_IN_SECONDS$ to 3600 + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +#ENDIF +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +