Exemplo n.º 1
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);
                });
            }
        }
Exemplo n.º 2
0
        public void ClearMatrix()
        {
            txtBags.Value  = String.Empty;
            txtItem.Value  = String.Empty;
            txtDate.Value  = String.Empty;
            txtQDif.Value  = String.Empty;
            txtQPlan.Value = String.Empty;
            txtQReal.Value = String.Empty;
            txtFolio.Value = String.Empty;

            this.UIAPIRawForm.Freeze(true);
            SAPMatrix.ClearMtx(mtx0);
            this.UIAPIRawForm.Freeze(false);

            components     = null;
            productionLine = new Component();
            docEntry       = 0;
            plannedQty     = 0;

            EnableButtons(false);
        }