Preparazione bozza struttura chiamate e risposta
This commit is contained in:
@@ -155,5 +155,19 @@
|
||||
<Name>WeebDoorCreator.SDK</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="temp\Logo00.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="temp\Logo01.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="temp\Logo02.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="temp\Logo03.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
+52
-9
@@ -1,4 +1,5 @@
|
||||
Imports System.Net.NetworkInformation
|
||||
Imports System.IO
|
||||
Imports System.Net.NetworkInformation
|
||||
Imports System.Text
|
||||
Imports WeebDoorCreator.SDK
|
||||
|
||||
@@ -30,28 +31,70 @@ Public Class Form1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Dim idxSim As Integer = 0
|
||||
|
||||
Private Sub btnFullTest_Click(sender As Object, e As EventArgs) Handles btnFullTest.Click
|
||||
Dim answ As String = ""
|
||||
|
||||
Dim num2proc As Integer
|
||||
Dim queueStatus As New Dictionary(Of String, Long)
|
||||
Dim queueList As New Dictionary(Of String, String)
|
||||
Dim procResults As New List(Of CalcResultDTO)
|
||||
Dim respDone As Boolean
|
||||
Dim fileName As String
|
||||
Dim fileCont As String
|
||||
|
||||
queueStatus = currWDC.queueStatus
|
||||
Dim sb As StringBuilder
|
||||
sb = New StringBuilder
|
||||
sb.AppendLine("----------------------------")
|
||||
For Each item As KeyValuePair(Of String, Long) In queueStatus
|
||||
sb.AppendLine($"{item.Key} | Found {item.Value} items")
|
||||
Next
|
||||
sb.AppendLine()
|
||||
sb.AppendLine("----------------------------")
|
||||
sb.AppendLine()
|
||||
lblOut.Text = sb.ToString()
|
||||
' recupero numero da processare
|
||||
num2proc = currWDC.numTask2proc
|
||||
If (num2proc > 0) Then
|
||||
|
||||
sb.AppendLine("----------------------------")
|
||||
' mi prendo la lista dei primi 2 e processo...
|
||||
queueList = currWDC.queueList(2)
|
||||
' gestione random se success oppure errore...
|
||||
For Each item As KeyValuePair(Of String, String) In queueList
|
||||
fileCont = ""
|
||||
idxSim = idxSim + 1
|
||||
If (idxSim > 3) Then
|
||||
idxSim = 0
|
||||
End If
|
||||
fileName = Path.Combine("temp", $"Logo{idxSim:00}.svg")
|
||||
If (File.Exists(fileName)) Then
|
||||
fileCont = File.ReadAllText(fileName)
|
||||
End If
|
||||
|
||||
answ = sb.ToString()
|
||||
lblOut.Text = answ
|
||||
|
||||
' mi prendo la lista dei primi 2 e processo...
|
||||
|
||||
' gestione random se success oppure errore...
|
||||
sb.AppendLine($"DoorId.Vers: {item.Key}.{item.Value}")
|
||||
Dim currRes As New CalcResultDTO
|
||||
currRes.Validated = True
|
||||
currRes.DoorIdVers = $"{item.Key}.{item.Value}"
|
||||
currRes.SvgGen = fileCont
|
||||
procResults.Add(currRes)
|
||||
Next
|
||||
sb.AppendLine("----------------------------")
|
||||
sb.AppendLine()
|
||||
|
||||
' rendo la risposta...
|
||||
respDone = currWDC.SendProcResults(procResults)
|
||||
sb.AppendLine()
|
||||
sb.AppendLine("----------------------------")
|
||||
If (respDone) Then
|
||||
sb.AppendLine("Effettuato invio risposta al server")
|
||||
Else
|
||||
sb.AppendLine("Errore durante invio risposta al server")
|
||||
End If
|
||||
sb.AppendLine("----------------------------")
|
||||
|
||||
lblOut.Text = sb.ToString()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace WebDoorCreator.API.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("TakeNextItems")]
|
||||
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems)
|
||||
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10)
|
||||
{
|
||||
var actQueue = await QDataServ.TakeProcessingItems(numItems);
|
||||
return actQueue;
|
||||
|
||||
@@ -11,11 +11,8 @@ order:
|
||||
elevation:
|
||||
project:
|
||||
pO:
|
||||
line:
|
||||
<<<<<<< HEAD
|
||||
line:
|
||||
date: 2023-04-19T12:47:14.6842406+02:00
|
||||
=======
|
||||
>>>>>>> 7b61d49767d77faa7513f4f237adadd704a7631d
|
||||
piece: DO_1
|
||||
produce: false
|
||||
profiles:
|
||||
@@ -35,8 +32,6 @@ profiles:
|
||||
type: BV
|
||||
machining: ON
|
||||
overmaterial: 0.1
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
secure: UP
|
||||
size:
|
||||
width: 33.8125
|
||||
@@ -64,6 +59,5 @@ locks:
|
||||
back_set: 2.0
|
||||
offset_WS: 0.0
|
||||
side: lock_top
|
||||
>>>>>>> 7b61d49767d77faa7513f4f237adadd704a7631d
|
||||
|
||||
---
|
||||
|
||||
@@ -78,14 +78,36 @@ namespace WeebDoorCreator.SDK
|
||||
/// <summary>
|
||||
/// Status delle code chiamate
|
||||
/// </summary>
|
||||
public Dictionary<string, long> queueStatus
|
||||
public Dictionary<string, long> queueStatus()
|
||||
{
|
||||
get
|
||||
var rawData = callUrl(urlActLenght);
|
||||
var returnData = JsonConvert.DeserializeObject<Dictionary<string, long>>(rawData);
|
||||
return returnData;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco degli item da processare, nel formato DoorId, Vers
|
||||
/// </summary>
|
||||
public Dictionary<string, string> queueList(int maxNum)
|
||||
{
|
||||
Dictionary<string, string> parList = new Dictionary<string, string>
|
||||
{
|
||||
var rawData = callUrl(urlActLenght);
|
||||
var returnData = JsonConvert.DeserializeObject<Dictionary<string, long>>(rawData);
|
||||
return returnData;
|
||||
}
|
||||
{ "numItems", $"{maxNum}" }
|
||||
};
|
||||
var rawData = callUrl(urlTakeNextItems, parList);
|
||||
var returnData = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice l'elenco degli esiti di processing
|
||||
/// </summary>
|
||||
/// <param name="calcResults"></param>
|
||||
/// <returns></returns>
|
||||
public bool SendProcResults(List<CalcResultDTO> calcResults)
|
||||
{
|
||||
bool fatto = false;
|
||||
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -163,6 +185,37 @@ namespace WeebDoorCreator.SDK
|
||||
// restituisco valore!
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua chiamata URL e restituisce risultato
|
||||
/// </summary>
|
||||
/// <param name="URL"></param>
|
||||
/// <returns></returns>
|
||||
protected string callUrl(string URL, Dictionary<string,string> paramsList)
|
||||
{
|
||||
string answ = "";
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
// compongo
|
||||
string paramsQuery = "";
|
||||
foreach (var item in paramsList)
|
||||
{
|
||||
paramsQuery += $"{item.Key}={item.Value}";
|
||||
}
|
||||
var request = new RestRequest($"{URL}?{paramsQuery}");
|
||||
var response = client.Get(request);
|
||||
// controllo status code risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// deserializzo risposta
|
||||
answ = response.Content;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
// restituisco valore!
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user