Пример #1
0
        private bool DeleteMatrixRows_CALL(string pDeliveryCode)
        {
            bool bRtnValue = true;
            System.Data.DataRow[] findRows = null;
            string strIdx = string.Empty;
            int iBtnValue = -1;
            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_ORIG").Specific;
                findRows = gDs.Tables[oForm.UniqueID + "_Call"].Select(string.Format(" DELVCD = '{0}' ", pDeliveryCode));

                // 1. 메트릭스 삭제대상 삭제 적용
                if (findRows.Count() > 0)
                {
                    iBtnValue = B1Connections.theAppl.MessageBox("상담이력이 존재 합니다. 삭제하시겠습니까?", 1, "&Yes", "&No", "");

                    if (iBtnValue == 1)
                    {
                        foreach (System.Data.DataRow dr in findRows)
                        {
                            //삭제할것들 선택한다.
                            strIdx = dr["IDX"].ToString();
                            oMatrix.SelectRow(int.Parse(strIdx) + 1, true, true);

                            gDs.Tables[oForm.UniqueID + "_Call"].Rows.Remove(dr);
                        }

                        // 선택된 Rows를 삭제한다.
                        int iSelectIdx = 0;

                        while (iSelectIdx != -1)
                        {
                            iSelectIdx = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);
                            if (iSelectIdx != -1)
                                oMatrix.DeleteRow(iSelectIdx);
                        }
                        if (findRows.Count() > 0)
                            oMatrix.FlushToDataSource();
                    }
                    else
                        bRtnValue = false;
                }
            }

            catch (Exception)
            {
                bRtnValue = false;
                throw;
            }
            finally
            {
                findRows = null;
            }
            return bRtnValue;
        }
Пример #2
0
        private int GetSelectedMatrixRowIndex(SAPbouiCOM.Form oForm)
        {
            int retValue = -1;
            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific;
                retValue = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);
            }
            catch (Exception)
            {

                throw;
            }
            return retValue;
        }
Пример #3
0
        public virtual void ET_AFRowDataMenu_Add(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;
            // ADD YOUR ACTION CODE HERE ...


            string strCode = string.Empty;
            string strDELIVCD = string.Empty;

            if (gSelMtx == "mtx1_DUMY")
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(gSelMtx).Specific;
                oDB1_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301Z_HRD");

                // 배달코드 생성
                strDELIVCD = GetMaxDelivCode(oForm);

                // SystemDataTable에 행 추가하고 추가된 Index값을 리턴받는다.
                int index = AddRowDataTable_DELIVER(oForm, strDELIVCD);

                SetMatrixAddRow(ref oForm, ref oMatrix, ref oDB1_Z, index.ToString(), strDELIVCD, "U_DELVCD");
            }
            else
            {
                // 배달리스트에서 선택된 라인의 배달코드
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific;


                int iSelectIndex = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_RowOrder);
                strDELIVCD = FN.GetMatirxCellValue(ref oMatrix, "U_DELVCD", iSelectIndex);

                oDB2_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00302Z_HRD");

                // SystemDataTable에 행 추가하고 추가된 Index값을 리턴받는다.
                int index = AddRowDataTable_CALL(oForm, strDELIVCD);

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_DUMY").Specific;
                SetMatrixAddRow(ref oForm, ref oMatrix, ref oDB2_Z, index.ToString(), strDELIVCD, "U_DELVCD");

                // 상담리스트에 행추가하고 선택된 행의 Index 값을 가져와서 선택된 행의 수정여부를 수정한다.
                iSelectIndex = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_RowOrder);

                oMatrix.CommonSetting.SetCellEditable(iSelectIndex, gCallTp_IDX, true);// 콜유형
                oMatrix.CommonSetting.SetCellEditable(iSelectIndex, gComment_IDX, true);// 접수내용

            }
            B1Connections.theAppl.StatusBar.SetText(pVal.MenuUID.ToString(), SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_None);
        }
Пример #4
0
        public virtual bool ET_BFRowDataMenu_Add(MenuEvent pVal)
        {
            oForm = B1Connections.theAppl.Forms.ActiveForm;

            bool rtnValue = true;

            if (gSelMtx == "mtx1_DUMY")
            {

            }
            else
            {
                // 배송리스트가 추가된 내역이 있으면
                int iCount = 0;
                var query = from c in gDs.Tables[oForm.UniqueID + "_Deliver"].AsEnumerable()
                            where c.Field<string>("ROWSTATE") == "I"
                            select new { };

                iCount = query.Count();
                if (iCount > 0)
                {
                    rtnValue = false;
                    B1Connections.theAppl.StatusBar.SetText("배송리스트에 추가된 내역이 존재 합니다. 갱신후 상담내용을 수정해주세요.! ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific;
                int iSelectIndex = oMatrix.GetNextSelectedRow(0, BoOrderType.ot_RowOrder);
                string strDELIVCD = FN.GetMatirxCellValue(ref oMatrix, "U_DELVCD", iSelectIndex);
                if ((string.IsNullOrEmpty(strDELIVCD)) || sFindTY == "")
                {
                    rtnValue = false;
                    B1Connections.theAppl.StatusBar.SetText("배송리스트를 선택해주세요! ", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
            }
            return rtnValue;
        }
Пример #5
0
        public virtual bool ET_mtx1_BFRightClick(ContextMenuInfo pVal)
        {
            oForm = B1Connections.theAppl.Forms.Item(pVal.FormUID);
            oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1").Specific));
            // ADD YOUR ACTION CODE HERE ...

            iRightRowIndex = pVal.Row;

            try
            {
                if (oForm.Mode == BoFormMode.fm_ADD_MODE || oForm.Mode == BoFormMode.fm_OK_MODE || oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                {
                    if (pVal.Row > 0 && pVal.Row <= oMatrix.VisualRowCount)
                    {
                        //문서상태가 미결이고 행상태가 미결 때만 행삭제
                        if (oForm.DataSources.UserDataSources.Item("cboSTATUS").Value == "SO")
                        {
                            SAPbouiCOM.DBDataSource oKIS_SD00301_HRD = oForm.DataSources.DBDataSources.Item("@KIS_SD00301_HRD");
                            if (oKIS_SD00301_HRD.Size>=pVal.Row)
                            {
                                if (oKIS_SD00301_HRD.GetValue("U_STATUS",pVal.Row-1).Trim() != "C")
                                {
                                    oForm.EnableMenu("1293", true);//행삭제
                                }   
                            }
                            oKIS_SD00301_HRD = null;
                        }
                    }
                }

                int oMatrixRow = oMatrix.GetNextSelectedRow();
                if (oMatrixRow > 0)
                {

                    string U_BTYPE = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_BTYPE", oMatrixRow)).Value.Trim();//기준문서 유형
                    string U_TTYPE = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_TTYPE", oMatrixRow)).Value.Trim();//대상문서 유형

                    //메뉴추가
                    SAPbouiCOM.MenuItem oMenuItem;
                    SAPbouiCOM.Menus oMenus;
                    SAPbouiCOM.MenuCreationParams oCreationPackage = (SAPbouiCOM.MenuCreationParams)B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);


                    if (string.IsNullOrEmpty(U_BTYPE) == false)
                    {
                        oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;
                        oCreationPackage.UniqueID = "SUB_BASEDOC";
                        oCreationPackage.String = "(&B)기준전표";
                        oCreationPackage.Enabled = true;
                        oMenuItem = B1Connections.theAppl.Menus.Item("1280"); //'Data'
                        oMenus = oMenuItem.SubMenus;
                        oMenus.AddEx(oCreationPackage);
                    }
                    if (string.IsNullOrEmpty(U_TTYPE) == false)
                    {
                        oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;
                        oCreationPackage.UniqueID = "SUB_TARGETDOC";
                        oCreationPackage.String = "(&T)대상전표";
                        oCreationPackage.Enabled = true;

                        oMenuItem = B1Connections.theAppl.Menus.Item("1280"); //'Data'
                        oMenus = oMenuItem.SubMenus;
                        oMenus.AddEx(oCreationPackage);
                    }

                    oCreationPackage = null;

                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            return true;
        }
Пример #6
0
        /// <summary>
        /// Asigna los numero de serie correspondientes a cada artículo
        /// </summary>
        /// <param name="_oForm">Forma activa</param>
        private void AsignarNumerosDeSeries(Form _oForm)
        {
            try
            {
                _oMatrixSerieArticulos = _oForm.Items.Item(GRID_ARTICULOS_SERIE).Specific;
                _oMatrixSerieDefinir   = _oForm.Items.Item(GRID_SERIE_DEFINIR).Specific;
                List <string> mensajes        = new List <string>();
                List <string> solicitudes     = new List <string>();
                bool          seEncontroSerie = false;

                for (int noLinea = 1; noLinea <= _oMatrixSerieArticulos.RowCount; noLinea++)
                {
                    ProcesoActivo = true;
                    _oForm.Freeze(false);
                    seEncontroSerie = false;

                    _oClaveArticulo      = (SAPbouiCOM.EditText)_oMatrixSerieArticulos.Columns.Item(COLUMNA_CLAVE_ARTICULO).Cells.Item(noLinea).Specific;
                    _oTotalSeleccionados = (SAPbouiCOM.EditText)_oMatrixSerieArticulos.Columns.Item(COLUMNA_TOTAL_SELECCIONADO).Cells.Item(noLinea).Specific;

                    var serieI = from p in lDatosTransferenciaStock
                                 where p.itemCode == _oClaveArticulo.Value.ToString() && p.noLinea == noLinea
                                 select p.serieInial;
                    var serieF = from p in lDatosTransferenciaStock
                                 where p.itemCode == _oClaveArticulo.Value.ToString() && p.noLinea == noLinea
                                 select p.serieFinal;

                    int x = 1;

                    string PrefijoSerie         = serieI.ElementAt(0).ToString().Substring(0, 6);
                    int    serieInicial         = Convert.ToInt32(serieI.ElementAt(0).ToString().Substring(6));
                    int    serieFinal           = Convert.ToInt32(serieF.ElementAt(0).ToString().Substring(6));
                    int    totalSeries          = (serieFinal - serieInicial) + 1;
                    int    longitudSerieInicial = serieI.ElementAt(0).ToString().Substring(6).Length;
                    int    longitudSerieFinal   = serieF.ElementAt(0).ToString().Substring(6).Length;

                    if (_oTotalSeleccionados.Value == "0.0")
                    {
                        _oForm.Freeze(false);
                        _oTxtFiltro = _oForm.Items.Item(CAMPO_FILTRO).Specific;

                        if (serieInicial == serieFinal)
                        {
                            if (serieInicial.ToString().Length < longitudSerieInicial)
                            {
                                _oTxtFiltro.Value = PrefijoSerie + serieInicial.ToString().PadLeft(longitudSerieInicial, '0'); // +"0" + serieInicial;
                            }
                            else
                            {
                                _oTxtFiltro.Value = PrefijoSerie + serieInicial;
                            }
                        }
                        else
                        {
                            for (int i = 0; i < serieI.ElementAt(0).ToString().Length; i++)
                            {
                                if (serieI.ElementAt(0).ToString().Substring(i, 1) != serieF.ElementAt(0).ToString().Substring(i, 1))
                                {
                                    _oTxtFiltro.Value = serieI.ElementAt(0).ToString().Substring(0, i);
                                    break;
                                }
                            }
                            //_oTxtFiltro.Value = PrefijoSerie;
                        }

                        string SerFinal = null;
                        if (serieFinal.ToString().Length < longitudSerieFinal)
                        {
                            SerFinal = PrefijoSerie + serieFinal.ToString().PadLeft(longitudSerieFinal, '0'); // +"0" + serieFinal;
                        }
                        else
                        {
                            SerFinal = PrefijoSerie + serieFinal;
                        }

                        //Presionar de forma automática tabulación para que el sistema realice la búsqueda
                        _Application.SendKeys("{TAB}");
                        _oForm.Select();
                        if (_oMatrixSerieDefinir.RowCount != 0)
                        {
                            _oForm.Freeze(true);
                            _oMatrixSerieDefinir.Columns.Item("19").TitleObject.Click(BoCellClickType.ct_Regular, 4096);
                            _oMatrixSerieDefinir.Columns.Item("19").TitleObject.Click(BoCellClickType.ct_Double);
                            _oForm.Select();
                            // oProgBar = _Application.StatusBar.CreateProgressBar("Seleccionando series del articulo: " + _oClaveArticulo.Value.ToString(), totalSeries, false);
                            _Application.StatusBar.SetText("Buscando series por favor espere....", BoMessageTime.bmt_Long, BoStatusBarMessageType.smt_Warning);
                            for (int noLineaSerie = 1; noLineaSerie <= _oMatrixSerieDefinir.RowCount; noLineaSerie++)
                            {
                                _oForm.Select();
                                if (seEncontroSerie == false)
                                {
                                    _Application.StatusBar.SetText("Buscando series por favor espere...." + noLineaSerie + " de " + _oMatrixSerieDefinir.RowCount.ToString(), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                }
                                //Realiza la función de mantener presionado CTRL y seleccionar cada fila para asignar la serie.
                                SAPbouiCOM.EditText SerieSeleccionada = _oMatrixSerieDefinir.Columns.Item(COLUMNA_NUMERO_SERIE).Cells.Item(noLineaSerie).Specific;

                                try
                                {
                                    if (SerFinal != SerieSeleccionada.Value.ToString())
                                    {
                                        if ((serieInicial.ToString().Length < longitudSerieInicial ?
                                             PrefijoSerie + serieInicial.ToString().PadLeft(longitudSerieInicial, '0') : // "0" + serieInicial.ToString() :
                                             PrefijoSerie + serieInicial.ToString()) == SerieSeleccionada.Value.ToString())
                                        {
                                            //  oProgBar.Text = "Seleccionando serie " + _oClaveArticulo.Value.ToString() + " : " + x + " de " + totalSeries;
                                            _Application.StatusBar.SetText("Seleccionando serie " + _oClaveArticulo.Value.ToString() + " : " + x + " de " + totalSeries,
                                                                           BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                            seEncontroSerie = true;
                                            _oMatrixSerieDefinir.Columns.Item(0).Cells.Item(noLineaSerie).Click(BoCellClickType.ct_Regular, 4096);
                                            x            += 1;
                                            serieInicial += 1;
                                            //oProgBar.Value += 1;
                                        }
                                    }
                                    else
                                    {
                                        //x += 1;
                                        //oProgBar.Text = "Seleccionando serie " + _oClaveArticulo.Value.ToString() + " : " + x + " de " + totalSeries;
                                        _Application.StatusBar.SetText("Seleccionando serie " + _oClaveArticulo.Value.ToString() + " : " + x + " de " + totalSeries,
                                                                       BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                        _oMatrixSerieDefinir.Columns.Item(0).Cells.Item(noLineaSerie).Click(BoCellClickType.ct_Regular, 4096);
                                        break;
                                    }
                                }
                                catch (Exception)
                                {
                                    solicitudes.Add(SerFinal);
                                }
                            }
                            _oForm.Select();
                            // oProgBar.Stop();
                            int selRow = _oMatrixSerieDefinir.GetNextSelectedRow(0, BoOrderType.ot_SelectionOrder);

                            if (selRow != -1)
                            {
                                _oForm.Items.Item(BTN_ASIGNAR_SERIE).Click();
                                _oForm.Items.Item(BTN_ACTUALIZAR).Click();
                            }

                            if (noLinea < _oMatrixSerieArticulos.RowCount)
                            {
                                _oMatrixSerieArticulos.Columns.Item(COLUMNA_NIVEL_LINEA_ARTICULO).Cells.Item(noLinea + 1).Click(BoCellClickType.ct_Regular, 4096);
                            }
                            _oForm.Select();
                            _oTotalSeleccionados = (SAPbouiCOM.EditText)_oMatrixSerieArticulos.Columns.Item(COLUMNA_TOTAL_SELECCIONADO).Cells.Item(noLinea).Specific;
                            _oCantidad           = (SAPbouiCOM.EditText)_oMatrixSerieArticulos.Columns.Item(COLUMNA_CANTIDAD).Cells.Item(noLinea).Specific;

                            if (_oTotalSeleccionados.Value != _oCantidad.Value)
                            {
                                solicitudes.Add(SerFinal);
                                mensajes.Add("No se encontraron algunas series, favor de verificar");
                            }
                        }
                        else
                        {
                            solicitudes.Add(SerFinal);
                            mensajes.Add("No se encontraron algunas series, favor de verificar");
                        }
                    }
                }
                lDatosTransferenciaStock.Clear();
                if (mensajes.Count() != 0)
                {
                    var    listaSolicitudes = string.Join(", ", solicitudes.Select(s => s.ToString()));
                    string mostrar          = mensajes[0] + Environment.NewLine + listaSolicitudes;
                    _Application.MessageBox(mostrar);
                }
                else
                {
                    _Application.MessageBox("Se agregaron las series correctamente.");
                }
            }
            catch (Exception ex)
            {
                //oProgBar.Stop();
                throw new Exception("Error al asignar números de serie *AsignarNumerosDeSeries* : " + ex.Message);
            }
            finally
            {
                _oForm.Freeze(false);
            }
        }
Пример #7
0
        /// <summary>
        /// 선택된 메트릭스의 행값을 헤더의 텍스트 박스에 반영합니다.
        /// </summary>
        private void SetHeaderValues()
        {
            try
            {
                oMatrix = oForm.Items.Item("mtx1").Specific;

                int SelectRowNumber = oMatrix.GetNextSelectedRow();

                if (SelectRowNumber > 0)
                {
                    oForm.DataSources.UserDataSources.Item("edtDOCNUM").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("DocEntry", SelectRowNumber)).Value; ;
                    oForm.DataSources.UserDataSources.Item("edtYEAR").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_YEAR", SelectRowNumber)).Value;
                    oForm.DataSources.UserDataSources.Item("edtMONTH").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_MONTH", SelectRowNumber)).Value;
                    oForm.DataSources.UserDataSources.Item("edtWEEK").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_WEEK", SelectRowNumber)).Value;

                    oForm.DataSources.UserDataSources.Item("edtFRDT").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_FRDT", SelectRowNumber)).Value;
                    oForm.DataSources.UserDataSources.Item("edtTODT").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_TODT", SelectRowNumber)).Value;
                    oForm.DataSources.UserDataSources.Item("edtAMT").Value = ((SAPbouiCOM.EditText)oMatrix.GetCellSpecific("U_PLANSUM", SelectRowNumber)).Value;
                }
                else
                {
                    oForm.DataSources.UserDataSources.Item("edtDOCNUM").Value = "";
                    oForm.DataSources.UserDataSources.Item("edtYEAR").Value = "";
                    oForm.DataSources.UserDataSources.Item("edtMONTH").Value = "";
                    oForm.DataSources.UserDataSources.Item("edtWEEK").Value = "";

                    oForm.DataSources.UserDataSources.Item("edtFRDT").Value = "";
                    oForm.DataSources.UserDataSources.Item("edtTODT").Value = "";
                    oForm.DataSources.UserDataSources.Item("edtAMT").Value = "";
                }
            }
            catch (Exception ex)
            {
                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
            
        }