diff --git a/EgwProxy.MagMan/DTO/ProjectDTO.cs b/EgwProxy.MagMan/DTO/ProjectDTO.cs
new file mode 100644
index 0000000..5d3d2fa
--- /dev/null
+++ b/EgwProxy.MagMan/DTO/ProjectDTO.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EgwProxy.MagMan.DTO
+{
+ public class ProjectDTO
+ {
+ #region Public Properties
+
+ ///
+ /// Nome file BTL originale
+ ///
+ public string BTLFileName { get; set; } = "";
+
+ ///
+ /// Data Creazione progetto
+ ///
+ public DateTime DtCreated { get; set; } = DateTime.Now;
+
+ ///
+ /// Data ora ultima operazione registrata
+ ///
+ public DateTime DtLastAction { get; set; } = DateTime.MinValue;
+
+ ///
+ /// Data di schedulazione (prevista)
+ ///
+ public DateTime DtSchedule { get; set; } = DateTime.Today.AddMonths(3);
+
+ ///
+ /// Data Inizio Produzione
+ ///
+ public DateTime DtStartProd { get; set; } = DateTime.MinValue;
+
+ ///
+ /// Record attivo (se false == cancellazione logica)
+ ///
+ public bool IsActive { get; set; } = true;
+
+ ///
+ /// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
+ ///
+ public bool IsArchived { get; set; } = false;
+
+ ///
+ /// Key di riferimento per il progetto
+ ///
+ public int KeyNum { get; set; } = 0;
+
+ ///
+ /// ListName del BTL
+ ///
+ public string ListName { get; set; } = "";
+
+ ///
+ /// Macchina (Costruttore/Modello)
+ ///
+ public string Machine { get; set; } = "";
+
+ ///
+ /// Id macchina (MagMan)
+ ///
+ public int MachineID { get; set; } = 0;
+
+ ///
+ /// Tempo lavorazione previsto (stima) in minuti
+ ///
+ public double ProcTimeEst { get; set; } = 0;
+
+ ///
+ /// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
+ ///
+ public double ProcTimeReal { get; set; } = 0;
+
+ ///
+ /// Descrizione progetto (copiata da BTLFileName inizialmente)
+ ///
+ public string ProjDescription { get; set; } = "";
+
+ ///
+ /// ID del DB EgtBW, univoco con KeyNum
+ ///
+ public int ProjExtDbId { get; set; } = 0;
+
+ ///
+ /// ID esterno (da EgtBW)
+ ///
+ public int ProjExtId { get; set; } = 0;
+
+ ///
+ /// Tipologia del progetto (Travi, Pareti, ...)
+ ///
+ public BWType PType { get; set; } = BWType.NULL;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/EgwProxy.MagMan/DataSyncro.cs b/EgwProxy.MagMan/DataSyncro.cs
index aa490f8..207d9d7 100644
--- a/EgwProxy.MagMan/DataSyncro.cs
+++ b/EgwProxy.MagMan/DataSyncro.cs
@@ -141,14 +141,15 @@ namespace EgwProxy.MagMan
}
///
/// Invia un elenco di RawItems associati ad un singolo materiale, il server farà il merge
+ /// record da inviare
///
- public async Task InventorySend(MaterialDTO Mat2Merge)
+ public async Task InventorySend(MaterialDTO rec2send)
{
bool answ = false;
// cerco online
var client = new RestClient(apiUrl);
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
- var jsonBody = JsonConvert.SerializeObject(Mat2Merge.ItemList);
+ var jsonBody = JsonConvert.SerializeObject(rec2send.ItemList);
var request = new RestRequest($"Inventory/upsert/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
var response = await client.PostAsync(request);
// controllo risposta
@@ -163,6 +164,52 @@ namespace EgwProxy.MagMan
#endregion Public Methods
+
+ ///
+ /// Elenco progetti associati a chiave
+ ///
+ /// Se 0 = tutto
+ ///
+ public async Task> ProjectGet(int NumKey)
+ {
+ List answ = new List();
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ string MKeyEnc = HttpUtility.UrlEncode(RestToken);
+ var request = new RestRequest($"Projects/{MKeyEnc}?KeyNum={NumKey}", Method.Get);
+ var response = await client.GetAsync(request);
+ // controllo risposta
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ // contenuto serializzato
+ string rawData = $"{response.Content}";
+ answ = JsonConvert.DeserializeObject>(rawData);
+ }
+ return await Task.FromResult(answ);
+ }
+ ///
+ /// Invia un elenco di RawItems associati ad un singolo materiale, il server farà il merge
+ /// record da inviare
+ ///
+ public async Task ProjectSend(ProjectDTO rec2send)
+ {
+ bool answ = false;
+ // cerco online
+ var client = new RestClient(apiUrl);
+ string MKeyEnc = HttpUtility.UrlEncode(RestToken);
+ var jsonBody = JsonConvert.SerializeObject(rec2send);
+ var request = new RestRequest($"Projects/upsert/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
+ var response = await client.PostAsync(request);
+ // controllo risposta
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ // contenuto serializzato
+ string rawData = $"{response.Content}";
+ answ = rawData == "OK";
+ }
+ return await Task.FromResult(answ);
+ }
+
#region Private Fields
///
diff --git a/EgwProxy.MagMan/EgwProxy.MagMan.csproj b/EgwProxy.MagMan/EgwProxy.MagMan.csproj
index 25c7dfa..30ff467 100644
--- a/EgwProxy.MagMan/EgwProxy.MagMan.csproj
+++ b/EgwProxy.MagMan/EgwProxy.MagMan.csproj
@@ -79,6 +79,8 @@
+
+
diff --git a/EgwProxy.MagMan/Enums.cs b/EgwProxy.MagMan/Enums.cs
new file mode 100644
index 0000000..288e10e
--- /dev/null
+++ b/EgwProxy.MagMan/Enums.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EgwProxy.MagMan
+{
+ public enum BWType
+ {
+ NULL = 0,
+ BEAM = 1,
+ WALL = 2
+ }
+ public enum ProjResState
+ {
+ ///
+ /// Registrazione consumo effettivo (update giacenza su tab RawItemList)
+ ///
+ Consumed = -1,
+ ///
+ /// Non definito
+ ///
+ ND = 0,
+ ///
+ /// Consumo stimato da nesting (solo simulazione)
+ ///
+ Estimated,
+ ///
+ /// Consumo confermato (da ordinare)
+ ///
+ Confirmed,
+ ///
+ /// Riservato (utile x calcolo quantità da ordinare)
+ ///
+ Reserved
+ }
+}
diff --git a/EgwProxy.MagMan/app.config b/EgwProxy.MagMan/app.config
index 8922cd8..c3de069 100644
--- a/EgwProxy.MagMan/app.config
+++ b/EgwProxy.MagMan/app.config
@@ -8,7 +8,7 @@
-
+
diff --git a/MagMan.Core/RestPayload.cs b/MagMan.Core/RestPayload.cs
index 7566fc5..15575df 100644
--- a/MagMan.Core/RestPayload.cs
+++ b/MagMan.Core/RestPayload.cs
@@ -25,6 +25,11 @@ namespace MagMan.Core
public List? ItemList { get; set; }
}
+ public class Projects
+ {
+ public ProjectDTO? Project { get; set; }
+ }
+
public class Resources
{
///
diff --git a/MagMan.UI/Controllers/ProjectsController.cs b/MagMan.UI/Controllers/ProjectsController.cs
index 38b575a..adf7abf 100644
--- a/MagMan.UI/Controllers/ProjectsController.cs
+++ b/MagMan.UI/Controllers/ProjectsController.cs
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
+using Org.BouncyCastle.Asn1.Pkcs;
using System.Diagnostics;
namespace MagMan.UI.Controllers
@@ -59,15 +60,22 @@ namespace MagMan.UI.Controllers
}
///
- /// Elenco Macchine dato RestToken
+ /// Elenco Progetti dato RestToken
///
/// Rest Token cliente
+ /// Chiave associata ai progetti
///
// GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7
[HttpGet("{id}")]
- public async Task> Get(string id, int KeyNum)
+ public async Task> Get(string id, int KeyNum)
{
- var ListRecords = await MTAdmService.MachineGetByToken(id);
+ List ListRecords = new List();
+ if (!string.IsNullOrEmpty(id))
+ {
+ // in primis recupero codice chiave da token...
+ int nKey = await MTAdmService.MainKeyByToken(id);
+ ListRecords = await TService.ProjectGetAll(nKey);
+ }
return ListRecords;
}
@@ -78,19 +86,19 @@ namespace MagMan.UI.Controllers
/// token comunicazione
///
[HttpPost("upsert/{id}")]
- public async Task upsert(string id, [FromBody] ProjectDTO projectData)
+ public async Task upsert(string id, [FromBody] RestPayload.Projects rawData)
{
string answ = "ND";
bool fatto = false;
// verifico ci sia valore
- if (!string.IsNullOrEmpty(id) && projectData != null)
+ if (!string.IsNullOrEmpty(id) && rawData != null && rawData.Project != null)
{
// in primis recupero codice chiave da token...
int nKey = await MTAdmService.MainKeyByToken(id);
if (nKey > 0)
{
// converto ProjDto --> DB
- var currRec = TService.ProjectFromDto(projectData);
+ var currRec = TService.ProjectFromDto(rawData.Project);
try
{
await TService.ProjectUpdate(nKey, currRec);
diff --git a/MagMan.UI/Controllers/ResourcesController.cs b/MagMan.UI/Controllers/ResourcesController.cs
index 81edb1b..af8f3b3 100644
--- a/MagMan.UI/Controllers/ResourcesController.cs
+++ b/MagMan.UI/Controllers/ResourcesController.cs
@@ -61,6 +61,7 @@ namespace MagMan.UI.Controllers
/// Elenco Macchine dato RestToken
///
/// Rest Token cliente
+ /// Chiave associata ai progetti
///
// GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7
[HttpGet("{id}")]
diff --git a/MagMan.UI/MagMan.UI.csproj b/MagMan.UI/MagMan.UI.csproj
index 1a68aab..edce482 100644
--- a/MagMan.UI/MagMan.UI.csproj
+++ b/MagMan.UI/MagMan.UI.csproj
@@ -2,7 +2,7 @@
net6.0
- 1.0.2401.2220
+ 1.0.2401.2309
enable
enable
true
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 943797f..1f0e378 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
MagMan - Wood Warehouse Management System
- Versione: 1.0.2401.2220
+ Versione: 1.0.2401.2309
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 68903f3..8a1d986 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-1.0.2401.2220
+1.0.2401.2309
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 912635f..2ef87ac 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 1.0.2401.2220
+ 1.0.2401.2309
http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip
http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html
false
diff --git a/TestConsoleApp/App.config b/TestConsoleApp/App.config
index f7ec97c..4142046 100644
--- a/TestConsoleApp/App.config
+++ b/TestConsoleApp/App.config
@@ -11,7 +11,7 @@
-
+
diff --git a/TestConsoleApp/Program.cs b/TestConsoleApp/Program.cs
index 9a28dfc..c7a6431 100644
--- a/TestConsoleApp/Program.cs
+++ b/TestConsoleApp/Program.cs
@@ -21,7 +21,7 @@ namespace DemoApp
// token di auth
string testToken = "91f4fec6-7e9c-4130-9df2-702d729ccdd3";
#else
- // Indirizzo server (DEBUG)
+ // Indirizzo server (RELEASE)
string servAddr = "magman.egalware.com";
// token di auth
@@ -63,7 +63,9 @@ namespace DemoApp
Console.WriteLine();
}
}
+ Console.WriteLine("Enter to next step");
answ = Console.ReadLine();
+
// leggo inventario
var inventList = await commLib.InventoryGet(0);
if (inventList != null)
@@ -98,7 +100,33 @@ namespace DemoApp
Console.WriteLine();
}
}
+ Console.WriteLine("Enter to next step");
+ answ = Console.ReadLine();
+ // leggo projectList
+ var projList = await commLib.ProjectGet(470);
+ if (projList != null)
+ {
+ foreach (var itemMat in projList)
+ {
+ Console.WriteLine(sep);
+ Console.WriteLine($"MachineId: {itemMat.MachineID}");
+ Console.WriteLine($"Key: {itemMat.KeyNum}");
+ Console.WriteLine($"ProjExtDbId: {itemMat.ProjExtDbId}");
+ Console.WriteLine($"ProjExtId: {itemMat.ProjExtId}");
+ Console.WriteLine($"BTL filename: {itemMat.BTLFileName}");
+ Console.WriteLine($"PType: {itemMat.PType}");
+ Console.WriteLine($"Machine: {itemMat.Machine}");
+ Console.WriteLine($"Descript: {itemMat.ProjDescription}");
+ Console.WriteLine($"Proc time est/real: {itemMat.ProcTimeEst:N1} / {itemMat.ProcTimeReal:N1}");
+ Console.WriteLine(sep);
+ Console.WriteLine();
+ }
+ }
+ answ = Console.ReadLine();
+
+
+ Console.WriteLine("Enter to close");
answ = Console.ReadLine();
}
}
diff --git a/TestConsoleApp/TestConsoleApp.csproj b/TestConsoleApp/TestConsoleApp.csproj
index a62ac36..f66cc33 100644
--- a/TestConsoleApp/TestConsoleApp.csproj
+++ b/TestConsoleApp/TestConsoleApp.csproj
@@ -33,8 +33,40 @@
4
+
+ ..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
+
+
+ ..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll
+
+
+ ..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+ ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
+
+
@@ -48,6 +80,7 @@
+
diff --git a/TestConsoleApp/packages.config b/TestConsoleApp/packages.config
new file mode 100644
index 0000000..7b51933
--- /dev/null
+++ b/TestConsoleApp/packages.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TestWinFormVB/App.config b/TestWinFormVB/App.config
index 65cbb66..33bd4dd 100644
--- a/TestWinFormVB/App.config
+++ b/TestWinFormVB/App.config
@@ -9,6 +9,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/TestWinFormVB/TestWinFormVB.vbproj b/TestWinFormVB/TestWinFormVB.vbproj
index 152fead..2432a7b 100644
--- a/TestWinFormVB/TestWinFormVB.vbproj
+++ b/TestWinFormVB/TestWinFormVB.vbproj
@@ -55,7 +55,7 @@
..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
- ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
..\packages\RestSharp.110.2.0\lib\net471\RestSharp.dll
@@ -80,8 +80,8 @@
..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll
-
- ..\packages\System.Text.Json.7.0.2\lib\net462\System.Text.Json.dll
+
+ ..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll
..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
diff --git a/TestWinFormVB/packages.config b/TestWinFormVB/packages.config
index 7d159d3..9b9b66b 100644
--- a/TestWinFormVB/packages.config
+++ b/TestWinFormVB/packages.config
@@ -2,14 +2,14 @@
-
+
-
+
\ No newline at end of file