When posting a production report as finished journal you may receive this error,
Physical remaining quantity and total quantity must have the same sign.
It is because the remaining quantity on the production order is incorrect.
The quantity should never be negative. I think it happens after running estimation incorrectly. Run this job and it will fix the quantity.
static void fixProdNegQty(Args _args)
{
ProdTable prodTable;
;
ttsbegin;
select firstOnly forUpdate prodTable
where prodTable.ProdId == "W0024381"
&& prodTable.RemainInventPhysical < 0;
if (prodTable.RecId)
{
prodTable.RemainInventPhysical = 0;
prodTable.modifiedField(fieldnum(ProdTable, RemainInventPhysical));
prodTable.update();
info("Updated");
}
ttscommit;
}
thank you, worked for me.