added additional checks in WO_LOG WRITE_PRE action to only set the closes date and closed status if the work order is not already closed
This commit is contained in:
@ -222,14 +222,17 @@ WRITE_RECORD_PRE:
|
||||
Record<WO_LOG_RX_QTY_STATIC$> = RXQty
|
||||
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$>
|
||||
If ( ( (ScrapQty + ShipQty) GE NewQty ) or (YearsOpen GE 3) ) then
|
||||
|
||||
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'
|
||||
SaveRecord = Record
|
||||
end
|
||||
@ -545,4 +548,3 @@ ClearCursors:
|
||||
Next counter
|
||||
return
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user