Update SDK x nuget gestione syncro con single Proj get
This commit is contained in:
@@ -474,7 +474,7 @@ namespace EgwProxy.MagMan
|
||||
/// <summary>
|
||||
/// Elenco progetti associati a chiave
|
||||
/// </summary>
|
||||
/// <param name="MatID">Se 0 = tutto</param>
|
||||
/// <param name="NumKey">Se 0 = tutto</param>
|
||||
/// <returns></returns>
|
||||
public List<ProjectDTO> ProjectGet(int NumKey)
|
||||
{
|
||||
@@ -521,6 +521,56 @@ namespace EgwProxy.MagMan
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record progetto da Key/ID
|
||||
/// </summary>
|
||||
/// <param name="ProjCloudId">Se 0 = tutto</param>
|
||||
/// <returns></returns>
|
||||
public ProjectDTO ProjectGetSingle(int ProjCloudId)
|
||||
{
|
||||
ProjectDTO answ = new ProjectDTO();
|
||||
// cerco online
|
||||
using (RestClient client = new RestClient(rcOptions))
|
||||
{
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var request = new RestRequest($"Projects/single/{MKeyEnc}?ProjCloudId={ProjCloudId}", Method.Get);
|
||||
var response = client.Get(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<ProjectDTO>(rawData);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record progetto da Key/ID
|
||||
/// </summary>
|
||||
/// <param name="ProjCloudId">Se 0 = tutto</param>
|
||||
/// <returns></returns>
|
||||
public async Task<ProjectDTO> ProjectGetSingleAsync(int ProjCloudId)
|
||||
{
|
||||
ProjectDTO answ = new ProjectDTO();
|
||||
// cerco online
|
||||
using (RestClient client = new RestClient(rcOptions))
|
||||
{
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
var request = new RestRequest($"Projects/single/{MKeyEnc}?ProjCloudId={ProjCloudId}", Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
// contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<ProjectDTO>(rawData);
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio elenco di RawItems associati ad un singolo materiale, il server farà il merge
|
||||
/// <param name="rec2send">record da inviare</param>
|
||||
|
||||
+34
-11
@@ -108,24 +108,47 @@ namespace DemoApp
|
||||
var projList = commLib.ProjectGet(470);
|
||||
if (projList != null)
|
||||
{
|
||||
foreach (var itemMat in projList)
|
||||
foreach (var itemProj in projList)
|
||||
{
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine($"MachineId: {itemMat.MachineCloudId}");
|
||||
Console.WriteLine($"Key: {itemMat.KeyNum}");
|
||||
Console.WriteLine($"ProjLocalId: {itemMat.ProjLocalId}");
|
||||
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($"MachineId: {itemProj.MachineCloudId}");
|
||||
Console.WriteLine($"Key: {itemProj.KeyNum}");
|
||||
Console.WriteLine($"ProjLocalId: {itemProj.ProjLocalId}");
|
||||
Console.WriteLine($"ProjExtId: {itemProj.ProjExtId}");
|
||||
Console.WriteLine($"BTL filename: {itemProj.BTLFileName}");
|
||||
Console.WriteLine($"PType: {itemProj.PType}");
|
||||
Console.WriteLine($"Machine: {itemProj.Machine}");
|
||||
Console.WriteLine($"Descript: {itemProj.ProjDescription}");
|
||||
Console.WriteLine($"Proc time est/real: {itemProj.ProcTimeEst:N1} / {itemProj.ProcTimeReal:N1}");
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
answ = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Enter to next step: numb of proj to read");
|
||||
answ = Console.ReadLine();
|
||||
int projId = 1;
|
||||
int.TryParse(answ, out projId);
|
||||
var singleProj = commLib.ProjectGetSingle(projId);
|
||||
if (singleProj != null)
|
||||
{
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine($"Proj {projId} data:");
|
||||
Console.WriteLine($"MachineId: {singleProj.MachineCloudId}");
|
||||
Console.WriteLine($"Key: {singleProj.KeyNum}");
|
||||
Console.WriteLine($"ProjLocalId: {singleProj.ProjLocalId}");
|
||||
Console.WriteLine($"ProjExtId: {singleProj.ProjExtId}");
|
||||
Console.WriteLine($"BTL filename: {singleProj.BTLFileName}");
|
||||
Console.WriteLine($"PType: {singleProj.PType}");
|
||||
Console.WriteLine($"Machine: {singleProj.Machine}");
|
||||
Console.WriteLine($"Descript: {singleProj.ProjDescription}");
|
||||
Console.WriteLine($"Proc time est/real: {singleProj.ProcTimeEst:N1} / {singleProj.ProcTimeReal:N1}");
|
||||
Console.WriteLine(sep);
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
||||
answ = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Inserire Qty materiale syncronizzare (Demo, WxHxL: 100x100x0):");
|
||||
var sQty = Console.ReadLine();
|
||||
|
||||
Reference in New Issue
Block a user