BPM stop shipment if job is not complete

Here’s what we use to make sure that the qty is completed and they don’t over-ship the qty complete.

var ttShipDtl_Row = (from row in ttShipDtl select row).LastOrDefault();

            if (ttShipDtl_Row != null)
            { 
                Erp.Tables.JobPart JobPart = Db.JobPart.Where(jp => jp.Company == ttShipDtl_Row.Company && jp.JobNum == ttShipDtl_Row.JobNum).FirstOrDefault();
                
                if (JobPart != null)
                {
                    if (ttShipDtl_Row.OurJobShipQty > (JobPart.QtyCompleted - JobPart.ShippedQty) || JobPart.WIPQty <= 0)
                    {
                        return true;
                    }
                    else 
                    {
                      return false;
                    }
                }
                else 
                {
                  return false;
                }
            }
            else 
            {
              return false;
            }

Hope this helps.

4 Likes