refactored auto hold service and toggle hold service
This commit is contained in:
parent
2332b04103
commit
9d86fd5fba
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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\
|
||||||
@ -271,12 +272,16 @@ Service ProcessAutoHold()
|
|||||||
// 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
|
||||||
|
|
||||||
|
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||||
|
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
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
|
||||||
HoldList = ''
|
HoldList = ''
|
||||||
|
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'))
|
||||||
Flag = ''
|
Flag = ''
|
||||||
@ -292,9 +297,13 @@ Service ProcessAutoHold()
|
|||||||
Readnext WOMatKey else EOF = True$
|
Readnext WOMatKey else EOF = True$
|
||||||
Until EOF
|
Until EOF
|
||||||
|
|
||||||
|
ErrorMsg = '' ; // Local loop error message tracking
|
||||||
|
ExpiredFlag = ''
|
||||||
|
HoldFlag = ''
|
||||||
|
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'Placing lot "':WOMatKey:'" on hold.'
|
LogData<2> = 'Identified lot "':WOMatKey:'" as older than three years. Checking hold state...'
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
|
||||||
WONo = Field(WOMatKey, '*', 1)
|
WONo = Field(WOMatKey, '*', 1)
|
||||||
@ -307,43 +316,123 @@ Service ProcessAutoHold()
|
|||||||
HoldEntity = 'RDS'
|
HoldEntity = 'RDS'
|
||||||
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
HoldEntityID = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
||||||
end
|
end
|
||||||
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
|
|
||||||
|
|
||||||
|
WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
HoldFlag = WOMatRec<WO_MAT_HOLD$>
|
||||||
|
If HoldFlag EQ True$ then
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'Lot "':WOMatKey:'" hold flag = ':Xlate(HoldEntity, HoldEntityID, 'HOLD', 'X'):'.'
|
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)
|
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 = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'Marking lot "':WOMatKey:'" as expired.'
|
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)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
|
|
||||||
Material_Services('MarkMUCassExpired', WOMatKey)
|
Material_Services('MarkMUCassExpired', WOMatKey)
|
||||||
ExpiredFlag = Xlate('MAKEUP_WAFERS', WOMatKey, 'EXPIRED', 'X')
|
|
||||||
If Error_Services('NoError') then
|
If Error_Services('NoError') then
|
||||||
|
MWRec = Database_Services('ReadDataRow', 'MAKEUP_WAFERS', WOMatKey)
|
||||||
|
If Error_Services('NoError') then
|
||||||
|
ExpiredFlag = MWRec<MAKEUP_WAFERS.EXPIRED$>
|
||||||
LogData = ''
|
LogData = ''
|
||||||
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
LogData<1> = OConv(Datetime(), 'DT2/^H')
|
||||||
LogData<2> = 'Successfully marked lot "':WOMatKey:'" as expired. Expired flag = ':ExpiredFlag:'.'
|
LogData<2> = 'Successfully marked lot "':WOMatKey:'" as expired. Expired flag = ':ExpiredFlag:'.'
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
end else
|
end else
|
||||||
|
ErrorMsg = Error_Services('GetMessage')
|
||||||
|
LogMsg = 'Failed to verify lot "':WOMatKey:'" was marked as expired.'
|
||||||
|
LogMsg := 'Error message: ':ErrorMsg
|
||||||
LogData = ''
|
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> = LogMsg
|
||||||
ErrorMsg := 'Error message: ':Error_Services('GetMessage')
|
|
||||||
LogData<2> = ErrorMsg
|
|
||||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
|
||||||
end
|
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
|
Repeat
|
||||||
|
|
||||||
// Send notification if list is not null
|
// Send notification of successful lots and failed lots
|
||||||
If HoldList NE '' then
|
If (HoldList NE '') then
|
||||||
Recipients = ''
|
Recipients = ''
|
||||||
SentFrom = 'SYSTEM'
|
SentFrom = 'SYSTEM'
|
||||||
Subject = 'Makeup Wafer Auto-Hold Report'
|
Subject = 'Makeup Wafer Auto-Hold Report'
|
||||||
@ -358,11 +447,29 @@ Service ProcessAutoHold()
|
|||||||
obj_Notes('Create',Parms)
|
obj_Notes('Create',Parms)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
If (FailedHoldList 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 failed to be placed on hold by '
|
||||||
|
Message := 'the system.':CRLF$:'Reminder: EpiPro lots can contain multiple RDS lots.':CRLF$:CRLF$
|
||||||
|
Swap @FM with CRLF$ in FailedHoldList
|
||||||
|
Message := FailedHoldList
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
end service
|
end service
|
||||||
|
|
||||||
|
|
||||||
@ -1353,3 +1460,4 @@ ClearCursors:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user