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

@ -19,11 +19,11 @@ Compile Function obj_WM_Out(Method,Parms)
Declare Function Get_Status, Msg, Utility, obj_Tables, NextKey, obj_WO_Verify, obj_Prod_Spec, Send_Dyn, obj_RDS_Makeup
Declare Function obj_RDS2, obj_WM_Out, Delete, Signature_Services, Environment_Services, Logging_Services
Declare Function Database_Services
Declare Function Database_Services, SRP_Array
Declare Subroutine Set_Status, Msg, obj_Tables, Send_Dyn, obj_WO_Step, obj_RDS_Layer, obj_RDS_Test, Btree.Extract
Declare Subroutine Extract_SI_Keys, obj_WM_Out, obj_WO_Mat, obj_Post_Log, obj_WO_Mat_Log, ErrMsg, obj_WO_Wfr
Declare Subroutine Logging_Services, Material_Services, Database_Services, Update_Index, Work_Order_Services
Declare Subroutine Service_Services, obj_Notes
Declare Subroutine Service_Services, obj_Notes, Delay
$Insert MSG_EQUATES
$Insert APP_INSERTS
@ -40,6 +40,8 @@ $Insert CLEAN_INSP_EQUATES
$Insert WMO_WFRS_EQUATES
$Insert REACT_RUN_EQUATES
EQU NUM_RETRIES$ TO 50
ErrTitle = 'Error in Stored Procedure "obj_WM_Out"'
ErrorMsg = ''
ErrCode = ''
@ -167,14 +169,37 @@ Create:
WMOutKeys = XLATE('WO_STEP',WONo:'*':WOStep,WO_STEP_WM_OUT_KEYS$,'X')
IF WMOutKeys = '' THEN
WMOutKeys = SRP_Array('SortRows', WMOutKeys, 'AR3', 'LIST', @VM, '*')
If WMOutKeys NE '' then
LastCassNo = WMOutKeys[-1, 'B*']
end else
LastCassNo = 0
end
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
CassNo = ''
CandidateCassNo = LastCassNo + 1
Loop
CandidateWmOutKey = WONo:'*':WOStep:'*':CandidateCassNo
If Not(RowExists('WM_OUT', CandidateWmOutKey)) then
Lock hSysLists, CandidateWmOutKey then
CassNo = CandidateCassNo
end
end
Until (CassNo NE '')
CandidateCassNo += 1
Repeat
IF (CassNo EQ 1) THEN
WMOStartBox = 1
WMOStartSlot = 1
END ELSE
LastBoxOut = WMOutKeys[-1,'B':@VM]
LastWMORec = XLATE('WM_OUT',LastBoxOut,'','X')
PrevCassNo = CassNo - 1
LastBoxOut = WONo:'*':WOStep:'*':PrevCassNo
LastWMORec = XLATE('WM_OUT',LastBoxOut,'','X')
LastBoxLastSlot = LastWMORec<WM_OUT_SLOT_NO$>[-1,'B':@VM]
IF LastBoxLastSlot < CassLoadQty THEN
IF ( (LastBoxLastSlot NE '') and (LastBoxLastSlot LT CassLoadQty) ) THEN
WMOStartBox = FIELD(LastBoxOut,'*',3) ;* Start IN the last box
WMOStartSlot = LastBoxLastSlot + 1 ;* Start with first slot past current and less than Load Qty
END ELSE
@ -225,7 +250,8 @@ Create:
NumAttempts = 0
Loop
NumAttempts += 1
Database_Services('WriteDataRow', 'WM_OUT', WMOutKey, WMOutRec)
If NumAttempts GT 1 then Delay(NumAttempts)
Database_Services('WriteDataRow', 'WM_OUT', WMOutKey, WMOutRec, True$, False$, False$)
If Error_Services('HasError') then
// Log the error
LogData = ''
@ -247,9 +273,11 @@ Create:
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM)
Done = True$
end
Until ( (NumAttempts EQ 10) or (Done EQ True$) )
Until ( (NumAttempts GT NUM_RETRIES$) or (Done EQ True$) )
Repeat
Unlock hSysLists, CandidateWmOutKey else Null
WMOutRec = Database_Services('ReadDataRow', 'WM_OUT', WMOutKey)
If WMOutRec EQ '' then
// Record did not write to the database
@ -280,7 +308,6 @@ Create:
WMOCassNo += 1
WMOSlotNo = 1
REPEAT
Result = OutOnlyCassIDs
@ -1961,5 +1988,3 @@ ConvertCleanInsp:
RETURN

View File

@ -53,9 +53,8 @@ $Insert MSG_EQUATES
$Insert DICT_EQUATES
$Insert WM_IN_EQUATES
Declare function Database_Services
Declare function PSN_Services, SRP_Rotate_Array, Datetime
Declare subroutine Database_Services, Set_Status, OBJ_WO_MAT_LOG
Declare function PSN_Services, SRP_Rotate_Array, Datetime, Database_Services, Environment_Services, Logging_Services
Declare subroutine Database_Services, Set_Status, obj_Wo_Mat_Log, Logging_Services, Extract_Si_Keys
GoToService
@ -121,7 +120,9 @@ Service AddComment(WMInNo, Comment)
End Service
Service SetVoidFlag(WMInKey, Username)
ErrorMessage = ''
If RowExists('WM_IN', WMInKey) then
WMInRec = Database_Services('ReadDataRow', 'WM_IN', WMInKey, True$, 0, False$)
@ -160,7 +161,210 @@ Service SetVoidFlag(WMInKey, Username)
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
Service VerifyWoStepWMIKeyIndex(WMIKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_IN'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_IN WO_STEP{WM_IN_KEY} Log.csv'
Headers = 'Logging DTM':@FM:'WMIKey':@FM:'WOStep':@FM:'Result'
objVerifyWMIKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMIKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMIKey NE '' then
If RowExists('WM_IN', WMIKey) then
WOStepKey = Field(WMIKey, '*', 1, 2)
If WOStepKey NE '' then
WOStepWMIKeys = Xlate('WO_STEP', WOStepKey, 'WM_IN_KEYS', 'X')
LogData<3> = WOStepKey
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
Locate WMIKey in WOStepWMIKeys using @VM setting vPos else
LogData<4> = 'WMIKey missing from WO_STEP record. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
// Add index transaction to update WM_IN_KEYS relational index (target WO_STEP table)
IndexTransactionRow = 'WO_STEP*WM_IN_KEYS*AR':@FM:WMIKey:@FM:"":@FM:WOStepKey:@FM
Open "!WM_IN" 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', objVerifyWMIKeyLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey
end
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey
end else
ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey
end
end else
ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey
end
end
end else
LogData<4> = 'WO_STEP key for WM_IN ':WMIKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
end
end
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
Service VerifyWOLogWMIKeyIndex(WMIKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_IN'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_IN WM_IN{WO_NO} Log.csv'
Headers = 'Logging DTM':@FM:'WMIKey':@FM:'WOStep':@FM:'Result'
objVerifyWMIWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMIKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMIKey NE '' then
If RowExists('WM_IN', WMIKey) then
WONo = Field(WMIKey, '*', 1, 1)
If WONo NE '' then
WOLogRDSKeys = ''
Extract_Si_Keys('WM_IN', 'WO_NO', WONo, WOLogRDSKeys)
LogData<3> = WONo
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
Locate WMIKey in WOLogRDSKeys using @VM setting vPos else
LogData<4> = 'WMIKey missing from Btree index. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
// Add index transaction to update WO_NO btree index
IndexTransactionRow = 'WO_NO':@FM:WMIKey:@FM:"":@FM:WONo:@FM
Open "!WM_IN" 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', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_IN. ':WMIKey
end
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_IN to add index transaction. ':WMIKey
end else
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_IN to add index transaction. ':WMIKey
end
end else
ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_IN to add index transaction. ':WMIKey
end
end
end else
LogData<4> = 'WONo for WM_IN ':WMIKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Null WMIKey passed in.'
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
Service VerifyWOMatWMIKeyIndex(WMIKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_IN'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_IN WO_MAT{WMI_KEY} Log.csv'
Headers = 'Logging DTM':@FM:'WMIKey':@FM:'WOMatKey':@FM:'Result'
objVerifyWoMatWmiKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMIKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMIKey NE '' then
If RowExists('WM_IN', WMIKey) then
WOMatKey = Field(WMIKey, '*', 1, 1):'*':Field(WMIKey, '*', 3, 1)
If WOMatKey NE '' then
WOMatWMIKey = Xlate('WO_MAT', WOMatKey, 'WMI_KEY', 'X')
LogData<3> = WOMatKey
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
If WOMatWMIKey EQ '' then
LogData<4> = 'WMIKey missing from WO_MAT record. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
// Add index transaction to update WMI_KEY relational index (target WO_MAT table)
IndexTransactionRow = 'WO_MAT*WMI_KEY*TOP':@FM:WMIKey:@FM:"":@FM:WOMatKey:@FM
Open "!WM_IN" 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', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey
end
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey
end else
ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey
end
end else
ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey
end
end
end else
LogData<4> = 'WO_MAT key for WM_IN ':WMIKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
end
end
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service

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

View File

@ -648,7 +648,6 @@ Service ReceiveCassette(WONo, ReceiveUser, LotNo, CassQty, SubPartNo, SubVendorC
WOMatKeys = SRP_Array('SortRows', WOMatKeys, 'AR2', 'LIST', @VM, '*')
If WOMatKeys NE '' then
WOMatKeys = SRP_Array('SortRows', WOMatKeys, 'AR2', 'LIST', @VM, '*')
LastCassNo = WOMatKeys[-1, 'B*']
end else
LastCassNo = 0
@ -1894,20 +1893,22 @@ Service UpdateOpenWorkOrderStatuses()
end else
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_DEV_SERVICE_MANAGER'
end
MonaStatus = 'ok'
Server = Environment_Services('GetServer')
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Update Work Order Status Log.csv'
Headers = 'Logging DTM' : @FM : 'Work Order No' : @FM : 'Log'
objStatusLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Update Work Order Status Log.csv'
Headers = 'Logging DTM':@FM:'Server':@FM:'WONo':@FM:'Result'
objVerifyWOMatKeysLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
Server = Environment_Services('GetServer')
LogData = ''
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = 'Begin ':Service
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = Server
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
ErrorMsg = ''
OpenWoLogKeys = ''
@ -1915,46 +1916,50 @@ Service UpdateOpenWorkOrderStatuses()
Extract_Si_Keys('WO_LOG', 'CLOSE_DATE', '', OpenWoLogKeys)
If Not(Get_Status(ErrCode)) then
If OpenWoLogKeys NE '' then
For each OpenWoLogKey in OpenWoLogKeys using @VM
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderStatus':SD$:OpenWoLogKey)
If Error_Services('NoError') then
OpenWoLogKeys = SRP_Array('SortSimpleList', OpenWoLogKeys, 'AscendingNumbers', @VM)
LastOpenWoUpdated = ''
ServiceKey = UCase(Service)
If RowExists('APP_INFO', ServiceKey) then
LastOpenWoUpdated = Database_Services('ReadDataRow', 'APP_INFO', ServiceKey)
end
If (LastOpenWoUpdated NE '') then
Locate LastOpenWoUpdated in OpenWoLogKeys using @VM setting vPos then
vPos += 1
end else
vPos = 1
end
end else
vPos = 1
end
NextOpenWoLogKey = OpenWoLogKeys<0, vPos>
Database_Services('WriteDataRow', 'APP_INFO', ServiceKey, NextOpenWoLogKey, True$, False$, False$)
If NextOpenWoLogKey NE '' then
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderStatus':SD$:NextOpenWoLogKey)
If Error_Services('HasError') then
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = 'Successfully posted UpdateWorkOrderStatus procedure to PROC_QUEUE for WO_LOG ':OpenWOLogKey:'.'
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
end else
ErrorMsg = 'Error posting UpdateWorkOrderStatus procedure to PROC_QUEUE for WO_LOG ':OpenWOLogKey:'.'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = ErrorMsg
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
end
Next OpenWoLogKey
ErrorMsg = 'Error posting UpdateWorkOrderStatus request for WO_LOG ':NextOpenWoLogKey:'. ':Error_Services('GetMessage')
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
end
end else
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = 'No open work orders to update.'
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
LogData<4> = 'No open work orders to update.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end else
MonaStatus = 'critical'
ErrorMsg = 'Error calling Extract_Si_Keys. Error code: ':ErrCode:'.'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = ErrorMsg
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
LogData = ''
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<3> = 'End ':Service
Logging_Services('AppendLog', objStatusLog, LogData, @RM, @FM)
If ErrorMsg EQ '' then
MonaStatus = 'ok'
end else
MonaStatus = 'critical'
end
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
Mona_Services('PostStatus', MonaResource, StatusName, MonaStatus)
@ -2079,10 +2084,10 @@ Service UpdateOpenWorkOrderData()
end
MonaStatus = 'ok'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_MAT'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' WO_MAT WO_LOG{WO_MAT_KEY} Log.csv'
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Update Work Order Data Log.csv'
Headers = 'Logging DTM':@FM:'Server':@FM:'WONo':@FM:'Result'
objVerifyWOMatKeysLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
@ -2120,15 +2125,22 @@ Service UpdateOpenWorkOrderData()
If NextOpenWoLogKey NE '' then
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderData':SD$:NextOpenWoLogKey)
If Error_Services('HasError') then
LogData<1> = OConv(Datetime(), 'DT/^S')
ErrorMsg = 'Error posting UpdateWorkOrderData request for WO_LOG ':NextOpenWoLogKey:'. ':Error_Services('GetMessage')
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderStatus':SD$:NextOpenWoLogKey)
If Error_Services('HasError') then
LogData<1> = OConv(Datetime(), 'DT/^S')
ErrorMsg = 'Error posting UpdateWorkOrderStatus request for WO_LOG ':NextOpenWoLogKey:'. ':Error_Services('GetMessage')
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
end
If Error_Services('HasError') then
LogData<1> = OConv(Datetime(), 'DT/^S')
ErrorMsg = Error_Services('GetMessage')
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
end else
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'No open work orders to update.'
@ -2184,16 +2196,41 @@ Service UpdateWorkOrderData(WONo)
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
ErrorMsg = ''
OpenWoLogKeys = ''
ErrCode = ''
Done = False$
ErrorMsg = ''
OpenWoLogKeys = ''
ErrCode = ''
EpiPro = (Xlate('WO_LOG', WONo, 'PS_REACTOR_TYPE', 'X') _EQC 'EPP')
OrigWOLogWOMatKeys = Database_Services('ReadDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, True$, 0)
If Error_Services('NoError') then
NewWOLogWOMatKeys = ''
For CassNo = 1 to MAX_NUM_CASS$
WOMatKey = WONo:'*':CassNo
If RowExists('WO_MAT', WOMatKey) then
If EpiPro then
WMIKey = Xlate('WO_MAT', WOMatKey, 'WMI_KEY', 'X')
If (WMIKey EQ '') then
If RowExists('WM_IN', WONo:'*1*':CassNo) then
WMIKey = WONo:'*1*':CassNo
WM_In_Services('VerifyWOMatWMIKeyIndex', WMIKey)
end
end
If (WMIKey NE '') then
WM_In_Services('VerifyWoStepWMIKeyIndex', WMIKey)
WM_In_Services('VerifyWOLogWMIKeyIndex', WMIKey)
end
WMOKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X')
If (WMOKey EQ '') then
If RowExists('WM_OUT', WONo:'*1*':CassNo) then
WMOKey = WONo:'*1*':CassNo
WM_Out_Services('VerifyWOMatWMOKeyIndex', WMOKey)
end
end
If (WMOKey NE '') then
WM_Out_Services('VerifyWoStepWMOKeyIndex', WMOKey)
WM_Out_Services('VerifyWOLogWMOKeyIndex', WMOKey)
end
end
RDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
If (RDSNo NE '') then
If (DCount(RDSNo, @VM) GT 1) then
@ -2222,7 +2259,6 @@ Service UpdateWorkOrderData(WONo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end
end else
EpiPro = (Xlate('WO_LOG', WONo, 'PS_REACTOR_TYPE', 'X') _EQC 'EPP')
If Not(EpiPro) then
Query = 'SELECT RDS WITH WO EQ ':WONo:' AND WITH CASS_NO EQ ':CassNo
RList(Query, TARGET_ACTIVELIST$, '', '', '')
@ -2248,7 +2284,10 @@ Service UpdateWorkOrderData(WONo)
end
Voided = Xlate('WO_MAT', WOMatKey, 'VOID', 'X')
If Not(Voided) then NewWOLogWOMatKeys<0, -1> = WOMatKey
end else
Done = True$
end
Until Done
Next CassNo
NewWOLogWOMatKeys = SRP_Array('SortRows', NewWOLogWOMatKeys, 'AR2', 'LIST', @VM, '*')
If OrigWOLogWOMatKeys NE NewWOLogWOMatKeys then