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
|
Record<WO_LOG_RX_QTY_STATIC$> = RXQty
|
||||||
SaveRecord = Record
|
SaveRecord = Record
|
||||||
end
|
end
|
||||||
|
|
||||||
EntryDate = Record<WO_LOG_ENTRY_DATE$>
|
EntryDate = Record<WO_LOG_ENTRY_DATE$>
|
||||||
Today = Date()
|
Today = Date()
|
||||||
YearsOpen = SRP_Date('YearSpan', EntryDate, Today, True$)
|
YearsOpen = SRP_Date('YearSpan', EntryDate, Today, True$)
|
||||||
ScrapQty = Record<WO_LOG_SCRAP_QTY_STATIC$>
|
ScrapQty = Record<WO_LOG_SCRAP_QTY_STATIC$>
|
||||||
ShipQty = Record<WO_LOG_SHIP_QTY_STATIC$>
|
ShipQty = Record<WO_LOG_SHIP_QTY_STATIC$>
|
||||||
If ( ( (ScrapQty + ShipQty) GE NewQty ) or (YearsOpen GE 3) ) then
|
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
|
// Auto-close the work order
|
||||||
|
Record<WO_LOG_CLOSE_DATE$> = Date()
|
||||||
Record<WO_LOG_CURR_STATUS_STATIC$> = 'CL'
|
Record<WO_LOG_CURR_STATUS_STATIC$> = 'CL'
|
||||||
SaveRecord = Record
|
SaveRecord = Record
|
||||||
end
|
end
|
||||||
@ -545,4 +548,3 @@ ClearCursors:
|
|||||||
Next counter
|
Next counter
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user