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

@ -223,17 +223,27 @@ WRITE_RECORD_PRE:
SaveRecord = Record
end
EntryDate = Record<WO_LOG_ENTRY_DATE$>
Today = Date()
YearsOpen = SRP_Date('YearSpan', EntryDate, Today, True$)
ScrapQty = Record<WO_LOG_SCRAP_QTY_STATIC$>
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'
// 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$)
ScrapQty = Record<WO_LOG_SCRAP_QTY_STATIC$>
ShipQty = Record<WO_LOG_SHIP_QTY_STATIC$>
CurrStatus = Record<WO_LOG_CURR_STATUS_STATIC$>
CloseDate = Record<WO_LOG_CLOSE_DATE$>
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