/// <summary> /// Process Issue /// </summary> /// <returns>true if processed</returns> public bool Process() { if (!Save()) { return(false); } if (GetM_Product_ID() == 0) { log.Log(Level.SEVERE, "No Product"); return(false); } MProduct product = MProduct.Get(GetCtx(), GetM_Product_ID()); // If not a stocked Item nothing to do if (!product.IsStocked()) { SetProcessed(true); return(Save()); } /** @todo Transaction */ // ** Create Material Transactions ** MTransaction mTrx = new MTransaction(GetCtx(), GetAD_Org_ID(), MTransaction.MOVEMENTTYPE_WorkOrderPlus, GetM_Locator_ID(), GetM_Product_ID(), GetM_AttributeSetInstance_ID(), Decimal.Negate(GetMovementQty()), GetMovementDate(), Get_TrxName()); mTrx.SetC_ProjectIssue_ID(GetC_ProjectIssue_ID()); // MLocator loc = MLocator.Get(GetCtx(), GetM_Locator_ID()); if (MStorage.Add(GetCtx(), loc.GetM_Warehouse_ID(), GetM_Locator_ID(), GetM_Product_ID(), GetM_AttributeSetInstance_ID(), GetM_AttributeSetInstance_ID(), Decimal.Negate(GetMovementQty()), null, null, Get_TrxName())) { if (mTrx.Save(Get_TrxName())) { SetProcessed(true); if (Save()) { return(true); } else { log.Log(Level.SEVERE, "Issue not saved"); // requires trx !! } } else { log.Log(Level.SEVERE, "Transaction not saved"); // requires trx !! } } else { log.Log(Level.SEVERE, "Storage not updated"); // OK } // return(false); }