From 895d4e89f0e75600cc21a0a08cbfa0682c10c18e Mon Sep 17 00:00:00 2001 From: Gerardo Date: Wed, 29 Mar 2023 23:41:00 +0200 Subject: [PATCH] Log mensaje error --- Helper/HelperGdb.cs | 12 +++++++++--- Services/EjecServ.cs | 1 - Services/FinProcServ.cs | 13 ++++++++----- View/Recogida/PaneRecogidaSub1.xaml | 6 +++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 9950349..f9a27a8 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -1443,11 +1443,14 @@ namespace OliviaAddInPro.Helper if (!System.IO.Directory.Exists(outpath)) System.IO.Directory.CreateDirectory(outpath); FeatureClass fc = null; + bool debug = true; ///////////////////////////////////////////////////////// //Prepara una where_clause con las entidades que cumplen el filtro //Abre la featureclass try { + if (debug) + HelperGlobal.ponMsg("pathLayerIn " + pathLayerIn); fc = GetFtClassSync(pathLayerIn); if (fc == null) { @@ -1456,14 +1459,17 @@ namespace OliviaAddInPro.Helper } List ids = new List(); + if (debug) + HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name); ///////////////////////////////////////////////////////// //Añade a la lista los ids que cumplen el filtro espacial try { ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); } - catch - { + catch(Exception ex) + { + OutStr = "Error al seleccionar IDs. "+ex.Message; ids = new List(); } @@ -1479,7 +1485,7 @@ namespace OliviaAddInPro.Helper }*/ if (ids.Count <= 0) { - OutStr = "Error al aplicar filtro espacial en exportación"; + OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr; return false; } ///////////////////////////////////////////////////////// diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 5e66f9d..ef7d484 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -832,7 +832,6 @@ namespace OliviaAddInPro.Services string shapefile = System.IO.Path.GetFileNameWithoutExtension(path_shape); int ind = shapefile.IndexOf("_", 0); string prefijo = shapefile.Substring(ind + 1, 1); - ////////////////////////////////////////////////////////////////////////////////// //decodifica el nombre del shapefile para asignarle el correspondiente nombre en la GDB a la que se importa el shape string tratamiento = string.Empty; diff --git a/Services/FinProcServ.cs b/Services/FinProcServ.cs index 759ba5e..839e343 100644 --- a/Services/FinProcServ.cs +++ b/Services/FinProcServ.cs @@ -54,7 +54,7 @@ namespace OliviaAddInPro.Services ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func)(() => { string GdbFileName = resp.Value; - + string nombAmbitos = string.Empty; if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización { //actualiza los flags @@ -130,7 +130,7 @@ namespace OliviaAddInPro.Services if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación { //guarda csv - GuardaCsv(inst); + GuardaCsv(inst,resp2.Value); } msg = Resource1.String_exito; @@ -209,7 +209,7 @@ namespace OliviaAddInPro.Services /* * Permite guardar el archivo CSV que contiene la secuencia que se ha llevado a cabo en las rutas en la planificación. */ - public static void GuardaCsv(TratamientoComun inst) + public static void GuardaCsv(TratamientoComun inst, string pathImport) { string auxi, nombre = null; string[] nameDokL; @@ -221,7 +221,10 @@ namespace OliviaAddInPro.Services string Filter = "Secuencia en formato CSV (*.csv)|*.csv"; inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), out auxi, out nombre); - + if (!string.IsNullOrEmpty(pathImport)) + { + nombre = System.IO.Path.GetFileNameWithoutExtension(pathImport); + } //string Path = HelperGdb.SaveFileDlg(Title, DirData, inst.ServCom.EXT_CSV, Filter); string Path = string.Empty; if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGuardCsv)) @@ -234,7 +237,7 @@ namespace OliviaAddInPro.Services bool ok = HelperGlobal.ponMsg("Se va a perder el archivo que contiene la secuencia en planificación, ¿está seguro?", MessageBoxImage.Question,"OLIVIA",MessageBoxButton.YesNo); if (!ok) - GuardaCsv(inst); + GuardaCsv(inst, pathImport); } else { diff --git a/View/Recogida/PaneRecogidaSub1.xaml b/View/Recogida/PaneRecogidaSub1.xaml index fee26b9..dd38b13 100644 --- a/View/Recogida/PaneRecogidaSub1.xaml +++ b/View/Recogida/PaneRecogidaSub1.xaml @@ -49,7 +49,7 @@ - +