Updated WO_LOG_ACTIONS to also set the legacy status field in the WO_LOG table. Updated GetIQSViolationData to only update the Reactor record if something has changed.

This commit is contained in:
Infineon\StieberD
2025-07-11 07:59:48 -07:00
parent 269e5f9bd4
commit eb85afaf35
2 changed files with 30 additions and 16 deletions

View File

@ -3756,6 +3756,9 @@ Service UpdateReactorIQSViolations()
If HaveLock then
ReactorRec = Database_Services('ReadDataRow', 'REACTOR', ReactNo)
If Error_Services('NoError') then
CurrAlarmDtm = ReactorRec<REACTOR_IQS_ALARM_DTM$>
CurrAlarmTest = ReactorRec<REACTOR_IQS_ALARM_TEST$>
If ( (CurrAlarmDtm NE '') or (CurrAlarmTest NE '') ) then
ReactorRec<REACTOR_IQS_ALARM_DTM$> = ''
ReactorRec<REACTOR_IQS_ALARM_TEST$> = ''
// WriteDataRow will clear the lock as long as "IgnoreAllLocks" is false
@ -3763,6 +3766,7 @@ Service UpdateReactorIQSViolations()
end
end
end
end
Next ReactNo
end
end

View File

@ -223,6 +223,7 @@ WRITE_RECORD_PRE:
SaveRecord = Record
end
// Check if we need to auto-close the work order
EntryDate = Record<WO_LOG_ENTRY_DATE$>
Today = Date()
YearsOpen = SRP_Date('YearSpan', EntryDate, Today, True$)
@ -230,10 +231,19 @@ WRITE_RECORD_PRE:
ShipQty = Record<WO_LOG_SHIP_QTY_STATIC$>
CurrStatus = Record<WO_LOG_CURR_STATUS_STATIC$>
CloseDate = Record<WO_LOG_CLOSE_DATE$>
If ( ( (CurrStatus NE 'CL') or (CloseDate EQ '') ) and ( ( (ScrapQty + ShipQty) GE NewQty ) or (YearsOpen GE 3) ) ) then
// Auto-close the work order
Record<WO_LOG_CLOSE_DATE$> = Date()
Record<WO_LOG_CURR_STATUS_STATIC$> = 'CL'
LegacyStatus = Record<WO_LOG_STATUS$>
If ( ( (CurrStatus NE 'CL') or (CloseDate EQ '') or (LegacyStatus NE 'C') ) and ( ( (ScrapQty + ShipQty) GE NewQty ) or (YearsOpen GE 1) ) ) then
If (CloseDate EQ '') then Record<WO_LOG_CLOSE_DATE$> = Date()
If (CurrStatus NE 'CL') then Record<WO_LOG_CURR_STATUS_STATIC$> = 'CL'
If (LegacyStatus NE 'C') then Record<WO_LOG_STATUS$> = 'C'
SaveRecord = Record
end
// For work orders already closed, ensure CurrStatus, LegacyStatus, and Close date are consistent
If ( (CurrStatus EQ 'CL') or (CloseDate NE '') or (LegacyStatus EQ 'C') ) then
If (CloseDate EQ '') then Record<WO_LOG_CLOSE_DATE$> = Date()
If (CurrStatus NE 'CL') then Record<WO_LOG_CURR_STATUS_STATIC$> = 'CL'
If (LegacyStatus NE 'C') then Record<WO_LOG_STATUS$> = 'C'
SaveRecord = Record
end