Ejemplo n.º 1
0
        public void OpenStockTransferForm()
        {
            try {
                if (!Object.ReferenceEquals(requestTransfers, null))
                {
                    LogService.WriteInfo("Begin Transfer for Document: " + requestTransfers[0].DocNum);
                    SAPMatrix.SetColumnQuantities(mtx0, "Quantity", requestTransfers, "Quantity");
                    requestTransfers[0].Observations = txtObserv.Value;
                    var result = StockTransferDI.CreateDraft(requestTransfers, user);

                    if (result.Success)
                    {
                        Form form = SAPbouiCOM.Framework.Application.SBO_Application.OpenForm((BoFormObjectEnum)112, "", result.DocEntry.ToString());
                        this.UIAPIRawForm.Close();

                        Task.Factory.StartNew(() => {
                            AlertMessageDI.Create(new MessageDTO()
                            {
                                UserCode = foodTransferDAO.GetUserCode(requestTransfers[0].UserID.ToString()),
                                Message  = "Se ha realizado la transferencia de mercancia solicitada en el documento #" + requestTransfers[0].DocNum
                            });
                        });
                        LogService.WriteInfo("End Transfer for Document: " + requestTransfers[0].DocNum);
                    }
                    else
                    {
                        UIApplication.ShowMessageBox(result.Message);
                    }
                }
            }
            catch (Exception ex) {
                SAPException.Handle(ex, "OpenStockTransferForm");
            }
        }
Ejemplo n.º 2
0
        private void CreateTransfer(bool isCancellation)
        {
            var transferDocument = new DocumentTransfer();

            try {
                LogService.WriteInfo("Begin Create Transfer");
                transferDocument.Document = pendingTransfers[selectedRow - 1];
                transferDocument.Lines    = transferItems;
                transferDocument.Series   = seriesNumbers;

                if (!String.IsNullOrEmpty(txtComment.Value))
                {
                    transferDocument.Document.Comments = txtComment.Value;
                }

                Task.Factory.StartNew(() => {
                    return(StockTransferDI.CreateTransfer(transferDocument, isCancellation));
                }).ContinueWith(t => {
                    if (t.Result.Success)
                    {
                        pendingTransfers = foodTransferDAO.GetPendingTransfers();
                        this.UIAPIRawForm.Freeze(true);
                        SAPMatrix.Fill("DT0", dt0, mtx0, columns0.Keys.ToList(), pendingTransfers);
                        this.UIAPIRawForm.Freeze(false);

                        if (isCancellation)
                        {
                            AlertMessageDI.Create(new MessageDTO()
                            {
                                UserCode = foodTransferDAO.GetUserCode(transferDocument.Document.UserID.ToString()),
                                Message  = String.Format("Se ha rechazado la transferencia #{0} y se ha solicitado la trasnferencia de devolución #{1}", transferDocument.Document.Folio, t.Result.DocEntry)
                            });
                        }

                        SAPMatrix.ClearMtx(mtx1);
                        transferItems    = null;
                        seriesNumbers    = null;
                        transferDocument = null;
                    }

                    UIApplication.ShowMessageBox(t.Result.Message);
                    LogService.WriteInfo("End Create Transfer");
                });
            }
            catch (AggregateException ae) {
                ae.Handle(e => {
                    SAPException.Handle(e, "CreateTransfer");
                    return(true);
                });
            }
        }
Ejemplo n.º 3
0
        private void CreatePlantTransfer(bool switchWhs)
        {
            var transferDocument = new DocumentTransfer();

            transferDocument.Document = pendingTransfers[selectedRow - 1];
            transferDocument.Lines    = transferItems;

            if (!String.IsNullOrEmpty(txtComment.Value))
            {
                transferDocument.Document.Comments = txtComment.Value;
            }

            UIApplication.ShowMessageBox(StockTransferDI.TransferPlant(transferDocument, switchWhs).Message);
        }
Ejemplo n.º 4
0
        public void OpenStockTransferForm()
        {
            if (!Object.ReferenceEquals(requestTransfers, null))
            {
                SetStockTransferQuantities("C_Quantity");
                requestTransfers[0].Observations = txtObserv.Value;
                var result = StockTransferDI.CreateDraft(requestTransfers, user);

                if (result.Success)
                {
                    Form form = SAPbouiCOM.Framework.Application.SBO_Application.OpenForm((BoFormObjectEnum)112, "", result.Message);
                }
                else
                {
                    UIApplication.ShowMessageBox(result.Message);
                }
            }
        }