Added calls to verify indexes and update indexes right after receiving and releasing material. Refactored codebase to adjust work order quantities instead of recalculate quantities.
Removing reliance on transaction queue for receive and releaase Added unlock call in case write fails
This commit is contained in:
@ -57,18 +57,20 @@ $Insert WO_MAT_EQUATES
|
||||
$Insert WO_LOG_EQUATES
|
||||
$Insert COMPANY_EQUATES
|
||||
$Insert RETURN_TO_FAB_LOTS_EQUATES
|
||||
$INSERT PROD_SPEC_EQUATES
|
||||
$INSERT WO_STEP_EQUATES
|
||||
$INSERT EPI_PART_EQUATES
|
||||
$INSERT CUST_EPI_PART_EQUATES
|
||||
$INSERT PRS_STAGE_EQUATES
|
||||
$insert UNIT_EQUATES
|
||||
$Insert PROD_SPEC_EQUATES
|
||||
$Insert WO_STEP_EQUATES
|
||||
$Insert EPI_PART_EQUATES
|
||||
$Insert CUST_EPI_PART_EQUATES
|
||||
$Insert PRS_STAGE_EQUATES
|
||||
$Insert UNIT_EQUATES
|
||||
|
||||
Equ NUM_ATTEMPTS$ to 60
|
||||
|
||||
Declare function Database_Services, SRP_JSON, Error_Services, Clean_Insp_Services, WO_Mat_QA_Services
|
||||
Declare function PSN_Services, SRP_Rotate_Array, Datetime, Return_To_Fab_Services, Environment_Services
|
||||
Declare function Logging_Services
|
||||
Declare subroutine Database_Services, SRP_JSON, Error_Services, Extract_Si_Keys, Set_Status, obj_wo_mat_log
|
||||
Declare subroutine Logging_Services, Btree.Extract
|
||||
Declare subroutine Logging_Services, Btree.Extract, Update_Index, Delay
|
||||
|
||||
GoToService else
|
||||
Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
|
||||
@ -458,10 +460,9 @@ Service VerifyWoStepWMOKeyIndex(WMOKey)
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_STEP{WM_OUT_KEYS} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyWMOKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<2> = WMOKey
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
@ -472,32 +473,44 @@ Service VerifyWoStepWMOKeyIndex(WMOKey)
|
||||
WOStepKey = Field(WMOKey, '*', 1, 2)
|
||||
If WOStepKey NE '' then
|
||||
WOStepWMOKeys = Xlate('WO_STEP', WOStepKey, 'WM_OUT_KEYS', 'X')
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<3> = WOStepKey
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
Locate WMOKey in WOStepWMOKeys using @VM setting vPos else
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'WMOKey missing from WO_STEP record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update WM_OUT_KEYS relational index (target WO_STEP table)
|
||||
IndexTransactionRow = 'WO_STEP*WM_OUT_KEYS*AR':@FM:WMOKey:@FM:"":@FM:WOStepKey:@FM
|
||||
Open "!WM_OUT" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
Done = False$
|
||||
For AttemptNo = 1 to NUM_ATTEMPTS$
|
||||
If AttemptNo GT 1 then Delay(1)
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
Done = True$
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
If AttemptNo GE NUM_ATTEMPTS$ then
|
||||
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
Until Done or ErrorMsg
|
||||
Next AttemptNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'WO_STEP key for WM_OUT ':WMOKey:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
@ -505,10 +518,12 @@ Service VerifyWoStepWMOKeyIndex(WMOKey)
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
|
||||
|
||||
@ -525,10 +540,9 @@ Service VerifyWOLogWMOKeyIndex(WMOKey)
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WM_OUT{WO_NO} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyWMOWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<2> = WMOKey
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
@ -540,6 +554,7 @@ Service VerifyWOLogWMOKeyIndex(WMOKey)
|
||||
If WONo NE '' then
|
||||
WOLogRDSKeys = ''
|
||||
Extract_Si_Keys('WM_OUT', 'WO_NO', WONo, WOLogRDSKeys)
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<3> = WONo
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
Locate WMOKey in WOLogRDSKeys using @VM setting vPos else
|
||||
@ -548,24 +563,34 @@ Service VerifyWOLogWMOKeyIndex(WMOKey)
|
||||
// Add index transaction to update WO_NO btree index
|
||||
IndexTransactionRow = 'WO_NO':@FM:WMOKey:@FM:"":@FM:WONo:@FM
|
||||
Open "!WM_OUT" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
Done = False$
|
||||
For AttemptNo = 1 to NUM_ATTEMPTS$
|
||||
If AttemptNo GT 1 then Delay(1)
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
Done = True$
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
If AttemptNo GE NUM_ATTEMPTS$ then
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
Until Done or ErrorMsg
|
||||
Next AttemptNo
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'WONo for WM_OUT ':WMOKey:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
@ -575,10 +600,12 @@ Service VerifyWOLogWMOKeyIndex(WMOKey)
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM)
|
||||
|
||||
@ -595,10 +622,9 @@ Service VerifyWOMatWMOKeyIndex(WMOKey)
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_MAT{WMO_KEY} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOMatKey':@FM:'Result'
|
||||
objVerifyWOMatWmoKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<2> = WMOKey
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
@ -609,32 +635,44 @@ Service VerifyWOMatWMOKeyIndex(WMOKey)
|
||||
WOMatKey = Field(WMOKey, '*', 1, 1):'*':Field(WMOKey, '*', 3, 1)
|
||||
If WOMatKey NE '' then
|
||||
WOMatWMOKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X')
|
||||
LogData<3> = WOMatKey
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<3> = WOMatKey
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
If WOMatWMOKey EQ '' then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'WMOKey missing from WO_MAT record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update WMO_KEY relational index (target WO_MAT table)
|
||||
IndexTransactionRow = 'WO_MAT*WMO_KEY*TOP':@FM:WMOKey:@FM:"":@FM:WOMatKey:@FM
|
||||
Open "!WM_OUT" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
Done = False$
|
||||
For AttemptNo = 1 to NUM_ATTEMPTS$
|
||||
If AttemptNo GT 1 then Delay(1)
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
Done = True$
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
|
||||
If AttemptNo GE NUM_ATTEMPTS$ then
|
||||
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
Until Done or ErrorMsg
|
||||
Next AttemptNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'WO_MAT key for WM_OUT ':WMOKey:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
@ -642,10 +680,12 @@ Service VerifyWOMatWMOKeyIndex(WMOKey)
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<1> = OConv(Datetime(), 'DT/^S')
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM)
|
||||
|
||||
@ -653,6 +693,7 @@ Service VerifyWOMatWMOKeyIndex(WMOKey)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service GetWMOutKeys(WOLogId)
|
||||
|
||||
ErrorMsg = ''
|
||||
|
||||
Reference in New Issue
Block a user