Beispiel #1
0
        private void LoadRisesByContract(string pStrContractDocEntry)
        {
            try
            {
                this.UIAPIRawForm.Freeze(true);

                ClearMatrix(dtRise.UniqueID, mtxRise);

                List <RiseFiltersDTO> lLstRises = mObjMachineryServiceFactory.GetRiseService().GetRisesByContractId(pStrContractDocEntry);

                foreach (var lObjRise in lLstRises)
                {
                    AddRise(lObjRise);
                }
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[frmRiseSearch - LoadRisesByContract] Error al buscar las subidas: {0}", lObjException.Message));
                throw new Exception(string.Format("Error al buscar las subidas: {0}", lObjException.Message));
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Beispiel #2
0
        private void CreateStockTransfer()
        {
            try
            {
                if (string.IsNullOrEmpty(txtRiseFolio.Value))
                {
                    UIApplication.ShowError("No se seleccionó una subida");
                    return;
                }

                if (dtItems.Rows.Count <= 0)
                {
                    UIApplication.ShowError("Sin artículos para dar salida");
                    return;
                }

                SAPbobsCOM.StockTransfer lObjStockTransfer = (SAPbobsCOM.StockTransfer)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer);
                lObjStockTransfer.FromWarehouse = "MQHEOBRA";
                lObjStockTransfer.ToWarehouse   = "MQHE";
                lObjStockTransfer.UserFields.Fields.Item("U_MQ_Rise").Value = txtRiseFolio.Value;

                for (int i = 0; i < dtItems.Rows.Count; i++)
                {
                    string lStrItemCode = dtItems.GetValue("ItemCode", i).ToString();
                    double lDblQuantity = double.Parse(dtItems.GetValue("Qty", i).ToString());

                    if (lDblQuantity <= 0)
                    {
                        UIApplication.ShowError(string.Format("No puede dar entrada al artículo {0} si la cantidad es menor o igual a 0", lStrItemCode));
                        return;
                    }

                    lObjStockTransfer.Lines.SetCurrentLine(i);
                    lObjStockTransfer.Lines.ItemCode          = lStrItemCode;
                    lObjStockTransfer.Lines.FromWarehouseCode = "MQHEOBRA";
                    lObjStockTransfer.Lines.WarehouseCode     = "MQHE";
                    lObjStockTransfer.Lines.Quantity          = lDblQuantity;
                    lObjStockTransfer.Lines.Add();
                }

                if (lObjStockTransfer.Add() != 0)
                {
                    string lStrLastError = DIApplication.Company.GetLastErrorDescription();
                    UIApplication.ShowMessageBox(string.Format("Error al generar la entrada de consumibles: {0}", DIApplication.Company.GetLastErrorDescription()));
                }
                else
                {
                    int lIntDocEntry = int.Parse(DIApplication.Company.GetNewObjectKey());

                    LogUtility.WriteSuccess(string.Format("[frmStockTransfer - CreateStockTransfer] StockTransfer creado correctamente con el DocEntry {0} para la Subida: {1}", lIntDocEntry, txtRiseFolio.Value));

                    mObjMachineryServiceFactory.GetRiseService().MarkRiseAsStockTransfer(int.Parse(txtRiseFolio.Value));
                    ClearControls();

                    UIApplication.ShowSuccess("Entrada de mercancía creada correctamente");
                }
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[frmStockTransfer - CreateStockTransfer] Error al crear la entrada de consumibles: {0}", lObjException.Message));
                throw new Exception(string.Format("Error al crear la entrada de consumibles: {0}", lObjException.Message));
            }
        }
Beispiel #3
0
        private void LoadFolios(FoliosFormModeEnum pEnmFoliosModeEnum)
        {
            try
            {
                this.UIAPIRawForm.Freeze(true);
                Application.SBO_Application.StatusBar.SetText("Buscando folios...", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);

                ClearMatrix();

                //FillDataSource(pStrDate1, pStrDate2);

                if (pEnmFoliosModeEnum == FoliosFormModeEnum.Commission)
                {
                    this.UIAPIRawForm.DataSources.DataTables.Item("DT_Fol").ExecuteQuery(mObjMachinerySeviceFactory.GetRiseService().GetCommissionsRiseQuery());
                }
                else if (pEnmFoliosModeEnum == FoliosFormModeEnum.RelatedRise)
                {
                    this.UIAPIRawForm.DataSources.DataTables.Item("DT_Fol").ExecuteQuery(mObjMachinerySeviceFactory.GetRiseService().GetRiseFoliosQuery());
                }
                else //StockTransfer
                {
                    this.UIAPIRawForm.DataSources.DataTables.Item("DT_Fol").ExecuteQuery(mObjMachinerySeviceFactory.GetRiseService().GetNoStockTransferRisesQuery());
                }

                mtxFolios.AutoResizeColumns();
                mtxFolios.Columns.Item("ColFolio").DataBind.Bind("DT_Fol", "U_IdRise");
                mtxFolios.Columns.Item("ColClient").DataBind.Bind("DT_Fol", "ClientName");
                //mtxFolios.Columns.Item("ColEst").DataBind.Bind("DT_Fol", "Estatus");

                mtxFolios.LoadFromDataSource();
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(String.Format("[frmCFLFolios - LoadFolios] Error: {0}", lObjException.Message));
                SAPbouiCOM.Framework.Application.SBO_Application.MessageBox(string.Format("Error al obtener los folios: {0}", lObjException.Message));
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }