54249c1766
- primo rilascio.
153 lines
5.1 KiB
C#
153 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Integration
|
|
{
|
|
public class PatternInfo
|
|
{
|
|
public enum Results
|
|
{
|
|
NONE = 0,
|
|
OK = 1,
|
|
ERROR = 2
|
|
}
|
|
private bool _transformable;
|
|
private Int32 _patternId;
|
|
private Int32 _productionId;
|
|
private string _filename;
|
|
private System.Collections.Generic.Dictionary<int, CutChanged> _changed = new System.Collections.Generic.Dictionary<int, CutChanged>();
|
|
private System.Collections.Generic.Dictionary<Tuple<int, int>, Tuple<Results, string>> _states = new System.Collections.Generic.Dictionary<Tuple<int, int>, Tuple<Results, string>>();
|
|
|
|
public class CutChanged
|
|
{
|
|
private int _cutId;
|
|
private System.Collections.Generic.Dictionary<string, double> _values = new System.Collections.Generic.Dictionary<string, double>();
|
|
public CutChanged(int cutId)
|
|
{
|
|
_cutId = cutId;
|
|
}
|
|
|
|
public void AddChange(string key, double value)
|
|
{
|
|
key = key.ToUpper().Trim();
|
|
if (_values.ContainsKey(key))
|
|
{
|
|
_values[key] = value;
|
|
}
|
|
else
|
|
{
|
|
_values.Add(key, value);
|
|
}
|
|
}
|
|
|
|
public System.Collections.Generic.Dictionary<string, double> Values
|
|
{
|
|
get
|
|
{
|
|
return _values;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Segnala un cambiamento delle carateristiche dello schema
|
|
/// </summary>
|
|
/// <param name="key">la caratteristica (nome campo db)</param>
|
|
/// <param name="value">il nuovo valore</param>
|
|
public void AddPatternChange(string key, double value)
|
|
{
|
|
int cutId = -1;
|
|
if (_changed.ContainsKey(cutId))
|
|
{
|
|
_changed[cutId].AddChange(key, value);
|
|
}
|
|
else
|
|
{
|
|
CutChanged cut = new CutChanged(cutId);
|
|
cut.AddChange(key, value);
|
|
_changed.Add(cutId, cut);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Imposta uno stato al taglio
|
|
/// </summary>
|
|
/// <param name="cutId">L'id del taglio</param>
|
|
/// <param name="value">il nuovo valore</param>
|
|
public void SetTaskState(int cutId, int taskId, Results value, string message)
|
|
{
|
|
Tuple<int, int> key = new Tuple<int, int>(cutId, taskId);
|
|
if (_states.ContainsKey(key))
|
|
{
|
|
_states[key] = new Tuple<Results, string>(value, message);
|
|
}
|
|
else
|
|
{
|
|
_states.Add(key, new Tuple<Results, string>(value, message));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Segnala un cambiamento delle carateristiche del taglio nello schema
|
|
/// </summary>
|
|
/// <param name="cutId">L'id del taglio</param>
|
|
/// <param name="key">la caratteristica (nome campo db)</param>
|
|
/// <param name="value">il nuovo valore</param>
|
|
public void AddCutChange(int cutId, string key, double value)
|
|
{
|
|
if (_changed.ContainsKey(cutId))
|
|
{
|
|
_changed[cutId].AddChange(key, value);
|
|
}
|
|
else
|
|
{
|
|
CutChanged cut = new CutChanged(cutId);
|
|
cut.AddChange(key, value);
|
|
_changed.Add(cutId, cut);
|
|
}
|
|
}
|
|
|
|
public PatternInfo(Int32 productionId, Int32 patternId, bool transformable, string filename)
|
|
{
|
|
_patternId = patternId;
|
|
_productionId = productionId;
|
|
_transformable = transformable;
|
|
_filename = filename;
|
|
}
|
|
/// <summary>
|
|
/// chiave produzione
|
|
/// </summary>
|
|
public Int32 ProductionId { get { return _productionId; } }
|
|
/// <summary>
|
|
/// chiave scherma
|
|
/// </summary>
|
|
public Int32 PatternId { get { return _patternId; } }
|
|
/// <summary>
|
|
/// Messaggio eventuale di errore
|
|
/// </summary>
|
|
public string Message { get; set; }
|
|
/// <summary>
|
|
/// file iso generato
|
|
/// </summary>
|
|
public string OutputFilename { get { return _filename; } }
|
|
/// <summary>
|
|
/// indica lo stato di generazione
|
|
/// </summary>
|
|
public Results Result { get; set; }
|
|
/// <summary>
|
|
/// Iso generato
|
|
/// </summary>
|
|
public String Iso { get; set; }
|
|
/// <summary>
|
|
/// Specifica se è possibile trasformare o ruotare lo schema
|
|
/// </summary>
|
|
public bool Transformable { get; set; }
|
|
/// <summary>
|
|
/// Libero
|
|
/// </summary>
|
|
public object Tag { get; set; }
|
|
}
|
|
}
|