refactored auto hold service and toggle hold service

This commit is contained in:
Infineon\StieberD 2025-01-22 15:42:27 -07:00
parent 2332b04103
commit 9d86fd5fba
2 changed files with 199 additions and 90 deletions

View File

@ -78,7 +78,7 @@ Return Response or ""
// WOMatKey - [Required] // WOMatKey - [Required]
// HoldEntity - [Required] // HoldEntity - [Required]
// HoldEntityID - [Required] // HoldEntityID - [Required]
// CtrlEntID - [Required] // CtrlEntID - [Optional] *Required for ship hold checks
// OriginFlag - [Optional] // OriginFlag - [Optional]
// HoldData - [Optional] // HoldData - [Optional]
// OperatorID - [Optional] // OperatorID - [Optional]
@ -87,15 +87,15 @@ Return Response or ""
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service ToggleHold(WOMatKey, HoldEntity, HoldEntityID, CtrlEntID, OriginFlag, HoldData, OperatorID) Service ToggleHold(WOMatKey, HoldEntity, HoldEntityID, CtrlEntID, OriginFlag, HoldData, OperatorID)
IF WOMatKey = '' or HoldEntity = '' or HoldEntityID = '' or CtrlEntID = '' THEN If ( (WOMatKey EQ '') or (HoldEntity EQ '') or (HoldEntityID EQ '') ) then
Error_Services('Add', 'Null parameter WOMatKey, HoldEntity, HoldEntityID, CtrlEntID passed to service.') Error_Services('Add', 'Null parameter WOMatKey, HoldEntity, or HoldEntityID passed to service.')
end else end else
HoldCheck = Hold_Services("CheckForHold", WOMatKey, CtrlEntID) HoldCheck = Hold_Services("CheckForHold", WOMatKey, CtrlEntID)
If Unassigned(OperatorID) then OperatorID = '' If Unassigned(OperatorID) then OperatorID = ''
BEGIN CASE Begin Case
CASE INDEX(CtrlEntID,'SHIP_HOLD',1) ; HoldType = 'SHOLD' ; * Ship Hold Case Index(CtrlEntID,'SHIP_HOLD',1) ; HoldType = 'SHOLD' ; * Ship Hold
CASE 1 ; HoldType = 'HOLD' ; * Production or Engineering Hold Case Otherwise$ ; HoldType = 'HOLD' ; * Production or Engineering Hold
END CASE End Case
If Error_Services("NoError") then If Error_Services("NoError") then
If HoldCheck = False$ then If HoldCheck = False$ then
Hold_Services("OnHold", WOMatKey, HoldEntity, HoldEntityID, HoldType, HoldData, OperatorID, OriginFlag) Hold_Services("OnHold", WOMatKey, HoldEntity, HoldEntityID, HoldType, HoldData, OperatorID, OriginFlag)
@ -502,8 +502,8 @@ Service CheckForHold(WOMatKey, CtrlEntID)
WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey, '', '', '') WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey, '', '', '')
BEGIN CASE BEGIN CASE
CASE INDEX(CtrlEntID,'SHIP_HOLD',1) ; HoldType = 'SHOLD' ; * Ship Hold CASE Index(CtrlEntID,'SHIP_HOLD',1) ; HoldType = 'SHOLD' ; * Ship Hold
CASE 1 ; HoldType = 'HOLD' ; * Production or Engineering Hold CASE Otherwise$ ; HoldType = 'HOLD' ; * Production or Engineering Hold
END CASE END CASE
IF HoldType = 'SHOLD' THEN IF HoldType = 'SHOLD' THEN
@ -765,3 +765,4 @@ Service CreateComment(HoldEntity, HoldEntityID, Reason, Transition, HoldType, Op
end service end service

View File

@ -49,6 +49,7 @@ $insert CLEAN_INSP_EQUATES
$insert RDS_LAYER_EQUATES $insert RDS_LAYER_EQUATES
$insert RDS_TEST_EQUATES $insert RDS_TEST_EQUATES
$insert TW_USE_EQUATES $insert TW_USE_EQUATES
$insert MAKEUP_WAFERS_EQUATES
Equ Tab$ to Char(9) Equ Tab$ to Char(9)
Equ Esc$ to \1B\ Equ Esc$ to \1B\
@ -264,105 +265,211 @@ End Service
// looks for MakeUp wafers older than 3 years old and then puts them on hold and sends notification. // looks for MakeUp wafers older than 3 years old and then puts them on hold and sends notification.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service ProcessAutoHold() Service ProcessAutoHold()
// Service should run once a day or less // Service should run once a day or less
// First find subset of Makeup lots that are over 3 years old (age based on date out) // First find subset of Makeup lots that are over 3 years old (age based on date out)
// From above list, // From above list,
// 1) Put affected lots on hold and // 1) Put affected lots on hold and
// 2) Send notification to notification group // 2) Send notification to notification group
LogData = '' hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
LogData<1> = OConv(Datetime(), 'DT2/^H') Lock hSysLists, ServiceKeyID then
LogData<2> = 'Begin ':Service
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
HoldList = '' LogData = ''
CutoffDate = SRP_Date('AddYears', Date(), -3) LogData<1> = OConv(Datetime(), 'DT2/^H')
Query = 'SELECT MAKEUP_WAFERS WITH UNLOAD_DTM LT ':Quote(OConv(CutoffDate, 'DT2/^H')) LogData<2> = 'Begin ':Service
Flag = '' Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
RList(Query, TARGET_ACTIVELIST$, '', '', Flag)
HoldList = ''
LogData = '' FailedHoldList = ''
LogData<1> = OConv(Datetime(), 'DT2/^H') CutoffDate = SRP_Date('AddYears', Date(), -3)
LogData<2> = 'RList Flag = ':Flag:'. @RecCount = ':@RecCount Query = 'SELECT MAKEUP_WAFERS WITH UNLOAD_DTM LT ':Quote(OConv(CutoffDate, 'DT2/^H'))
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Flag = ''
RList(Query, TARGET_ACTIVELIST$, '', '', Flag)
EOF = False$
Loop
Readnext WOMatKey else EOF = True$
Until EOF
LogData = '' LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H') LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Placing lot "':WOMatKey:'" on hold.' LogData<2> = 'RList Flag = ':Flag:'. @RecCount = ':@RecCount
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
WONo = Field(WOMatKey, '*', 1) EOF = False$
ReactType = Xlate('WO_LOG', WONo, 'REACT_TYPE', 'X') Loop
If ReactType EQ 'EPP' then Readnext WOMatKey else EOF = True$
CassNo = Field(WOMatKey, '*', 2) Until EOF
HoldEntity = 'WM_OUT'
HoldEntityID = WONo:'*1*':CassNo ErrorMsg = '' ; // Local loop error message tracking
end else ExpiredFlag = ''
HoldEntity = 'RDS' HoldFlag = ''
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
end LogData = ''
HoldList<-1> = ReactType:TAB$:HoldEntityID
OnHold = Xlate(HoldEntity, HoldEntityID, 'HOLD', 'X')
If OnHold NE True$ then
//obj_WO_Mat('ToggleHold',WOMatKey:@RM:HoldEntity:@RM:HoldEntityID:@RM:'':@RM:'H':@RM:'SYSTEM')
Hold_Services('ToggleHold', WOMatKey, HoldEntity, HoldEntityID, '', 'H', '', 'SYSTEM')
end
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Lot "':WOMatKey:'" hold flag = ':Xlate(HoldEntity, HoldEntityID, 'HOLD', 'X'):'.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Marking lot "':WOMatKey:'" as expired.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Material_Services('MarkMUCassExpired', WOMatKey)
ExpiredFlag = Xlate('MAKEUP_WAFERS', WOMatKey, 'EXPIRED', 'X')
If Error_Services('NoError') then
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Successfully marked lot "':WOMatKey:'" as expired. Expired flag = ':ExpiredFlag:'.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end else
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H') LogData<1> = OConv(Datetime(), 'DT2/^H')
ErrorMsg = 'Failed to mark lot "':WOMatKey:'" as expired. Expired flag = ':ExpiredFlag:'. ' LogData<2> = 'Identified lot "':WOMatKey:'" as older than three years. Checking hold state...'
ErrorMsg := 'Error message: ':Error_Services('GetMessage')
LogData<2> = ErrorMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
WONo = Field(WOMatKey, '*', 1)
ReactType = Xlate('WO_LOG', WONo, 'REACT_TYPE', 'X')
If ReactType EQ 'EPP' then
CassNo = Field(WOMatKey, '*', 2)
HoldEntity = 'WM_OUT'
HoldEntityID = WONo:'*1*':CassNo
end else
HoldEntity = 'RDS'
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
end
WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
If Error_Services('NoError') then
HoldFlag = WOMatRec<WO_MAT_HOLD$>
If HoldFlag EQ True$ then
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Lot "':WOMatKey:'" already on hold. Hold flag = ':HoldFlag:'.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end else
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Lot "':WOMatKey:'" not on hold. Hold flag = ':HoldFlag:'. Attempting to place lot on hold...'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
// Toggle hold state
Hold_Services('ToggleHold', WOMatKey, HoldEntity, HoldEntityID, '', 'H', '', 'SYSTEM')
If Error_Services('NoError') then
// Verify hold state
// Re-read record to verify hold state
WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
If Error_Services('NoError') then
NewHoldFlag = WOMatRec<WO_MAT_HOLD$>
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Lot "':WOMatKey:'" new hold flag = ':NewHoldFlag:'.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
If NewHoldFlag EQ HoldFlag then
// Something went wrong somewhere
ErrorMsg = 'New hold state, ':NewHoldFlag:', of lot "':WOMatKey:'" equals previous hold state, ':HoldFlag:'.'
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = ErrorMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to verify lot "':WOMatKey:'" was placed on hold.'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to toggle hold state of lot "':WOMatKey:'".'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end
If ErrorMsg EQ '' then
// Now mark cassette as expired
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Attempting to mark lot "':WOMatKey:'" as expired.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Material_Services('MarkMUCassExpired', WOMatKey)
If Error_Services('NoError') then
MWRec = Database_Services('ReadDataRow', 'MAKEUP_WAFERS', WOMatKey)
If Error_Services('NoError') then
ExpiredFlag = MWRec<MAKEUP_WAFERS.EXPIRED$>
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'Successfully marked lot "':WOMatKey:'" as expired. Expired flag = ':ExpiredFlag:'.'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to verify lot "':WOMatKey:'" was marked as expired.'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to mark lot "':WOMatKey:'" as expired.'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to toggle hold state of lot "':WOMatKey:'".'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
end else
ErrorMsg = Error_Services('GetMessage')
LogMsg = 'Failed to place lot "':WOMatKey:'" on hold. Error reading WO_MAT record to get hold state.'
LogMsg := 'Error message: ':ErrorMsg
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = LogMsg
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
If (ErrorMsg EQ '') then
HoldList<-1> = ReactType:TAB$:HoldEntityID
end else
FailedHoldList<-1> = ReactType:TAB$:HoldEntityID
end
Repeat
// Send notification of successful lots and failed lots
If (HoldList NE '') then
Recipients = ''
SentFrom = 'SYSTEM'
Subject = 'Makeup Wafer Auto-Hold Report'
AttachWindow = ''
AttachKey = ''
SendToGroup = 'AUTO_HOLD'
Message = 'The following makeup cassettes are older than three years and have been automatically '
Message := 'placed on hold.':CRLF$:'Reminder: EpiPro lots can contain multiple RDS lots.':CRLF$:CRLF$
Swap @FM with CRLF$ in HoldList
Message := HoldList
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
end end
Repeat If (FailedHoldList NE '') then
Recipients = ''
// Send notification if list is not null SentFrom = 'SYSTEM'
If HoldList NE '' then Subject = 'Makeup Wafer Auto-Hold Report'
Recipients = '' AttachWindow = ''
SentFrom = 'SYSTEM' AttachKey = ''
Subject = 'Makeup Wafer Auto-Hold Report' SendToGroup = 'AUTO_HOLD'
AttachWindow = '' Message = 'The following makeup cassettes are older than three years and failed to be placed on hold by '
AttachKey = '' Message := 'the system.':CRLF$:'Reminder: EpiPro lots can contain multiple RDS lots.':CRLF$:CRLF$
SendToGroup = 'AUTO_HOLD' Swap @FM with CRLF$ in FailedHoldList
Message = 'The following makeup cassettes are older than three years and have been automatically ' Message := FailedHoldList
Message := 'placed on hold.':CRLF$:'Reminder: EpiPro lots can contain multiple RDS lots.':CRLF$:CRLF$ Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
Swap @FM with CRLF$ in HoldList obj_Notes('Create',Parms)
Message := HoldList end
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms) LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'End ':Service
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Unlock hSysLists, ServiceKeyID else Null
end end
LogData = ''
LogData<1> = OConv(Datetime(), 'DT2/^H')
LogData<2> = 'End ':Service
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end service end service
@ -1353,3 +1460,4 @@ ClearCursors:
return return