updated auto-hold service to resend notifications every 12 hours if expired mu cassette is not NCRd
This commit is contained in:
parent
bdd3c84a78
commit
864355dfc2
@ -265,16 +265,10 @@ 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
|
|
||||||
// First find subset of Makeup lots that are over 3 years old (age based on date out)
|
|
||||||
// From above list,
|
|
||||||
// 1) Put affected lots on hold and
|
|
||||||
// 2) Send notification to notification group
|
|
||||||
|
|
||||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||||
Lock hSysLists, ServiceKeyID then
|
Lock hSysLists, ServiceKeyID then
|
||||||
|
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'Begin ':Service
|
LogData<2> = 'Begin ':Service
|
||||||
@ -283,7 +277,7 @@ Service ProcessAutoHold()
|
|||||||
HoldList = ''
|
HoldList = ''
|
||||||
FailedHoldList = ''
|
FailedHoldList = ''
|
||||||
CutoffDate = SRP_Date('AddYears', Date(), -3)
|
CutoffDate = SRP_Date('AddYears', Date(), -3)
|
||||||
Query = 'SELECT MAKEUP_WAFERS WITH UNLOAD_DTM LT ':Quote(OConv(CutoffDate, 'DT2/^H'))
|
Query = 'SELECT MAKEUP_WAFERS WITH UNLOAD_DTM LT ':Quote(OConv(CutoffDate, 'DT2/^H'): ' AND WITH EXPIRED NE ':True$)
|
||||||
Flag = ''
|
Flag = ''
|
||||||
RList(Query, TARGET_ACTIVELIST$, '', '', Flag)
|
RList(Query, TARGET_ACTIVELIST$, '', '', Flag)
|
||||||
|
|
||||||
@ -431,7 +425,9 @@ Service ProcessAutoHold()
|
|||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
|
|
||||||
// Send notification of successful lots and failed lots
|
NotifyDtm = Datetime()
|
||||||
|
|
||||||
|
// Send initial notification of successful lots and failed lots
|
||||||
If (HoldList NE '') then
|
If (HoldList NE '') then
|
||||||
Recipients = ''
|
Recipients = ''
|
||||||
SentFrom = 'SYSTEM'
|
SentFrom = 'SYSTEM'
|
||||||
@ -445,6 +441,57 @@ Service ProcessAutoHold()
|
|||||||
Message := HoldList
|
Message := HoldList
|
||||||
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||||
obj_Notes('Create',Parms)
|
obj_Notes('Create',Parms)
|
||||||
|
|
||||||
|
For each WOMatKey in HoldList using @FM
|
||||||
|
|
||||||
|
WONo = Field(WOMatKey, '*', 1)
|
||||||
|
ReactType = Xlate('WO_LOG', WONo, 'REACT_TYPE', 'X')
|
||||||
|
If ReactType EQ 'EPP' then
|
||||||
|
CassNo = Field(WOMatKey, '*', 2)
|
||||||
|
HoldEntityID = WONo:'*1*':CassNo
|
||||||
|
end else
|
||||||
|
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
||||||
|
end
|
||||||
|
MUWfrRec = Database_Services('ReadDataRow', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
HaveLock = Database_Services('GetKeyIDLock', 'MAKEUP_WAFERS', WOMatKey, True$)
|
||||||
|
If HaveLock then
|
||||||
|
MUWfrRec<MAKEUP_WAFERS.EXPIRY_LAST_NOTIFY_DTM$> = NotifyDtm
|
||||||
|
Database_Services('WriteDataRow', 'MAKEUP_WAFERS', WOMatKey, MUWfrRec, True$, False$, False$)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = 'Updated expiry notify dtm for expired lot "':WOMatKey:'".'
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
end else
|
||||||
|
ErrorMsg = Error_Services('GetMessage')
|
||||||
|
LogMsg = 'Failed to update expiry notify dtm for expired lot "':WOMatKey:'". Error updating MAKEUP_WAFERS record.'
|
||||||
|
LogMsg := 'Error message: ':ErrorMsg
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = LogMsg
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
SelfLocked = Database_Services('IsKeyIDSelfLocked', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
If SelfLocked then Database_Services('ReleaseKeyIDLock', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
LogMsg = 'MAKEUP_WAFERS record for expired lot "':WOMatKey:'" is locked. Service will attempt again on next service call.'
|
||||||
|
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 send notification for expired lot "':WOMatKey:'". Error reading MAKEUP_WAFERS record.'
|
||||||
|
LogMsg := 'Error message: ':ErrorMsg
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = LogMsg
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
end
|
||||||
|
Next WOMatKey
|
||||||
end
|
end
|
||||||
|
|
||||||
If (FailedHoldList NE '') then
|
If (FailedHoldList NE '') then
|
||||||
@ -462,10 +509,92 @@ Service ProcessAutoHold()
|
|||||||
obj_Notes('Create',Parms)
|
obj_Notes('Create',Parms)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
// Send reminders of expired lots not yet NCR'd, which should trigger deletion of MAKEUP_WAFERS record when quantity reaches zero.
|
||||||
|
NotifyList = ''
|
||||||
|
ThresholdDtm = SRP_Datetime('AddHours', Datetime(), -12)
|
||||||
|
ThresholdDtm = OConv(ThresholdDtm, 'DT2/^H')
|
||||||
|
Query = 'SELECT MAKEUP_WAFERS WITH EXPIRED EQ ':True$:' AND WITH EXPIRY_LAST_NOTIFY_DTM LT ':Quote(ThresholdDtm)
|
||||||
|
Flag = ''
|
||||||
|
RList(Query, TARGET_ACTIVELIST$, '', '', Flag)
|
||||||
|
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = 'Notification RList Flag = ':Flag:'. @RecCount = ':@RecCount
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
|
||||||
|
EOF = False$
|
||||||
|
Loop
|
||||||
|
Readnext WOMatKey else EOF = True$
|
||||||
|
Until EOF
|
||||||
|
WONo = Field(WOMatKey, '*', 1)
|
||||||
|
ReactType = Xlate('WO_LOG', WONo, 'REACT_TYPE', 'X')
|
||||||
|
If ReactType EQ 'EPP' then
|
||||||
|
CassNo = Field(WOMatKey, '*', 2)
|
||||||
|
HoldEntityID = WONo:'*1*':CassNo
|
||||||
|
end else
|
||||||
|
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
||||||
|
end
|
||||||
|
MUWfrRec = Database_Services('ReadDataRow', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
HaveLock = Database_Services('GetKeyIDLock', 'MAKEUP_WAFERS', WOMatKey, True$)
|
||||||
|
If HaveLock then
|
||||||
|
MUWfrRec<MAKEUP_WAFERS.EXPIRY_LAST_NOTIFY_DTM$> = NotifyDtm
|
||||||
|
Database_Services('WriteDataRow', 'MAKEUP_WAFERS', WOMatKey, MUWfrRec, True$, False$, False$)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
NotifyList<-1> = ReactType:TAB$:HoldEntityID
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = 'Updated expiry notify dtm for expired lot "':WOMatKey:'".'
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
end else
|
||||||
|
ErrorMsg = Error_Services('GetMessage')
|
||||||
|
LogMsg = 'Failed to send notification for expired lot "':WOMatKey:'". Error updating MAKEUP_WAFERS record.'
|
||||||
|
LogMsg := 'Error message: ':ErrorMsg
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = LogMsg
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
SelfLocked = Database_Services('IsKeyIDSelfLocked', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
If SelfLocked then Database_Services('ReleaseKeyIDLock', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
LogMsg = 'MAKEUP_WAFERS record for expired lot "':WOMatKey:'" is locked. Service will attempt again on next service call.'
|
||||||
|
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 send notification for expired lot "':WOMatKey:'". Error reading MAKEUP_WAFERS record.'
|
||||||
|
LogMsg := 'Error message: ':ErrorMsg
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
|
LogData<2> = LogMsg
|
||||||
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
end
|
||||||
|
Repeat
|
||||||
|
|
||||||
|
If (NotifyList 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 NotifyList
|
||||||
|
Message := NotifyList
|
||||||
|
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
|
||||||
|
obj_Notes('Create',Parms)
|
||||||
|
end
|
||||||
|
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'End ':Service
|
LogData<2> = 'End ':Service
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
|
||||||
Unlock hSysLists, ServiceKeyID else Null
|
Unlock hSysLists, ServiceKeyID else Null
|
||||||
end
|
end
|
||||||
@ -1461,3 +1590,4 @@ ClearCursors:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,21 +6,22 @@ compile insert MAKEUP_WAFERS_EQUATES
|
|||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
Equ MAKEUP_WAFERS.WO_NO$ To 0
|
Equ MAKEUP_WAFERS.WO_NO$ To 0
|
||||||
Equ MAKEUP_WAFERS.CASS_NO$ To 0
|
Equ MAKEUP_WAFERS.CASS_NO$ To 0
|
||||||
Equ MAKEUP_WAFERS.SAP_BATCH_NO$ To 1
|
Equ MAKEUP_WAFERS.SAP_BATCH_NO$ To 1
|
||||||
Equ MAKEUP_WAFERS.PS_NO$ To 2
|
Equ MAKEUP_WAFERS.PS_NO$ To 2
|
||||||
Equ MAKEUP_WAFERS.CUST_NO$ To 3
|
Equ MAKEUP_WAFERS.CUST_NO$ To 3
|
||||||
Equ MAKEUP_WAFERS.PROD_ORD_NO$ To 4
|
Equ MAKEUP_WAFERS.PROD_ORD_NO$ To 4
|
||||||
Equ MAKEUP_WAFERS.WAFER_SIZE$ To 5
|
Equ MAKEUP_WAFERS.WAFER_SIZE$ To 5
|
||||||
Equ MAKEUP_WAFERS.EPI_PART_NO$ To 6
|
Equ MAKEUP_WAFERS.EPI_PART_NO$ To 6
|
||||||
Equ MAKEUP_WAFERS.RDS_NO$ To 7
|
Equ MAKEUP_WAFERS.RDS_NO$ To 7
|
||||||
Equ MAKEUP_WAFERS.WM_OUT_NO$ To 8
|
Equ MAKEUP_WAFERS.WM_OUT_NO$ To 8
|
||||||
Equ MAKEUP_WAFERS.PROD_VER_NO$ To 9
|
Equ MAKEUP_WAFERS.PROD_VER_NO$ To 9
|
||||||
Equ MAKEUP_WAFERS.CUST_PART_NO$ To 10
|
Equ MAKEUP_WAFERS.CUST_PART_NO$ To 10
|
||||||
Equ MAKEUP_WAFERS.REACT_TYPE$ To 11
|
Equ MAKEUP_WAFERS.REACT_TYPE$ To 11
|
||||||
Equ MAKEUP_WAFERS.CURR_STATUS_STATIC$ To 12
|
Equ MAKEUP_WAFERS.CURR_STATUS_STATIC$ To 12
|
||||||
Equ MAKEUP_WAFERS.UNLOAD_DTM$ To 13
|
Equ MAKEUP_WAFERS.UNLOAD_DTM$ To 13
|
||||||
Equ MAKEUP_WAFERS.WFR_QTY$ To 14
|
Equ MAKEUP_WAFERS.WFR_QTY$ To 14
|
||||||
Equ MAKEUP_WAFERS.EXPIRED$ To 15
|
Equ MAKEUP_WAFERS.EXPIRED$ To 15
|
||||||
|
Equ MAKEUP_WAFERS.EXPIRY_LAST_NOTIFY_DTM$ To 16
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user