117 lines
3.0 KiB
C#
117 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using AppData;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace NKC_WF
|
|
{
|
|
public partial class Utility : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
txtCodTakt.Text = $"{DateTime.Now:yyyyMMdd}.1";
|
|
txtNumStaks.Text = "3";
|
|
txtNumPanels.Text = "5";
|
|
}
|
|
}
|
|
|
|
protected int numStackReq
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
Int32.TryParse(txtNumStaks.Text, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
protected int numPanels
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
Int32.TryParse(txtNumPanels.Text, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
|
|
protected void lbtMakeSim_Click(object sender, EventArgs e)
|
|
{
|
|
// creazione degli stack e dei pannelli...
|
|
List<ComLib.WStack> stackList = new List<ComLib.WStack>();
|
|
List<ComLib.Panel> panelList;
|
|
ComLib.WStack currStack;
|
|
ComLib.Panel currPanel;
|
|
ComLib.MaterialData currMaterial;
|
|
ComLib.WorkData currPrintData;
|
|
ComLib.WorkData currMachiningData;
|
|
ComLib.WorkData currUnloadData;
|
|
for (int i = 1; i <= numStackReq; i++)
|
|
{
|
|
// devo creare fino a maxNumPanels
|
|
panelList = new List<ComLib.Panel>();
|
|
for (int j = 1; j <= numPanels; j++)
|
|
{
|
|
currMaterial = new ComLib.MaterialData()
|
|
{
|
|
MaterialId = 1,
|
|
MaterialPN = "6120",
|
|
MaterialDescription = "BOARD, WAFER, 1/4 X 48 X 96"
|
|
};
|
|
currPrintData = new ComLib.WorkData()
|
|
{
|
|
ProgramPath = @"c:\temp\PrintProgram.cnc"
|
|
};
|
|
currMachiningData = new ComLib.WorkData()
|
|
{
|
|
ProgramPath = @"c:\temp\MachiningProgram.cnc"
|
|
};
|
|
currUnloadData = new ComLib.WorkData()
|
|
{
|
|
ProgramPath = @""
|
|
};
|
|
currPanel = new ComLib.Panel()
|
|
{
|
|
PanelId = j,
|
|
Status = ComLib.PStatus.Programmed,
|
|
Material = currMaterial,
|
|
Printing = currPrintData,
|
|
Machining = currMachiningData,
|
|
Unloading = currUnloadData
|
|
};
|
|
panelList.Add(currPanel);
|
|
}
|
|
|
|
currStack = new ComLib.WStack()
|
|
{
|
|
DataMatrix = $"DM{txtCodTakt.Text}.{i}",
|
|
StackId = i,
|
|
Status = ComLib.CStatus.Programmed,
|
|
PanelsList = panelList
|
|
};
|
|
stackList.Add(currStack);
|
|
}
|
|
// creazione oggetto takt
|
|
ComLib.Takt currTakt = new ComLib.Takt()
|
|
{
|
|
TaktId = txtCodTakt.Text,
|
|
Status = ComLib.CStatus.Programmed,
|
|
StackList = stackList
|
|
};
|
|
// serializzo
|
|
//string jsonData = JsonConvert.SerializeObject(currTakt);
|
|
string jsonData = ComLib.serializeTakt(currTakt);
|
|
|
|
// scrivo su label
|
|
lblOut.Text = jsonData;
|
|
// salvo in redis / DB
|
|
ComLib.saveTakt("SERV", currTakt);
|
|
}
|
|
}
|
|
} |