BPM to restrict transfer order shipment more than requested qty along with changed and update

Any one know the code to restrict , transfer order shipment , ourstockshipped qty should not be greater than requested qty.

@abdul Welcome. We don’t do transfer orders, but if you search the site for customer shipment entry there should be several examples of this that should be a good starting point.

Create a pre-processing Method Directive on TransOrderShip.Update, add a custom code widget and paste the following code:

var ShipDtl = ds.TFShipDtl.Where(sd => (sd.Added() ||sd.Updated()) && ((sd.OurStockShippedQty) > (sd.OurStockQty))).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,});
}

Should give you what you want but will need testing

3 Likes

Hi, Sue,

I tried this code before, but it is working fine for the first line but not working for another line. It means, if I am going to ship partial qty by line no 1 and another remaining qty by line 2 then at the time of second shipping, system allowing me to ship more than required qty.

Please help me out in this.

Screenshot 2023-09-25 105951

We used to get complaints from our shipping department that we would get an error message if we attempted to do this. Are you using transfer order suggestions? Guess maybe it was a bug that did what you want the BPM to do… I just know we had to adjust our transfer orders themselves for a long time to be the quantity that the shipping dept wanted to ship if it was greater than the quantity the transfer order was for.