Files
2024-01-31 08:53:02 +01:00

110 lines
3.9 KiB
VB.net

Imports EgwProxy.MagMan
Imports Microsoft.SqlServer
Public Class Form1
#If DEBUG Then
' token di auth
Private restToken As String = "91f4fec6-7e9c-4130-9df2-702d729ccdd3"
' Indirizzo server (DEBUG)
Private servAddr As String = "localhost:7207"
#Else
' token di auth
Private restToken As String = "22fa4426-6670-41ad-ac2b-d7b5c3dfe849"
' Indirizzo server (DEBUG)
Private servAddr As String = "magman.egalware.com"
#End If
Private commLib As DataSyncro
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' esegue test comunicazione server (ping, alive)
commLib = New DataSyncro(servAddr, restToken)
Dim servOk As Boolean
servOk = commLib.CheckRemote()
Dim esito As String = ""
If (servOk) Then
esito = "Test Ping: OK"
Else
esito = "Test Ping: KO"
End If
lblServTest.Text = esito
End Sub
Private Async Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
' recupera e mostra dati elenco materiali
commLib = New DataSyncro(servAddr, restToken)
Dim result As String = ""
Dim matList = Await commLib.MaterialsGet()
If matList IsNot Nothing Then
For Each item In matList
result += $"Mat ID: {item.MatID}{Environment.NewLine}"
result += $"Mat Code: {item.MatExtCode}{Environment.NewLine}"
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
result += $"descript: {item.MatDesc}{Environment.NewLine}"
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
If item.ItemList IsNot Nothing Then
'result += $"Items count: {item.ItemList.Count}"
result += $"{Environment.NewLine}"
End If
Next
End If
txtOut.Text = result
End Sub
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
' recupera e mostra dati elenco materiali
commLib = New DataSyncro(servAddr, restToken)
Dim result As String = ""
Dim sepShort As String = "----"
Dim matList = Await commLib.InventoryGet(0)
If matList IsNot Nothing Then
For Each item In matList
result += $"Mat ID: {item.MatID}{Environment.NewLine}"
result += $"Mat Code: {item.MatExtCode}{Environment.NewLine}"
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
result += $"descript: {item.MatDesc}{Environment.NewLine}"
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
If item.ItemList IsNot Nothing Then
result += $"Items count: {item.ItemList.Count}{Environment.NewLine}"
If item.ItemList.Count > 0 Then
result += "Inventario:"
For Each itemInv In item.ItemList
result += $"{sepShort}{Environment.NewLine}"
result += $"ID: {itemInv.ItemID}{Environment.NewLine}"
result += $"Location: {itemInv.Location}{Environment.NewLine}"
result += $"Descript: {itemInv.Note}{Environment.NewLine}"
result += $"Giacenza: {itemInv.QtyAvail}{Environment.NewLine}"
result += $"Dimensions W x T x L: {itemInv.WMm:N3} x {itemInv.TMm:N3} x {itemInv.LMm:N3}{Environment.NewLine}"
result += $"Dtmx Code: {itemInv.ItemDtmx}{Environment.NewLine}"
Next
End If
End If
result += $"{Environment.NewLine}"
Next
End If
txtOut.Text = result
End Sub
End Class