Arreglos comenzar ejecución recogida
parent
297d960b90
commit
8c3589370d
|
|
@ -434,17 +434,22 @@ namespace OliviaAddInPro.Helper
|
||||||
public static int CheckFileds(string pathCapa, string[] camps)
|
public static int CheckFileds(string pathCapa, string[] camps)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
FeatureClass fc = null;
|
||||||
if (string.IsNullOrEmpty(pathCapa))
|
try
|
||||||
{
|
{
|
||||||
OutStr = "No se encuentra la capa";
|
fc = GetFtClass(pathCapa);
|
||||||
|
if (fc == null)
|
||||||
|
{
|
||||||
|
OutStr = "No se puede abrir la capa " + pathCapa;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObservableCollection<string> fields = GetFields(fc).Result;
|
||||||
OutStr = "No se encuentran el/los campo/s: ";
|
OutStr = "No se encuentran el/los campo/s: ";
|
||||||
int mal = 0;
|
int mal = 0;
|
||||||
for (i = 0; i < camps.Length; i++)
|
for (i = 0; i < camps.Length; i++)
|
||||||
{
|
{
|
||||||
if (!CheckField(pathCapa, camps[i]))
|
if (!fields.Contains(camps[i]))
|
||||||
{
|
{
|
||||||
OutStr = OutStr + camps[i] + " ";
|
OutStr = OutStr + camps[i] + " ";
|
||||||
mal++;
|
mal++;
|
||||||
|
|
@ -454,6 +459,15 @@ namespace OliviaAddInPro.Helper
|
||||||
OutStr = "";
|
OutStr = "";
|
||||||
return mal;
|
return mal;
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Free(fc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Devuelve comilla simple si el campo es de texto, o nada si es númerico
|
//Devuelve comilla simple si el campo es de texto, o nada si es númerico
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,14 @@ namespace OliviaAddInPro.Model
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class OliviaConf
|
class OliviaConf
|
||||||
{
|
{
|
||||||
|
[TypeConverter(typeof(EnumToStringUsingDescription))]
|
||||||
public enum OpsRecoCont
|
public enum OpsRecoCont
|
||||||
{
|
{
|
||||||
[Description("Contenedor lleno (usa capacidad y densidad cont.)")]
|
[Description("Contenedor lleno (usa capac. y densidad cont.)")]
|
||||||
LlenoUsaDensidad,
|
LlenoUsaDensidad,
|
||||||
[Description("Lee campo 'Kg Contenedor'")]
|
[Description("Lee campo 'Kg del Contenedor'")]
|
||||||
LeeCampoTabla,
|
LeeCampoTabla,
|
||||||
[Description("Usa 'Kg Defecto'")]
|
[Description("Usa 'Kg por Defecto'")]
|
||||||
UsaKgDef
|
UsaKgDef
|
||||||
}
|
}
|
||||||
private string m2s(int min)
|
private string m2s(int min)
|
||||||
|
|
@ -381,7 +382,7 @@ namespace OliviaAddInPro.Model
|
||||||
[Category("Campos Recogida")]
|
[Category("Campos Recogida")]
|
||||||
[PropertyOrder(8)]
|
[PropertyOrder(8)]
|
||||||
[ReadOnly(false)]
|
[ReadOnly(false)]
|
||||||
[DisplayName("Campo 'Kg a recoger'")]
|
[DisplayName("Campo 'Kg del contenedor'")]
|
||||||
[Description("Nombre del campo que indica los kg del contenedor")]
|
[Description("Nombre del campo que indica los kg del contenedor")]
|
||||||
public string kgrec { get; set; }
|
public string kgrec { get; set; }
|
||||||
|
|
||||||
|
|
@ -1289,5 +1290,39 @@ namespace OliviaAddInPro.Model
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public class EnumToStringUsingDescription : TypeConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||||
|
{
|
||||||
|
return (sourceType.Equals(typeof(Enum)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
||||||
|
{
|
||||||
|
return (destinationType.Equals(typeof(String)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
|
||||||
|
{
|
||||||
|
return base.ConvertFrom(context, culture, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
|
||||||
|
{
|
||||||
|
if (!destinationType.Equals(typeof(String)))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Can only convert to string.", "destinationType");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value.GetType().BaseType.Equals(typeof(Enum)))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Can only convert an instance of enum.", "value");
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = value.ToString();
|
||||||
|
object[] attrs =
|
||||||
|
value.GetType().GetField(name).GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||||
|
return (attrs.Length > 0) ? ((DescriptionAttribute)attrs[0]).Description : name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ namespace OliviaAddInPro.Services
|
||||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk);
|
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
borra_files();
|
|
||||||
if (mal)
|
if (mal)
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg(err, System.Windows.MessageBoxImage.Error);
|
HelperGlobal.ponMsg(err, System.Windows.MessageBoxImage.Error);
|
||||||
|
|
@ -68,44 +67,5 @@ namespace OliviaAddInPro.Services
|
||||||
OliviaGlob.ShowHidePane(true);
|
OliviaGlob.ShowHidePane(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Borra los archivos exportados para el proceso
|
|
||||||
*/
|
|
||||||
public static void borra_files()
|
|
||||||
{
|
|
||||||
string[] list = null;
|
|
||||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
|
|
||||||
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (capa_principal == null)
|
|
||||||
return;
|
|
||||||
list = Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal + "*");
|
|
||||||
if (list.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (string f in list)
|
|
||||||
{
|
|
||||||
if (System.IO.Path.GetExtension(f) == ".lock")
|
|
||||||
continue;
|
|
||||||
File.Delete(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (capa_principal_nw == null)
|
|
||||||
return;
|
|
||||||
list = Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw + "*");
|
|
||||||
if (list.Length > 0)
|
|
||||||
{
|
|
||||||
foreach (string f in list)
|
|
||||||
{
|
|
||||||
File.Delete(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
HelperGlobal.ponMsg(ex.Message, System.Windows.MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,13 @@ namespace OliviaAddInPro.Services
|
||||||
camps[4] = RecogidaDef.campos_def.cons_uds;
|
camps[4] = RecogidaDef.campos_def.cons_uds;
|
||||||
camps[5] = RecogidaDef.campos_def.cons_kgrec;
|
camps[5] = RecogidaDef.campos_def.cons_kgrec;
|
||||||
int compCamp = HelperGdb.CheckFileds(pathCapa, camps);
|
int compCamp = HelperGdb.CheckFileds(pathCapa, camps);
|
||||||
|
ErrStr = HelperGdb.OutStr;
|
||||||
if (compCamp == 0)
|
if (compCamp == 0)
|
||||||
return 0;
|
return 0;
|
||||||
else if (compCamp == 1 && ErrStr.Contains(RecogidaDef.campos_def.cons_kgrec))
|
else if (compCamp == 1 && HelperGdb.OutStr.Contains(RecogidaDef.campos_def.cons_kgrec)) //le falta el de kg recogida, que igual no le hace falta
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 2;
|
return 2; //error o le falta 1 que no es el de kg reco o más
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="150"/>
|
<ColumnDefinition Width="150"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ComboBox x:Name="comboBox_frac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposFrac}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="150"
|
<ComboBox x:Name="comboBox_frac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposFrac}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="150"
|
||||||
SelectionChanged="comboBox_frac_SelectionChanged" SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}"
|
SelectionChanged="comboBox_frac_SelectionChanged" SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}"
|
||||||
|
|
@ -48,7 +49,8 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</-->
|
</-->
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBox x:Name="txtBox_densCont" Width="90" ToolTip="{Binding ToolTip_TextDensCont}" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Visibility="{Binding Path=VisTextDens, Mode = TwoWay}" Grid.Column="1" Margin="10,0" TextWrapping="NoWrap" Text="{Binding Path=TextDensCont, Mode = TwoWay}" TextAlignment="Right" MaxLength="5" PreviewTextInput="txtBox_densCont_PreviewTextInput"/>
|
<TextBox x:Name="txtBox_densCont" Width="60" ToolTip="{Binding ToolTip_TextDensCont}" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Visibility="{Binding Path=VisTextDens, Mode = TwoWay}" Grid.Column="1" Margin="10,0" TextWrapping="NoWrap" Text="{Binding Path=TextDensCont, Mode = TwoWay}" TextAlignment="Right" MaxLength="5" PreviewTextInput="txtBox_densCont_PreviewTextInput"/>
|
||||||
|
<Label x:Name="label_densCont" Grid.Column="2" Content="kg/m3" Margin="0,-1,0,0" Visibility="{Binding Path=VisTextDens, Mode = TwoWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Label Content="Tipo de carga" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
|
<Label Content="Tipo de carga" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
|
||||||
<Grid Margin="20,0,0,0">
|
<Grid Margin="20,0,0,0">
|
||||||
|
|
|
||||||
|
|
@ -176,18 +176,17 @@ namespace OliviaAddInPro
|
||||||
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
||||||
{
|
{
|
||||||
string err = "";
|
string err = "";
|
||||||
|
//comprueba datos de la ventana
|
||||||
|
|
||||||
OliviaGlob.progrDialog.Show();
|
|
||||||
//oculta la ventana
|
|
||||||
OliviaGlob.ShowHidePane(false);
|
|
||||||
|
|
||||||
if (!Lee(out err))
|
if (!Lee(out err))
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg(err);
|
HelperGlobal.ponMsg(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//muestra progreso
|
||||||
|
OliviaGlob.progrDialog.Show();
|
||||||
|
//oculta la ventana
|
||||||
|
OliviaGlob.ShowHidePane(false);
|
||||||
|
//comienza ejecución
|
||||||
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
||||||
OliviaGlob.Limp.EjecutaAsync(modo, ac);
|
OliviaGlob.Limp.EjecutaAsync(modo, ac);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ namespace OliviaAddInPro
|
||||||
public string TextDensCont
|
public string TextDensCont
|
||||||
{
|
{
|
||||||
get { return textDensCont; }
|
get { return textDensCont; }
|
||||||
set { base.SetProperty(ref textKgCapac, value, () => TextDensCont); }
|
set { base.SetProperty(ref textDensCont, value, () => TextDensCont); }
|
||||||
}
|
}
|
||||||
private Visibility visTextDens = Visibility.Hidden;
|
private Visibility visTextDens = Visibility.Hidden;
|
||||||
public Visibility VisTextDens
|
public Visibility VisTextDens
|
||||||
|
|
@ -278,7 +278,8 @@ namespace OliviaAddInPro
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//comprueba los campos de recogida
|
//comprueba los campos de recogida
|
||||||
if (recoServ.CompruebaCamposReco(capa)>1 || (recoServ.CompruebaCamposReco(capa)==1 && RecogidaDef.kgrec_camp))
|
int camp = recoServ.CompruebaCamposReco(capa);
|
||||||
|
if (camp>1 || (camp==1 && RecogidaDef.kgrec_camp))
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg(recoServ.ErrStr, System.Windows.MessageBoxImage.Warning);
|
HelperGlobal.ponMsg(recoServ.ErrStr, System.Windows.MessageBoxImage.Warning);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ namespace OliviaAddInPro
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reco.DensCont = Convert.ToInt32(_subPanel1ViewModel.TextDensCont);
|
reco.DensCont = Convert.ToInt32(_subPanel1ViewModel.TextDensCont);
|
||||||
if (reco.DensCont <= 0 || reco.DensCont > 100)
|
if (reco.DensCont <= 0 || reco.DensCont > 1000)
|
||||||
{
|
{
|
||||||
err_str = "El valor introducido para la densidad del contenedor no es válido.";
|
err_str = "El valor introducido para la densidad del contenedor no es válido.";
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -224,16 +224,17 @@ namespace OliviaAddInPro
|
||||||
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
||||||
{
|
{
|
||||||
string err = "";
|
string err = "";
|
||||||
OliviaGlob.progrDialog.Show();
|
//comprueba datos de la ventana
|
||||||
//oculta la ventana
|
|
||||||
OliviaGlob.ShowHidePane(false);
|
|
||||||
|
|
||||||
if (!Lee(out err))
|
if (!Lee(out err))
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg(err);
|
HelperGlobal.ponMsg(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//muestra la ventana de progreso
|
||||||
|
OliviaGlob.progrDialog.Show();
|
||||||
|
//oculta la ventana
|
||||||
|
OliviaGlob.ShowHidePane(false);
|
||||||
|
//comienza ejecución
|
||||||
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
Action<TareaRes> ac = OliviaGlob.finEjecuta;
|
||||||
OliviaGlob.Reco.EjecutaAsync(modo, ac);
|
OliviaGlob.Reco.EjecutaAsync(modo, ac);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue