private void ManageBatches(out bool BubbleEvent)
        {
            bool isIssueMandatorybatches;
            bool isReceiptMandatoryBatches;

            var issBatchRowsList = GetIssueSelectedItems(out isIssueMandatorybatches);
            var recBatchRowsList = GetReceiptSelectedItems(out isReceiptMandatoryBatches);

            var parameters = new Dictionary <object, object>();

            //if (BatchForm == null && (BatchesManaged == false || BatchesManaged == null) && (isIssueMandatorybatches || isReceiptMandatoryBatches))
            if (BatchForm == null && (BatchesManaged == null) && (isIssueMandatorybatches || isReceiptMandatoryBatches))
            {
                BatchForm = new BatchNumberSelection(this, issBatchRowsList, recBatchRowsList);
                parameters.Add("Instance", BatchForm);
                OnSubFormCreated(this, new FormArgs(parameters));
                ClearListsContents();
                BubbleEvent = false;
            }
            else
            //if (BatchForm != null && (BatchesManaged == false || BatchesManaged == null) && (isIssueMandatorybatches || isReceiptMandatoryBatches))
            if (BatchForm != null && (BatchesManaged == null) && (isIssueMandatorybatches || isReceiptMandatoryBatches))
            {
                BatchForm.UIAPIRawForm.Select();
                ClearListsContents();
                BubbleEvent = false;
            }
            else
            {
                BubbleEvent = true;
            }
        }
Exemple #2
0
        public void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            var currentForm = Application.SBO_Application.Forms.ActiveForm;

            try
            {
                if (pVal.BeforeAction && pVal.MenuUID == "frm_TransferItems")
                {
                    TransferItems activeForm = new TransferItems();
                    activeForm.Show();
                    activeForm.OnUserFormClosedDone += new UserFormClosedDone(OnUserFormClosed);
                    activeForm.OnSubFormCreated     += new SubFormCreated <BatchNumberSelection>(ExecuteCustomHandler <BatchNumberSelection>);
                    frmInstances.Add(activeForm);
                }
                if (pVal.BeforeAction && pVal.MenuUID == "frm_TransferSetup")
                {
                    TransferSetup activeForm = new TransferSetup();
                    activeForm.Show();
                    activeForm.OnUserFormClosedDone += new UserFormClosedDone(OnUserFormClosed);

                    frmInstances.Add(activeForm);
                }

                var currentFormId = Application.SBO_Application.Forms.ActiveForm.TypeEx;

                var formTypes = frmInstances.Where(c => c.UIAPIRawForm.TypeEx == currentFormId);
                if (formTypes.Count() > 0)
                {
                    if (!pVal.BeforeAction)
                    {
                        var currentFormInstance = frmInstances.Where(x => x.UIAPIRawForm.UniqueID == Application.SBO_Application.Forms.ActiveForm.UniqueID).FirstOrDefault();
                        currentFormInstance.MenuEvent(ref pVal, out BubbleEvent);
                    }
                }

                if (pVal.BeforeAction && pVal.MenuUID == "new_3")
                {
                    BatchNumberSelection bselection = new BatchNumberSelection();
                    bselection.Show();
                }
            }
            catch (Exception ex)
            {
                Utilities.LogException(ex);
            }
        }