Bozza test export csv
- esporta i file - NON rispetta description - no rispetta ordine
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
public class DataExport
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio in file di un generico oggetto in formato CSV
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="reportData"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="separator">Separatore da impiegare (default ";")</param>
|
||||
/// <returns></returns>
|
||||
public static async Task SaveToCsv<T>(List<T> reportData, string path, char separator=';')
|
||||
{
|
||||
var lines = new List<string>();
|
||||
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
|
||||
var header = string.Join($"{separator}", props.ToList().Select(x => x.Name));
|
||||
lines.Add(header);
|
||||
var valueLines = reportData.Select(row => string.Join($"{separator}", header.Split(separator).Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
|
||||
//var valueLines = reportData.Select(row => string.Join(";", header.Split(';').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
|
||||
lines.AddRange(valueLines);
|
||||
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataExport.cs" />
|
||||
<Compile Include="Eurom63.cs" />
|
||||
<Compile Include="IobWinStatus.cs" />
|
||||
<Compile Include="TCMan.cs" />
|
||||
|
||||
@@ -106,6 +106,9 @@
|
||||
<Reference Include="EasyModbus, Version=5.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.Ftp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.Ftp.3.6.2210.418\lib\EgwProxy.Ftp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.Icoel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.Icoel.3.6.2206.2811\lib\EgwProxy.Icoel.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -302,6 +305,9 @@
|
||||
</Compile>
|
||||
<Compile Include="UAClient.cs" />
|
||||
<Compile Include="utils.cs" />
|
||||
<Content Include="temp\.placeholder.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="DATA\CONF\1033.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
+76
-44
@@ -17,7 +17,6 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
@@ -587,6 +586,11 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se la chiamata WDST dit racking watchdog sia disabilitata dall'invio nel FluxLog
|
||||
/// </summary>
|
||||
public bool disableWdst { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indica lo stato Online/Offline della IOB
|
||||
/// </summary>
|
||||
@@ -635,11 +639,6 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
public bool isVerboseLog { get; set; } = utils.CRB("verbose");
|
||||
|
||||
/// <summary>
|
||||
/// Indica se la chiamata WDST dit racking watchdog sia disabilitata dall'invio nel FluxLog
|
||||
/// </summary>
|
||||
public bool disableWdst { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo Alarm letto
|
||||
/// </summary>
|
||||
@@ -3438,41 +3437,6 @@ namespace IOB_WIN_NEXT
|
||||
lgDebug("startAdapter completed");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei valori bloccati x evitare log eccessivo
|
||||
/// </summary>
|
||||
private Dictionary<string, DateTime> vetoLogError = new Dictionary<string, DateTime>();
|
||||
/// <summary>
|
||||
/// Periodo di veto log in minuti
|
||||
/// </summary>
|
||||
private int vetoPeriodMin = 15;
|
||||
/// <summary>
|
||||
/// Verifica se il log di un dato errore sia permesso
|
||||
/// </summary>
|
||||
/// <param name="logKey">ID del valore log da loggare/verificare</param>
|
||||
/// <returns></returns>
|
||||
private bool logValuePermit(string logKey)
|
||||
{
|
||||
bool doLog = false;
|
||||
if (vetoLogError.ContainsKey(logKey))
|
||||
{
|
||||
// verifico se veto scaduto...
|
||||
if (DateTime.Now > vetoLogError[logKey])
|
||||
{
|
||||
doLog = true;
|
||||
vetoLogError[logKey] = DateTime.Now.AddMinutes(vetoPeriodMin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
doLog = true;
|
||||
vetoLogError.Add(logKey, DateTime.Now.AddMinutes(vetoPeriodMin));
|
||||
}
|
||||
|
||||
return doLog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ferma l'adapter...
|
||||
/// </summary>
|
||||
@@ -4519,6 +4483,36 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera da server set di dati specifici x IOB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual async Task<bool> iobGetDataFromServer()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua upload verso server FTP della macchina dei files nella folder indicata
|
||||
/// </summary>
|
||||
/// <param name="folderDir"></param>
|
||||
/// <returns></returns>
|
||||
protected virtual async Task<bool> iobSendFTP(string folderDir)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepara files CSV da inviare alla macchina
|
||||
/// </summary>
|
||||
protected virtual async Task<bool> iobWriteLocalCSV()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
@@ -4821,8 +4815,7 @@ namespace IOB_WIN_NEXT
|
||||
lgError("loadMemConf: parametro ENABLE_SEND_PZC_BLOCK non trovato, verificare anche MAX_SEND_PZC_BLOCK e MIN_SEND_PZC_BLOCK");
|
||||
}
|
||||
|
||||
// abilitazione invio WDST
|
||||
// disabilitazione controllo range valori DynData
|
||||
// abilitazione invio WDST disabilitazione controllo range valori DynData
|
||||
if (!string.IsNullOrEmpty(getOptPar("DISABLE_SEND_WDST")))
|
||||
{
|
||||
bool checkDisWdst = false;
|
||||
@@ -4830,7 +4823,6 @@ namespace IOB_WIN_NEXT
|
||||
disableWdst = checkDisWdst;
|
||||
}
|
||||
|
||||
|
||||
// disabilitazione controllo range valori DynData
|
||||
if (!string.IsNullOrEmpty(getOptPar("disDynDataRangeCheck")))
|
||||
{
|
||||
@@ -5249,6 +5241,20 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei valori bloccati x evitare log eccessivo
|
||||
/// </summary>
|
||||
private Dictionary<string, DateTime> vetoLogError = new Dictionary<string, DateTime>();
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di veto log in minuti
|
||||
/// </summary>
|
||||
private int vetoPeriodMin = 15;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -5661,6 +5667,32 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il log di un dato errore sia permesso
|
||||
/// </summary>
|
||||
/// <param name="logKey">ID del valore log da loggare/verificare</param>
|
||||
/// <returns></returns>
|
||||
private bool logValuePermit(string logKey)
|
||||
{
|
||||
bool doLog = false;
|
||||
if (vetoLogError.ContainsKey(logKey))
|
||||
{
|
||||
// verifico se veto scaduto...
|
||||
if (DateTime.Now > vetoLogError[logKey])
|
||||
{
|
||||
doLog = true;
|
||||
vetoLogError[logKey] = DateTime.Now.AddMinutes(vetoPeriodMin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
doLog = true;
|
||||
vetoLogError.Add(logKey, DateTime.Now.AddMinutes(vetoPeriodMin));
|
||||
}
|
||||
|
||||
return doLog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe fittizia in caso di processing GLOBALE di tutto in 1 solo colpo...
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using MapoSDK;
|
||||
using IOB_UT_NEXT;
|
||||
using MapoSDK;
|
||||
using Opc.Ua;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
@@ -32,7 +36,7 @@ namespace IOB_WIN_NEXT
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// Processo i task richiesti e li elimino dalla coda 2:2
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
@@ -95,6 +99,12 @@ namespace IOB_WIN_NEXT
|
||||
setInizioProd();
|
||||
break;
|
||||
|
||||
case taskType.syncDbData:
|
||||
iobGetDataFromServer();
|
||||
iobWriteLocalCSV();
|
||||
iobSendFTP("");
|
||||
break;
|
||||
|
||||
default:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
@@ -146,6 +156,147 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<ArtRow> ListaArticoli { get; set; } = new List<ArtRow>();
|
||||
|
||||
protected List<JobRow> ListaJobs { get; set; } = new List<JobRow>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupera da server set di dati specifici x IOB : qui per compilare files CSV
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override async Task<bool> iobGetDataFromServer()
|
||||
{
|
||||
bool answ = false;
|
||||
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
|
||||
|
||||
// FIXME TODO !!!
|
||||
Random rnd = new Random();
|
||||
int firstId = rnd.Next(1000);
|
||||
simArticoli(firstId);
|
||||
simJobs(firstId);
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua upload verso server FTP della macchina dei files nella folder indicata
|
||||
/// </summary>
|
||||
/// <param name="folderDir"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task<bool> iobSendFTP(string folderDir)
|
||||
{
|
||||
// FIXME TODO !!!
|
||||
|
||||
bool answ = false;
|
||||
await Task.Delay(1);
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepara files CSV da inviare alla macchina
|
||||
/// </summary>
|
||||
protected override async Task<bool> iobWriteLocalCSV()
|
||||
{
|
||||
bool answ = false;
|
||||
// salvo articoli
|
||||
string basePath = Directory.GetCurrentDirectory();
|
||||
string filePath = Path.Combine(basePath, "temp/articoli.csv");
|
||||
await DataExport.SaveToCsv(ListaArticoli, filePath);
|
||||
|
||||
// salvo PODLE
|
||||
filePath = Path.Combine(basePath, $"temp/{DateTime.Now:dd-MM-yyyy}.csv");
|
||||
await DataExport.SaveToCsv(ListaJobs, filePath);
|
||||
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Protected Classes
|
||||
|
||||
protected class ArtRow
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Description("Articolo")]
|
||||
public string Articolo { get; set; } = "";
|
||||
|
||||
[Description("Identificazione")]
|
||||
public string Descrizione { get; set; } = "";
|
||||
|
||||
[Description("Limitazione_velocita_sollevamento[%]")]
|
||||
public int LimiteVel { get; set; } = 100;
|
||||
|
||||
[Description("Matricola_articolo")]
|
||||
public string Matricola { get; set; } = "";
|
||||
|
||||
[Description("Peso_teorico_linea1[ton]")]
|
||||
public int Peso_01 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea2[ton]")]
|
||||
public int Peso_02 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea3[ton]")]
|
||||
public int Peso_03 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea4[ton]")]
|
||||
public int Peso_04 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 1[mm]")]
|
||||
public int PosizCarrello_01 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 2[mm]")]
|
||||
public int PosizCarrello_02 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 3[mm]")]
|
||||
public int PosizCarrello_03 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 4[mm]")]
|
||||
public int PosizCarrello_04 { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
protected class JobRow
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Description("Articolo")]
|
||||
public string Articolo { get; set; } = "";
|
||||
|
||||
[Description("Commessa")]
|
||||
public string Commessa { get; set; } = "";
|
||||
|
||||
[Description("Data inserimento")]
|
||||
public string DataIns { get; set; } = "";
|
||||
|
||||
[Description("Identificazione")]
|
||||
public string Descrizione { get; set; } = "";
|
||||
|
||||
[Description("Lavorazione")]
|
||||
public string Lavorazione { get; set; } = "";
|
||||
|
||||
[Description("Matricola")]
|
||||
public string Matricola { get; set; } = "";
|
||||
|
||||
[Description("Ora inserimento")]
|
||||
public string OraIns { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Protected Classes
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -206,6 +357,53 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void simArticoli(int firstId)
|
||||
{
|
||||
// FAKE: crea finti dati...
|
||||
Random rnd = new Random();
|
||||
ListaArticoli = new List<ArtRow>();
|
||||
for (int i = firstId; i <= firstId + 5; i++)
|
||||
{
|
||||
ArtRow artRow = new ArtRow()
|
||||
{
|
||||
Matricola = $"{i}",
|
||||
Articolo = $"Articolo_{i:000}",
|
||||
Descrizione = $"Descrizione_{i:000}",
|
||||
Peso_01 = rnd.Next(100),
|
||||
Peso_02 = rnd.Next(100),
|
||||
Peso_03 = rnd.Next(100),
|
||||
Peso_04 = rnd.Next(100),
|
||||
PosizCarrello_01 = rnd.Next(0, 2000),
|
||||
PosizCarrello_02 = rnd.Next(2100, 5000),
|
||||
PosizCarrello_03 = rnd.Next(6000, 15000),
|
||||
PosizCarrello_04 = rnd.Next(16000, 25000)
|
||||
};
|
||||
ListaArticoli.Add(artRow);
|
||||
}
|
||||
}
|
||||
|
||||
private void simJobs(int firstId)
|
||||
{
|
||||
// FAKE: crea finti dati...
|
||||
Random rnd = new Random();
|
||||
ListaJobs = new List<JobRow>();
|
||||
for (int i = firstId; i <= firstId + 5; i++)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
JobRow jobRow = new JobRow()
|
||||
{
|
||||
Matricola = $"{i}",
|
||||
Commessa = $"ODL000{i:0000}",
|
||||
Articolo = $"Articolo_{i:000}",
|
||||
Descrizione = $"Descrizione_{i:000}",
|
||||
DataIns = $"{adesso:dd/MM/yyyy}",
|
||||
OraIns = $"{adesso.AddMinutes(-i):HH:mm}",
|
||||
Lavorazione = "TEST LAV"
|
||||
};
|
||||
ListaJobs.Add(jobRow);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
@@ -90,6 +93,193 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
// parto processando dynData
|
||||
processDynData();
|
||||
|
||||
// simulazione processo FTP (Cimolai) - FIXME TODO DeleteME
|
||||
simulaFTP();
|
||||
}
|
||||
|
||||
private void simulaFTP()
|
||||
{
|
||||
// fixme todo: test scrittura file csv...
|
||||
iobGetDataFromServer();
|
||||
iobWriteLocalCSV();
|
||||
iobSendFTP("");
|
||||
}
|
||||
|
||||
|
||||
protected class ArtRow
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Description("Articolo")]
|
||||
public string Articolo { get; set; } = "";
|
||||
|
||||
[Description("Identificazione")]
|
||||
public string Descrizione { get; set; } = "";
|
||||
|
||||
[Description("Limitazione_velocita_sollevamento[%]")]
|
||||
public int LimiteVel { get; set; } = 100;
|
||||
|
||||
[Description("Matricola_articolo")]
|
||||
public string Matricola { get; set; } = "";
|
||||
|
||||
[Description("Peso_teorico_linea1[ton]")]
|
||||
public int Peso_01 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea2[ton]")]
|
||||
public int Peso_02 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea3[ton]")]
|
||||
public int Peso_03 { get; set; } = 0;
|
||||
|
||||
[Description("Peso_teorico_linea4[ton]")]
|
||||
public int Peso_04 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 1[mm]")]
|
||||
public int PosizCarrello_01 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 2[mm]")]
|
||||
public int PosizCarrello_02 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 3[mm]")]
|
||||
public int PosizCarrello_03 { get; set; } = 0;
|
||||
|
||||
[Description("Pos. Carrello 4[mm]")]
|
||||
public int PosizCarrello_04 { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
protected class JobRow
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Description("Articolo")]
|
||||
public string Articolo { get; set; } = "";
|
||||
|
||||
[Description("Commessa")]
|
||||
public string Commessa { get; set; } = "";
|
||||
|
||||
[Description("Data inserimento")]
|
||||
public string DataIns { get; set; } = "";
|
||||
|
||||
[Description("Identificazione")]
|
||||
public string Descrizione { get; set; } = "";
|
||||
|
||||
[Description("Lavorazione")]
|
||||
public string Lavorazione { get; set; } = "";
|
||||
|
||||
[Description("Matricola")]
|
||||
public string Matricola { get; set; } = "";
|
||||
|
||||
[Description("Ora inserimento")]
|
||||
public string OraIns { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
protected List<ArtRow> ListaArticoli { get; set; } = new List<ArtRow>();
|
||||
|
||||
protected List<JobRow> ListaJobs { get; set; } = new List<JobRow>();
|
||||
|
||||
/// <summary>
|
||||
/// Recupera da server set di dati specifici x IOB : qui per compilare files CSV
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override async Task<bool> iobGetDataFromServer()
|
||||
{
|
||||
bool answ = false;
|
||||
// recupera dati da server tramite chiamate REST a MP/IO/IOB...
|
||||
|
||||
// FIXME TODO !!!
|
||||
Random rnd = new Random();
|
||||
int firstId = rnd.Next(1000);
|
||||
simArticoli(firstId);
|
||||
simJobs(firstId);
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
private void simArticoli(int firstId)
|
||||
{
|
||||
// FAKE: crea finti dati...
|
||||
Random rnd = new Random();
|
||||
ListaArticoli = new List<ArtRow>();
|
||||
for (int i = firstId; i <= firstId + 5; i++)
|
||||
{
|
||||
ArtRow artRow = new ArtRow()
|
||||
{
|
||||
Matricola = $"{i}",
|
||||
Articolo = $"Articolo_{i:000}",
|
||||
Descrizione = $"Descrizione_{i:000}",
|
||||
Peso_01 = rnd.Next(100),
|
||||
Peso_02 = rnd.Next(100),
|
||||
Peso_03 = rnd.Next(100),
|
||||
Peso_04 = rnd.Next(100),
|
||||
PosizCarrello_01 = rnd.Next(0, 2000),
|
||||
PosizCarrello_02 = rnd.Next(2100, 5000),
|
||||
PosizCarrello_03 = rnd.Next(6000, 15000),
|
||||
PosizCarrello_04 = rnd.Next(16000, 25000)
|
||||
};
|
||||
ListaArticoli.Add(artRow);
|
||||
}
|
||||
}
|
||||
|
||||
private void simJobs(int firstId)
|
||||
{
|
||||
// FAKE: crea finti dati...
|
||||
Random rnd = new Random();
|
||||
ListaJobs = new List<JobRow>();
|
||||
for (int i = firstId; i <= firstId + 5; i++)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
JobRow jobRow = new JobRow()
|
||||
{
|
||||
Matricola = $"{i}",
|
||||
Commessa = $"ODL000{i:0000}",
|
||||
Articolo = $"Articolo_{i:000}",
|
||||
Descrizione = $"Descrizione_{i:000}",
|
||||
DataIns = $"{adesso:dd/MM/yyyy}",
|
||||
OraIns = $"{adesso.AddMinutes(-i):HH:mm}",
|
||||
Lavorazione = "TEST LAV"
|
||||
};
|
||||
ListaJobs.Add(jobRow);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua upload verso server FTP della macchina dei files nella folder indicata
|
||||
/// </summary>
|
||||
/// <param name="folderDir"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task<bool> iobSendFTP(string folderDir)
|
||||
{
|
||||
// FIXME TODO !!!
|
||||
|
||||
bool answ = false;
|
||||
await Task.Delay(1);
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepara files CSV da inviare alla macchina
|
||||
/// </summary>
|
||||
protected override async Task<bool> iobWriteLocalCSV()
|
||||
{
|
||||
bool answ = false;
|
||||
// salvo articoli
|
||||
string basePath = Directory.GetCurrentDirectory();
|
||||
string filePath = Path.Combine(basePath, "temp/articoli.csv");
|
||||
await DataExport.SaveToCsv(ListaArticoli, filePath);
|
||||
|
||||
// salvo PODLE
|
||||
filePath = Path.Combine(basePath, $"temp/{DateTime.Now:dd-MM-yyyy}.csv");
|
||||
await DataExport.SaveToCsv(ListaJobs, filePath);
|
||||
|
||||
answ = true;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<packages>
|
||||
<package id="Autoupdater.NET.Official" version="1.7.0" targetFramework="net462" />
|
||||
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net462" />
|
||||
<package id="EgwProxy.Ftp" version="3.6.2210.418" targetFramework="net462" />
|
||||
<package id="EgwProxy.Icoel" version="3.6.2206.2811" targetFramework="net462" />
|
||||
<package id="EgwProxy.MultiCncLib" version="3.6.2207.1211" targetFramework="net462" />
|
||||
<package id="EgwProxy.OsaiCncLib" version="3.6.2205.2015" targetFramework="net462" />
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user