Bug fix to ensure correct WM_OUT key is identified and created. Added services to ensure WM_IN and WM_OUT indexes are maintained.

This commit is contained in:
Infineon\StieberD
2025-07-31 13:55:07 -07:00
parent 898f21b73d
commit 3186ec1ad6
4 changed files with 546 additions and 74 deletions

View File

@ -59,8 +59,10 @@ $Insert COMPANY_EQUATES
$Insert RETURN_TO_FAB_LOTS_EQUATES
Declare function Database_Services, SRP_JSON, Error_Services, Clean_Insp_Services, WO_Mat_QA_Services
Declare function PSN_Services, SRP_Rotate_Array, Datetime, Return_To_Fab_Services
Declare function PSN_Services, SRP_Rotate_Array, Datetime, Return_To_Fab_Services, Environment_Services
Declare function Logging_Services
Declare subroutine Database_Services, SRP_JSON, Error_Services, Extract_Si_Keys, Set_Status, obj_wo_mat_log
Declare subroutine Logging_Services
GoToService
@ -436,8 +438,210 @@ Service SetVoidFlag(WMOutKey, Username)
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
Service VerifyWoStepWMOKeyIndex(WMOKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_OUT'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_STEP{WM_OUT_KEYS} Log.csv'
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result'
objVerifyWMOKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMOKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMOKey NE '' then
If RowExists('WM_OUT', WMOKey) then
WOStepKey = Field(WMOKey, '*', 1, 2)
If WOStepKey NE '' then
WOStepWMOKeys = Xlate('WO_STEP', WOStepKey, 'WM_OUT_KEYS', 'X')
LogData<3> = WOStepKey
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
Locate WMOKey in WOStepWMOKeys using @VM setting vPos else
LogData<4> = 'WMOKey missing from WO_STEP record. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
// Add index transaction to update WM_OUT_KEYS relational index (target WO_STEP table)
IndexTransactionRow = 'WO_STEP*WM_OUT_KEYS*AR':@FM:WMOKey:@FM:"":@FM:WOStepKey:@FM
Open "!WM_OUT" to BangTable then
Lock BangTable, 0 then
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
PendingTrans := IndexTransactionRow
Write PendingTrans on BangTable, 0 then
LogData<4> = 'Index transaction successfully added.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
end
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end else
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
end
end else
ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end
end
end else
LogData<4> = 'WO_STEP key for WM_OUT ':WMOKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end
end
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
Service VerifyWOLogWMOKeyIndex(WMOKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_OUT'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WM_OUT{WO_NO} Log.csv'
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result'
objVerifyWMOWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMOKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMOKey NE '' then
If RowExists('WM_OUT', WMOKey) then
WONo = Field(WMOKey, '*', 1, 1)
If WONo NE '' then
WOLogRDSKeys = ''
Extract_Si_Keys('WM_OUT', 'WO_NO', WONo, WOLogRDSKeys)
LogData<3> = WONo
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
Locate WMOKey in WOLogRDSKeys using @VM setting vPos else
LogData<4> = 'WMOKey missing from Btree index. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
// Add index transaction to update WO_NO btree index
IndexTransactionRow = 'WO_NO':@FM:WMOKey:@FM:"":@FM:WONo:@FM
Open "!WM_OUT" to BangTable then
Lock BangTable, 0 then
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
PendingTrans := IndexTransactionRow
Write PendingTrans on BangTable, 0 then
LogData<4> = 'Index transaction successfully added.'
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_OUT. ':WMOKey
end
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey
end else
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_OUT to add index transaction. ':WMOKey
end
end else
ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey
end
end
end else
LogData<4> = 'WONo for WM_OUT ':WMOKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Null WMOKey passed in.'
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
Service VerifyWOMatWMOKeyIndex(WMOKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_OUT'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_MAT{WMO_KEY} Log.csv'
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOMatKey':@FM:'Result'
objVerifyWOMatWmoKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMOKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMOKey NE '' then
If RowExists('WM_OUT', WMOKey) then
WOMatKey = Field(WMOKey, '*', 1, 1):'*':Field(WMOKey, '*', 3, 1)
If WOMatKey NE '' then
WOMatWMOKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X')
LogData<3> = WOMatKey
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
If WOMatWMOKey EQ '' then
LogData<4> = 'WMOKey missing from WO_MAT record. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
// Add index transaction to update WMO_KEY relational index (target WO_MAT table)
IndexTransactionRow = 'WO_MAT*WMO_KEY*TOP':@FM:WMOKey:@FM:"":@FM:WOMatKey:@FM
Open "!WM_OUT" to BangTable then
Lock BangTable, 0 then
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
PendingTrans := IndexTransactionRow
Write PendingTrans on BangTable, 0 then
LogData<4> = 'Index transaction successfully added.'
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
end
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end else
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
end
end else
ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end
end
end else
LogData<4> = 'WO_MAT key for WM_OUT ':WMOKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
end
end
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service