Update demo VB x NKC

This commit is contained in:
Samuele E. Locatelli
2020-03-30 18:27:26 +02:00
parent b286d85fdd
commit fd386e95be
3 changed files with 239 additions and 142 deletions
+119 -4
View File
@@ -112,6 +112,13 @@ namespace NKC_SDK
return $"{_baseUrl}api/Bunk"; return $"{_baseUrl}api/Bunk";
} }
} }
protected string urlCurrSheet4Mac
{
get
{
return $"{_baseUrl}api/Sheet/{_codPost}";
}
}
protected string urlGetBunk(int currBunkId) protected string urlGetBunk(int currBunkId)
{ {
return $"{_baseUrl}api/Bunk/{currBunkId}?showNext=false"; return $"{_baseUrl}api/Bunk/{currBunkId}?showNext=false";
@@ -125,6 +132,17 @@ namespace NKC_SDK
return $"{_baseUrl}api/Bunk/{currBunkId}"; return $"{_baseUrl}api/Bunk/{currBunkId}";
} }
/// <summary> /// <summary>
/// URL x salvataggio dati SHEET
/// </summary>
/// <returns></returns>
protected string urlPutSheetList
{
get
{
return $"{_baseUrl}api/Sheet/{_codPost}";
}
}
/// <summary>
/// file locale per persistenza BUNK /// file locale per persistenza BUNK
/// </summary> /// </summary>
protected string persistFileName = "data/persistFile.json"; protected string persistFileName = "data/persistFile.json";
@@ -138,17 +156,26 @@ namespace NKC_SDK
/// DEV: https://localhost:44388/ /// DEV: https://localhost:44388/
/// </summary> /// </summary>
protected string _baseUrl { get; set; } = @"http://seriate.steamware.net:8083/NKC/"; protected string _baseUrl { get; set; } = @"http://seriate.steamware.net:8083/NKC/";
/// <summary>
/// DnsName/IP di base x chaimate
/// </summary>
protected string _baseIp { get; set; } = "seriate.steamware.net"; protected string _baseIp { get; set; } = "seriate.steamware.net";
/// <summary>
/// COD macchina x cui si effettua chiamata
/// </summary>
protected string _codPost { get; set; } = "";
/// <summary> /// <summary>
/// Classe per effettuare comunicazioni con NKC /// Classe per effettuare comunicazioni con NKC
/// </summary> /// </summary>
/// <param name="baseIp"></param> /// <param name="baseIp">IP di base x ping</param>
/// <param name="baseUrl"></param> /// <param name="baseUrl">URL di abse x chiamate REST</param>
public NKC(string baseIp, string baseUrl) /// <param name="codPost">Codice posstazione/macchina x cui si fa chiamata</param>
public NKC(string baseIp, string baseUrl, string codPost)
{ {
_baseIp = baseIp;
_baseUrl = baseUrl; _baseUrl = baseUrl;
_codPost = codPost;
} }
/// <summary> /// <summary>
/// Effettua test ping all'indirizzo del server /// Effettua test ping all'indirizzo del server
@@ -203,6 +230,92 @@ namespace NKC_SDK
} }
} }
#region metodi per SheetWorklist
/// <summary>
/// Recupera elenco dei fogli ATTIVI
/// - effettua chiamata tramite REST API HTTP
/// - il risutlato viene deserializzato nell'oggetto richiesto
/// </summary>
/// <returns></returns>
public SheetWorkList getCurrentSheets()
{
SheetWorkList answ = null;
string rawdata = "";
// chiamo metodo x recupero WBunk...
try
{
rawdata = callUrl(urlCurrSheet4Mac);
answ = JsonConvert.DeserializeObject<SheetWorkList>(rawdata);
}
catch (Exception exc)
{
Log.Instance.Error($"Eccezione durante getCurrentSheets, ricevuto {rawdata}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Effettua salvataggio dell'elenco dei fogli (1..n) su NKC
/// </summary>
/// <param name="updatedSheetList"></param>
public bool saveSheets(SheetWorkList updatedSheetList)
{
bool answ = false;
string rawdata = "";
try
{
// serializzo oggetto
rawdata = JsonConvert.SerializeObject(updatedSheetList);
// invio con metodo put!
putData(urlPutSheetList, rawdata);
answ = true;
}
catch (Exception exc)
{
Log.Instance.Error($"Eccezione durante saveSheets, ricevuto {rawdata}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Oggetto che contiene l'oggetto SHEET WorkList corrente salvato LOCALMENTE
/// </summary>
public SheetWorkList persistedSheetList
{
get
{
SheetWorkList answ = new SheetWorkList();
try
{
string rawdata = File.ReadAllText(persistFileName);
answ = JsonConvert.DeserializeObject<SheetWorkList>(rawdata);
}
catch (Exception exc)
{
Log.Instance.Error($"Eccezione durante recupero locale della SheetList{Environment.NewLine}{exc}");
}
return answ;
}
set
{
try
{
// serializzo oggetto
string rawdata = JsonConvert.SerializeObject(value);
// salvo in locale
File.WriteAllText(persistFileName, rawdata);
}
catch (Exception exc)
{
Log.Instance.Error($"Eccezione durante salvataggio locale della SheetList{Environment.NewLine}{exc}");
}
}
}
#endregion
#if false
#region metodi per BUNK
/// <summary> /// <summary>
/// Recupera il PRIMO BUNK /// Recupera il PRIMO BUNK
/// - effettua chiamata tramite REST API HTTP /// - effettua chiamata tramite REST API HTTP
@@ -326,6 +439,8 @@ namespace NKC_SDK
} }
} }
#endregion
#endif
} }
} }
+79 -80
View File
@@ -33,9 +33,7 @@ Partial Class Form1
Me.btnWorkEnd = New System.Windows.Forms.Button() Me.btnWorkEnd = New System.Windows.Forms.Button()
Me.btnUnlStart = New System.Windows.Forms.Button() Me.btnUnlStart = New System.Windows.Forms.Button()
Me.btnUnlEnd = New System.Windows.Forms.Button() Me.btnUnlEnd = New System.Windows.Forms.Button()
Me.btnNextBunk = New System.Windows.Forms.Button()
Me.txtCurrBunk = New System.Windows.Forms.TextBox() Me.txtCurrBunk = New System.Windows.Forms.TextBox()
Me.lblNextBunk = New System.Windows.Forms.Label()
Me.txtPrintStart = New System.Windows.Forms.TextBox() Me.txtPrintStart = New System.Windows.Forms.TextBox()
Me.txtWorkStart = New System.Windows.Forms.TextBox() Me.txtWorkStart = New System.Windows.Forms.TextBox()
Me.txtUnlStart = New System.Windows.Forms.TextBox() Me.txtUnlStart = New System.Windows.Forms.TextBox()
@@ -52,9 +50,10 @@ Partial Class Form1
' '
'btnReset 'btnReset
' '
Me.btnReset.Location = New System.Drawing.Point(64, 398) Me.btnReset.Location = New System.Drawing.Point(85, 490)
Me.btnReset.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnReset.Name = "btnReset" Me.btnReset.Name = "btnReset"
Me.btnReset.Size = New System.Drawing.Size(75, 23) Me.btnReset.Size = New System.Drawing.Size(100, 28)
Me.btnReset.TabIndex = 0 Me.btnReset.TabIndex = 0
Me.btnReset.Text = "reset Date" Me.btnReset.Text = "reset Date"
Me.btnReset.UseVisualStyleBackColor = True Me.btnReset.UseVisualStyleBackColor = True
@@ -62,26 +61,29 @@ Partial Class Form1
'Label1 'Label1
' '
Me.Label1.AutoSize = True Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(262, 403) Me.Label1.Location = New System.Drawing.Point(349, 496)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label1.Name = "Label1" Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13) Me.Label1.Size = New System.Drawing.Size(51, 17)
Me.Label1.TabIndex = 1 Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1" Me.Label1.Text = "Label1"
' '
'btnLoadBunk 'btnLoadBunk
' '
Me.btnLoadBunk.Location = New System.Drawing.Point(64, 36) Me.btnLoadBunk.Location = New System.Drawing.Point(85, 44)
Me.btnLoadBunk.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnLoadBunk.Name = "btnLoadBunk" Me.btnLoadBunk.Name = "btnLoadBunk"
Me.btnLoadBunk.Size = New System.Drawing.Size(75, 23) Me.btnLoadBunk.Size = New System.Drawing.Size(100, 28)
Me.btnLoadBunk.TabIndex = 2 Me.btnLoadBunk.TabIndex = 2
Me.btnLoadBunk.Text = "Load BUNK" Me.btnLoadBunk.Text = "Load data"
Me.btnLoadBunk.UseVisualStyleBackColor = True Me.btnLoadBunk.UseVisualStyleBackColor = True
' '
'btnPrintStart 'btnPrintStart
' '
Me.btnPrintStart.Location = New System.Drawing.Point(64, 165) Me.btnPrintStart.Location = New System.Drawing.Point(85, 203)
Me.btnPrintStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnPrintStart.Name = "btnPrintStart" Me.btnPrintStart.Name = "btnPrintStart"
Me.btnPrintStart.Size = New System.Drawing.Size(75, 23) Me.btnPrintStart.Size = New System.Drawing.Size(100, 28)
Me.btnPrintStart.TabIndex = 3 Me.btnPrintStart.TabIndex = 3
Me.btnPrintStart.Text = "Start Paint" Me.btnPrintStart.Text = "Start Paint"
Me.btnPrintStart.UseVisualStyleBackColor = True Me.btnPrintStart.UseVisualStyleBackColor = True
@@ -90,148 +92,144 @@ Partial Class Form1
' '
Me.cmbSheet.DisplayMember = "SheetId" Me.cmbSheet.DisplayMember = "SheetId"
Me.cmbSheet.FormattingEnabled = True Me.cmbSheet.FormattingEnabled = True
Me.cmbSheet.Location = New System.Drawing.Point(526, 39) Me.cmbSheet.Location = New System.Drawing.Point(700, 54)
Me.cmbSheet.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.cmbSheet.Name = "cmbSheet" Me.cmbSheet.Name = "cmbSheet"
Me.cmbSheet.Size = New System.Drawing.Size(121, 21) Me.cmbSheet.Size = New System.Drawing.Size(160, 24)
Me.cmbSheet.TabIndex = 4 Me.cmbSheet.TabIndex = 4
' '
'Label2 'Label2
' '
Me.Label2.AutoSize = True Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(440, 46) Me.Label2.Location = New System.Drawing.Point(572, 57)
Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label2.Name = "Label2" Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(69, 13) Me.Label2.Size = New System.Drawing.Size(92, 17)
Me.Label2.TabIndex = 5 Me.Label2.TabIndex = 5
Me.Label2.Text = "current sheet" Me.Label2.Text = "current sheet"
' '
'btnPrintEnd 'btnPrintEnd
' '
Me.btnPrintEnd.Location = New System.Drawing.Point(423, 165) Me.btnPrintEnd.Location = New System.Drawing.Point(564, 203)
Me.btnPrintEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnPrintEnd.Name = "btnPrintEnd" Me.btnPrintEnd.Name = "btnPrintEnd"
Me.btnPrintEnd.Size = New System.Drawing.Size(75, 23) Me.btnPrintEnd.Size = New System.Drawing.Size(100, 28)
Me.btnPrintEnd.TabIndex = 6 Me.btnPrintEnd.TabIndex = 6
Me.btnPrintEnd.Text = "End Paint" Me.btnPrintEnd.Text = "End Paint"
Me.btnPrintEnd.UseVisualStyleBackColor = True Me.btnPrintEnd.UseVisualStyleBackColor = True
' '
'btnWorkStart 'btnWorkStart
' '
Me.btnWorkStart.Location = New System.Drawing.Point(64, 209) Me.btnWorkStart.Location = New System.Drawing.Point(85, 257)
Me.btnWorkStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnWorkStart.Name = "btnWorkStart" Me.btnWorkStart.Name = "btnWorkStart"
Me.btnWorkStart.Size = New System.Drawing.Size(75, 23) Me.btnWorkStart.Size = New System.Drawing.Size(100, 28)
Me.btnWorkStart.TabIndex = 7 Me.btnWorkStart.TabIndex = 7
Me.btnWorkStart.Text = "Start Cut" Me.btnWorkStart.Text = "Start Cut"
Me.btnWorkStart.UseVisualStyleBackColor = True Me.btnWorkStart.UseVisualStyleBackColor = True
' '
'btnWorkEnd 'btnWorkEnd
' '
Me.btnWorkEnd.Location = New System.Drawing.Point(423, 209) Me.btnWorkEnd.Location = New System.Drawing.Point(564, 257)
Me.btnWorkEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnWorkEnd.Name = "btnWorkEnd" Me.btnWorkEnd.Name = "btnWorkEnd"
Me.btnWorkEnd.Size = New System.Drawing.Size(75, 23) Me.btnWorkEnd.Size = New System.Drawing.Size(100, 28)
Me.btnWorkEnd.TabIndex = 8 Me.btnWorkEnd.TabIndex = 8
Me.btnWorkEnd.Text = "End Cut" Me.btnWorkEnd.Text = "End Cut"
Me.btnWorkEnd.UseVisualStyleBackColor = True Me.btnWorkEnd.UseVisualStyleBackColor = True
' '
'btnUnlStart 'btnUnlStart
' '
Me.btnUnlStart.Location = New System.Drawing.Point(64, 251) Me.btnUnlStart.Location = New System.Drawing.Point(85, 309)
Me.btnUnlStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnUnlStart.Name = "btnUnlStart" Me.btnUnlStart.Name = "btnUnlStart"
Me.btnUnlStart.Size = New System.Drawing.Size(75, 23) Me.btnUnlStart.Size = New System.Drawing.Size(100, 28)
Me.btnUnlStart.TabIndex = 9 Me.btnUnlStart.TabIndex = 9
Me.btnUnlStart.Text = "Start Unload" Me.btnUnlStart.Text = "Start Unload"
Me.btnUnlStart.UseVisualStyleBackColor = True Me.btnUnlStart.UseVisualStyleBackColor = True
' '
'btnUnlEnd 'btnUnlEnd
' '
Me.btnUnlEnd.Location = New System.Drawing.Point(423, 251) Me.btnUnlEnd.Location = New System.Drawing.Point(564, 309)
Me.btnUnlEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnUnlEnd.Name = "btnUnlEnd" Me.btnUnlEnd.Name = "btnUnlEnd"
Me.btnUnlEnd.Size = New System.Drawing.Size(75, 23) Me.btnUnlEnd.Size = New System.Drawing.Size(100, 28)
Me.btnUnlEnd.TabIndex = 10 Me.btnUnlEnd.TabIndex = 10
Me.btnUnlEnd.Text = "End Unload" Me.btnUnlEnd.Text = "End Unload"
Me.btnUnlEnd.UseVisualStyleBackColor = True Me.btnUnlEnd.UseVisualStyleBackColor = True
' '
'btnNextBunk
'
Me.btnNextBunk.Location = New System.Drawing.Point(64, 86)
Me.btnNextBunk.Name = "btnNextBunk"
Me.btnNextBunk.Size = New System.Drawing.Size(75, 23)
Me.btnNextBunk.TabIndex = 11
Me.btnNextBunk.Text = "Next BUNK"
Me.btnNextBunk.UseVisualStyleBackColor = True
Me.btnNextBunk.Visible = False
'
'txtCurrBunk 'txtCurrBunk
' '
Me.txtCurrBunk.Location = New System.Drawing.Point(159, 37) Me.txtCurrBunk.Location = New System.Drawing.Point(212, 46)
Me.txtCurrBunk.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtCurrBunk.Name = "txtCurrBunk" Me.txtCurrBunk.Name = "txtCurrBunk"
Me.txtCurrBunk.Size = New System.Drawing.Size(100, 20) Me.txtCurrBunk.Size = New System.Drawing.Size(132, 22)
Me.txtCurrBunk.TabIndex = 12 Me.txtCurrBunk.TabIndex = 12
' '
'lblNextBunk
'
Me.lblNextBunk.AutoSize = True
Me.lblNextBunk.Location = New System.Drawing.Point(159, 95)
Me.lblNextBunk.Name = "lblNextBunk"
Me.lblNextBunk.Size = New System.Drawing.Size(16, 13)
Me.lblNextBunk.TabIndex = 13
Me.lblNextBunk.Text = "---"
Me.lblNextBunk.Visible = False
'
'txtPrintStart 'txtPrintStart
' '
Me.txtPrintStart.Location = New System.Drawing.Point(159, 168) Me.txtPrintStart.Location = New System.Drawing.Point(212, 207)
Me.txtPrintStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtPrintStart.Name = "txtPrintStart" Me.txtPrintStart.Name = "txtPrintStart"
Me.txtPrintStart.Size = New System.Drawing.Size(142, 20) Me.txtPrintStart.Size = New System.Drawing.Size(188, 22)
Me.txtPrintStart.TabIndex = 14 Me.txtPrintStart.TabIndex = 14
' '
'txtWorkStart 'txtWorkStart
' '
Me.txtWorkStart.Location = New System.Drawing.Point(159, 211) Me.txtWorkStart.Location = New System.Drawing.Point(212, 260)
Me.txtWorkStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtWorkStart.Name = "txtWorkStart" Me.txtWorkStart.Name = "txtWorkStart"
Me.txtWorkStart.Size = New System.Drawing.Size(142, 20) Me.txtWorkStart.Size = New System.Drawing.Size(188, 22)
Me.txtWorkStart.TabIndex = 15 Me.txtWorkStart.TabIndex = 15
' '
'txtUnlStart 'txtUnlStart
' '
Me.txtUnlStart.Location = New System.Drawing.Point(159, 253) Me.txtUnlStart.Location = New System.Drawing.Point(212, 311)
Me.txtUnlStart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtUnlStart.Name = "txtUnlStart" Me.txtUnlStart.Name = "txtUnlStart"
Me.txtUnlStart.Size = New System.Drawing.Size(142, 20) Me.txtUnlStart.Size = New System.Drawing.Size(188, 22)
Me.txtUnlStart.TabIndex = 16 Me.txtUnlStart.TabIndex = 16
' '
'txtUnlEnd 'txtUnlEnd
' '
Me.txtUnlEnd.Location = New System.Drawing.Point(526, 252) Me.txtUnlEnd.Location = New System.Drawing.Point(701, 310)
Me.txtUnlEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtUnlEnd.Name = "txtUnlEnd" Me.txtUnlEnd.Name = "txtUnlEnd"
Me.txtUnlEnd.Size = New System.Drawing.Size(142, 20) Me.txtUnlEnd.Size = New System.Drawing.Size(188, 22)
Me.txtUnlEnd.TabIndex = 19 Me.txtUnlEnd.TabIndex = 19
' '
'txtWorkEnd 'txtWorkEnd
' '
Me.txtWorkEnd.Location = New System.Drawing.Point(526, 210) Me.txtWorkEnd.Location = New System.Drawing.Point(701, 258)
Me.txtWorkEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtWorkEnd.Name = "txtWorkEnd" Me.txtWorkEnd.Name = "txtWorkEnd"
Me.txtWorkEnd.Size = New System.Drawing.Size(142, 20) Me.txtWorkEnd.Size = New System.Drawing.Size(188, 22)
Me.txtWorkEnd.TabIndex = 18 Me.txtWorkEnd.TabIndex = 18
' '
'txtPrintEnd 'txtPrintEnd
' '
Me.txtPrintEnd.Location = New System.Drawing.Point(526, 167) Me.txtPrintEnd.Location = New System.Drawing.Point(701, 206)
Me.txtPrintEnd.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtPrintEnd.Name = "txtPrintEnd" Me.txtPrintEnd.Name = "txtPrintEnd"
Me.txtPrintEnd.Size = New System.Drawing.Size(142, 20) Me.txtPrintEnd.Size = New System.Drawing.Size(188, 22)
Me.txtPrintEnd.TabIndex = 17 Me.txtPrintEnd.TabIndex = 17
' '
'btnSaveAll 'btnSaveAll
' '
Me.btnSaveAll.Location = New System.Drawing.Point(58, 307) Me.btnSaveAll.Location = New System.Drawing.Point(77, 378)
Me.btnSaveAll.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnSaveAll.Name = "btnSaveAll" Me.btnSaveAll.Name = "btnSaveAll"
Me.btnSaveAll.Size = New System.Drawing.Size(610, 23) Me.btnSaveAll.Size = New System.Drawing.Size(813, 28)
Me.btnSaveAll.TabIndex = 20 Me.btnSaveAll.TabIndex = 20
Me.btnSaveAll.Text = "Save All Data" Me.btnSaveAll.Text = "Save All Data"
Me.btnSaveAll.UseVisualStyleBackColor = True Me.btnSaveAll.UseVisualStyleBackColor = True
' '
'btnPing 'btnPing
' '
Me.btnPing.Location = New System.Drawing.Point(64, 6) Me.btnPing.Location = New System.Drawing.Point(85, 7)
Me.btnPing.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnPing.Name = "btnPing" Me.btnPing.Name = "btnPing"
Me.btnPing.Size = New System.Drawing.Size(75, 23) Me.btnPing.Size = New System.Drawing.Size(100, 28)
Me.btnPing.TabIndex = 21 Me.btnPing.TabIndex = 21
Me.btnPing.Text = "Test Ping" Me.btnPing.Text = "Test Ping"
Me.btnPing.UseVisualStyleBackColor = True Me.btnPing.UseVisualStyleBackColor = True
@@ -239,17 +237,19 @@ Partial Class Form1
'lblPing 'lblPing
' '
Me.lblPing.AutoSize = True Me.lblPing.AutoSize = True
Me.lblPing.Location = New System.Drawing.Point(159, 11) Me.lblPing.Location = New System.Drawing.Point(212, 14)
Me.lblPing.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblPing.Name = "lblPing" Me.lblPing.Name = "lblPing"
Me.lblPing.Size = New System.Drawing.Size(45, 13) Me.lblPing.Size = New System.Drawing.Size(59, 17)
Me.lblPing.TabIndex = 22 Me.lblPing.TabIndex = 22
Me.lblPing.Text = "ping???" Me.lblPing.Text = "ping???"
' '
'btnAlive 'btnAlive
' '
Me.btnAlive.Location = New System.Drawing.Point(423, 6) Me.btnAlive.Location = New System.Drawing.Point(564, 7)
Me.btnAlive.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnAlive.Name = "btnAlive" Me.btnAlive.Name = "btnAlive"
Me.btnAlive.Size = New System.Drawing.Size(75, 23) Me.btnAlive.Size = New System.Drawing.Size(100, 28)
Me.btnAlive.TabIndex = 23 Me.btnAlive.TabIndex = 23
Me.btnAlive.Text = "Test Alive" Me.btnAlive.Text = "Test Alive"
Me.btnAlive.UseVisualStyleBackColor = True Me.btnAlive.UseVisualStyleBackColor = True
@@ -257,26 +257,28 @@ Partial Class Form1
'lblAlive 'lblAlive
' '
Me.lblAlive.AutoSize = True Me.lblAlive.AutoSize = True
Me.lblAlive.Location = New System.Drawing.Point(523, 11) Me.lblAlive.Location = New System.Drawing.Point(697, 14)
Me.lblAlive.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblAlive.Name = "lblAlive" Me.lblAlive.Name = "lblAlive"
Me.lblAlive.Size = New System.Drawing.Size(47, 13) Me.lblAlive.Size = New System.Drawing.Size(61, 17)
Me.lblAlive.TabIndex = 24 Me.lblAlive.TabIndex = 24
Me.lblAlive.Text = "alive???" Me.lblAlive.Text = "alive???"
' '
'btnPersist 'btnPersist
' '
Me.btnPersist.Location = New System.Drawing.Point(423, 86) Me.btnPersist.Location = New System.Drawing.Point(564, 106)
Me.btnPersist.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnPersist.Name = "btnPersist" Me.btnPersist.Name = "btnPersist"
Me.btnPersist.Size = New System.Drawing.Size(75, 23) Me.btnPersist.Size = New System.Drawing.Size(100, 28)
Me.btnPersist.TabIndex = 25 Me.btnPersist.TabIndex = 25
Me.btnPersist.Text = "Save Local" Me.btnPersist.Text = "Save Local"
Me.btnPersist.UseVisualStyleBackColor = True Me.btnPersist.UseVisualStyleBackColor = True
' '
'Form1 'Form1
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450) Me.ClientSize = New System.Drawing.Size(1067, 554)
Me.Controls.Add(Me.btnPersist) Me.Controls.Add(Me.btnPersist)
Me.Controls.Add(Me.lblAlive) Me.Controls.Add(Me.lblAlive)
Me.Controls.Add(Me.btnAlive) Me.Controls.Add(Me.btnAlive)
@@ -289,9 +291,7 @@ Partial Class Form1
Me.Controls.Add(Me.txtUnlStart) Me.Controls.Add(Me.txtUnlStart)
Me.Controls.Add(Me.txtWorkStart) Me.Controls.Add(Me.txtWorkStart)
Me.Controls.Add(Me.txtPrintStart) Me.Controls.Add(Me.txtPrintStart)
Me.Controls.Add(Me.lblNextBunk)
Me.Controls.Add(Me.txtCurrBunk) Me.Controls.Add(Me.txtCurrBunk)
Me.Controls.Add(Me.btnNextBunk)
Me.Controls.Add(Me.btnUnlEnd) Me.Controls.Add(Me.btnUnlEnd)
Me.Controls.Add(Me.btnUnlStart) Me.Controls.Add(Me.btnUnlStart)
Me.Controls.Add(Me.btnWorkEnd) Me.Controls.Add(Me.btnWorkEnd)
@@ -303,6 +303,7 @@ Partial Class Form1
Me.Controls.Add(Me.btnLoadBunk) Me.Controls.Add(Me.btnLoadBunk)
Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.btnReset) Me.Controls.Add(Me.btnReset)
Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Name = "Form1" Me.Name = "Form1"
Me.Text = "Form1" Me.Text = "Form1"
Me.ResumeLayout(False) Me.ResumeLayout(False)
@@ -321,11 +322,9 @@ Partial Class Form1
Friend WithEvents btnWorkEnd As Button Friend WithEvents btnWorkEnd As Button
Friend WithEvents btnUnlStart As Button Friend WithEvents btnUnlStart As Button
Friend WithEvents btnUnlEnd As Button Friend WithEvents btnUnlEnd As Button
Friend WithEvents btnNextBunk As Button Friend WithEvents txtCurrBunk As TextBox
Friend WithEvents txtCurrBunk As TextBox Friend WithEvents txtPrintStart As TextBox
Friend WithEvents lblNextBunk As Label Friend WithEvents txtWorkStart As TextBox
Friend WithEvents txtPrintStart As TextBox
Friend WithEvents txtWorkStart As TextBox
Friend WithEvents txtUnlStart As TextBox Friend WithEvents txtUnlStart As TextBox
Friend WithEvents txtUnlEnd As TextBox Friend WithEvents txtUnlEnd As TextBox
Friend WithEvents txtWorkEnd As TextBox Friend WithEvents txtWorkEnd As TextBox
+41 -58
View File
@@ -9,9 +9,10 @@ Public Class Form1
' DEV: https : http://localhost:44388/ ' DEV: https : http://localhost:44388/
Dim baseIp As String = "seriate.steamware.net" Dim baseIp As String = "seriate.steamware.net"
Dim baseUrl As String = "http://seriate.steamware.net:8083/NKC/" Dim baseUrl As String = "http://seriate.steamware.net:8083/NKC/"
Dim currNKC As NKC = New NKC(baseIp, baseUrl) Dim codPost As String = "WRK001" ' nome macchina
Dim currNKC As NKC = New NKC(baseIp, baseUrl, codPost)
Dim currentBunk As ProdBunk = Nothing Dim currentSheets As SheetWorkList = Nothing
Dim risultatoPing As PingReply = Nothing Dim risultatoPing As PingReply = Nothing
Dim srvAlive As Boolean = False Dim srvAlive As Boolean = False
Dim srvClock As String = "" Dim srvClock As String = ""
@@ -20,15 +21,15 @@ Public Class Form1
' resetto TUTTE le date e salvo il bunk! ' resetto TUTTE le date e salvo il bunk!
currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = Nothing
currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = Nothing
currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = Nothing
currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = Nothing
currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = Nothing
currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = Nothing currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = Nothing
' salvo! ' salvo!
currNKC.saveBunk(currentBunk) currNKC.saveSheets(currentSheets)
updateDataButtons() updateDataButtons()
@@ -65,50 +66,20 @@ Public Class Form1
End Sub End Sub
Private Sub btnNextBunk_Click(sender As Object, e As EventArgs) Handles btnNextBunk.Click
' carico nextBunk
Dim bunkId As Integer
bunkId = 0
Integer.TryParse(txtCurrBunk.Text, bunkId)
'' con com lib diretta...
'Dim nextBunk = ComLib.prodGetNextBunk(bunkId)
Dim nextBunk = currNKC.getNextBunk(bunkId)
' mostro risultato...
If Not IsNothing(nextBunk) Then
lblNextBunk.Text = nextBunk.BunkId
Else
lblNextBunk.Text = "none"
End If
End Sub
Private Sub btnLoadBunk_Click(sender As Object, e As EventArgs) Handles btnLoadBunk.Click Private Sub btnLoadBunk_Click(sender As Object, e As EventArgs) Handles btnLoadBunk.Click
' recupero BUNK! ' recupero BUNK!
currentBunk = currNKC.getFirstBunk currentSheets = currNKC.getCurrentSheets
'' chiamata diretta redis + DB If (currentSheets Is Nothing) Then
'Dim getFirstBunk = ComLib.prodGetFirstBunk()
' ho un bunk coi suoi pannelli...
If (currentBunk Is Nothing) Then
' non ho un current bunk ' non ho un current bunk
Label1.Text = "non ho trovato nessun bunk corrente" Label1.Text = "non ho trovato nessun bunk corrente"
Else Else
Label1.Text = $"Trovato il bunk {currentBunk.BunkId} costituito da {currentBunk.SheetList.Count} pannelli" Label1.Text = $"Trovata lista costituita da {currentSheets.SheetList.Count} pannelli"
' salvo bunk corrente
txtCurrBunk.Text = currentBunk.BunkId
' visualizzo btn nextBunk
btnNextBunk.Visible = True
lblNextBunk.Visible = True
lblNextBunk.Text = "..."
' popolo il selettore dei fogli... ' popolo il selettore dei fogli...
cmbSheet.DataSource = currentBunk.SheetList cmbSheet.DataSource = currentSheets.SheetList
updateDataButtons() updateDataButtons()
End If End If
@@ -129,12 +100,12 @@ Public Class Form1
' ok show ' ok show
showButtons = True showButtons = True
' imposto dateora ed in base ai valori dt del currBunk abilito o meno i buttons... ' imposto dateora ed in base ai valori dt del currBunk abilito o meno i buttons...
txtPrintStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart.ToString() txtPrintStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart.ToString()
txtPrintEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd.ToString() txtPrintEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd.ToString()
txtWorkStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart.ToString() txtWorkStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart.ToString()
txtWorkEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd.ToString() txtWorkEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd.ToString()
txtUnlStart.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart.ToString() txtUnlStart.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart.ToString()
txtUnlEnd.Text = currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd.ToString() txtUnlEnd.Text = currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd.ToString()
btnPrintStart.Enabled = String.IsNullOrWhiteSpace(txtPrintStart.Text) btnPrintStart.Enabled = String.IsNullOrWhiteSpace(txtPrintStart.Text)
@@ -153,7 +124,6 @@ Public Class Form1
' fix buttons ' fix buttons
btnLoadBunk.Visible = showButtons btnLoadBunk.Visible = showButtons
btnNextBunk.Visible = showButtons
btnPrintStart.Visible = showButtons btnPrintStart.Visible = showButtons
btnPrintEnd.Visible = showButtons btnPrintEnd.Visible = showButtons
btnWorkStart.Visible = showButtons btnWorkStart.Visible = showButtons
@@ -171,15 +141,28 @@ Public Class Form1
End Sub End Sub
Private Sub saveSelection() Private Sub saveSelection()
currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = txtPrintStart.Text ' salvo SOLO SE è != ""
currentBunk.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = txtPrintEnd.Text If (Not String.IsNullOrEmpty(txtPrintStart.Text)) Then
currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = txtWorkStart.Text currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtStart = txtPrintStart.Text
currentBunk.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = txtWorkEnd.Text End If
currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = txtUnlStart.Text If (Not String.IsNullOrEmpty(txtPrintEnd.Text)) Then
currentBunk.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = txtUnlEnd.Text currentSheets.SheetList(cmbSheet.SelectedIndex).Printing.DtEnd = txtPrintEnd.Text
End If
If (Not String.IsNullOrEmpty(txtWorkStart.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtStart = txtWorkStart.Text
End If
If (Not String.IsNullOrEmpty(txtWorkEnd.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Machining.DtEnd = txtWorkEnd.Text
End If
If (Not String.IsNullOrEmpty(txtUnlStart.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtStart = txtUnlStart.Text
End If
If (Not String.IsNullOrEmpty(txtUnlEnd.Text)) Then
currentSheets.SheetList(cmbSheet.SelectedIndex).Unloading.DtEnd = txtUnlEnd.Text
End If
' salvo! ' salvo!
currNKC.saveBunk(currentBunk) currNKC.saveSheets(currentSheets)
updateDataButtons() updateDataButtons()
End Sub End Sub
@@ -222,7 +205,7 @@ Public Class Form1
End Sub End Sub
Private Sub btnPersist_Click(sender As Object, e As EventArgs) Handles btnPersist.Click Private Sub btnPersist_Click(sender As Object, e As EventArgs) Handles btnPersist.Click
currNKC.persistedBunk = currentBunk currNKC.persistedSheetList = currentSheets
End Sub End Sub
End Class End Class