BPM to prevent overshipping sales order line quantity

Hi Guys,
Who has a BPM that’s working that prevents one from overshipping.

Pre-Processing Method Directive on CustShip.Update with a custom code node which uses the following:

var ShipDtl = ttShipDtl.Where(sd => (sd.Added()) && ((sd.OurJobShipQty + sd.OurInventoryShipQty) > (sd.SellingReqQty - sd.SellingShippedQty))).FirstOrDefault();

if(ShipDtl != null)
{

  var message = "You are attempting to overship this line, please correct before you can continue."; 
        throw new Ice.Common.BusinessObjectException(new Ice.Common.BusinessObjectMessage(message){Type =Ice.Common.BusinessObjectMessageType.Error,});

}

Thanks SueLowden
I have noted when it throws that error then you put the correct remaining quantity one can save and the error disappears.
After this if you change the ourshipmentquantity to a higher value than the remaining quantity it allows one to oveship.

Thanks Jane

We use a Method Direvtive on Erp.BO.CustShip.GetQtyInfo > Pre-processing.

Hey! Pay Attention!
You are about to overship this order by <Overship/> pieces! 
The release is requesting <myRelQty/> pieces.
<prevShip/> pieces have been shipped already.
You entered <ourQty/> from job, and <ourInvQty/> from inventory.
If you are sure this is correct, please continue. Otherwise, reduce the shipment amount.

The setup:

This doesn’t stop them from over-shipping, but it does warn them and give enough information to make a choice about how to continue.

Just add “sd.Updated()” to the linq statement to fix that.

var ShipDtl = ttShipDtl.Where(sd => ( sd.Added() || sd.Updated() ) && ((sd.OurJobShipQty + sd.OurInventoryShipQty) > (sd.SellingReqQty - sd.SellingShippedQty))).FirstOrDefault();

if(ShipDtl != null)
{

  var message = "You are attempting to overship this line, please correct before you can continue."; 
        throw new Ice.Common.BusinessObjectException(new Ice.Common.BusinessObjectMessage(message){Type =Ice.Common.BusinessObjectMessageType.Error,});
}
1 Like

Great my issue now sorted.

I know that you have this “solved”, but there is another scenario that you need to check for:

  1. create one order, one detail, one release for 100 pieces
  2. create TWO packslips, each for 75 pieces… since neither of them exceed the order quantity they are both ok
  3. ship both of them, and you are exceeding the qty.

Make sure that your BPM catches this condition as well.

I found for one customer that we had to not only verify THIS packslip, but all other open packslips as well in order to catch this type of condition.

1 Like

I didn’t even think of that, we generally have 1 release per order. I’ll see if I can come up with a bpm to monitor those multiple release situations as well.