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

@ -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