Hi All,
Our client had a requirement to run reorders based on min-max
i.e reorder trigger point should be MINLEVEL and reorder quantity to be MAXLEVEL instead of MINLEVEL.
if minlevel is 5 and maxlevel is 10, oncel current balance reached 5, it should reorder to replinish back to 10.
I found the MAXLEVEL attribute without any logic and we want to do minimum customization.
So i loaded the values to minlevel and maxlevel, wrote an autoscript on reorderpad object on before save event.
Here the script withh update the reorderqty to add the difference between minlevel and maxlevel.
The script works perfect and it orders to maxlevel when it reach minlevel, but only when the items are less.
currentOrderQty = mbo.getInt("REORDERQTY")
invSet = mbo.getMboSet("INVENTORY")
invSet.setDiscardable(True)
if invSet is not None and not invSet.isEmpty():
invMbo = invSet.moveFirst()
if invMbo is not None and not invMbo.isNull("MAXLEVEL") and not invMbo.isNull("MINLEVEL"):
maxLevel = invMbo.getInt("MAXLEVEL")
minLevel = invMbo.getInt("MINLEVEL")
if maxLevel > 0:
mbo.setValue("REORDERQTY", currentOrderQty + (maxLevel - (minLevel + 1)), 11L)
When we let the reorder cron run reorder for bulk of items we get below error:
Reorder cron task Tue Jul 07 11:36:00 AST 2026 Reorder cron task processes storeroom MAINSTORE in site XXX. BMXAA6713E - The MBO fetch operation failed in the mboset with the SQL error code -4470. The record could not be retrieved from the database. See the log file for more details about the error.
This error is happening because of the last setvalue on reorderqty.
The alternative solutions are to ditch completely the reorder pad and push the logic to PRLINE level, or have our own logic in reorder using DB formulas.
Before trying these out, wanted to know if the current setup of scripting over reorderpad is recommended?
I want to achieve this with only minimum customization.
------------------------------
salah hassan
------------------------------