コード例 #1
0
        private string CancelGoodsIssue(CancelMovementDTO pObjCancelMovementDTO)
        {
            string lStrResult = string.Empty;

            try
            {
                List <GoodsIssue>  lLstGoodsIssue      = mObjAuctionsFactory.GetBatchAuctionService().GetBatches(mObjAuction.Id).SelectMany(x => x.GoodsIssues).Where(y => y.BatchId == mObjBatch.Id).ToList();
                List <GoodsReturn> lLstGoodsReturnExit = mObjAuctionsFactory.GetBatchAuctionService().GetBatches(mObjAuction.Id).SelectMany(x => x.GoodsReturns).Where(y => !y.Removed && y.BatchId == mObjBatch.Id && y.Delivered == true).ToList();

                int lIntQtyGoodIssue = lLstGoodsIssue != null?lLstGoodsIssue.Sum(z => z.Quantity) : 0;

                int lIntQtyGoodReturnExit = lLstGoodsReturnExit != null?lLstGoodsReturnExit.Sum(z => z.Quantity) : 0;

                if (lIntQtyGoodIssue - pObjCancelMovementDTO.GoodIssue.Quantity >= lIntQtyGoodReturnExit)
                {
                    pObjCancelMovementDTO.GoodIssue.Canceled = true;
                    mObjInventoryServicesFactory.GetGoodsIssueService().SaveOrUpdate(pObjCancelMovementDTO.GoodIssue);
                    mObjInventoryServicesFactory.GetGoodsIssueService().Remove(pObjCancelMovementDTO.MovementId);
                    lStrResult = "";
                }
                else
                {
                    lStrResult = "Favor de revisar las cantidades " + "Cantidad Salidas - Cantidad Salida a Cancelar >= Cantidad Devoluciones(Salida)";
                }
            }
            catch (Exception ex)
            {
                lStrResult = "Error al cancelar folio: " + pObjCancelMovementDTO.GoodIssue.Id + " Error: " + ex.Message;
                //CustomMessageBox.Show("Error al cancelar", ex.Message, this.GetParent());
            }

            return(lStrResult);
        }
コード例 #2
0
ファイル: UCGoodIssues.xaml.cs プロジェクト: xavl369/UGRS
        private void LoadDatagrid()
        {
            FormLoading();
            try
            {
                Auction lObjAuction = mObjAuctionsServicesFactory.GetAuctionService().GetCurrentOrLast(AuctionCategoryEnum.AUCTION);
                mLstObjPickList = mObjInventoryServicesFactory.GetGoodsIssueService().GetListToPick(lObjAuction != null ? lObjAuction.Id : 0);
                mLcvListData    = new ListCollectionView(mLstObjPickList);

                this.Dispatcher.Invoke(() =>
                {
                    dgBatch.ItemsSource = null;
                    dgBatch.ItemsSource = mLstObjPickList;

                    SetControlsAuction(lObjAuction);
                });
            }
            catch (Exception lObjException)
            {
                FormDefault();
                ShowMessage("Error", lObjException.Message);
            }
            finally
            {
                FormDefault();
            }
        }