diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb index 70707b8f5..b784fb90d 100644 --- a/Bancos/PagoElectronicoGrupos.aspx.vb +++ b/Bancos/PagoElectronicoGrupos.aspx.vb @@ -1197,7 +1197,7 @@ Partial Class Bancos_PagoElectronicoGrupos For Each drow As DataRow In DTPendientesTemp.Rows - + EsCIE = False MENSAJEError.Clear() diff --git a/TareasProgramadas/Tareas119.ashx b/TareasProgramadas/Tareas119.ashx index a1b854f02..83be5b74f 100644 --- a/TareasProgramadas/Tareas119.ashx +++ b/TareasProgramadas/Tareas119.ashx @@ -23,8 +23,7 @@ public class TareasJam : IHttpHandler switch (Metodo) { case "TestConexion": - //PruebaConexionFTP("ftp://127.0.0.1/", "Toor", "agj-3500"); - retorno = PruebaConexionFTP("ftp://us2.hostedftp.com/", "agrojam", "A12345678"); + retorno = PruebaConexionFTP("ftp://us2.hostedftp.com/", "agrojam", "A12345678"); break; case "EjecutaThalamus": retorno =EjecutaThalamus(CveEmpresa); @@ -41,8 +40,8 @@ public class TareasJam : IHttpHandler context.Response.Write("False"); } - context.Response.End(); - //ModExtensiones.GuardaLogAD(string.Format("{3} CveEmpresa={0} cveTareaProgramada={1} CveTareaProgramadaHistorial={2}", CveEmpresa, cveTareaProgramada, CveTareaProgramadaHistorial, Metodo), "Tareas Programadas"); + context.Response.End(); + } private bool EjecutaThalamus(int CveEmpresa) { @@ -52,6 +51,8 @@ public class TareasJam : IHttpHandler DataTable DTProductos = new DataTable(); DataTable DTVentas = new DataTable(); DataTable DTClientes = new DataTable(); + DataTable DTAlmacenes = new DataTable(); + bool ErrorProceso = false; if (ObjGenerales.GetJAMCorveta(1)) @@ -72,6 +73,12 @@ public class TareasJam : IHttpHandler } else { ErrorProceso = true; } + if (ObjGenerales.GetJAMCorveta(4)) + { + DTAlmacenes = ObjGenerales.DtResultados.Copy(); + } + else { ErrorProceso = true; } + ObjGenerales.Dispose(); if (!ErrorProceso) @@ -79,6 +86,8 @@ public class TareasJam : IHttpHandler string RutaProductos = $@"{ HttpContext.Current.Server.MapPath("~") }Temp\Productos{DateTime.Now.ToString("yyyyMMdd")}.xlsx"; string RutaVentas = $@"{ HttpContext.Current.Server.MapPath("~") }Temp\Ventas{DateTime.Now.ToString("yyyyMMdd")}.xlsx"; string RutaClientes = $@"{ HttpContext.Current.Server.MapPath("~") }Temp\Clientes{DateTime.Now.ToString("yyyyMMdd")}.xlsx"; + string RutaAlmacenes = $@"{ HttpContext.Current.Server.MapPath("~") }Temp\Almacenes{DateTime.Now.ToString("yyyyMMdd")}.xlsx"; + string FTPServer = "ftp://127.0.0.1/"; string TFPUsr = "Toor"; @@ -87,7 +96,7 @@ public class TareasJam : IHttpHandler SpreadsheetInfo.SetLicense(Extensiones.ModExtensiones.SerialGemBoxSpreadsheet()); var workbookProductos = new ExcelFile(); - var worksheetProductos = workbookProductos.Worksheets.Add("Ventas"); + var worksheetProductos = workbookProductos.Worksheets.Add("Productos"); worksheetProductos.InsertDataTable(DTProductos, new InsertDataTableOptions() { ColumnHeaders = true, @@ -106,7 +115,7 @@ public class TareasJam : IHttpHandler var workbookClientes = new ExcelFile(); - var worksheetClientes = workbookClientes.Worksheets.Add("Ventas"); + var worksheetClientes = workbookClientes.Worksheets.Add("Clientes"); worksheetClientes.InsertDataTable(DTClientes, new InsertDataTableOptions() { ColumnHeaders = true, @@ -115,14 +124,26 @@ public class TareasJam : IHttpHandler workbookClientes.Save(RutaClientes); + var workbookAlmacenes = new ExcelFile(); + var worksheetAlmacenes = workbookClientes.Worksheets.Add("Almacenes"); + worksheetAlmacenes.InsertDataTable(DTAlmacenes, new InsertDataTableOptions() + { + ColumnHeaders = true, + StartRow = 0 + }); + workbookClientes.Save(RutaAlmacenes); + + var FInfoProductos = new FileInfo(RutaProductos); var FInfoVentas = new FileInfo(RutaVentas); var FInfoClientes = new FileInfo(RutaClientes); + var FInfoAlmacenes = new FileInfo(RutaAlmacenes); bool CargaProductos = false; bool CargaVentas = false; bool CargaClientes = false; + bool CargaAlmacenes = false; CargaProductos = CargarArchivos(FInfoProductos, FTPServer, TFPUsr, FTPPass); if (CargaProductos) @@ -149,7 +170,17 @@ public class TareasJam : IHttpHandler } - if (CargaProductos & CargaVentas & CargaClientes) + if (CargaProductos & CargaVentas& CargaClientes ) + { + CargaAlmacenes = CargarArchivos(FInfoAlmacenes, FTPServer, TFPUsr, FTPPass); + if (CargaClientes) + { + CargaAlmacenes = VerificarArchivo(FInfoAlmacenes, FInfoAlmacenes.Length, FTPServer, TFPUsr, FTPPass); + } + } + + + if (CargaProductos & CargaVentas & CargaClientes & CargaAlmacenes) { return true; } @@ -272,7 +303,7 @@ public class TareasJam : IHttpHandler private bool PruebaConexionFTP( string FTPServer, string FTPUsr, string FTPPass) { - bool Respuesta = false; + bool Respuesta = false; FtpWebRequest request =(FtpWebRequest)WebRequest.Create($"{FTPServer}/Test.log"); request.Method = WebRequestMethods.Ftp.ListDirectory;