Exemplo n.º 1
0
        public List <SapDepartment> SapDepartmentGetByProductCode(string branchCode, string productCode)
        {
            RfcDestination sapRfcDestination = SapHelper.Destination;
            RfcRepository  sapRfcRepository  = sapRfcDestination.Repository;

            RfcRepository repo       = sapRfcRepository;
            string        bapiName   = "ZDD_EXPORT_TABLE_ZMATSELLER";
            IRfcFunction  exportBapi = repo.CreateFunction(bapiName);

            exportBapi.SetValue("IN_MATNR", SapFormatProductCode(productCode));
            exportBapi.Invoke(sapRfcDestination);
            IRfcTable detail = exportBapi.GetTable("IN_ZMAT_SELLER");

            var sapDepartment = new List <SapDepartment>();

            foreach (var item in detail)
            {
                if (branchCode.Equals(item["WERKS"].GetString()))
                {
                    sapDepartment.Add(new SapDepartment
                    {
                        DepartmentCode = detail.GetString("LOGGR"),
                        DepartmentName = detail.GetString("LTEXT")
                    });
                }
            }

            return(sapDepartment);
        }
Exemplo n.º 2
0
        public string getLP_Desc(string idioma, string lista) //Trae la descripción lista de precio consultada
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_007");//Módulo de función

                //bapi.SetValue("SPRAS", ");
                bapi.SetValue("PLTYP", lista);

                bapi.Invoke(oDestino);

                //IRfcTable tabla = bapi.GetTable("IT_KNVP");
                string    cadena = "";
                IRfcTable tabla  = bapi.GetTable("IT_T189T");
                for (int i = 0; i < tabla.Count & i < 1; i++)
                {
                    tabla.CurrentIndex = i;
                    cadena             = tabla.GetString("PLTYP") + " " + tabla.GetString("PTEXT");
                }

                return(cadena);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public string auto_clientes(string vk, string vt, string sp, string ku, string em, string tp) //Autocompleta de cliente
        {
            Conexion con = new Conexion("E-DESARROLL2", "Initial02");
            string   t   = "";

            //if (!tp.Trim().Equals("A"))
            if (tp.Trim().Equals("V") | tp.Trim().Equals("C")) //ADD RSG 23.06.2017
            {
                t = em;
            }
            IRfcTable tabla = con.AutoKUNNR(vk, vt, sp, ku.ToUpper(), t);

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("KUNNR");
                lista[i]          += " - " + tabla.GetString("NAME1");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 4
0
        public List <SapDepartment> SapDepartmentGetByLocationCode(string branchCode, string warehouseCode, string locationCode)
        {
            RfcDestination sapRfcDestination = SapHelper.Destination;
            RfcRepository  sapRfcRepository  = sapRfcDestination.Repository;

            RfcRepository repo        = sapRfcRepository;
            string        bapiName    = "ZDD_EXPORT_SELLER_FROM_LOCATE";
            IRfcFunction  companyBapi = repo.CreateFunction(bapiName);

            companyBapi.SetValue("I_BIN_CODE", locationCode);
            companyBapi.SetValue("I_LGORT", warehouseCode);
            companyBapi.SetValue("I_WERKS", branchCode);
            companyBapi.Invoke(sapRfcDestination);
            IRfcTable detail = companyBapi.GetTable("O_TLOGT");

            var sapDepartment = new List <SapDepartment>();

            foreach (var item in detail)
            {
                sapDepartment.Add(new SapDepartment
                {
                    DepartmentCode = detail.GetString("LOGGR"),
                    DepartmentName = detail.GetString("LTEXT")
                });
            }

            return(sapDepartment);
        }
Exemplo n.º 5
0
        public List <meins> meinss() //Trae cadena de mail y teléfono
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_045");//Módulo de función

                bapi.Invoke(oDestino);

                IRfcTable    tcurr = bapi.GetTable("IT_T006A");
                List <meins> mm    = new List <meins>();

                for (int i = 0; i < tcurr.Count; i++)
                {
                    tcurr.CurrentIndex = i;
                    meins m = new meins();
                    m.MSEHI = tcurr.GetString("MSEHI");
                    //m.MSEHI = tcurr.GetString("MSEH3");
                    m.MSEH3 = tcurr.GetString("MSEH3");
                    m.desc  = tcurr.GetString("MSEHL");
                    mm.Add(m);
                }
                //List<string> ms = new List<string>();
                //foreach(meins m in mm)
                //{
                //    ms.Add("<option value='"+m.MSEHI+"'>"+ m.MSEH3+ " - " + "</option>");
                //}

                return(mm);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        public static List <ActivityType> getAllActivityTypes(RfcDestination destination, ControllingArea iControllingArea)
        {
            List <ActivityType> ret = new List <ActivityType>();

            RfcRepository repo             = destination.Repository;
            IRfcFunction  activityTypeList = repo.CreateFunction("BAPI_ACTIVITYTYPE_GETLIST");

            activityTypeList.SetValue("CONTROLLINGAREA", iControllingArea.ControllingAreaCode);
            activityTypeList.SetValue("DATE", DateTime.Now);

            activityTypeList.Invoke(destination);

            IRfcTable activityTypes = activityTypeList.GetTable("ACTIVITYTYPE_LIST");

            for (int cuIndex = 0; cuIndex < activityTypes.RowCount; cuIndex++)
            {
                activityTypes.CurrentIndex = cuIndex;
                ActivityType activityT = new ActivityType();
                activityT.ActivityTypeCode    = activityTypes.GetString("ACTTYPE");
                activityT.ActivityTypeName    = activityTypes.GetString("NAME");
                activityT.ActivityDescription = activityTypes.GetString("DESCRIPT");
                activityT.ControllingArea     = iControllingArea;
                ret.Add(activityT);
            }
            return(ret);
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Conexion c = new Conexion("E-DESARROLL2", "Initial02");

            try
            {
                hidUsuario.Value = Session["Usuario"].ToString();
                hidNumEmp.Value  = Session["NumEmp"].ToString();
                hidTipoEmp.Value = Session["TipoEmp"].ToString();

                Conexion c = new Conexion();
                if (c.conectar())
                {
                    IRfcTable lista_vkorg = c.ListaVKORG("", "");
                    IRfcTable lista_vtweg = c.ListaVTWEG("", "", "");
                    IRfcTable lista_spart = c.ListaSPART("", hidNumEmp.Value, "", "", "01");
                    IRfcTable lista_pltyp;
                    if (lista_spart.Count > 0)
                    {
                        lista_spart.CurrentIndex = 0;
                        lista_pltyp = c.ListaPLTYP(hidNumEmp.Value, lista_spart.GetString("SPART"), "");
                        for (int i = 0; i < lista_pltyp.Count; i++)
                        {
                            lista_pltyp.CurrentIndex = i;
                            txtPLTYP_N.Items.Add(new ListItem(lista_pltyp.GetString("PLTYP") + " " + lista_pltyp.GetString("PTEXT"), lista_pltyp.GetString("PLTYP")));
                        }
                    }
                    fecha_limite = c.fechaLimite();

                    for (int i = 0; i < lista_vkorg.Count; i++)
                    {
                        lista_vkorg.CurrentIndex = i;
                        txtVKORG.Items.Add(new ListItem(lista_vkorg.GetString("VKORG") + " " + lista_vkorg.GetString("VTEXT"), lista_vkorg.GetString("VKORG")));
                        if (lista_vkorg.GetString("VKORG").Equals("1000"))
                        {
                            txtVKORG.SelectedIndex = i;
                        }
                    }
                    for (int i = 0; i < lista_vtweg.Count; i++)
                    {
                        lista_vtweg.CurrentIndex = i;
                        txtVTWEG.Items.Add(new ListItem(lista_vtweg.GetString("VTWEG") + " " + lista_vtweg.GetString("VTEXT"), lista_vtweg.GetString("VTWEG")));
                        if (lista_vtweg.GetString("VTWEG").Equals("10"))
                        {
                            txtVTWEG.SelectedIndex = i;
                        }
                    }
                    for (int i = 0; i < lista_spart.Count; i++)
                    {
                        lista_spart.CurrentIndex = i;
                        txtSPART.Items.Add(new ListItem(lista_spart.GetString("SPART") + " " + lista_spart.GetString("VTEXT"), lista_spart.GetString("SPART")));
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("https://www.terzaonline.com/nworkflow/login/");
            }
        }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            month = HttpUtil.GetReqStrValue("month");
            werk  = HttpUtil.GetReqStrValue("werk");
            SAPCHARTPARAM param = new SAPCHARTPARAM();
            param.I_WERKS = werk;
            param.I_GJAHR = month.Substring(0, 4);
            param.I_MONAT = month.Substring(5, 2);
            monthStr      = param.I_MONAT;
            days          = DateTime.DaysInMonth(Convert.ToInt32(param.I_GJAHR), Convert.ToInt32(param.I_MONAT));
            //库存金额情况变动表
            //ZTTPP_STOCK_MONEY val1 = new ZTTPP_STOCK_MONEY();
            //val1.ZDATE = "";
            //val1.ZKCJE = "";
            //val1.ZKW = "";
            //val1List = RFCUtil.GetTable<ZTTPP_STOCK_MONEY>(param, "ZP_REPL_STOCK_MONEY_OUT", "IT_STOCK_MONEY", val1);
            //  AttributeItem[]  item1List = val1.af_GetAvailableAttributeItem();
            for (int i = 1; i <= days; i++)
            {
                labels += "\"" + param.I_MONAT + "/" + (i < 10 ? "0" + i : "" + i) + "\",";
            }
            labels = labels.Substring(0, labels.Length - 1);


            IRfcTable IrfTable = RFCUtil.GetTable(param, "ZP_REPL_STOCK_MONEY_OUT", "IT_STOCK_MONEY");
            for (int i = 0; i < IrfTable.Count; i++)
            {
                IrfTable.CurrentIndex = i;
                string zdate = IrfTable.GetString("ZDATE");
                string zkw   = IrfTable.GetString("ZKW");
                string zkcje = IrfTable.GetString("ZKCJE");

                stockMap.Add("" + zdate + zkw, zkcje);
                //zkwMap.Add(zkw, zkw);
                if (!zkwMap.ContainsKey(zkw))
                {
                    zkwMap.Add(zkw, zkw);
                }
            }

            foreach (var zkw in zkwMap)
            {
                lineNames.Add(zkw.Key);
                string data = "";
                for (int i = 1; i <= days; i++)
                {
                    data += stockMap.ContainsKey(month + "-" + (i < 10 ? "0" + i : "" + i) + zkw.Key) ? stockMap[month + "-" + (i < 10 ? "0" + i : "" + i) + zkw.Key] + "," : "0" + ",";
                }
                datas.Add(data);
            }
            //itemLists.Add(item1List);
        }
        else
        {
        }
    }
Exemplo n.º 9
0
 private string getDescLP(string pltyp, IRfcTable p)
 {
     for (int i = 0; i < p.Count; i++)
     {
         p.CurrentIndex = i;
         if (p.GetString("PLTYP").Equals(pltyp))
         {
             return(p.GetString("PLTYP") + " " + p.GetString("PTEXT"));
         }
     }
     return("");
 }
Exemplo n.º 10
0
        public void getSAPData()
        {
            try
            {
                RfcConfigParameters rfcPar = new RfcConfigParameters();
                rfcPar.Add(RfcConfigParameters.Name, "DEV");
                rfcPar.Add(RfcConfigParameters.AppServerHost, "10.1.10.6");
                rfcPar.Add(RfcConfigParameters.Client, "560");
                rfcPar.Add(RfcConfigParameters.User, "IT_XM01");
                rfcPar.Add(RfcConfigParameters.Password, "/qaz456");
                rfcPar.Add(RfcConfigParameters.SystemNumber, "01");
                rfcPar.Add(RfcConfigParameters.Language, "ZF");

                RfcDestination dest   = RfcDestinationManager.GetDestination(rfcPar);
                RfcRepository  rfcrep = dest.Repository;
                IRfcFunction   myfun  = null;
                myfun = rfcrep.CreateFunction("ZPP_EXCEL_CO01"); //SAP里面的函数名称
                myfun.SetValue("I_AUFNR_B", "11000086");         //SAP传入参数 Single
                myfun.SetValue("WERKS", "1201");                 //SAP传入参数 Single
                                                                 //IRfcStructure rfcstructSN = null;
                                                                 //IRfcStructure rfcstructX = null;
                                                                 //rfcstructSN = myfun.GetStructure("GENERALDATA");   //SAP传入参数 Structure
                                                                 //rfcstructSN.SetValue("SERIAL_NO", "TestValue");   //SAP传入参数 Structure
                                                                 //myfun.SetValue("GENERALDATA", rfcstructSN);
                myfun.Invoke(dest);
                //IRfcStructure rfcReturn = myfun.GetStructure("RETURN"); //此处返回类型为Structure 如果是Single类型 则直接调用myfun.GetString("RETURN");
                //string s = rfcReturn.GetString("TYPE");



                IRfcTable irfcTable = myfun.GetTable("E_BOMCOMP");
                //提前实例化一个空的表结构出来
                DataTable dt = new DataTable();
                dt.Columns.Add("GAMNG");
                dt.Columns.Add("MATNR");
                dt.Columns.Add("BDMNG");
                //循环把IRfcTable里面的数据放入Table里面,因为类型不同,不可直接使用。
                for (int i = 0; i < irfcTable.Count; i++)
                {
                    irfcTable.CurrentIndex = i;
                    DataRow dr = dt.NewRow();
                    dr["GAMNG"] = irfcTable.GetString("AUFNR");
                    dr["MATNR"] = irfcTable.GetString("Z_SYTABIX");
                    dr["BDMNG"] = irfcTable.GetString("BDMNG");
                    dt.Rows.Add(dr);
                }

                dgSAPData.DataSource = dt;
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 11
0
        public EmployeeDetail getEmployeeDetailedInfo(string personalNr)
        {
            EmployeeDetail result      = null;
            RfcDestination destination = (RfcDestination)(TestConfigSAPDotNet.getConnectionObject());

            if (!personalNr.Equals(string.Empty))
            {
                try
                {
                    RfcRepository repo         = destination.Repository;
                    IRfcFunction  employeeList = repo.CreateFunction(Constants.BAPI_PERSDATA_GETDETAILEDLIST);
                    employeeList.SetValue(Constants.EMPLOYEENUMBER, personalNr);

                    employeeList.Invoke(destination);
                    IRfcTable employees = employeeList.GetTable(Constants.PERSONALDATA);

                    for (int cuIndex = 0; cuIndex < employees.RowCount; cuIndex++)
                    {
                        employees.CurrentIndex = cuIndex;

                        var NAMeOFFORMOFADD = employees.GetString(Constants.NAMeOFFORMOFADD);
                        var FIRSTNAME       = employees.GetString(Constants.FIRSTNAME);
                        var LASTNAME        = employees.GetString(Constants.LASTNAME);
                        var NAMEOFLANGUAGE  = employees.GetString(Constants.NAMEOFLANGUAGE);
                        var NAMEOFNATIONALI = employees.GetString(Constants.NAMEOFNATIONALITY);
                        var DATEOFBIRTH     = employees.GetString(Constants.DATEOFBIRTH);
                        var BIRTHPLACE      = employees.GetString(Constants.BIRTHPLACE);
                        var NAMEOFGENDER    = employees.GetString(Constants.NAMEOFGENDER);
                        var NAMEOFCOUNTRYOF = employees.GetString(Constants.NAMEOFCOUNTRYOF);

                        result = new EmployeeDetail()
                        {
                            Country     = NAMEOFCOUNTRYOF,
                            DateOfBith  = DATEOFBIRTH,
                            FirstName   = FIRSTNAME,
                            Gender      = NAMEOFGENDER,
                            Language    = NAMEOFLANGUAGE,
                            LastName    = LASTNAME,
                            NamePrefix  = NAMeOFFORMOFADD,
                            Nationality = NAMEOFNATIONALI,
                            PlaceOfBith = BIRTHPLACE
                        };
                    }
                }
                catch (Exception ex)
                {
                    _loggingManager.ThrowException(ex, DOTNETSAPErrorSeverity.High);
                }
                finally
                {
                }
            }
            return(result);
        }
Exemplo n.º 12
0
        private void btnPO_Click(object sender, EventArgs e)
        {
            sapConnClass sc      = new sapConnClass();
            var          rfcPara = sc.setParaToConn(connClient);
            var          rfcDest = RfcDestinationManager.GetDestination(rfcPara);
            var          rfcRepo = rfcDest.Repository;

            IRfcFunction getPORFC = null;

            // rfc 函數名稱
            getPORFC = rfcRepo.CreateFunction(getPODetail);
            //輸入參數:工單號碼
            getPORFC.SetValue("P_AUFNR", txtAufnr.Text.ToString().Trim());
            // Call function.
            getPORFC.Invoke(rfcDest);
            //回傳內表
            IRfcTable ITAB = getPORFC.GetTable("ITAB");
            DataTable dt   = new DataTable();

            dt.Columns.Add("作業號碼");
            dt.Columns.Add("作業短文");
            dt.Columns.Add("報工數量");

            for (int i = 0; i <= ITAB.RowCount - 1; i++)
            {
                DataRow dr = dt.NewRow();
                ITAB.CurrentIndex = i;
                dr["作業號碼"]        = ITAB.GetString("VORNR").ToString();
                dr["作業短文"]        = ITAB.GetString("LTXA1").ToString();
                dr["報工數量"]        = ITAB.GetString("GMNGA").ToString();
                dt.Rows.Add(dr);
            }

            dataGridView1.DataSource = dt.DefaultView;
            dataGridView1.ReadOnly   = true;

            // rfc 回傳參數
            string KDAUF     = getPORFC.GetValue("KDAUF").ToString().TrimStart('0');
            string KDPOS     = getPORFC.GetValue("KDPOS").ToString().TrimStart('0');
            string PSMNG     = getPORFC.GetValue("PSMNG").ToString().TrimEnd('0').TrimEnd('.');
            string DGLTS     = getPORFC.GetValue("DGLTS").ToString();
            string USER_LINE = getPORFC.GetValue("USER_LINE").ToString();

            lblQty.Text     = "工單數量:" + PSMNG;
            lblStatus.Text  = "使用者自定狀態:" + USER_LINE;
            lblSoitme.Text  = "銷售訂單/項次:" + KDAUF + " / " + KDPOS;
            lblEnddate.Text = "工單排程結束日期:" + DGLTS;
        }
Exemplo n.º 13
0
        public List <string> monedas() //Trae cadena de mail y teléfono
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_021");//Módulo de función

                bapi.Invoke(oDestino);

                IRfcTable     tcurr = bapi.GetTable("IT_TCURC");
                List <string> m     = new List <string>();

                for (int i = 0; i < tcurr.Count; i++)
                {
                    tcurr.CurrentIndex = i;
                    m.Add(tcurr.GetString("WAERS"));
                }

                return(m);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 14
0
        public string getDescLP(string lp, string vk, string vt, string sp, string ku) //Obtiene descripción de la lista de precio
        {
            Conexion con = new Conexion("E-DESARROLL2", "Initial02");

            IRfcTable tabla = con.getCliente(vk, vt, sp, ku.ToUpper());

            string[] cl   = new string[tabla.Count];
            string   desc = "";

            if (tabla.Count > 0)
            {
                for (int i = 0; i < 1 & i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                    cl[i] = tabla.GetString("NAME1");
                }
                if (cl[0] != null)
                {
                    desc = cl[0];
                }
            }
            else
            {
                desc = "";
            }
            if (!desc.Equals(""))
            {
                return(con.getLP_Desc("ES", lp));
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 15
0
        public string getColumnaCliente(string vk, string vt, string sp, string kunnr, string column) //Obtener columna de cliente
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.getCliente(vk, vt, sp, kunnr.ToUpper());

            string[] lista = new string[tabla.Count];

            if (tabla.Count > 0)
            {
                for (int i = 0; i < 1 & i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                    lista[i]           = tabla.GetString(column);
                }
                if (lista[0] != null)
                {
                    return(lista[0]);
                }
            }
            else
            {
                return("");
            }
            return("");
        }
Exemplo n.º 16
0
        public string lista_asset(string asset)
        {
            Conexion con = new Conexion();

            asset = asset.ToUpper();
            IRfcTable grupos = con.get_asset(asset);

            string[] lista = new string[grupos.Count];
            for (int i = 0; i < grupos.Count; i++)
            {
                grupos.CurrentIndex = i;
                lista[i]            = grupos.GetString("ANLN1");
            }
            for (int i = 0; i < lista.Length; i++)
            {
                int cont = 0;
                foreach (char c in lista[i])
                {
                    if (c.Equals('0'))
                    {
                        cont++;
                    }
                    else
                    {
                        break;
                    }
                }
                lista[i] = lista[i].Substring(cont, lista[i].Length - cont);
            }
            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);

            return(list);
        }
Exemplo n.º 17
0
        public string lista_cuentas(string saknr)
        {
            Conexion  con     = new Conexion();
            IRfcTable cuentas = con.get_saknr(saknr);

            string[] lista = new string[cuentas.Count];
            for (int i = 0; i < cuentas.Count; i++)
            {
                cuentas.CurrentIndex = i;
                lista[i]             = cuentas.GetString("SAKNR");
                lista[i]            += " - " + cuentas.GetString("TXT50");
            }
            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);

            return(list);
        }
Exemplo n.º 18
0
        public string lista_costes(string kostl)
        {
            Conexion  con    = new Conexion();
            IRfcTable costes = con.get_kostl(kostl);

            string[] lista = new string[costes.Count];
            for (int i = 0; i < costes.Count; i++)
            {
                costes.CurrentIndex = i;
                lista[i]            = costes.GetString("KOSTL");
                lista[i]           += " - " + costes.GetString("KTEXT");
            }
            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);

            return(list);
        }
Exemplo n.º 19
0
        private string desc_cuentas(string saknr)
        {
            Conexion  con     = new Conexion();
            IRfcTable cuentas = con.get_saknr(saknr);

            string lista = "";

            for (int i = 0; i < cuentas.Count; i++)
            {
                cuentas.CurrentIndex = i;
                lista  = cuentas.GetString("SAKNR");
                lista += " - " + cuentas.GetString("TXT50");
            }
            //JavaScriptSerializer js = new JavaScriptSerializer();
            //string list = js.Serialize(lista);
            return(lista);
        }
Exemplo n.º 20
0
        private string desc_costes(string kostl)
        {
            Conexion  con    = new Conexion();
            IRfcTable costes = con.get_kostl(kostl);

            string lista = "";

            for (int i = 0; i < costes.Count; i++)
            {
                costes.CurrentIndex = i;
                lista  = costes.GetString("KOSTL");
                lista += " - " + costes.GetString("KTEXT");
            }
            //JavaScriptSerializer js = new JavaScriptSerializer();
            //string list = js.Serialize(lista);
            return(lista);
        }
Exemplo n.º 21
0
        public string getLPSCliente(string sp, string kunnr, string em) //Obtiene la lista de precio del cliente
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.ListaPLTYP(em, sp, kunnr);

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("PLTYP") + " " + tabla.GetString("PTEXT");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 22
0
        public List <T> IRcTabeltoList <T>(IRfcTable table) where T : new()
        {
            List <T> listt = new List <T>();

            System.Reflection.PropertyInfo[] propertiesT = typeof(T).GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);


            for (int i = 0; i < table.Count; i++)
            {
                T t = new T();
                table.CurrentIndex = i;
                for (int j = 0; j < table.ElementCount; j++)
                {
                    foreach (System.Reflection.PropertyInfo itemT in propertiesT)
                    {
                        if (itemT.Name.ToLower() == table.GetElementMetadata(j).Name.ToLower())
                        {
                            switch (itemT.PropertyType.Name.ToLower())
                            {
                            case "string":
                                itemT.SetValue(t, table.GetString(j), null);
                                break;

                            case "int":
                                itemT.SetValue(t, Convert.ToInt32(table.GetInt(j)), null);
                                break;

                            case "int32":
                                itemT.SetValue(t, Convert.ToInt32(table.GetInt(j)), null);
                                break;

                            case "datetime":
                                itemT.SetValue(t, Convert.ToDateTime(table.GetString(j)), null);

                                break;
                            }
                        }
                    }
                }

                listt.Add(t);
            }

            return(listt);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 物料凭证查询
        /// </summary>
        /// <param name="I_BKTXT">凭证抬头文本(凭证号与抬头文本至少填一个)</param>
        /// <param name="I_MBLNR">物料凭证(凭证号与抬头文本至少填一个)</param>
        /// <param name="I_MJAHR">物料凭证年度(选填)</param>
        /// <returns></returns>
        public static Result ZWMS_MKPF(string I_BKTXT, string I_MBLNR = "", string I_MJAHR = "")
        {
            Result result = new Result {
                Success = false
            };

            try
            {
                //RfcDestination rfcDest = RfcDestinationManager.GetDestination(GetSapServerString());
                RfcDestination rfcDest = RfcDestinationManager.GetDestination(ConfigurationManager.AppSettings["sapServer"].ToString());

                //选择要调用的BAPI的名称
                RfcFunctionMetadata rfMD = rfcDest.Repository.GetFunctionMetadata("ZWMS_MKPF");
                //新建调用该BAPI的一个“实例”
                IRfcFunction irF = rfMD.CreateFunction();

                //******************************
                //输入参数设置
                //******************************

                irF.SetValue("I_MBLNR", I_MBLNR);   //物料凭证
                irF.SetValue("I_MJAHR", I_MJAHR);   //物料凭证年度
                irF.SetValue("I_BKTXT", I_BKTXT);   //凭证抬头文本

                IRfcTable irt = irF.GetTable("O_MKPF");

                RfcSessionManager.BeginContext(rfcDest);

                irF.Invoke(rfcDest);
                //irfCommit.Invoke(rfcDest);

                RfcSessionManager.EndContext(rfcDest);

                result.Success = irF.GetString("RTYPE").ToUpper() == "S";
                result.Message = irF.GetValue("RTMSG").ToString();
                if (result.Success && irt.RowCount > 0)
                {
                    var MBLNR = "";
                    for (int i = 0; i < irt.RowCount; i++)
                    {
                        irt.CurrentIndex = i;
                        if (MBLNR.IsNotEmpty())
                        {
                            MBLNR += "/";
                        }
                        MBLNR += irt.GetString("MBLNR");
                    }
                    result.Message = MBLNR;
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }
            return(result);
        }
Exemplo n.º 24
0
        public string auto_matkl(string mk, string sp) //Autocompleta de material
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.AutoMATKL(mk.ToUpper(), sp);

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("MATKL");
                lista[i]          += " " + tabla.GetString("WGBEZ");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 25
0
        public string llenaPltyp(string pr, string sp) //Autocompleta de material
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.ListaPLTYP(pr, sp, "");

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("PLTYP");
                lista[i]          += " " + tabla.GetString("PTEXT");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 26
0
        public string llenaSpart(string pr, string vk, string vt) //Autocompleta de material
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.ListaSPART("", pr, vk, vt, "02");

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("SPART");
                lista[i]          += " " + tabla.GetString("VTEXT");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 27
0
        public string auto_pernr(string pr) //Autocompleta de cliente
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.AutoPERNR(pr);

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("ZUEMP");
                lista[i]          += " - " + tabla.GetString("SNAME");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 28
0
        public string auto_clientesB(string vk, string vt, string sp, string ku) //Autocompleta de cliente
        {
            Conexion  con   = new Conexion("E-DESARROLL2", "Initial02");
            IRfcTable tabla = con.AutoKUNNR(vk, vt, sp, ku.ToUpper(), "");

            string[] lista = new string[tabla.Count];
            for (int i = 0; i < tabla.Count; i++)
            {
                tabla.CurrentIndex = i;
                lista[i]           = tabla.GetString("KUNNR");
                lista[i]          += " - " + tabla.GetString("NAME1");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 29
0
        public string lista_imputa(string texto)
        {
            Conexion  con        = new Conexion();                  //Conexión a SAP
            IRfcTable materiales = con.get_servicios(texto, "M");   //Llama módulo de función

            string[] lista = new string[materiales.Count];
            for (int i = 0; i < materiales.Count; i++)
            {
                //Llenado de lista
                materiales.CurrentIndex = i;
                lista[i]  = materiales.GetString("NUM");
                lista[i] += " - " + materiales.GetString("DESCR");
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string list             = js.Serialize(lista);          //Convertir arreglo a string para JavaScript

            return(list);
        }
Exemplo n.º 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            month = HttpUtil.GetReqStrValue("month");
            werk  = HttpUtil.GetReqStrValue("werk");
            SAPCHARTPARAM param = new SAPCHARTPARAM();
            param.I_WERKS = werk;
            param.I_GJAHR = month.Substring(0, 4);
            param.I_MONAT = month.Substring(5, 2);
            monthStr      = param.I_MONAT;
            days          = DateTime.DaysInMonth(Convert.ToInt32(param.I_GJAHR), Convert.ToInt32(param.I_MONAT));
            //库存金额情况变动表
            //ZTTPP_STOCK_MONEY val1 = new ZTTPP_STOCK_MONEY();
            //val1.ZDATE = "";
            //val1.ZKCJE = "";
            //val1.ZKW = "";
            //val1List = RFCUtil.GetTable<ZTTPP_STOCK_MONEY>(param, "ZP_REPL_STOCK_MONEY_OUT", "IT_STOCK_MONEY", val1);
            //  AttributeItem[]  item1List = val1.af_GetAvailableAttributeItem();


            IRfcTable IrfTable = RFCUtil.GetTable(param, "ZP_REPL_STOCK_MONEY_OUT", "IT_STOCK_MONEY");
            for (int i = 0; i < IrfTable.Count; i++)
            {
                IrfTable.CurrentIndex = i;
                string zdate = IrfTable.GetString("ZDATE");
                string zkw   = IrfTable.GetString("ZKW");
                string zkcje = IrfTable.GetString("ZKCJE");

                stockMap.Add("" + zdate + zkw, zkcje);
                //zkwMap.Add(zkw, zkw);
                if (!zkwMap.ContainsKey(zkw))
                {
                    zkwMap.Add(zkw, zkw);
                }
            }

            //itemLists.Add(item1List);
        }
        else
        {
        }
    }
 private static void WriteRowProperties(IRfcTable table, JsonWriter writer)
 {
     for (int columnNumber = 0; columnNumber < table.ElementCount; columnNumber++)
     {
         var name = table.GetElementMetadata(columnNumber).Name;
         var value = table.GetString(columnNumber);
         writer.WritePropertyName(name);
         writer.WriteValue(value);
     }
 }