Spostato serializzazione + fix simulazione num panels

This commit is contained in:
Samuele E. Locatelli
2019-08-21 11:55:50 +02:00
parent 2a8ec3eec1
commit ac7ed4e115
4 changed files with 35 additions and 15 deletions
+22 -1
View File
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -238,6 +239,26 @@ namespace AppData
}
}
}
/// <summary>
/// Helper x serializzare l'oggetto
/// </summary>
/// <param name="currData"></param>
/// <returns></returns>
public static string serializeTakt(Takt currData)
{
string answ = JsonConvert.SerializeObject(currData);
return answ;
}
/// <summary>
/// Helper x deserializzare l'oggetto
/// </summary>
/// <param name="rawData"></param>
/// <returns></returns>
public static Takt deserializeTakt(string rawData)
{
Takt answ = JsonConvert.DeserializeObject<Takt>(rawData);
return answ;
}
#endregion
+2 -2
View File
@@ -13,8 +13,8 @@
<asp:TextBox runat="server" ID="txtNumStaks" TextMode="Number" />
</div>
<div class="col-3">
Max Panels per stack:<br />
<asp:TextBox runat="server" ID="txtMaxPanels" TextMode="Number" />
Num Panels per stack:<br />
<asp:TextBox runat="server" ID="txtNumPanels" TextMode="Number" />
</div>
<div class="col-3">
<br />
+9 -10
View File
@@ -17,7 +17,7 @@ namespace NKC_WF
{
txtCodTakt.Text = $"{DateTime.Now:yyyyMMdd}.1";
txtNumStaks.Text = "3";
txtMaxPanels.Text = "10";
txtNumPanels.Text = "5";
}
}
@@ -30,15 +30,12 @@ namespace NKC_WF
return answ;
}
}
protected int maxNumPanels
protected int numPanels
{
get
{
int answ = 0;
Int32.TryParse(txtMaxPanels.Text, out answ);
// randomizzo da 1 a max...
Random rand = new Random();
answ = rand.Next(1, answ);
Int32.TryParse(txtNumPanels.Text, out answ);
return answ;
}
}
@@ -59,7 +56,7 @@ namespace NKC_WF
{
// devo creare fino a maxNumPanels
panelList = new List<ProdLib.Panel>();
for (int j = 1; j <= maxNumPanels; j++)
for (int j = 1; j <= numPanels; j++)
{
currMaterial = new ProdLib.MaterialData()
{
@@ -107,12 +104,14 @@ namespace NKC_WF
Status = ProdLib.CStatus.Programmed,
StackList = stackList
};
// salvo serializzato su etichetta
string jsonData = JsonConvert.SerializeObject(currTakt);
// serializzo
//string jsonData = JsonConvert.SerializeObject(currTakt);
string jsonData = ProdLib.serializeTakt(currTakt);
// scrivo su label
lblOut.Text = jsonData;
// salvo in redis / DB
}
}
}
+2 -2
View File
@@ -31,13 +31,13 @@ namespace NKC_WF {
protected global::System.Web.UI.WebControls.TextBox txtNumStaks;
/// <summary>
/// Controllo txtMaxPanels.
/// Controllo txtNumPanels.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtMaxPanels;
protected global::System.Web.UI.WebControls.TextBox txtNumPanels;
/// <summary>
/// Controllo lbtMakeSim.