예제 #1
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet AltaPack(string numero, string Descripcion, string UMBase, string GrContExis,
                               string PreIVAIncl, string GrIVANeg, string GrContProd, string GrIVAProd,
                               string PreVenta, string CodCategoria, string FechaIni, string FechaFin,
                               string ProdOpcionales, string TipoPack, string MotBloqueo,
                               string CodTienda, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "AltaPack()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = numero;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[16];
                MyArray[0] = numero;
                MyArray[1] = Descripcion;
                MyArray[2] = UMBase;
                MyArray[3] = GrContExis;
                MyArray[4] = PreIVAIncl;
                MyArray[5] = GrIVANeg;
                MyArray[6] = GrContProd;
                MyArray[7] = GrIVAProd;
                MyArray[8] = PreVenta;
                MyArray[9] = CodCategoria;
                MyArray[10] = FechaIni;
                MyArray[11] = FechaFin;
                MyArray[12] = ProdOpcionales;
                MyArray[13] = TipoPack;
                MyArray[14] = MotBloqueo;
                MyArray[15] = CodTienda;

                nas.ExecuteFunction = "DarAltaProductoPack";
                nas.Parameters = MyArray;
                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "AltaPack()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_ComponentesPack";
                    string[] MyArray1 = new string[11];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//CodPack
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLinea
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Tipo
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//CodProd
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][4].ToString();//Descripcion
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][5].ToString();//UDM
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][6].ToString();//Cantidad
                    MyArray1[7] = DatosLineas.Tables[0].Rows[i][7].ToString();//Coste
                    MyArray1[8] = DatosLineas.Tables[0].Rows[i][8].ToString();//CosteTotal
                    MyArray1[9] = DatosLineas.Tables[0].Rows[i][9].ToString();//Obligatorio
                    MyArray1[10] = DatosLineas.Tables[0].Rows[i][10].ToString();//TipoObli

                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "AltaPack()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
예제 #2
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet HistLinFra_Generar(DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "HistLinFra_Generar()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTDHistLinFraGenerar";
                    string[] MyArray1 = new string[3];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//NumFactura
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLinea
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Numcheque
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "HistLinFra_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "HistLinFra");
                this.BorrarCabecera(NumeroSerieNuevo, "HistLinFra");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("HistLinFra", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["HistLinFra"] = NumeroSerieNuevo;
            return DsResult;
        }
예제 #3
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet DiarioProd_Generar(DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "DiarioProd_Generar()", "ERROR: No se ha validado, debe abrir login");

            //TODO: Comprobar utilidad de los siguientes objetos !?
            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            //NumeroSerieNuevo = NumeroTicket;

            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_DiarioProd_Generar";
                    string[] MyArray1 = new string[11];
                    MyArray1[0] = DatosLineas.Tables[0].Rows[i][0].ToString();//Libro
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//Seccion
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//Nº linea
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//Producto
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][4].ToString();//Fecha
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][5].ToString();//Tipo Mov
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][6].ToString();//Nº documento
                    MyArray1[7] = DatosLineas.Tables[0].Rows[i][7].ToString();//Almacen
                    MyArray1[8] = DatosLineas.Tables[0].Rows[i][8].ToString();//Cantidad
                    MyArray1[9] = DatosLineas.Tables[0].Rows[i][9].ToString();//Cantidad calculada
                    MyArray1[10] = DatosLineas.Tables[0].Rows[i][10].ToString();//Cantidad fisica
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "DiarioProd_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Diario Producto");
                this.BorrarCabecera(NumeroSerieNuevo, "Diario Producto");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("DiarioProd", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["DiarioProd"] = NumeroSerieNuevo;
            return DsResult;
        }
예제 #4
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet Competidores(string CodProv, string Nombre, string Direccion,
                                string Direccion2, string Poblacion, string Pais,
                                string CP, string Provincia, string Mail,
                                string Web, string Telefono, string Fax,
                                string FechaMod, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "Competidores()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = CodProv;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[13];
                MyArray[0] = CodProv;
                MyArray[1] = Nombre;
                MyArray[2] = Direccion;
                MyArray[3] = Direccion2;
                MyArray[4] = Poblacion;
                MyArray[5] = Pais;
                MyArray[6] = CP;
                MyArray[7] = Provincia;
                MyArray[8] = Mail;
                MyArray[9] = Web;
                MyArray[10] = Telefono;
                MyArray[11] = Fax;
                MyArray[12] = FechaMod;

                nas.ExecuteFunction = "PSTD_Competidores";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Competidores()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_PrecioCompetidores";
                    string[] MyArray1 = new string[6];
                    MyArray1[0] = CodProv;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][0].ToString();//producto
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][1].ToString();//fecha inicio
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][2].ToString();//unidad medida
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][3].ToString();//coste
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][4].ToString();//fecha fin
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Competidores()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
예제 #5
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet CabRep_Generar(string NumeroTicket, string AlmOrigen, string AlmDestino,
                        string FechaEnvio, string FechaReg, string FechaDoc, string AlmTransito,
                        string Vendedor, string NumBultos, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "CabRep_Generar()", "ERROR: No se ha validado, debe abrir login");

            //TODO: Comprobar la utilidad de los siguientes objetos !?
            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = string.Empty;

            NumeroSerieNuevo = NumeroTicket;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[10];
                MyArray[0] = NumeroSerieNuevo;
                MyArray[1] = AlmOrigen;
                MyArray[2] = AlmDestino;
                MyArray[3] = FechaEnvio;
                MyArray[4] = FechaReg;
                MyArray[5] = FechaDoc;
                MyArray[6] = AlmTransito;
                MyArray[7] = Vendedor;
                MyArray[8] = NumBultos;
                MyArray[9] = DatosLineas.Tables[0].Rows.Count.ToString();

                nas.ExecuteFunction = "PSTD_PedTransferencia_Generar";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabRep_Generar()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_GrabarLineaTransferencia";
                    string[] MyArray1 = new string[7];
                    MyArray1[0] = NumeroSerieNuevo;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][0].ToString();//NumDoc
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][1].ToString();//Cantidad
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][2].ToString();//AlmOrigen
                    MyArray1[4] = DatosLineas.Tables[0].Rows[i][3].ToString();//AlmDestino
                    MyArray1[5] = DatosLineas.Tables[0].Rows[i][4].ToString();//NumLinea
                    MyArray1[6] = DatosLineas.Tables[0].Rows[i][5].ToString();//CodVariante
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabRep_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            try
            {
                NavisionDB.NavisionDBNas nasReg = new NavisionDB.NavisionDBNas();
                nasReg.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[1];
                MyArray[0] = NumeroSerieNuevo;

                nasReg.ExecuteFunction = "PSTD_RegEnvio_Transferencia";
                nasReg.Parameters = MyArray;

                nasReg.SendParamsAsync(nasReg, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Factura");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "Ventas_Crear()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }
예제 #6
0
파일: TPV.cs 프로젝트: fcrespo/WSTPV
        public DataSet CabCarga_Generar(string NumCarga, string FechaEnvio, string NatuTrans,
                                        string ModTrans, string Puerto, string EspTrans,
                                        string CodTrans, string CondEnvio, string CodTPV,
                                        string CodTienda, string Estado, string FechaCreacion,
                                        string ServTrans, DataSet DatosLineas)
        {
            int TimeoutCabecera = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_CABECERA"]);
            int TimeoutLineas = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TIME_OUT_MILISEG_GRABAR_LINEAS"]);

            string nombre_servidor_colas = System.Configuration.ConfigurationManager.AppSettings["NOMBRE_SERVIDOR_COLAS"];
            string colaToNav = System.Configuration.ConfigurationManager.AppSettings["COLA_TO_NAVISION"];
            string colaFromNav = System.Configuration.ConfigurationManager.AppSettings["COLA_FROM_NAVISION"];

            DataSet DsResult = new DataSet();
            if ((this.DBUser == null) || (this.DBUser.UserCode == ""))
                return Utilidades.GenerarError("", "CabCarga_Generar()", "ERROR: No se ha validado, debe abrir login");

            NavisionDBTable Dt = new NavisionDBTable(this.Connection, this.DBUser);
            NavisionDBAdapter Da = new NavisionDBAdapter();
            NavisionDBCommand Cmd = new NavisionDBCommand(this.Connection);
            NavisionDBNumSerie NumSerie = new NavisionDBNumSerie(this.DBUser, this.Connection);
            NavisionDBDataReader Rd = new NavisionDBDataReader();
            string NumeroSerieNuevo = "";

            NumeroSerieNuevo = NumCarga;

            try
            {
                NavisionDB.NavisionDBNas nas = new NavisionDB.NavisionDBNas();
                nas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                string[] MyArray = new string[13];
                MyArray[0] = NumCarga;
                MyArray[1] = FechaEnvio;
                MyArray[2] = NatuTrans;
                MyArray[3] = ModTrans;
                MyArray[4] = Puerto;
                MyArray[5] = EspTrans;
                MyArray[6] = CodTrans;
                MyArray[7] = CondEnvio;
                MyArray[8] = CodTPV;
                MyArray[9] = CodTienda;
                MyArray[10] = Estado;
                MyArray[11] = FechaCreacion;
                MyArray[12] = ServTrans;

                nas.ExecuteFunction = "PSTD_CabCarga_Generar";
                nas.Parameters = MyArray;

                nas.SendParamsAsync(nas, "", false);

            }
            catch (System.Messaging.MessageQueueException ex)
            {
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabCarga_Generar()", "Error al insertar la cabecera: " + ex.Message + ". Cabecera borrada: " + NumeroSerieNuevo);
                return DsResult;
            }
            try
            {
                int i;
                for (i = 0; i <= DatosLineas.Tables[0].Rows.Count - 1; i++)
                {
                    NavisionDB.NavisionDBNas NasLineas = new NavisionDB.NavisionDBNas();
                    NasLineas.NasInitializeChannels(nombre_servidor_colas, colaFromNav, colaToNav);
                    NasLineas.ExecuteFunction = "PSTD_GrabarLineaCarga";
                    string[] MyArray1 = new string[4];
                    MyArray1[0] = NumCarga;
                    MyArray1[1] = DatosLineas.Tables[0].Rows[i][1].ToString();//NumLin
                    MyArray1[2] = DatosLineas.Tables[0].Rows[i][2].ToString();//NumEntrega
                    MyArray1[3] = DatosLineas.Tables[0].Rows[i][3].ToString();//NumLinEntrega
                    NasLineas.Parameters = MyArray1;
                    NasLineas.SendParamsAsync(NasLineas, "", false);

                }
            }
            catch (System.Messaging.MessageQueueException ex)
            {
                DsResult = Utilidades.GenerarError(this.DBUser.UserCode, "CabCarga_Generar()", "Error al insertar línea: " + ex.Message);
                this.BorrarLineas(NumeroSerieNuevo, "Pedido");
                this.BorrarCabecera(NumeroSerieNuevo, "Pedido");
                return DsResult;
            }

            DsResult = Utilidades.GenerarResultado("Correcto");
            DsResult.Tables[0].Columns.Add("NumPedido", Type.GetType("System.String"));
            DsResult.Tables[0].Rows[0]["NumPedido"] = NumeroSerieNuevo;
            return DsResult;
        }