예제 #1
0
        /// <summary>
        /// Función que extrae de un stored procedure si un RFC Existe, y trae el id de este para tabla Patente y RFC patente
        /// </summary>
        /// <param name="rfc">Espera el RFC del stored Procedure</param>
        /// <returns>Variable del tipo DatosRFC</returns>
        private RFC ExtraeRFCPatente(string rfc)
        {
            try
            {
                //List<SqlParameterItem> parametros = new List<SqlParameterItem>();
                //parametros.Add(new SqlParameterItem("@prueba", SqlDbType.Bit, 0));
                ////parametros.Add(new SqlParameterItem("@pDescripcion", SqlDbType.VarChar, 100, "prueba"));
                ////parametros.Add(new SqlParameterItem("@pDescripcionIngles", SqlDbType.VarChar, 100, "trial"));
                ////parametros.Add(new SqlParameterItem("@pID", SqlDbType.Int, ParameterDirection.Output));
                ////parametros.Add(new SqlParameterItem("@EsActivo", SqlDbType.Bit, item.EsActivo));
                //InicializarConexion(TipoBaseDatos.Catalogos);
                //var ret = helper.ExecuteNonQuery("Sacsp_Reg001_RegistraDatos", parametros);

                //return null;
                var item       = new RFC();
                var parametros = new List <SqlParameterItem>();
                parametros.Add(new SqlParameterItem("@pRFC", SqlDbType.VarChar, 13, rfc));
                parametros.Add(new SqlParameterItem("@pID", SqlDbType.SmallInt, 0, ParameterDirection.Output));
                InicializarConexion(TipoBaseDatos.Softrade);
                helper.ExecuteNonQuery("usp_EmpresaVW_DameIDxRFC", parametros);
                item = new RFC()
                {
                    IdRFC = Convert.ToInt16(helper.GetParameterOutput("@pID"))
                };
                return(item);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="loginUsuario"></param>
 private void ValidarRFCExistente(RFC filtro)
 {
     if (null == extraeRFCRepositorio.ExtraeRFC(filtro))
     {
         throw new NoExisteRFCException();
     }
 }
예제 #3
0
    /// <summary>
    /// Rebuild the list of known RFC calls.
    /// </summary>

    void RebuildMethodList()
    {
        rebuildMethodList = false;
        mRFCs.Clear();
        MonoBehaviour[] mbs = GetComponentsInChildren <MonoBehaviour>(true);

        for (int i = 0, imax = mbs.Length; i < imax; ++i)
        {
            MonoBehaviour mb   = mbs[i];
            System.Type   type = mb.GetType();

            MethodInfo[] methods = type.GetMethods(
                BindingFlags.Public |
                BindingFlags.NonPublic |
                BindingFlags.Instance);

            for (int b = 0; b < methods.Length; ++b)
            {
                if (methods[b].IsDefined(typeof(RFC), true))
                {
                    CachedFunc ent = new CachedFunc();
                    ent.obj  = mb;
                    ent.func = methods[b];

                    RFC tnc = (RFC)ent.func.GetCustomAttributes(typeof(RFC), true)[0];
                    ent.id = tnc.id;
                    mRFCs.Add(ent);
                }
            }
        }
    }
예제 #4
0
파일: SAP.cs 프로젝트: tvrjcf/Demo
        /// <summary>
        /// ZWMS_DN_CONF接口
        /// 成品发货
        /// </summary>
        /// <param name="inputheader">输入参数头</param>
        /// <param name="listInputDetail">接口明细定义列表</param>
        /// <returns></returns>
        public Result ZWMS_DN_CONF(ZwmsDnConfHeader inputheader, List <ZwmsDnConfDetail> listInputDetail)
        {
            var ret = GetSapState();

            if (!ret.Success)
            {
                ret.Success = true;
                return(ret);
            }

            RFC rfc = GetSapServer();
            //RFC调用函数名
            string funcName = "ZWMS_DN_CONF";
            //import
            Hashtable import = new Hashtable();


            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable
            DataTable idt1 = new DataTable();

            idt1           = DataTableExtensions.ToDataTable <ZwmsDnConfDetail>(listInputDetail);
            idt1.TableName = "T_TAB";

            ids.Tables.Add(idt1);

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //消息类型: S 成功,E 错误
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);

            Result result = new Result {
                Success = false
            };

            try
            {
                //执行RFC函数
                bool resultRFC = rfc.UploadByRFC(funcName, import, ids, ref ods);

                //根据RFC执行后返回的数据处理业务逻辑
                if (resultRFC && ods.Tables["Export"].Rows.Count > 0)
                {
                    result.Success = ods.Tables["Export"].Rows[0]["RTYPE"].ToString() == "S";
                    result.Message = ods.Tables["Export"].Rows[0]["RTMSG"].ToString();
                }
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }
            return(result);
        }
예제 #5
0
        private static List <Warehouse> ERP_MES_Warehouse(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <Warehouse>();
            //RFC调用函数名
            string funcName = "ZWMS_T001L";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //处理标识
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂编码
            odt1.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地编码
            odt1.Columns.Add(new DataColumn("LGOBE", typeof(string))); //库存地描述
            odt1.Columns.Add(new DataColumn("XBUFX", typeof(string))); //冻结状态
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string factoryCode = dt.Rows[i]["WERKS"].ToString();
                string code        = dt.Rows[i]["LGORT"].ToString();
                string name        = dt.Rows[i]["LGOBE"].ToString();
                string state       = dt.Rows[i]["XBUFX"].ToString();
                var    warehouse   = new Warehouse {
                    Code = code, Name = name, Factory = new Organization {
                        Code = factoryCode
                    }
                };
                //if (factoryCode == "4200")
                //{
                //    warehouse.FactoryId = 2;
                //}
                //else
                //{

                //}
                lst.Add(warehouse);
            }
            return(lst);
        }
예제 #6
0
        private static List <Customer> ERP_MES_Customer(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <Customer>();
            //RFC调用函数名
            string funcName = "ZWMS_KNA1";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //处理标识
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_KNA1";
            odt1.Columns.Add(new DataColumn("BUKRS", typeof(string))); //公司代码
            odt1.Columns.Add(new DataColumn("KUNNR", typeof(string))); //客户编号1
            odt1.Columns.Add(new DataColumn("NAME1", typeof(string))); //名称 1
            odt1.Columns.Add(new DataColumn("BZIRK", typeof(string))); //销售地区
            odt1.Columns.Add(new DataColumn("BZTXT", typeof(string))); //区名
            odt1.Columns.Add(new DataColumn("ABRVW", typeof(string))); //使用标识
            odt1.Columns.Add(new DataColumn("SORTL", typeof(string))); //排序字段
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_KNA1"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string corp     = dt.Rows[i]["BUKRS"].ToString();
                string code     = dt.Rows[i]["KUNNR"].ToString();
                string name     = dt.Rows[i]["NAME1"].ToString();
                string areaCode = dt.Rows[i]["BZIRK"].ToString();
                string areaName = dt.Rows[i]["BZTXT"].ToString();
                string state    = dt.Rows[i]["ABRVW"].ToString();
                var    customer = new Customer
                {
                    Code       = code,
                    Name       = name,
                    SalesArea  = areaCode,
                    CreateBy   = PlatformEnvironment.IdentityId,
                    CreateDate = DateTime.Now
                };
                lst.Add(customer);
            }
            return(lst);
        }
예제 #7
0
        static void FirstTask()
        {
            var text    = "WEAREDISCOVEREDFLEEATONCE";
            var rails   = 3;
            var encoded = RFC.Encode(text, rails);
            var decoded = RFC.Decode(encoded, rails);

            Console.WriteLine($"Input:\t\t{text}\nEncoded:\t{encoded}\nDecoded:\t{decoded}\n\n");
        }
예제 #8
0
파일: RFC_Supplier.cs 프로젝트: tvrjcf/Demo
        private static List <Supplier> ERP_MES_Supplier(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <Supplier>();
            //RFC调用函数名
            string funcName = "ZWMS_LFA1";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("BUKRS", typeof(string))); //公司代码
            odt1.Columns.Add(new DataColumn("LIFNR", typeof(string))); //供应商编码
            odt1.Columns.Add(new DataColumn("TXT30", typeof(string))); //供应商类型描述
            odt1.Columns.Add(new DataColumn("NAME1", typeof(string))); //供应商名称
            odt1.Columns.Add(new DataColumn("SPERZ", typeof(string))); //付款冻结
            odt1.Columns.Add(new DataColumn("KTOKK", typeof(string))); //供应商帐户组
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string code = dt.Rows[i]["LIFNR"].ToString();
                string type = dt.Rows[i]["TXT30"].ToString();
                string desc = dt.Rows[i]["KTOKK"].ToString();
                string name = dt.Rows[i]["NAME1"].ToString();
                name = string.IsNullOrEmpty(name) ? code : name;
                string frozen   = dt.Rows[i]["SPERZ"].ToString();
                var    supplier = new Supplier
                {
                    Code        = code,
                    Description = desc,
                    Name        = name,
                    ExpiryDate  = DateTime.Now.AddYears(1000),
                    Type        = type
                };
                lst.Add(supplier);
            }
            return(lst);
        }
예제 #9
0
        public RFC ExtraeRFC(RFC rfc)
        {
            if (!String.IsNullOrEmpty(rfc.RFCDato))
            {
                ValidarRFCExistente(rfc);
            }
            var datos = extraeRFCRepositorio.ExtraeRFC(rfc);

            return(datos);
        }
예제 #10
0
 public void TestMethod1()
 {
     var rfc = new RFC()
     {
         IdRFC     = 0,
         TipoDeRFC = TipoRFC.RFCEmpresa,
         RFCDato   = "OITR900906"
     };
     var dominio   = new RFCDominio();
     var respuesta = dominio.ExtraeRFC(rfc);
 }
예제 #11
0
 public void InsertOrUpdate(RFC rfc)
 {
     if (rfc.RFCID == default(int))
     {
         //New Entity
         _context.RFC.Add(rfc);
     }
     else
     {
         _context.Entry(rfc).State = EntityState.Modified;
     }
 }
예제 #12
0
 private void HabilitarCajas(bool habilitadas)
 {
     Nombre.Clear();
     Direccion.Clear();
     RFC.Clear();
     Telefono.Clear();
     Email.Clear();
     Nombre.IsEnabled    = habilitadas;
     Direccion.IsEnabled = habilitadas;
     Telefono.IsEnabled  = habilitadas;
     Email.IsEnabled     = habilitadas;
 }
예제 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            SAP sap = new SAP();
            RFC rfc = sap.GetSapServer();

            if (rfc.TestConnection())
            {
                MessageBox.Show("连接成功");
            }
            else
            {
                MessageBox.Show("连接失败");
            }
        }
예제 #14
0
        private static List <PurchaseGroup> ERP_MES_Purchase(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <PurchaseGroup>();
            //RFC调用函数名
            string funcName = "ZWMS_T024";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("EKGRP", typeof(string)));
            odt1.Columns.Add(new DataColumn("EKNAM", typeof(string)));
            odt1.Columns.Add(new DataColumn("EKTEL", typeof(string)));
            odt1.Columns.Add(new DataColumn("TELFX", typeof(string)));
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string code     = dt.Rows[i]["EKGRP"].ToString();
                string employee = dt.Rows[i]["EKNAM"].ToString();//采购者
                //DomainControllerFactory.Create<EmployeeController>().get
                string phone = dt.Rows[i]["EKTEL"].ToString();
                string fax   = dt.Rows[i]["TELFX"].ToString();

                var model = new PurchaseGroup()
                {
                    Code = code, buyerName = employee, Phone = phone, Fax = fax
                };
                lst.Add(model);
            }
            return(lst);
        }
예제 #15
0
        /// <summary>
        /// Esta función determina a qué tabla se le hablará si a patente o empresa para verificar si el RFC existe
        /// </summary>
        /// <param name="rfc">Entidad tipo RFC es importante que traiga el tipo de RFC y el RFC</param>
        /// <returns></returns>
        public RFC ExtraeRFC(RFC rfc)
        {
            RFC item = null;

            switch (rfc.TipoDeRFC)
            {
            case TipoRFC.RFCEmpresa:
                item = ExtraeRFCEmpresa(rfc.RFCDato);
                break;

            case TipoRFC.RFCPatente:
                item = ExtraeRFCPatente(rfc.RFCDato);
                break;
            }
            return(item);
        }
예제 #16
0
        private static List <Factory> ERP_MES_CostCenter(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <Factory>();
            //RFC调用函数名
            string funcName = "ZWMS_CSKS";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("BUKRS", typeof(string))); //公司代码
            odt1.Columns.Add(new DataColumn("KOSTL", typeof(string))); //成本中心
            odt1.Columns.Add(new DataColumn("KTEXT", typeof(string))); //一般姓名
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string corpCode = dt.Rows[i]["BUKRS"].ToString();
                string costCode = dt.Rows[i]["KOSTL"].ToString();
                string name     = dt.Rows[i]["KTEXT"].ToString();
                var    model    = new Factory()
                {
                    Code = costCode, Name = name
                };

                lst.Add(model);
            }
            return(lst);
        }
예제 #17
0
        private static List <ItemSmallCategory> ERP_MES_Category(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <ItemSmallCategory>();
            //RFC调用函数名
            string funcName = "ZWMS_T023";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("MATKL", typeof(string))); //物料组代码
            odt1.Columns.Add(new DataColumn("WGBEZ", typeof(string))); //物料组描述
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string code = dt.Rows[i]["MATKL"].ToString();
                string name = dt.Rows[i]["WGBEZ"].ToString();
                name = string.IsNullOrEmpty(name) ? code : name;
                var cat = new ItemSmallCategory {
                    Code = code, Name = name, MediumCategory = new ItemMediumCategory {
                        Code = code, Name = name
                    }
                };
                lst.Add(cat);
            }
            return(lst);
        }
예제 #18
0
        private static List <Reasons> ERP_MES_MoveReason(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <Reasons>();
            //RFC调用函数名
            string funcName = "ZWMS_T157D";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("BWART", typeof(string))); //移动类型
            odt1.Columns.Add(new DataColumn("GRUND", typeof(string))); //移动原因
            odt1.Columns.Add(new DataColumn("GRTXT", typeof(string))); //移动原因
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string type   = dt.Rows[i]["BWART"].ToString();
                string reason = dt.Rows[i]["GRUND"].ToString();
                string txt    = dt.Rows[i]["GRTXT"].ToString();
                var    model  = new Reasons()
                {
                    Description = txt, Name = reason, MoveType = type
                };
                lst.Add(model);
            }
            return(lst);
        }
        protected override void OnStart(string[] args)
        {
            //Portal.DadosSap.Program.Main(new String[] { });

            //Instancie a variável criada, que receberá como parâmetro o caminho de meu arquivo de texto,

            //que será o log destes eventos do meu serviço, e o parâmetro encoding com o valor true.

            arquivoLog = new StreamWriter(@"C:\Log_Interface_PortalProgas.txt", true);

            RFC rfc = new RFC();

            //Escrevo no arquivo texto no momento que o arquivo for iniciado

            arquivoLog.WriteLine("Serviço iniciado em: " + DateTime.Now);

            //Limpo o buffer com o método Flush

            arquivoLog.Flush();
        }
예제 #20
0
	/// <summary>
	/// Rebuild the list of known RFC calls.
	/// </summary>

	void RebuildMethodList ()
	{
		rebuildMethodList = false;
		mRFCs.Clear();
		MonoBehaviour[] mbs = GetComponentsInChildren<MonoBehaviour>(true);

		for (int i = 0, imax = mbs.Length; i < imax; ++i)
		{
			if (methods[b].IsDefined(typeof(RFC), true))
				{
					CachedFunc ent = new CachedFunc();
					ent.obj = mb;
					ent.func = methods[b];

					RFC tnc = (RFC)ent.func.GetCustomAttributes(typeof(RFC), true)[0];
					ent.id = tnc.id;
					mRFCs.Add(ent);
				}
			}
		}
예제 #21
0
 /// <summary>
 /// Función que extrae de un stored procedure si un RFC Existe, y trae este el Id del mismo para tabla empresa
 /// </summary>
 /// <param name="rfc">Espera el RFC del stored Procedure</param>
 /// <returns>Variable del tipo DatosRFC</returns>
 private RFC ExtraeRFCEmpresa(string rfc)
 {
     try
     {
         var item       = new RFC();
         var parametros = new List <SqlParameterItem>();
         parametros.Add(new SqlParameterItem("@pRFC", SqlDbType.VarChar, 13, rfc));
         parametros.Add(new SqlParameterItem("@pID", SqlDbType.SmallInt, 0, ParameterDirection.Output));
         InicializarConexion(TipoBaseDatos.Softrade);
         helper.ExecuteNonQuery("usp_EmpresaVW_DameIDxRFC", parametros);
         item = new RFC()
         {
             IdRFC = Convert.ToInt16(helper.GetParameterOutput("@pID"))
         };
         return(item);
     }
     catch (Exception)
     {
         return(null);
     }
 }
예제 #22
0
        private void btnImprimir_Click(object sender, EventArgs e)
        {
            clientes.Enabled = true;


            Class.GenerarFactura gener = new Class.GenerarFactura();
            gener.Importe   = importe;
            gener.Nombre    = Nombre.Text;
            gener.Direccion = Direccion.Text;
            gener.Rfc       = RFC.Text;
            gener.Telefono  = Telefono.Text;
            gener.Lineas    = Lineas;
            gener.Generar();


            Nombre.Clear();
            Direccion.Clear();
            RFC.Clear();
            Telefono.Clear();

            textBox1.Clear();
            textBox3.Clear();
            precioUnitario.Clear();
            articulo.Text = "ELIGE";

            var word = new Word.Application();

            word.Documents.Add("C:/Factura.txt");
            word.Visible = true;
            contador     = 0;
            importe      = 0;
            for (int a = 0; a <= 1000; a++)
            {
                Lineas[a, 0] = null;
                Lineas[a, 1] = null;
                Lineas[a, 2] = null;
                Lineas[a, 3] = null;
            }
        }
예제 #23
0
        private static List <SaleBill> ERP_MES_JHD(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <SaleBill>();
            //RFC调用函数名
            string funcName = "ZWMS_JHD";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //消息文本
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_HEADER";
            odt1.Columns.Add(new DataColumn("VBELN", typeof(string))); //交货
            odt1.Columns.Add(new DataColumn("VSTEL", typeof(string))); //装运点/接收点
            odt1.Columns.Add(new DataColumn("VKORG", typeof(string))); //销售机构
            odt1.Columns.Add(new DataColumn("LFART", typeof(string))); //交货类型
            //odt1.Columns.Add(new DataColumn("KOKRS", typeof(string)));//客户编号
            odt1.Columns.Add(new DataColumn("WADAT", typeof(string))); //计划货物移动日期
            odt1.Columns.Add(new DataColumn("LFDAT", typeof(string))); //交货日期
            odt1.Columns.Add(new DataColumn("WBSTK", typeof(string))); //货物移动状态总计
            ods.Tables.Add(odt1);


            DataTable odt2 = new DataTable();

            odt2.TableName = "T_ITEM";
            odt2.Columns.Add(new DataColumn("VBELN", typeof(string))); //交货
            odt2.Columns.Add(new DataColumn("POSNR", typeof(string))); //交货项目
            odt2.Columns.Add(new DataColumn("PSTYV", typeof(string))); //交货项目类别
            odt2.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂
            odt2.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料号
            odt2.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地点

            odt2.Columns.Add(new DataColumn("CHARG", typeof(string))); //批号
            odt2.Columns.Add(new DataColumn("LICHN", typeof(string))); //供应商的批次
            odt2.Columns.Add(new DataColumn("KDMAT", typeof(string))); //客户物料
            odt2.Columns.Add(new DataColumn("PRODH", typeof(string))); //产品层次
            odt2.Columns.Add(new DataColumn("LFIMG", typeof(string))); //实际已交货量(按销售单位)
            odt2.Columns.Add(new DataColumn("VRKME", typeof(string))); //销售单位

            ods.Tables.Add(odt2);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);

            //根据RFC执行后返回的数据处理业务逻辑
            //DataTable dt = ods.Tables["T_ITEM"];
            foreach (DataRow h in ods.Tables["T_HEADER"].Rows)
            {
                var bill = new SaleBill();
                try
                {
                    string type  = h["LFART"].ToString();
                    string state = h["WBSTK"].ToString();

                    bill.No       = h["VBELN"].ToString();
                    bill.BillDate = DateTime.Now;
                    bill.Location = h["VSTEL"].ToString();
                    bill.Org      = h["VKORG"].ToString();
                    //bill.Location = h["LFART"].ToString();
                    DateTime planDate, deliveryDate;
                    if (DateTime.TryParse(h["WADAT"].ToString(), out planDate))
                    {
                        bill.PlanDate = Convert.ToDateTime(h["WADAT"].ToString());
                    }
                    //else
                    //    bill.PlanDate = Convert.ToDateTime(h["WADAT"].ToString());

                    if (DateTime.TryParse(h["LFDAT"].ToString(), out deliveryDate))
                    {
                        bill.DeliveryDate = Convert.ToDateTime(h["LFDAT"].ToString());
                    }
                    //bill.State = h["WBSTK"].ToString();

                    foreach (DataRow i in ods.Tables["T_ITEM"].AsEnumerable().Where(p => h["VBELN"].ToString() == p["VBELN"].ToString()))
                    {
                        var billDtl = new SaleBillDetail()
                        {
                            Item = new Item {
                                Code = i["MATNR"].ToString()
                            },
                            ProjectNo    = i["POSNR"].ToString(),
                            Qty          = Convert.ToDouble(i["LFIMG"] ?? 0),
                            Unit         = i["VRKME"].ToString(),
                            Factory      = i["WERKS"].ToString(),
                            BatchNo      = i["CHARG"].ToString(),
                            LotNo        = i["LICHN"].ToString(),
                            Warehouse    = i["LGORT"].ToString(),
                            BillType     = i["PSTYV"].ToString(),
                            ProductLevel = i["PRODH"].ToString(),
                        };
                        bill.SaleBillDetailList.Add(billDtl);
                    }
                    lst.Add(bill);
                }
                catch (Exception e)
                {
                    continue;
                }
            }
            return(lst);
        }
예제 #24
0
        private void BtnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                if (lookUpBanco.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor, Seleccione Banco.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (lookUpEmpresa.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor, Seleccione Empresa.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                E.Empleado empleado = new E.Empleado();
                nombre  = TxtNombreEmpl.Text.ToUpper();
                RFC     = TxtRFC.Text.ToUpper();
                CURP    = TxtCURP.Text.ToUpper();
                cuenta  = TxtCuenta.Text;
                clabe   = TxtCLABE.Text;
                banco   = lookUpBanco.Text;
                cve     = TxtCVE.Text;
                empresa = lookUpEmpresa.Text;
                idEmpr  = lookUpEmpresa.EditValue.ToString();
                numEmpl = TxtNumEmpl.Text;
                empleado.nominaEmpresaID = Properties.Settings.Default["EmpresaNominaID"].ToString();
                empleado.descuento       = Convert.ToDecimal(spinEdit1.EditValue.ToString());
                if (txtCorreo.Text.Equals(""))
                {
                    empleado.Correo = "";
                }
                else
                {
                    empleado.Correo = txtCorreo.Text;
                }
                if (nombre == "")
                {
                    XtraMessageBox.Show("El campo Nombre no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.Nombre = nombre;
                }

                if (numEmpl.Equals(""))
                {
                    XtraMessageBox.Show("El campo # Empleado no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.NumEmpl = numEmpl;
                }

                if (RFC == "")
                {
                    XtraMessageBox.Show("El campo RFC no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (!RFC.Length.Equals(13))
                    {
                        XtraMessageBox.Show("RFC no cumple con el formato correcto, favor de verificar.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        empleado.RFC = RFC.ToUpper();
                    }
                }

                if (CURP == "")
                {
                    XtraMessageBox.Show("El campo CURP no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (!CURP.Length.Equals(18))
                    {
                        XtraMessageBox.Show("CURP no cumple con el formato correcto, favor de verificar,", "Mesnaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        empleado.CURP = CURP.ToUpper();
                    }
                }

                if (peri == null)
                {
                    XtraMessageBox.Show("Seleccione tipo de periodicidad.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    empleado.Periodicidad = peri;
                }

                if (cuenta.Equals(""))
                {
                    XtraMessageBox.Show("El campo cuenta no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (cuenta.Length < 10)
                {
                    XtraMessageBox.Show("Cuenta no cumple con el formato correcto, debe contener al menos 10 digitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (cuenta.Length > 10)
                {
                    XtraMessageBox.Show("Cuenta no cumple con el formato correcto, debe contener máximo 10 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (cuenta.Equals("0"))
                {
                    empleado.cuenta = cuenta;
                }
                else
                {
                    empleado.cuenta = cuenta;
                }

                if (clabe.Equals(""))
                {
                    XtraMessageBox.Show("El campo CLABE no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (clabe.Length < 18)
                {
                    XtraMessageBox.Show("CLABE no cumple con el formato correcto, debe contener al menos 18 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (clabe.Length > 18)
                {
                    XtraMessageBox.Show("CLABE no cumple con el formato correcto, debe contener máximo 18 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (clabe.Equals("0"))
                {
                    empleado.clabe_bancaria = clabe;
                }
                {
                    empleado.clabe_bancaria = clabe;
                }

                if (banco.Equals(""))
                {
                    XtraMessageBox.Show("El campo bancoEmpleado no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.banco = banco;
                }

                if (cve.Equals(""))
                {
                    XtraMessageBox.Show("El campo CVE no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.cve_banco = cve;
                }

                if (empresa.Equals(""))
                {
                    XtraMessageBox.Show("El campo Empresa no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.empresa   = empresa;
                    empleado.idEmpresa = idEmpr;
                }

                if (lookUpTipoPago.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor, Seleccione Tipo Pago.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.tipoPago = lookUpTipoPago.EditValue.ToString();
                }


                if (empleado.RFC != null && empleado.Nombre != null && empleado.CURP != null && empleado.Periodicidad != null && empleado.cuenta != null && empleado.clabe_bancaria != null && empleado.banco != null && empleado.cve_banco != null && empleado.empresa != null && empleado.idEmpresa != null && empleado.NumEmpl != null)
                {
                    //XtraMessageBox.Show("Nombre:" + nombre + "\nRFC:" + RFC + "\nCURP:" + CURP + "\nPeriodicidad:" + peri, "mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (XtraMessageBox.Show("¿Desea Agregar al empleado?:\n" + empleado.Nombre.ToString() /* + "\n\nRFC:" + empleado.RFC.ToString() + "\n\nCURP:" + empleado.CURP.ToString() + "\n\nPeriodicidad pago:" + lookUpEdit2.Text +*/ + "\n\nFavor de verificar los datos.", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (Controlador.AgregaEmpleado(empleado).Equals(true))
                        {
                            this.ReiniciaFormulario();
                        }
                    }
                }
            }
            catch (Exception agregar)
            {
                XtraMessageBox.Show("Error: " + agregar.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #25
0
        private static List <PurchaseOrder> ERP_MES_Po(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <PurchaseOrder>();
            //RFC调用函数名
            string funcName = "ZWMS_PO";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_EKKO";
            odt1.Columns.Add(new DataColumn("BUKRS", typeof(string)));   //公司代码
            odt1.Columns.Add(new DataColumn("EBELN", typeof(string)));   //采购凭证号
            odt1.Columns.Add(new DataColumn("LIFNR", typeof(string)));   //供应商或债权人的帐号
            odt1.Columns.Add(new DataColumn("ZADRESS", typeof(string))); //地址
            odt1.Columns.Add(new DataColumn("SSQSS", typeof(string)));   //质检控制码
            odt1.Columns.Add(new DataColumn("AEDAT", typeof(string)));   //记录的创建日期
            odt1.Columns.Add(new DataColumn("LAND1", typeof(string)));   //国家代码
            odt1.Columns.Add(new DataColumn("ORT01", typeof(string)));   //城市
            odt1.Columns.Add(new DataColumn("ORT02", typeof(string)));   //地区
            odt1.Columns.Add(new DataColumn("STRAS", typeof(string)));   //住宅号及街道
            odt1.Columns.Add(new DataColumn("LANDX", typeof(string)));   //国家名称
            ods.Tables.Add(odt1);


            DataTable odt2 = new DataTable();

            odt2.TableName = "T_EKPO";
            odt2.Columns.Add(new DataColumn("EBELN", typeof(string))); //采购凭证号
            odt2.Columns.Add(new DataColumn("EBELP", typeof(string))); //采购凭证的项目编号
            odt2.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料号
            odt2.Columns.Add(new DataColumn("SSQSS", typeof(string))); //质检控制码
            odt2.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂
            odt2.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地点
            odt2.Columns.Add(new DataColumn("MENGE", typeof(string))); //采购订单数量
            odt2.Columns.Add(new DataColumn("MEINS", typeof(string))); //采购订单的计量单位
            odt2.Columns.Add(new DataColumn("RETPO", typeof(string))); //退货标识 X为退货
            odt2.Columns.Add(new DataColumn("PSTYP", typeof(string))); //采购项目类别
            odt2.Columns.Add(new DataColumn("INSMK", typeof(string))); //库存类型
            odt2.Columns.Add(new DataColumn("WAMNG", typeof(string))); //发货数量
            odt2.Columns.Add(new DataColumn("LOEKZ", typeof(string))); //删除标记
            odt2.Columns.Add(new DataColumn("ELIKZ", typeof(string))); //交货完成(接收完成)
            ods.Tables.Add(odt2);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);

            //根据RFC执行后返回的数据处理业务逻辑
            //DataTable dt = ods.Tables["T_ITEM"];
            foreach (DataRow h in ods.Tables["T_EKKO"].Rows)
            {
                var    po      = new PurchaseOrder();
                string address = h["ZADRESS"].ToString();
                po.PoNumber = h["EBELN"].ToString();
                po.Supplier = new BD.Suppliers.Supplier {
                    Code = h["LIFNR"].ToString()
                };
                po.CountryCode = h["LAND1"].ToString();
                po.CountryName = h["LANDX"].ToString();
                po.City        = h["ORT01"].ToString();
                po.Area        = h["ORT02"].ToString();
                po.Street      = h["STRAS"].ToString();
                po.CreateDate  = Convert.ToDateTime(h["AEDAT"].ToString());
                foreach (DataRow i in ods.Tables["T_EKPO"].AsEnumerable().Where(p => h["EBELN"].ToString() == p["EBELN"].ToString()))
                {
                    var poDetail = new PurchaseOrderDetail()
                    {
                        IqcFlag = i["SSQSS"].ToString().Trim(),
                        Item    = new Item {
                            Code = i["MATNR"].ToString()
                        },
                        ProjectNo      = i["EBELP"].ToString().Trim(),
                        Quantity       = Convert.ToDouble(i["MENGE"] ?? 0),
                        Unit           = i["MEINS"].ToString(),
                        Factory        = i["WERKS"].ToString(),
                        Warehouse      = i["LGORT"].ToString(),
                        PurchaseType   = (PurchaseType?)Convert.ToInt32(i["PSTYP"]),
                        IsReturn       = i["RETPO"].ToString().ToUpper() == "X",
                        ErpReceivedQty = Convert.ToDouble(i["WAMNG"] ?? 0),
                        State          = i["ELIKZ"].ToString().ToUpper() == "X" ? PoState.Received : PoState.New,
                    };
                    po.PurchaseOrderDetailList.Add(poDetail);
                }
                lst.Add(po);
            }
            return(lst);
        }
        private void Control_Leave(object sender, EventArgs e)
        {
            if (sender is RadTextBox)
            {
                objTextbox = (RadTextBox)sender;

                switch (objTextbox.Name)
                {
                //tab 2
                case "Nombre_Fiscal":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    RFC.Focus();
                    break;

                //tab 3
                case "RFC":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Tipo_Inmueble.Focus();
                    break;

                //tab 6
                case "Vialidad":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Codigo_Postal.Focus();
                    break;

                //tab 8
                case "No_Ext":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    No_Int.Focus();
                    break;

                //tab 9
                case "No_Int":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Colonia.Focus();
                    break;

                //tab 10
                case "Colonia":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Entidad_Federativa.Focus();
                    break;

                //tab 13
                case "eMail":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Telefono.Focus();
                    break;

                //tab 16
                case "Cuenta_Banco":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    btnExaminar.Focus();
                    break;
                }
            }
            else if (sender is RadMaskedEditBox)
            {
                objMaskedEditBox = (RadMaskedEditBox)sender;

                switch (objMaskedEditBox.Name)
                {
                //tab 7
                case "Codigo_Postal":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    No_Ext.Focus();
                    break;

                //tab 14
                case "Telefono":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Celular.Focus();
                    break;

                //tab 15
                case "Celular":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Cuenta_Banco.Focus();
                    break;
                }
            }
            else if (sender is RadDropDownList)
            {
                objDropDownList = (RadDropDownList)sender;

                switch (objDropDownList.Name)
                {
                //tab 1
                case "Giro_Comercial":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Nombre_Fiscal.Focus();
                    break;

                //tab 4
                case "Tipo_Inmueble":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Tipo_Vialidad.Focus();
                    break;

                //tab 5
                case "Tipo_Vialidad":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Vialidad.Focus();
                    break;

                //tab 11
                case "Entidad_Federativa":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    Municipio.Focus();
                    break;

                //tab 12
                case "Municipio":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    eMail.Focus();
                    break;
                }
            }
            else if (sender is RadButton)
            {
                objButton = (RadButton)sender;

                switch (objButton.Name)
                {
                //tab 17
                case "btnExaminar":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    btnAceptar.Focus();
                    break;

                //tab 18
                case "btnAceptar":
                    pvAddSupplier.SelectedPage = pvpDatosGenerales;
                    btnCancelar.Focus();
                    break;
                }
            }
        }
예제 #27
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            nombre             = TxtNombreEmpl.Text.ToUpper();
            RFC                = TxtRFC.Text.ToUpper();
            CURP               = TxtCURP.Text.ToUpper();
            cuenta             = TxtCuenta.Text;
            clabe              = TxtCLABE.Text;
            banco              = lookUpBanco.Text;
            cve                = TxtCVE.Text;
            empresa            = lookUpEmpresa.Text;
            idEmpr             = lookUpEmpresa.EditValue.ToString();
            numEmpl            = TxtNumEmpl.Text;
            peri               = lookUpEditPeriPago.EditValue.ToString();
            correoClte         = txtCorreoClte.Text;
            empleado.Correo    = correoClte;
            empleado.descuento = Convert.ToDecimal(spinEditDesc.EditValue.ToString());
            //empleado.descuento = empleado.descuento / 100;
            if (nombre == "")
            {
                XtraMessageBox.Show("El campo Nombre no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.Nombre = nombre;
            }

            if (numEmpl.Equals(""))
            {
                XtraMessageBox.Show("El campo # Empleado no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.NumEmpl = numEmpl;
            }

            if (RFC == "")
            {
                XtraMessageBox.Show("El campo RFC no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (!RFC.Length.Equals(13))
                {
                    XtraMessageBox.Show("RFC no cumple con el formato correcto, favor de verificar.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    RFC = RFC.ToUpper();
                }
            }

            if (CURP == "")
            {
                XtraMessageBox.Show("El campo CURP no puede estar vacio", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (!CURP.Length.Equals(18))
                {
                    XtraMessageBox.Show("CURP no cumple con el formato correcto, favor de verificar,", "Mesnaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    empleado.CURP = CURP.ToUpper();
                }
            }

            if (peri == null)
            {
                XtraMessageBox.Show("Seleccione tipo de periodicidad.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                empleado.Periodicidad = peri;
            }

            if (cuenta.Equals(""))
            {
                XtraMessageBox.Show("El campo cuenta no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (cuenta.Length < 10)
            {
                XtraMessageBox.Show("Cuenta no cumple con el formato correcto, debe contener al menos 10 digitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (cuenta.Length > 10)
            {
                XtraMessageBox.Show("Cuenta no cumple con el formato correcto, debe contener máximo 10 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.cuenta = cuenta;
            }

            if (clabe.Equals(""))
            {
                XtraMessageBox.Show("El campo CLABE no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (clabe.Length < 18)
            {
                XtraMessageBox.Show("CLABE no cumple con el formato correcto, debe contener al menos 18 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (clabe.Length > 18)
            {
                XtraMessageBox.Show("CLABE no cumple con el formato correcto, debe contener máximo 18 dígitos.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.clabe_bancaria = clabe;
            }

            if (banco.Equals(""))
            {
                XtraMessageBox.Show("El campo bancoEmpleado no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.banco = banco;
            }

            if (cve.Equals(""))
            {
                XtraMessageBox.Show("El campo CVE no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.cve_banco = cve;
            }

            if (empresa.Equals(""))
            {
                XtraMessageBox.Show("El campo Empresa no puede estar vacio.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.empresa   = empresa;
                empleado.idEmpresa = idEmpr;
            }

            if (lookUpTipoPago.Text.Equals("Seleccione"))
            {
                XtraMessageBox.Show("Por favor, Seleccione Tipo Pago.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                empleado.tipoPago = lookUpTipoPago.EditValue.ToString();
            }


            if (empleado.RFC != null && empleado.Nombre != null && empleado.CURP != null && empleado.Periodicidad != null && empleado.cuenta != null && empleado.clabe_bancaria != null && empleado.banco != null && empleado.cve_banco != null && empleado.empresa != null && empleado.idEmpresa != null && empleado.NumEmpl != null)
            {
                //XtraMessageBox.Show("Nombre:" + nombre + "\nRFC:" + RFC + "\nCURP:" + CURP + "\nPeriodicidad:" + peri, "mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (XtraMessageBox.Show("¿Desea Editar la información?:\n" + empleado.Nombre.ToString() /* + "\n\nRFC:" + empleado.RFC.ToString() + "\n\nCURP:" + empleado.CURP.ToString() + "\n\nPeriodicidad pago:" + lookUpEdit2.Text +*/ + "\n\nFavor de verificar los datos.", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    //Controlador.AgregaEmpleado(empleado);
                    Controlador.EditarEmpleado(empleado, RFC);
                    sqlDataSource1.Fill();
                    lookUpEmpl.EditValue = empleado.RFC;
                    this.DeshabilitarCampos();
                }
            }
        }
예제 #28
0
파일: RFC_Mo.cs 프로젝트: tvrjcf/Demo
        private static List <WorkOrder> ERP_Get_Mo(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <WorkOrder>();
            //RFC调用函数名
            string funcName = "ZWMS_MO";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTMSG", typeof(string)));//消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("WERKS", typeof(string)));  //工厂
            odt1.Columns.Add(new DataColumn("AUFNR", typeof(string)));  //订单号
            odt1.Columns.Add(new DataColumn("PLNBEZ", typeof(string))); //物料号
            odt1.Columns.Add(new DataColumn("MAKTX", typeof(string)));  //物料描述(短文本)
            odt1.Columns.Add(new DataColumn("GAMNG", typeof(string)));  //订单数量
            odt1.Columns.Add(new DataColumn("VAPLZ", typeof(string)));  //维护任务的工作中心
            odt1.Columns.Add(new DataColumn("LGORT", typeof(string)));  //收货库存地点
            odt1.Columns.Add(new DataColumn("FTRMS", typeof(string)));  //计划下达日期
            odt1.Columns.Add(new DataColumn("FTRMI", typeof(string)));  //实际下达日期
            odt1.Columns.Add(new DataColumn("AUART", typeof(string)));  //订单类型
            odt1.Columns.Add(new DataColumn("ERDAT", typeof(string)));  //创建日期
            odt1.Columns.Add(new DataColumn("VERID", typeof(string)));  //生产版本
            odt1.Columns.Add(new DataColumn("GUANBI", typeof(string))); //是否关闭
            odt1.Columns.Add(new DataColumn("BEIZHU", typeof(string))); //备注
            odt1.Columns.Add(new DataColumn("WEMPF", typeof(string)));  //车间
            odt1.Columns.Add(new DataColumn("STATE", typeof(string)));  //状态

            ods.Tables.Add(odt1);
            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string factory       = dt.Rows[i]["WERKS"].ToString();                    //工厂
                string work_order_no = dt.Rows[i]["AUFNR"].ToString();                    //工单号
                string item_code     = dt.Rows[i]["PLNBEZ"].ToString();                   //物料编号
                string work_center   = dt.Rows[i]["VAPLZ"].ToString();                    //工作中心
                string version       = dt.Rows[i]["VERID"].ToString();                    //生产版本
                double order_qty     = 0;
                double.TryParse(dt.Rows[i]["GAMNG"].ToString(), out order_qty);           //订单数量

                string   storage_location = dt.Rows[i]["LGORT"].ToString();               //库存地点
                DateTime plan_release_date;
                DateTime.TryParse(dt.Rows[i]["FTRMS"].ToString(), out plan_release_date); //计划下达日期
                DateTime act_begin_date;
                DateTime.TryParse(dt.Rows[i]["FTRMI"].ToString(), out act_begin_date);    //实际下达日期
                string   work_order_type = dt.Rows[i]["AUART"].ToString();                //订单类型
                DateTime create_date;
                DateTime.TryParse(dt.Rows[i]["ERDAT"].ToString(), out create_date);       //创建日期
                bool   closed   = dt.Rows[i]["GUANBI"].ToString().IsNullOrEmpty() ? false : true;
                string bz       = dt.Rows[i]["BEIZHU"].ToSafeString();                    //备注
                string sapState = dt.Rows[i]["STATE"].ToSafeString();                     //sap状态
                string workShop = dt.Rows[i]["WEMPF"].ToSafeString();                     //车间

                //var model = new WorkOrder()
                //{
                //    Factory = factory,
                //    WorkOrderNo = work_order_no,
                //    Item = new BD.Items.Item { Code = item_code },
                //    Workshop = new BD.Organizations.Organization { Code = workShop },
                //    OrderQty = (int)order_qty,
                //    ReceiptWarehouse = new INV.Hisense.Warehouses.Warehouses.Warehouse { Code = storage_location },
                //    PlanBeginDate = plan_release_date,
                //    ActuFinishDate = act_begin_date,
                //    S_Type = work_order_type,
                //    CreateDate = create_date,
                //    ProductVersion = version,
                //    Remark = bz,
                //    IsClosed = closed,
                //    Status = sapState.Contains("TECO") ? BD.WorkOrders.WorkOrderStatus.Close : BD.WorkOrders.WorkOrderStatus.Release
                //};

                //lst.Add(model);
            }
            return(lst);
        }
예제 #29
0
        private static List <YfWipIssueBill> ERP_MES_YF(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <YfWipIssueBill>();
            //RFC调用函数名
            string funcName = "ZWMS_YFRESERVE";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //消息文本
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_HEADER";
            odt1.Columns.Add(new DataColumn("RSNUM", typeof(string))); //预留单号
            odt1.Columns.Add(new DataColumn("BDTER", typeof(string))); //组件的需求日期
            odt1.Columns.Add(new DataColumn("BWART", typeof(string))); //移动类型
            odt1.Columns.Add(new DataColumn("KOSTL", typeof(string))); //成本中心
            odt1.Columns.Add(new DataColumn("KOKRS", typeof(string))); //控制范围
            ods.Tables.Add(odt1);

            DataTable odt2 = new DataTable();

            odt2.TableName = "T_ITEM";
            odt2.Columns.Add(new DataColumn("RSNUM", typeof(string))); //预留单号
            odt2.Columns.Add(new DataColumn("RSPOS", typeof(string))); //预留单号项目编号
            odt2.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂
            odt2.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料号
            odt2.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地点
            odt2.Columns.Add(new DataColumn("BDMNG", typeof(string))); //需求量
            odt2.Columns.Add(new DataColumn("MEINS", typeof(string))); //基本计量单位
            odt2.Columns.Add(new DataColumn("BDTER", typeof(string))); //组件的需求日期
            odt2.Columns.Add(new DataColumn("ENMNG", typeof(string))); //提货数

            ods.Tables.Add(odt2);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);

            //根据RFC执行后返回的数据处理业务逻辑
            //DataTable dt = ods.Tables["T_ITEM"];
            foreach (DataRow h in ods.Tables["T_HEADER"].Rows)
            {
                var bill = new YfWipIssueBill();

                string type = h["BWART"].ToString();
                string dept = h["KOSTL"].ToString();
                string ctrl = h["KOKRS"].ToString();

                bill.No         = h["RSNUM"].ToString();
                bill.BillDate   = Convert.ToDateTime(h["BDTER"].ToString());
                bill.CostCenter = new BD.Factories.Factory()
                {
                    Code = dept
                };

                foreach (DataRow i in ods.Tables["T_ITEM"].AsEnumerable().Where(p => h["RSNUM"].ToString() == p["RSNUM"].ToString()))
                {
                    var billDtl = new YfWipIssueBillDetail()
                    {
                        Item = new Item {
                            Code = i["MATNR"].ToString()
                        },
                        ProjectNo      = i["RSPOS"].ToString(),
                        Qty            = Convert.ToDouble(i["BDMNG"] ?? 0),
                        ActualQty      = Convert.ToDouble(i["ENMNG"] ?? 0),
                        Unit           = i["MEINS"].ToString(),
                        Factory        = i["WERKS"].ToString(),
                        IssueWarehouse = new INV.Hisense.Warehouses.Warehouses.Warehouse {
                            Code = i["LGORT"].ToString()
                        },
                        //Warehouse = i["LGORT"].ToString(),
                    };
                    bill.YfWipIssueBillDetailList.Add(billDtl);
                }
                lst.Add(bill);
            }
            return(lst);
        }
예제 #30
0
파일: RFC_Org.cs 프로젝트: tvrjcf/Demo
        private static List <Organization> ERP_MES_Org(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst   = new List <Organization>();
            var group = DomainControllerFactory.Create <OrganizationController>().GetList(1).Concrete().FirstOrDefault();
            //RFC调用函数名
            string funcName = "ZWMS_T001W";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //处理标识
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_TAB";
            odt1.Columns.Add(new DataColumn("ORGID", typeof(string)));      //组织编码
            odt1.Columns.Add(new DataColumn("ORGNAME", typeof(string)));    //组织名称
            odt1.Columns.Add(new DataColumn("PR_ORGID", typeof(string)));   //上层编码
            odt1.Columns.Add(new DataColumn("PR_ORGNAME", typeof(string))); //上层名称
            odt1.Columns.Add(new DataColumn("WTYPE", typeof(string)));      //组织类型
            ods.Tables.Add(odt1);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);
            //根据RFC执行后返回的数据处理业务逻辑
            DataTable dt = ods.Tables["T_TAB"];

            //for (int i = 0; i < dt.Rows.Count; i++)
            foreach (DataRow organ in ods.Tables["T_TAB"].Rows)
            {
                //string code = dt.Rows[i]["ORGID"].ToString();
                //string name = dt.Rows[i]["ORGNAME"].ToString();
                //string prCode = dt.Rows[i]["WERKS"].ToString();
                //string prName = dt.Rows[i]["NAME1"].ToString();
                //string type = dt.Rows[i]["WTYPE"].ToString();
                string code   = organ["ORGID"].ToString();
                string name   = organ["ORGNAME"].ToString();
                string prCode = organ["PR_ORGID"].ToString();
                string prName = organ["PR_ORGNAME"].ToString();
                string type   = organ["WTYPE"].ToString().Trim();

                var org = new Organization()
                {
                    Code       = code,
                    Name       = name,
                    CreateBy   = PlatformEnvironment.IdentityId,
                    CreateDate = DateTime.Now,
                    InvOrgId   = PlatformEnvironment.InvOrgId
                };
                if (type == "公司")
                {
                    org.LevelId = 1;
                }
                else if (type == "工厂")
                {
                    org.LevelId    = 2;
                    org.TreeParent = group;
                }
                lst.Add(org);
            }
            return(lst);
        }
예제 #31
0
        private static List <ProductBom> ERP_MES_Bom(Hashtable import)
        {
            RFC rfc = new RFC(ConfigurationManager.AppSettings["sapServer"].ToString());
            //RFC rfc = new RFC("SAPTest");
            var lst = new List <ProductBom>();
            //RFC调用函数名
            string funcName = "ZWMS_BOM";
            //传输传给RFC函数的DataSet
            DataSet ids = new DataSet();
            //构建RFC传入表DataTable

            //返回数据的DataSet框架
            DataSet ods = new DataSet();
            //构建Export参数DataTable
            DataTable export = new DataTable();

            export.TableName = "Export";
            export.Columns.Add(new DataColumn("RTYPE", typeof(string))); //处理标识
            export.Columns.Add(new DataColumn("RTMSG", typeof(string))); //消息文本
            ods.Tables.Add(export);
            //构建RFC传出表DataTable
            DataTable odt1 = new DataTable();

            odt1.TableName = "T_HEADER";
            odt1.Columns.Add(new DataColumn("WERKS", typeof(string))); //工厂
            odt1.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料代码
            odt1.Columns.Add(new DataColumn("VERID", typeof(string))); //生产版本
            //odt1.Columns.Add(new DataColumn("ZTEXT", typeof(string)));//BOM 文本
            //odt1.Columns.Add(new DataColumn("STKTX", typeof(string)));//可选文本
            odt1.Columns.Add(new DataColumn("LOEKZ", typeof(string)));//BOM 删除标志
            ods.Tables.Add(odt1);

            DataTable odt2 = new DataTable();

            odt2.TableName = "T_ITEM";
            odt2.Columns.Add(new DataColumn("MATNR", typeof(string))); //物料代码
            odt2.Columns.Add(new DataColumn("IDNRK", typeof(string))); //BOM 组件
            odt2.Columns.Add(new DataColumn("MAKTX", typeof(string))); //物料描述(短文本)
            odt2.Columns.Add(new DataColumn("MENGE", typeof(string))); //组件数量
            odt2.Columns.Add(new DataColumn("MEINS", typeof(string))); //组件计量单位
            odt2.Columns.Add(new DataColumn("LGORT", typeof(string))); //库存地点
            odt2.Columns.Add(new DataColumn("RGEKZ", typeof(string))); //是否反冲
            ods.Tables.Add(odt2);

            //执行RFC函数
            bool ret = rfc.DownloadByRFC(funcName, import, ids, ref ods);

            //根据RFC执行后返回的数据处理业务逻辑
            //DataTable dt = ods.Tables["T_ITEM"];
            foreach (DataRow h in ods.Tables["T_HEADER"].Rows)
            {
                var    bom  = new ProductBom();
                string code = h["MATNR"].ToString();
                string ver  = h["VERID"].ToString();
                string flag = h["LOEKZ"].ToString();
                bom.Item = new Item {
                    Code = code
                };
                bom.Name    = code;
                bom.Code    = code;
                bom.Version = ver;
                foreach (DataRow i in ods.Tables["T_ITEM"].AsEnumerable().Where(p => h["MATNR"].ToString() == p["MATNR"].ToString()))
                {
                    var resover   = i["RGEKZ"].ToString();
                    var bomDetail = new ProductBomDetail()
                    {
                        Item = new Item {
                            Code = i["IDNRK"].ToString()
                        },
                        UnitQty   = Convert.ToDouble(i["MENGE"] ?? 0),
                        Unit      = i["MEINS"].ToString(),
                        Rgekz     = resover.IsNullOrEmpty() || resover == "0" ? 0 : 1,
                        Warehouse = i["LGORT"].ToSafeString()
                    };
                    bom.DetailList.Add(bomDetail);
                }
                lst.Add(bom);
            }
            return(lst);
        }