160 lines
4.8 KiB
C#
160 lines
4.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using OliviaAddInPro.Helper;
|
|
using OliviaAddInPro.Services;
|
|
using ArcGIS.Core.Geometry;
|
|
using static OliviaAddInPro.Model.ComunDef;
|
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
|
using OliviaAddInPro.Services.LanzaSrv;
|
|
|
|
namespace OliviaAddInPro.Model
|
|
{
|
|
class Recogida : TratamientoComun
|
|
{
|
|
//**********************************************
|
|
//Se recogen en PaneRecogidaSub1
|
|
/**
|
|
* Tipo de fracción
|
|
*/
|
|
public int TipoFrac { get; set; } = -1;
|
|
/**
|
|
* Tipo de fracción
|
|
*/
|
|
public string TipoFracStr { get; set; } = string.Empty;
|
|
/**
|
|
* Tipo de carga
|
|
*/
|
|
public int TipoCarg { get; set; } = -1;
|
|
/**
|
|
* Tipo de carga
|
|
*/
|
|
public string TipoCargStr { get; set; } = string.Empty;
|
|
/**
|
|
* Tipo de Vehículo
|
|
*/
|
|
public int TipoVehic { get; set; } = -1;
|
|
/**
|
|
* Tipo de Lateralidad
|
|
*/
|
|
public int TipoLate { get; set; } = -1;
|
|
/**
|
|
* kg capac camión
|
|
*/
|
|
public int KgMaxVehic { get; set; } = 0;
|
|
/**
|
|
* dens contenedor
|
|
*/
|
|
public int DensCont { get; set; } = 0;
|
|
/**
|
|
* Tiempo de vaciado del contenedor, en seg
|
|
*/
|
|
public int TVaciCont { get; set; } = 0;
|
|
/**
|
|
* kg de carga en cada contenedor
|
|
*/
|
|
public int KgCont { get; set; } = 0;
|
|
/**
|
|
* grados en º de giro del vehículo
|
|
*/
|
|
public int GiroVehic { get; set; } = 0;
|
|
|
|
/*
|
|
*
|
|
* */
|
|
public double AnchoVehiculo
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
public RecogidaServ Serv
|
|
{
|
|
get
|
|
{
|
|
return (RecogidaServ)ServCom;
|
|
}
|
|
set
|
|
{
|
|
ServCom = value;
|
|
}
|
|
}
|
|
public LanzaRecoSrv LanzaSrv { get; set; } = null;
|
|
public Recogida()
|
|
{
|
|
Serv = new RecogidaServ(this);
|
|
LanzaSrv = new LanzaRecoSrv();
|
|
}
|
|
|
|
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
|
|
{
|
|
Respuesta<bool> res = new Respuesta<bool> { Value = false };
|
|
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk };
|
|
res = Serv.Ejecuta(modo);
|
|
if (res.Value)
|
|
{
|
|
res = LanzaSrv.ejec(this, modo, TipoTtoStr);
|
|
if (res.Value)
|
|
{
|
|
ProceSrv.ConfigConex();
|
|
res2 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
|
|
if (!LanzaSrv.EsperaProcess(GeneralDef.NombOlvTasks))
|
|
res2.Error.Add("No se ha podido cerrar oliviaTask.");
|
|
}
|
|
}
|
|
if (res.HasError)
|
|
{
|
|
res2.Error.AddRange(res.Error);
|
|
}
|
|
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)
|
|
{
|
|
auxili = shapefile.Substring(aux, auxl);
|
|
carga = carga + auxili;
|
|
}
|
|
|
|
//concatena el timestamp
|
|
carga = carga + shapefile.Substring(aux);
|
|
}
|
|
}
|
|
}
|