Beispiel #1
0
        private string CancelGoodReturn(CancelMovementDTO pObjCancelMovementDTO)
        {
            string lStrResult = string.Empty;

            try
            {
                bool lBolCancel = false;
                if (pObjCancelMovementDTO.GoodReturn.Delivered)
                {
                    List <GoodsReturn> lLstGoodsReturns = mObjAuctionsFactory.GetBatchAuctionService().GetBatches(mObjAuction.Id).SelectMany(x => x.GoodsReturns).Where(y => y.BatchId == mObjBatch.Id).ToList();
                    int lIntQtyGoodsReturns             = lLstGoodsReturns != null?lLstGoodsReturns.Sum(z => z.Quantity) : 0;


                    if (lIntQtyGoodsReturns > pObjCancelMovementDTO.GoodReturn.Quantity)
                    {
                        lBolCancel = true;
                    }
                    else
                    {
                        lBolCancel = false;
                        lStrResult = "Favor de revisar las cantidades " + "La cantidad a cancelar debe de ser menor a la cantidad de salidas";
                    }
                }
                else
                {
                    lBolCancel = true;
                }

                if (lBolCancel)
                {
                    pObjCancelMovementDTO.GoodReturn.Canceled = true;
                    mObjInventoryServicesFactory.GetGoodsReturnService().SaveOrUpdate(pObjCancelMovementDTO.GoodReturn);
                    mObjInventoryServicesFactory.GetGoodsReturnService().Remove(pObjCancelMovementDTO.MovementId);
                    lStrResult = "";
                }
            }
            catch (Exception ex)
            {
                lStrResult = "Error al cancelar " + ex.Message;
            }
            return(lStrResult);
        }
Beispiel #2
0
 private void SaveGoodsReturns()
 {
     FormLoading();
     try
     {
         if (ValidForm())
         {
             SetReturnMotive();
             SetWeights();
             mObjInventoryServicesFactory.GetGoodsReturnService().CreateGoodsReturn(mObjDetailedBatch, mIntAvailableQtty, mIntAvailableDeliveredQtty);
             this.ShowMessage("Devolución de ganado", "Devolución de ganado creada con éxito.");
         }
     }
     catch (Exception lObjException)
     {
         this.ShowMessage("Error", lObjException.Message);
     }
     finally
     {
         this.FormDefault();
     }
 }