Avances importación
parent
7f824052a3
commit
7ab639b800
|
|
@ -29,7 +29,8 @@ namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
private static string ObjectId = "OBJECTID";
|
private static string ObjectId = "OBJECTID";
|
||||||
private static string out_str = string.Empty;
|
private static string out_str = string.Empty;
|
||||||
public static string OutStr {
|
public static string OutStr
|
||||||
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
/*string val = "";
|
/*string val = "";
|
||||||
|
|
@ -43,7 +44,8 @@ namespace OliviaAddInPro.Helper
|
||||||
private static string texto_sal = string.Empty;
|
private static string texto_sal = string.Empty;
|
||||||
public static string TextoSal
|
public static string TextoSal
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
/*string val = "";
|
/*string val = "";
|
||||||
val.CopyFrom(texto_sal);
|
val.CopyFrom(texto_sal);
|
||||||
texto_sal = string.Empty; //lo borra cada vez que se consulta
|
texto_sal = string.Empty; //lo borra cada vez que se consulta
|
||||||
|
|
@ -145,7 +147,7 @@ namespace OliviaAddInPro.Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
//Devuelve el Path del archivo seleccionado o un string vacío si se ha cancelado
|
//Devuelve el Path del archivo seleccionado o un string vacío si se ha cancelado
|
||||||
public static string OpenFileDialog(TiposOpenFileDlg tipo, string initialLoc="")
|
public static string OpenFileDialog(TiposOpenFileDlg tipo, string initialLoc = "", string tit_ = "")
|
||||||
{
|
{
|
||||||
string titulo;
|
string titulo;
|
||||||
ReiniciaOutStr();
|
ReiniciaOutStr();
|
||||||
|
|
@ -179,15 +181,20 @@ namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
filtro.AddFilter(BrowseProjectFilter.GetFilter(""));
|
filtro.AddFilter(BrowseProjectFilter.GetFilter(""));
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(tit_))
|
||||||
|
titulo = tit_;
|
||||||
|
|
||||||
//Display the filter in an Open Item dialog
|
//Display the filter in an Open Item dialog
|
||||||
OpenItemDialog aNewFilter = new OpenItemDialog
|
OpenItemDialog aNewFilter = new OpenItemDialog
|
||||||
{
|
{
|
||||||
Title = titulo,
|
Title = titulo,
|
||||||
InitialLocation = initialLoc,
|
|
||||||
MultiSelect = false,
|
MultiSelect = false,
|
||||||
//Set the BrowseFilter property to Pro's Geodatabase filter.
|
//Set the BrowseFilter property to Pro's Geodatabase filter.
|
||||||
BrowseFilter = filtro
|
BrowseFilter = filtro
|
||||||
};
|
};
|
||||||
|
if (!string.IsNullOrEmpty(initialLoc))
|
||||||
|
aNewFilter.InitialLocation = initialLoc;
|
||||||
|
|
||||||
bool? ok = aNewFilter.ShowDialog();
|
bool? ok = aNewFilter.ShowDialog();
|
||||||
if ((ok ?? true) && aNewFilter.Items.Count() > 0)
|
if ((ok ?? true) && aNewFilter.Items.Count() > 0)
|
||||||
return aNewFilter.Items.First().Path;
|
return aNewFilter.Items.First().Path;
|
||||||
|
|
@ -1241,7 +1248,8 @@ namespace OliviaAddInPro.Helper
|
||||||
string message = String.Empty;
|
string message = String.Empty;
|
||||||
bool deletionResult = false;
|
bool deletionResult = false;
|
||||||
|
|
||||||
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => {
|
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
|
||||||
EditOperation editOperation = new EditOperation();
|
EditOperation editOperation = new EditOperation();
|
||||||
editOperation.Callback(context =>
|
editOperation.Callback(context =>
|
||||||
|
|
@ -1440,5 +1448,30 @@ namespace OliviaAddInPro.Helper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saca diálogo para guardar un archivo
|
||||||
|
*/
|
||||||
|
public static string SaveFileDlg(string title_, string initloc_, string ext_, string filt_)
|
||||||
|
{
|
||||||
|
//Display the filter in an Open Item dialog
|
||||||
|
SaveItemDialog dlg = new SaveItemDialog
|
||||||
|
{
|
||||||
|
Title = title_,
|
||||||
|
OverwritePrompt = true,
|
||||||
|
};
|
||||||
|
if (!string.IsNullOrEmpty(initloc_))
|
||||||
|
dlg.InitialLocation = initloc_;
|
||||||
|
if (!string.IsNullOrEmpty(filt_))
|
||||||
|
dlg.Filter = filt_;
|
||||||
|
if (!string.IsNullOrEmpty(ext_))
|
||||||
|
dlg.DefaultExt = ext_;
|
||||||
|
|
||||||
|
bool? ok = dlg.ShowDialog();
|
||||||
|
|
||||||
|
if ((ok ?? true) && dlg.FilePath.Length > 0)
|
||||||
|
return dlg.FilePath;
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,17 @@ namespace OliviaAddInPro.Model
|
||||||
* Instancia para las funciones de exportación y demás
|
* Instancia para las funciones de exportación y demás
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public LimpiezaServ Serv { get; set; } = null;
|
public LimpiezaServ Serv
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (LimpiezaServ)ServCom;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
ServCom = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
public LanzaLimpSrv LanzaSrv { get; set; } = null;
|
public LanzaLimpSrv LanzaSrv { get; set; } = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,8 +57,6 @@ namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
Serv = new LimpiezaServ(this);
|
Serv = new LimpiezaServ(this);
|
||||||
LanzaSrv = new LanzaLimpSrv();
|
LanzaSrv = new LanzaLimpSrv();
|
||||||
ProceSrv = new ProcesoEjecServ();
|
|
||||||
ProgrSrc = new MyCancelableProgressorSource(OliviaGlob.progrDialog.GetViewModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
||||||
|
|
@ -73,5 +81,55 @@ namespace OliviaAddInPro.Model
|
||||||
}
|
}
|
||||||
return res2;
|
return res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Descodifica el nombre del sahpefile de entrada identificando el tipo de tratamiento y los ámbitos de trabajo
|
||||||
|
*/
|
||||||
|
public override void decode_gdb(string shapefile, out string tratamiento, out string ambitos)
|
||||||
|
{
|
||||||
|
int aux, auxl, mbito, indice, tratamient;
|
||||||
|
string auxili, ambi, auxi;
|
||||||
|
|
||||||
|
indice = shapefile.IndexOf("_");
|
||||||
|
indice = indice + 2;//para saltarse la T que va antes del identificador del tipo de tratamiento
|
||||||
|
auxili = shapefile.Substring(indice, 2);
|
||||||
|
tratamient = Convert.ToInt32(auxili);
|
||||||
|
tratamiento = LimpiezaDef.tto_gdb[tratamient];
|
||||||
|
indice = shapefile.IndexOf("_", indice);
|
||||||
|
indice = indice + 2;//para saltarse la A que va antes del identificador de los ámbitos que intervienen
|
||||||
|
aux = shapefile.IndexOf("_", indice);
|
||||||
|
auxl = aux - indice;
|
||||||
|
auxi = "";
|
||||||
|
while (auxl > 0)
|
||||||
|
{
|
||||||
|
ambi = shapefile.Substring(indice, 2);
|
||||||
|
mbito = Convert.ToInt32(ambi);
|
||||||
|
indice = indice + 2;
|
||||||
|
auxl = auxl - 2;
|
||||||
|
if (auxl != 0)
|
||||||
|
auxi = auxi + LimpiezaDef.ambs_gdb[mbito] + "_";
|
||||||
|
else
|
||||||
|
auxi = auxi + LimpiezaDef.ambs_gdb[mbito];
|
||||||
|
}
|
||||||
|
ambitos = LimpiezaDef.preftto_gdb[tratamient] + "_" + auxi;
|
||||||
|
|
||||||
|
//quita los espacios
|
||||||
|
tratamiento = tratamiento.Replace(" ", "_");
|
||||||
|
ambitos = ambitos.Replace(" ", "_");
|
||||||
|
|
||||||
|
auxi = shapefile;
|
||||||
|
//para poner la zona cuando es seleccionada
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
indice = auxi.LastIndexOf("_");
|
||||||
|
auxi = auxi.Substring(0, indice);
|
||||||
|
}
|
||||||
|
auxl = indice - aux;
|
||||||
|
if (auxl <= 0)
|
||||||
|
return;
|
||||||
|
auxili = shapefile.Substring(aux, auxl);
|
||||||
|
ambitos = ambitos + auxili;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ namespace OliviaAddInPro.Model
|
||||||
get { return reco; }
|
get { return reco; }
|
||||||
set { reco = value; }
|
set { reco = value; }
|
||||||
}
|
}
|
||||||
public static EjecServ Serv { get; } = new EjecServ();
|
|
||||||
public static SpatialReference SpatRef { get; set; } = null;
|
public static SpatialReference SpatRef { get; set; } = null;
|
||||||
public static MarchandoUnaDe progrDialog { get; set; } = null;
|
public static MarchandoUnaDe progrDialog { get; set; } = null;
|
||||||
#endregion Properties
|
#endregion Properties
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,17 @@ namespace OliviaAddInPro.Model
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
public RecogidaServ Serv { get; set; } = null;
|
public RecogidaServ Serv
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (RecogidaServ)ServCom;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
ServCom = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
public LanzaRecoSrv LanzaSrv { get; set; } = null;
|
public LanzaRecoSrv LanzaSrv { get; set; } = null;
|
||||||
public Recogida()
|
public Recogida()
|
||||||
{
|
{
|
||||||
|
|
@ -99,5 +109,48 @@ namespace OliviaAddInPro.Model
|
||||||
}
|
}
|
||||||
return res2;
|
return res2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Descodifica el nombre del sahpefile de entrada identificando el tipo de fracción y la carga para la recogida de residuos
|
||||||
|
*/
|
||||||
|
public override void decode_gdb(string shapefile, out string fraccion, out string carga)
|
||||||
|
{
|
||||||
|
int aux, auxl, carg, indice, fracc;
|
||||||
|
string auxili, fra, auxi;
|
||||||
|
|
||||||
|
indice = shapefile.IndexOf("_");
|
||||||
|
indice = indice + 2;//para saltarse la F que va antes del identificador del tipo de fracción
|
||||||
|
auxili = shapefile.Substring(indice, 2);
|
||||||
|
fracc = Convert.ToInt32(auxili);
|
||||||
|
fraccion = RecogidaDef.tipos_fracc_str[fracc];
|
||||||
|
indice = shapefile.IndexOf("_", indice);
|
||||||
|
indice = indice + 2;//para saltarse la C que va antes del identificador de los tipos de carga de los vehículos
|
||||||
|
aux = shapefile.IndexOf("_", indice);
|
||||||
|
|
||||||
|
auxi = "";
|
||||||
|
|
||||||
|
fra = shapefile.Substring(indice, 2);
|
||||||
|
carg = Convert.ToInt32(fra);
|
||||||
|
|
||||||
|
carga = RecogidaDef.tipos_fracc_str[fracc] + "_" + RecogidaDef.tipos_carg_str[carg];
|
||||||
|
|
||||||
|
//quita los espacios
|
||||||
|
fraccion = fraccion.Replace(" ", "_");
|
||||||
|
carga = carga.Replace(" ", "_");
|
||||||
|
////////////////////////
|
||||||
|
|
||||||
|
auxi = shapefile;
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
indice = auxi.LastIndexOf("_");
|
||||||
|
auxi = auxi.Substring(0, indice);
|
||||||
|
}
|
||||||
|
auxl = indice - aux;
|
||||||
|
if (auxl <= 0)
|
||||||
|
return;
|
||||||
|
auxili = shapefile.Substring(aux, auxl);
|
||||||
|
carga = carga + auxili;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ namespace OliviaAddInPro.Model
|
||||||
public MyCancelableProgressorSource ProgrSrc { get; set; } = null;
|
public MyCancelableProgressorSource ProgrSrc { get; set; } = null;
|
||||||
public ProcesoEjecServ ProceSrv { get; set; } = null;
|
public ProcesoEjecServ ProceSrv { get; set; } = null;
|
||||||
public FinProcServ FinProceSrv { get; set; } = null;
|
public FinProcServ FinProceSrv { get; set; } = null;
|
||||||
|
public EjecServ ServCom { get; set; } = null;
|
||||||
|
|
||||||
public TratamientoComun()
|
public TratamientoComun()
|
||||||
{
|
{
|
||||||
|
|
@ -151,15 +152,15 @@ namespace OliviaAddInPro.Model
|
||||||
//oculta la ventana
|
//oculta la ventana
|
||||||
OliviaGlob.ShowHidePane(false);
|
OliviaGlob.ShowHidePane(false);
|
||||||
//comienza ejecución
|
//comienza ejecución
|
||||||
Action<Respuesta<TiposEjecucion>> ac = FinProceSrv.finEjecuta;
|
Action<Respuesta<TiposEjecucion>, TratamientoComun> ac = FinProceSrv.finEjecuta;
|
||||||
EjecutaAsync(modo, ac);
|
EjecutaAsync(modo, ac);
|
||||||
}
|
}
|
||||||
public async void EjecutaAsync(ModosEjec modo, Action<Respuesta<TiposEjecucion>> ffin)
|
public async void EjecutaAsync(ModosEjec modo, Action<Respuesta<TiposEjecucion>, TratamientoComun> ffin)
|
||||||
{
|
{
|
||||||
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
{
|
{
|
||||||
var res = Ejecuta(modo);
|
var res = Ejecuta(modo);
|
||||||
ffin(res);
|
ffin(res, this);
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -170,5 +171,14 @@ namespace OliviaAddInPro.Model
|
||||||
res.Error.Add("No implementado");
|
res.Error.Add("No implementado");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Descodifica el nombre del sahpefile de entrada identificando el tipo de tratamiento y los ámbitos de trabajo
|
||||||
|
*/
|
||||||
|
public virtual void decode_gdb(string shapefile, out string tratamiento, out string ambitos)
|
||||||
|
{
|
||||||
|
tratamiento = string.Empty;
|
||||||
|
ambitos = string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,6 @@ namespace OliviaAddInPro.Services
|
||||||
|
|
||||||
//mira spatialreference de los datos de entrada
|
//mira spatialreference de los datos de entrada
|
||||||
spatRefData = geom_export.SpatialReference;
|
spatRefData = geom_export.SpatialReference;
|
||||||
//AQUÍ COMPARAR SI ES IGUAL QUE SPATREFDEF Y SI NO, REPROYECTAR
|
|
||||||
/*if(spatRef.Wkid!=GeneralDef.SpatRefDef)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* FALTA HACER
|
|
||||||
* dame_geom_coords en v2010
|
|
||||||
*/
|
|
||||||
//}
|
|
||||||
|
|
||||||
//crea el filtro de exportación
|
//crea el filtro de exportación
|
||||||
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
|
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
|
||||||
|
|
@ -204,8 +196,7 @@ namespace OliviaAddInPro.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
//mira spatialreference del nw
|
//mira spatialreference del nw
|
||||||
FeatureClass fc = HelperGdb.GetFtClass(OliviaGlob.Paths.PathGdbNw);
|
/*FeatureClass fc = HelperGdb.GetFtClass(OliviaGlob.Paths.PathGdbNw);
|
||||||
/*
|
|
||||||
if (fc != null)
|
if (fc != null)
|
||||||
{
|
{
|
||||||
spatRef = fc.GetDefinition().GetSpatialReference();
|
spatRef = fc.GetDefinition().GetSpatialReference();
|
||||||
|
|
@ -368,5 +359,51 @@ namespace OliviaAddInPro.Services
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Realiza las funciones de importación de la sectorización
|
||||||
|
*/
|
||||||
|
public Respuesta<bool> ImportSecto(string GdbFileName)
|
||||||
|
{
|
||||||
|
var res = new Respuesta<bool> { Value = false };
|
||||||
|
|
||||||
|
/*
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//temp
|
||||||
|
string name;
|
||||||
|
res = import_secto_fin(GdbFileName, out name);
|
||||||
|
if (!res.Value)
|
||||||
|
{
|
||||||
|
res.Error.Add("Error al importar resultados.");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res = pinta_sectores(GdbFileName, name, 4);
|
||||||
|
if (!res.Value)
|
||||||
|
{
|
||||||
|
res.Error.Add("Error al pintar sectores.");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
res.Error.Add("Se ha cancelado la importación de resultados.");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res.Value = true;
|
||||||
|
return res;*/
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Realiza las funciones de importación de la planificación
|
||||||
|
*/
|
||||||
|
public Respuesta<bool> ImportPlanif(string GdbFileName)
|
||||||
|
{
|
||||||
|
var res = new Respuesta<bool> { Value = false };
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ namespace OliviaAddInPro.Services
|
||||||
{
|
{
|
||||||
public class FinProcServ
|
public class FinProcServ
|
||||||
{
|
{
|
||||||
public void finEjecuta(Respuesta<TiposEjecucion> res)
|
public void finEjecuta(Respuesta<TiposEjecucion> res, TratamientoComun inst)
|
||||||
{
|
{
|
||||||
|
//REVISAR CUANDO ACABA, SE CAMBIE EL MARCHANDO PARA QUE SE LE DE A FINALIZAR Y TERMINA OK
|
||||||
|
|
||||||
String msg=string.Empty;
|
String msg=string.Empty;
|
||||||
//gestiona los flags, el estado de finok o finnok va en res.Vale
|
//gestiona los flags, el estado de finok o finnok va en res.Vale
|
||||||
|
|
@ -25,42 +26,43 @@ namespace OliviaAddInPro.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = Resource1.String_exito;
|
//actualiza los flags
|
||||||
bool todoOk = true;
|
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
||||||
//importa resultados
|
//importa resultados
|
||||||
|
var resp = IniImport();
|
||||||
|
if (resp.HasError)
|
||||||
|
msg = resp.Error.First();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string GdbFileName = resp.Value;
|
||||||
|
var resp2 = new Respuesta<bool> { Value=false};
|
||||||
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización
|
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización
|
||||||
{
|
{
|
||||||
/*if (!gdb.import_secto_ini())
|
resp2 = inst.ServCom.ImportSecto(GdbFileName);
|
||||||
{
|
|
||||||
todoOk=false;
|
|
||||||
msg = msg + " " + gdb.err_st;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
||||||
{
|
{
|
||||||
/*guarda_csv();
|
GuardaCsv(inst);
|
||||||
if (!gdb.import_planif())
|
resp2 = inst.ServCom.ImportPlanif(GdbFileName);
|
||||||
{
|
|
||||||
todoOk=false;
|
|
||||||
msg = msg + " " + gdb.err_st;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
//actualiza los flags
|
if (!resp2.Value)
|
||||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
|
||||||
if (todoOk)
|
|
||||||
{
|
{
|
||||||
|
msg = resp2.Error.First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = Resource1.String_exito;
|
||||||
//pone modo config2
|
//pone modo config2
|
||||||
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
|
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//borra los archivos que le toca borrar
|
//borra los archivos que le toca borrar
|
||||||
BorraFiles();
|
BorraFiles();
|
||||||
HelperGlobal.ponMsg(msg);
|
HelperGlobal.ponMsg(msg);
|
||||||
Application.Current.Dispatcher.Invoke(new Action(() => { finEjecuta2(); }));
|
Application.Current.Dispatcher.Invoke(new Action(() => { finEjecuta2(); }));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void finEjecuta2()
|
public void finEjecuta2()
|
||||||
{
|
{
|
||||||
OliviaGlob.progrDialog.Hide();
|
OliviaGlob.progrDialog.Hide();
|
||||||
|
|
@ -68,8 +70,6 @@ namespace OliviaAddInPro.Services
|
||||||
OliviaGlob.ShowHidePane(true);
|
OliviaGlob.ShowHidePane(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Borra los archivos exportados para el proceso
|
* Borra los archivos exportados para el proceso
|
||||||
*/
|
*/
|
||||||
|
|
@ -113,5 +113,69 @@ namespace OliviaAddInPro.Services
|
||||||
MessageBox.Show(ex.Message);
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static string NAME_CSV = "_L";
|
||||||
|
public static string EXT_CSV = ".csv";
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
string auxi, nombre = null;
|
||||||
|
string[] nameDokL;
|
||||||
|
string DirData = System.IO.Path.GetDirectoryName(OliviaGlob.Paths.PathData);
|
||||||
|
nameDokL = Directory.GetFiles(DirData,
|
||||||
|
System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData) + NAME_CSV + ".*");
|
||||||
|
|
||||||
|
string Title = "Guardar Secuencia de la Planificación";
|
||||||
|
string Filter = "Secuencia en formato CSV (*.csv)|*.csv";
|
||||||
|
inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData),
|
||||||
|
out auxi, out nombre);
|
||||||
|
string InitialDirectory = System.IO.Path.Combine(DirData, nombre);
|
||||||
|
|
||||||
|
|
||||||
|
string FileName = HelperGdb.SaveFileDlg(Title, InitialDirectory, EXT_CSV, Filter);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(FileName) || FileName.Length == 0)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (File.Exists(FileName))
|
||||||
|
File.Delete(FileName);
|
||||||
|
File.Move(nameDokL[0], FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inicializa la importación
|
||||||
|
*/
|
||||||
|
public Respuesta<string> IniImport()
|
||||||
|
{
|
||||||
|
var res = new Respuesta<string>() { Value = string.Empty };
|
||||||
|
//Lanza ventana para elegir gdb a la que importar resultados
|
||||||
|
bool sal = true;
|
||||||
|
string GdbFileName="";
|
||||||
|
do
|
||||||
|
{
|
||||||
|
sal = true;
|
||||||
|
//repite por si se ha equivocado hasta que elige la gdb
|
||||||
|
GdbFileName = HelperGdb.OpenFileDialog(HelperGdb.TiposOpenFileDlg.OpenGdb,"", "Seleccionar GDB a la que importar los resultados");
|
||||||
|
if(string.IsNullOrEmpty(GdbFileName))
|
||||||
|
sal= HelperGlobal.ponMsg("¿Desea cancelar el proceso de imporación?",
|
||||||
|
MessageBoxImage.Question, "OLIVIA", MessageBoxButton.YesNo);
|
||||||
|
} while (!sal);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(GdbFileName) || !Directory.Exists(GdbFileName))
|
||||||
|
{
|
||||||
|
res.Error.Add("Se ha cancelado la importación de resultados.");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res.Value = GdbFileName;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,5 +208,6 @@ namespace OliviaAddInPro.Services
|
||||||
}
|
}
|
||||||
return amb_com;
|
return amb_com;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue