156 lines
4.1 KiB
C#
156 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace IOB_UT
|
|
{
|
|
/// <summary>
|
|
/// Classe di helper per metodi Euromap63 tramite File Exchange
|
|
/// </summary>
|
|
public class Eurom63
|
|
{
|
|
#region Public Enums
|
|
|
|
public enum FileOpr
|
|
{
|
|
Copy = 0,
|
|
ReplaceAndCopy
|
|
}
|
|
|
|
public enum FileType
|
|
{
|
|
NA = 0,
|
|
Dat,
|
|
Job,
|
|
Log,
|
|
Req,
|
|
Rsp
|
|
}
|
|
|
|
public enum JobType
|
|
{
|
|
NA = 0,
|
|
AbortAll,
|
|
GetStatus,
|
|
GetParams,
|
|
GetProduction,
|
|
IsConnected,
|
|
SetDateTime,
|
|
SetParamOdl
|
|
}
|
|
|
|
#endregion Public Enums
|
|
|
|
|
|
|
|
#region Public Classes
|
|
|
|
/// <summary>
|
|
/// Struttura per un file da processare
|
|
/// </summary>
|
|
public class FileTask
|
|
{
|
|
#region Public Properties
|
|
|
|
public string FilePath { get; set; } = @"EUR63_JOB\SESS9999.REQ";
|
|
public FileOpr OprReq { get; set; } = FileOpr.Copy;
|
|
public string RespKo { get; set; } = "ERROR";
|
|
public string RespOk { get; set; } = "PROCESSED";
|
|
public Dictionary<string, string> StrReplace { get; set; } = new Dictionary<string, string>();
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generic communication session
|
|
/// </summary>
|
|
public class Session
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Session currently active
|
|
/// </summary>
|
|
public bool Active { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Indicates that must be repeated/restarted when not active
|
|
/// </summary>
|
|
public bool Cycle { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Session Description
|
|
/// </summary>
|
|
public string Description { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Elenco dei file da processare
|
|
/// </summary>
|
|
public List<FileTask> FileList { get; set; } = new List<FileTask>();
|
|
|
|
/// <summary>
|
|
/// Numero MAX di esecuzioni da mantenere in HIST prima di eliminare i + vecchi (fare folder HIST\SESSnnnn)
|
|
/// </summary>
|
|
public int Max2Keep { get; set; } = 50;
|
|
|
|
/// <summary>
|
|
/// Session check passed (= not to repeat)
|
|
/// </summary>
|
|
public bool Passed { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Session Name
|
|
/// </summary>
|
|
public string SessionName { get; set; } = "SESS0000";
|
|
|
|
/// <summary>
|
|
/// Start of communication
|
|
/// </summary>
|
|
public DateTime SessionStarted { get; set; } = DateTime.Now.AddMinutes(-5);
|
|
|
|
/// <summary>
|
|
/// Session type
|
|
/// </summary>
|
|
public JobType SessionType { get; set; } = JobType.NA;
|
|
|
|
/// <summary>
|
|
/// Estimated Validity limit
|
|
/// </summary>
|
|
public DateTime SessionValidUntil { get; set; } = DateTime.Now.AddMinutes(-1);
|
|
|
|
/// <summary>
|
|
/// Set Step Order (=execution priority, 1...n)
|
|
/// </summary>
|
|
public int StepOrder { get; set; } = 999;
|
|
|
|
/// <summary>
|
|
/// Standard session validity time
|
|
/// </summary>
|
|
public double ValidityMinutes { get; set; } = 1;
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
public class SessionConf
|
|
{
|
|
#region Public Fields
|
|
|
|
public List<Session> ActiveSessions = new List<Session>();
|
|
|
|
#endregion Public Fields
|
|
|
|
|
|
|
|
#region Public Properties
|
|
|
|
public string BaseDir { get; set; } = @"C:\EUROMAP63\";
|
|
public List<DynDataItem> DynData { get; set; } = new List<DynDataItem>();
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
#endregion Public Classes
|
|
}
|
|
} |