moved procedure call from WO_MAT_ACTIONS to a standalone service to avoid posting too many transactions

This commit is contained in:
Infineon\StieberD
2025-07-28 14:34:20 -07:00
parent c7f1f86249
commit 9e54865e1e
5 changed files with 171 additions and 12 deletions

View File

@ -62,11 +62,10 @@ Main:
Open "DICT.":Table to @DICT then null
@ID = Key
Ans = Function(@Handler(Connection, Key, @RECORD))
If Ans EQ '' then
If (Ans EQ '') then
If Assigned(pKey) then
If pKey NE '' then
If (pKey NE '') then
Delete pTable, pKey else Null
Unlock pTable, pKey else Null
end
end
end
@ -101,7 +100,9 @@ Main:
end
If Assigned(pKey) then
If (pKey NE '') then
If (pKey NE '') then
// Call unlock here in case we ran into an error above
Unlock pTable, pKey else Null
// Always log the result
Open 'SQL_LOG' to hLog then
If Ans EQ '' then

View File

@ -52,10 +52,11 @@ Main:
// Read the record and call the handler
If Key NE "" then
Ans = Function(@Handler(Connection, Key))
If Ans EQ '' then
If (Ans EQ '') then
If Assigned(pKey) then
Delete pTable, pKey else Null
Unlock pTable, pKey else Null
If (pKey NE '') then
Delete pTable, pKey else Null
end
end
end
end
@ -85,7 +86,9 @@ Main:
// Always log the result
If Assigned(pKey) then
If (pKey NE '') then
If (pKey NE '') then
// Call unlock here in case an error was encountered above
Unlock pTable, pKey else Null
Open 'SQL_LOG' to hLog then
If Ans EQ '' then
Result = 'PROCESSED'

View File

@ -590,7 +590,9 @@ Service SetupDevServices()
BaselineServices = 'Update Material Logs':@VM:'Log Transaction Postings':@VM:'Process Wafer Image Queue':@VM
BaselineServices := 'Process UCL Requests':@VM:'Process ROTR Requests':@VM:'Process Wafer Image Requests':@VM
BaselineServices := 'Process SQL Requests':@VM:'Send Notes':@VM:'Update Notification Groups':@VM
BaselineServices := 'Update Security Groups':@VM:'Auto Scheduler'
BaselineServices := 'Update Security Groups':@VM:'Auto Scheduler':@VM:'Update NICA Orders':@VM:'Process Procedure Queue':@VM
BaselineServices := 'Process Transaction Queue':@VM:'Update Open Work Order Statuses':@VM:'Update Work Order Wafer Quantities':@VM
BaselineServices := 'Process Mona Requests'
Query = "SELECT SERVICES"

View File

@ -50,6 +50,8 @@ $Insert VOIDED_LOT_EQUATES
$Insert IFX_EQUATES
$Insert CUST_EPI_PART_EQUATES
Equ MAX_NUM_CASS$ to 96
Declare subroutine Error_Services, Work_Order_Services, Memory_Services, RList, Database_Services, SRP_JSON
Declare subroutine Btree.Extract, Set_Status, obj_WO_Log, obj_Notes, Print_Wo_Mat_In_Labels, Print_Wo_Mat_Out_Labels
Declare subroutine Print_Wmi_Labels, Print_Wmo_Labels, ErrMsg, Print_Cass_Labels, Logging_Services, Service_Services
@ -2062,6 +2064,160 @@ Service UpdateWorkOrderStatus(WOLogId)
end service
Service UpdateOpenWorkOrderData()
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID then
StatusName = Service
IsProd = Environment_Services('IsProd')
If IsProd then
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_SERVICE_MANAGER'
end else
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_DEV_SERVICE_MANAGER'
end
MonaStatus = 'ok'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_MAT'
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'
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> = LoggingDtm
LogData<2> = Server
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
ErrorMsg = ''
OpenWoLogKeys = ''
ErrCode = ''
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', 'UpdateWorkOrderData':SD$:OpenWOLogKey)
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
Next OpenWoLogKey
end else
LogData<1> = OConv(Datetime(), 'DT/^S')
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<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
Mona_Services('PostStatus', MonaResource, StatusName, MonaStatus)
Unlock hSysLists, ServiceKeyID else Null
end
end service
Service UpdateWorkOrderData(WONo)
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID:'*':WONo then
StatusName = Service
IsProd = Environment_Services('IsProd')
If IsProd then
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_SERVICE_MANAGER'
end else
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_DEV_SERVICE_MANAGER'
end
MonaStatus = 'ok'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_MAT'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : '-' : WONo : ' WO_MAT WO_LOG{WO_MAT_KEY} 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> = LoggingDtm
LogData<2> = Server
LogData<3> = WONo
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
ErrorMsg = ''
OpenWoLogKeys = ''
ErrCode = ''
OrigWOLogWOMatKeys = Database_Services('ReadDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, True$, 0)
If Error_Services('NoError') then
NewWOLogWOMatKeys = OrigWOLogWOMatKeys
For CassNo = 1 to MAX_NUM_CASS$
WOMatKey = WONo:'*':CassNo
If RowExists('WO_MAT', WOMatKey) then
Locate WOMatKey in OrigWOLogWOMatKeys using @VM setting vPos then
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'WOMatKey ':WOMatKey:' found in WO_LOG record. Nothing to update.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end else
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Adding WOMatKey to column.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
NewWOLogWOMatKeys<0, -1> = WOMatKey
end
end
Next CassNo
If OrigWOLogWOMatKeys NE NewWOLogWOMatKeys then
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'WOMatKeys missing from work order. Posting transaction to update WO_MAT_KEY column.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
NewWOLogWOMatKeys = SRP_Array('SortRows', NewWOLogWOMatKeys, 'AR2', 'LIST', @VM, '*')
Transaction_Services('PostWriteFieldTransaction', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, NewWOLogWOMatKeys)
If Error_Services('HasError') then ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = 'Error in ':Service:' service. ':Error_Services('GetMessage')
end
If ErrorMsg NE '' then
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<2> = Server
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
Mona_Services('PostStatus', MonaResource, StatusName, MonaStatus)
Unlock hSysLists, ServiceKeyID:'*':WONo else Null
end
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -2074,4 +2230,3 @@ ClearCursors:
return

View File

@ -869,8 +869,6 @@ WRITE_RECORD:
Service_Services('PostProcedure', 'SCHEDULE_SERVICES', 'MarkCassProcessed':SD$:WONo:SD$:CassNo:SD$:Datetime())
end
Service_Services('PostProcedure', 'WO_MAT_SERVICES', 'VerifyWOLogWOMatKeyColumn':SD$:Name)
return