Avance comunicacion con olivia task
parent
56473824df
commit
be1c7e5098
|
|
@ -116,25 +116,25 @@ namespace OliviaAddIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//funciones auxiliares------------------------------
|
//funciones auxiliares------------------------------
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern IntPtr str_socket_crea();
|
unsafe public static extern IntPtr str_socket_crea();
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern int str_socket_conecta(IntPtr soc, String ip, int puerto);
|
unsafe public static extern int str_socket_conecta(IntPtr soc, String ip, int puerto);
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern int str_socket_envia(IntPtr soc, String txt);
|
unsafe public static extern int str_socket_envia(IntPtr soc, String txt);
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern int str_socket_recive(IntPtr soc);
|
unsafe public static extern int str_socket_recive(IntPtr soc);
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern void str_socket_dame_buf(IntPtr soc, StringBuilder buf);
|
unsafe public static extern void str_socket_dame_buf(IntPtr soc, StringBuilder buf);
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern void str_socket_dame_error(IntPtr soc, StringBuilder error);//llamar con 1024 de espacio
|
unsafe public static extern void str_socket_dame_error(IntPtr soc, StringBuilder error);//llamar con 1024 de espacio
|
||||||
|
|
||||||
[DllImport("utiles.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
|
[DllImport("utiles.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
unsafe public static extern void str_socket_borra(IntPtr soc);
|
unsafe public static extern void str_socket_borra(IntPtr soc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ namespace OliviaAddInPro.Model
|
||||||
public Limpieza()
|
public Limpieza()
|
||||||
{
|
{
|
||||||
Serv = new LimpiezaServ(this);
|
Serv = new LimpiezaServ(this);
|
||||||
|
LanzaSrv = new LanzaLimpSrv();
|
||||||
|
ProceSrv = new ProcesoEjecServ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TareaRes Ejecuta(ModosEjec modo, CancelableProgressorSource cps)
|
public TareaRes Ejecuta(ModosEjec modo, CancelableProgressorSource cps)
|
||||||
|
|
@ -60,8 +62,26 @@ namespace OliviaAddInPro.Model
|
||||||
res = Serv.Sectoriza(cps);
|
res = Serv.Sectoriza(cps);
|
||||||
else if (modo == ModosEjec.Planifica)
|
else if (modo == ModosEjec.Planifica)
|
||||||
res = Serv.Planifica(cps);
|
res = Serv.Planifica(cps);
|
||||||
//
|
//if(!res.Errores)
|
||||||
|
if (res.Errores)
|
||||||
|
{
|
||||||
|
var res1=LanzaSrv.ejec(this, modo, TipoTtoStr);
|
||||||
|
if (!res1.HasError)
|
||||||
|
{
|
||||||
|
var conf = ConfigServ.Serv.Leer();
|
||||||
|
ProceSrv.Puerto = conf.Puerto;
|
||||||
|
ProceSrv.Ip = conf.Ip;
|
||||||
|
|
||||||
|
res1 = ProceSrv.start(LanzaSrv.str_cfg, cps);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res1.HasError)
|
||||||
|
{
|
||||||
|
res.Errores = true;
|
||||||
|
res.msg = "";
|
||||||
|
res1.Error.ForEach(e=> res.msg+=e+".\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
public async void EjecutaAsync(ModosEjec modo, CancelableProgressorSource cps, Action<TareaRes> ffin)
|
public async void EjecutaAsync(ModosEjec modo, CancelableProgressorSource cps, Action<TareaRes> ffin)
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,9 @@ namespace OliviaAddInPro.Model
|
||||||
return Error.Any();
|
return Error.Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Respuesta()
|
||||||
|
{
|
||||||
|
Error = new List<string>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,10 @@ namespace OliviaAddInPro.Services
|
||||||
public enum ModosEjec
|
public enum ModosEjec
|
||||||
{
|
{
|
||||||
Sectoriza,
|
Sectoriza,
|
||||||
Planifica
|
Planifica,
|
||||||
}
|
SoloPlanifica
|
||||||
|
|
||||||
|
}
|
||||||
//Clase que realiza las funciones de la ejecución
|
//Clase que realiza las funciones de la ejecución
|
||||||
public class EjecServ
|
public class EjecServ
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
* Comienza las funciones de ejecución
|
* Comienza las funciones de ejecución
|
||||||
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
||||||
*/
|
*/
|
||||||
public Respuesta<bool> ejec(Limpieza limp, int modo, string NombreTratamiento)
|
public Respuesta<bool> ejec(Limpieza limp, ModosEjec modo, string NombreTratamiento)
|
||||||
{
|
{
|
||||||
var res = new Respuesta<bool>();
|
var res = new Respuesta<bool>();
|
||||||
if (limp == null)
|
if (limp == null)
|
||||||
|
|
@ -56,7 +56,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
* Configura el str de opciones que va a mandar a OliviaTask
|
* Configura el str de opciones que va a mandar a OliviaTask
|
||||||
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
||||||
*/
|
*/
|
||||||
public bool configura_ops_geo(Limpieza limp, int modo)
|
private bool configura_ops_geo(Limpieza limp, ModosEjec modo)
|
||||||
{
|
{
|
||||||
string str;
|
string str;
|
||||||
string modo_str = "";
|
string modo_str = "";
|
||||||
|
|
@ -68,9 +68,9 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
if (limp.RespCirc)
|
if (limp.RespCirc)
|
||||||
r = 1; //restricción de circulación
|
r = 1; //restricción de circulación
|
||||||
|
|
||||||
if (modo == 0)
|
if (modo == ModosEjec.Sectoriza)
|
||||||
modo_str = GeneralDef.SockConf;
|
modo_str = GeneralDef.SockConf;
|
||||||
else if (modo == 1)
|
else if (modo == ModosEjec.Planifica)
|
||||||
modo_str = GeneralDef.SockConfPlan;
|
modo_str = GeneralDef.SockConfPlan;
|
||||||
var conf=ConfigServ.Serv.Leer();
|
var conf=ConfigServ.Serv.Leer();
|
||||||
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN
|
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,6 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
* */
|
* */
|
||||||
public class LanzaOlvServ
|
public class LanzaOlvServ
|
||||||
{
|
{
|
||||||
//*************************************************************************************
|
|
||||||
//Enums
|
|
||||||
public enum ModosEjec
|
|
||||||
{
|
|
||||||
Secto,
|
|
||||||
Planif,
|
|
||||||
SoloPlanif,
|
|
||||||
}
|
|
||||||
//*************************************************************************************
|
//*************************************************************************************
|
||||||
//Variables
|
//Variables
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,7 +95,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//van ParamN parámetros, sin incluir, si se añaden, incrementar ParamN
|
//van ParamN parámetros, sin incluir, si se añaden, incrementar ParamN
|
||||||
args = GeneralDef.EjecGeoParamSep + GeneralDef.GG_tipo + GeneralDef.EjecGeoParamIgual + ((int)OliviaGlob.TipoEjec).ToString() + " " +
|
args = GeneralDef.EjecGeoParamSep + GeneralDef.GG_tipo + GeneralDef.EjecGeoParamIgual + (((int)OliviaGlob.TipoEjec)-1).ToString() + " " +
|
||||||
GeneralDef.EjecGeoParamSep + GeneralDef.GG_ip + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Ip + " " +
|
GeneralDef.EjecGeoParamSep + GeneralDef.GG_ip + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Ip + " " +
|
||||||
GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Puerto + " " +
|
GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Puerto + " " +
|
||||||
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.TiempoOutSocket + " " +
|
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.TiempoOutSocket + " " +
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
* Comienza las funciones de ejecución
|
* Comienza las funciones de ejecución
|
||||||
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
||||||
*/
|
*/
|
||||||
public Respuesta<bool> ejec(Recogida reco, int modo, string NombreTratamiento)
|
public Respuesta<bool> ejec(Recogida reco, ModosEjec modo, string NombreTratamiento)
|
||||||
{
|
{
|
||||||
var res = new Respuesta<bool>();
|
var res = new Respuesta<bool>();
|
||||||
res.Value = false;
|
res.Value = false;
|
||||||
|
|
@ -52,15 +52,15 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
||||||
* Configura el str de opciones que va a mandar a OliviaTask
|
* Configura el str de opciones que va a mandar a OliviaTask
|
||||||
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
* modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica
|
||||||
*/
|
*/
|
||||||
public bool configura_ops_geo(Recogida reco, int modo)
|
private bool configura_ops_geo(Recogida reco, ModosEjec modo)
|
||||||
{
|
{
|
||||||
string str, modo_str = "";
|
string str, modo_str = "";
|
||||||
|
|
||||||
if (modo == (int)ModosEjec.Secto)
|
if (modo == ModosEjec.Sectoriza)
|
||||||
modo_str = GeneralDef.SockConf;
|
modo_str = GeneralDef.SockConf;
|
||||||
else if (modo == (int)ModosEjec.Planif)
|
else if (modo == ModosEjec.Planifica)
|
||||||
modo_str = GeneralDef.SockConfPlan;
|
modo_str = GeneralDef.SockConfPlan;
|
||||||
else if (modo == (int)ModosEjec.SoloPlanif)
|
else if (modo == ModosEjec.SoloPlanifica)
|
||||||
modo_str = GeneralDef.SockConfTodo;
|
modo_str = GeneralDef.SockConfTodo;
|
||||||
var conf = ConfigServ.Serv.Leer();
|
var conf = ConfigServ.Serv.Leer();
|
||||||
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN
|
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ namespace OliviaAddInPro.Services
|
||||||
var act = new Respuesta<TiposActu>() { Value = TiposActu.ActuMal };
|
var act = new Respuesta<TiposActu>() { Value = TiposActu.ActuMal };
|
||||||
act.Error.AddRange(res.Error);
|
act.Error.AddRange(res.Error);
|
||||||
actualiza(act);
|
actualiza(act);
|
||||||
|
sal = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nint++;
|
nint++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue