From a1e964fd8f5a715b94a484740fa997f0d519ae4e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 20 Jul 2020 16:17:38 +0200 Subject: [PATCH] Aggiunto metodo caricamento CART --- AppData/DS_App.Designer.cs | 56 +++++++++++- AppData/DS_App.xsd | 13 +++ AppData/DS_App.xss | 85 ++++++++++--------- NKC_WF/BaseUserControl.cs | 25 ++++++ .../WebUserControls/cmp_kittingSmart.ascx.cs | 11 ++- 5 files changed, 142 insertions(+), 48 deletions(-) diff --git a/AppData/DS_App.Designer.cs b/AppData/DS_App.Designer.cs index 5d229de..3c65a02 100644 --- a/AppData/DS_App.Designer.cs +++ b/AppData/DS_App.Designer.cs @@ -30006,17 +30006,25 @@ SELECT RemnantID, BatchID, MatID, SheetID, DimX, DimY, Available FROM Remnants W [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "select * from PackLog"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[1].Connection = this.Connection; - this._commandCollection[1].CommandText = "dbo.stp_PLog_getByCart"; + this._commandCollection[1].CommandText = "dbo.stp_PL_acquireCart"; this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CartID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CartDtmx", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Device", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@UserName", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[2].Connection = this.Connection; + this._commandCollection[2].CommandText = "dbo.stp_PLog_getByCart"; + this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CartID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -30048,7 +30056,7 @@ SELECT RemnantID, BatchID, MatID, SheetID, DimX, DimY, Available FROM Remnants W [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] public virtual DS_App.PackLogDataTable getByCartId(global::System.Nullable CartID) { - this.Adapter.SelectCommand = this.CommandCollection[1]; + this.Adapter.SelectCommand = this.CommandCollection[2]; if ((CartID.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((int)(CartID.Value)); } @@ -30059,6 +30067,46 @@ SELECT RemnantID, BatchID, MatID, SheetID, DimX, DimY, Available FROM Remnants W this.Adapter.Fill(dataTable); return dataTable; } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int acquireCart(string CartDtmx, string Device, string UserName) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1]; + if ((CartDtmx == null)) { + command.Parameters[1].Value = global::System.DBNull.Value; + } + else { + command.Parameters[1].Value = ((string)(CartDtmx)); + } + if ((Device == null)) { + command.Parameters[2].Value = global::System.DBNull.Value; + } + else { + command.Parameters[2].Value = ((string)(Device)); + } + if ((UserName == null)) { + command.Parameters[3].Value = global::System.DBNull.Value; + } + else { + command.Parameters[3].Value = ((string)(UserName)); + } + global::System.Data.ConnectionState previousConnectionState = command.Connection.State; + if (((command.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + command.Connection.Open(); + } + int returnValue; + try { + returnValue = command.ExecuteNonQuery(); + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + command.Connection.Close(); + } + } + return returnValue; + } } /// diff --git a/AppData/DS_App.xsd b/AppData/DS_App.xsd index c02aaa1..468e59b 100644 --- a/AppData/DS_App.xsd +++ b/AppData/DS_App.xsd @@ -2561,6 +2561,19 @@ FROM v_PackListDet + + + + dbo.stp_PL_acquireCart + + + + + + + + + diff --git a/AppData/DS_App.xss b/AppData/DS_App.xss index 9271767..e6a6e97 100644 --- a/AppData/DS_App.xss +++ b/AppData/DS_App.xss @@ -4,40 +4,41 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + 352 @@ -49,7 +50,7 @@ - + 1197 @@ -61,7 +62,7 @@ - + 1054 @@ -73,7 +74,7 @@ - + 788 @@ -85,7 +86,7 @@ - + 986 @@ -97,7 +98,7 @@ - + 699 @@ -109,7 +110,7 @@ - + 550 @@ -121,7 +122,7 @@ - + 1129 @@ -133,7 +134,7 @@ - + 1380 @@ -145,7 +146,7 @@ - + 1161 @@ -157,7 +158,7 @@ - + 131 @@ -169,7 +170,7 @@ - + 352 diff --git a/NKC_WF/BaseUserControl.cs b/NKC_WF/BaseUserControl.cs index 36dee73..dcc343a 100644 --- a/NKC_WF/BaseUserControl.cs +++ b/NKC_WF/BaseUserControl.cs @@ -93,5 +93,30 @@ namespace NKC_WF { } return answ; } + /// + /// Recupera IP utente + /// + /// + public string currIpAddress() + { + string userip = Request.UserHostAddress; + //if (Request.UserHostAddress != null) + //{ + // Int64 macinfo = new Int64(); + // string macSrc = macinfo.ToString("X"); + // if (macSrc == "0") + // { + // if (userip == "127.0.0.1") + // { + // Response.Write("visited Localhost!"); + // } + // else + // { + // lblIPAdd.Text = userip; + // } + // } + //} + return userip; + } } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs b/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs index 0baf2be..9da57fe 100644 --- a/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs @@ -1,5 +1,6 @@ using AppData; using NKC_SDK; +using SteamWare; using System; namespace NKC_WF.WebUserControls @@ -286,6 +287,7 @@ namespace NKC_WF.WebUserControls switch (tipoCod) { case codeType.OtherItem: + lastObject = ""; var tabOtherItem = DataLayer.man.taOtItem.getByKey(codeInt); if (tabOtherItem.Count == 1) { @@ -293,6 +295,7 @@ namespace NKC_WF.WebUserControls } break; case codeType.Item: + lastObject = ""; tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); if (tabItem.Count == 1) { @@ -304,6 +307,7 @@ namespace NKC_WF.WebUserControls } break; case codeType.ItemGeneric: + lastObject = ""; // PRIMA CERCSE ne ho in stato 1..3 tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); if (tabItem.Count == 0) @@ -358,13 +362,14 @@ namespace NKC_WF.WebUserControls { var rigaCheck = tabPLCheck[0]; // verifico penalty (vedere stored: pezzi da leggere >= pezzi del cart...) - if(rigaCheck.NumPenalty==0) + if (rigaCheck.NumPenalty == 0) { // verifico se sia SECONDA lettura if (lastObject == rawData) { // --> metto cart in scarico e registro LOG come se avesse appena letto 1:1 ogni Dtmx - displError($"OK: CART acquired {rawData}", true); + DataLayer.man.taPLog.acquireCart(rawData, currIpAddress(), user_std.UtSn.userNameAD); + displError($"OK: CART acquired {rawData} - item confirmed", true); lastObject = ""; } else @@ -411,6 +416,7 @@ namespace NKC_WF.WebUserControls #endif break; case codeType.Bin: + lastObject = ""; // verifico NON SIA richiesto PAINT if (showCart) { @@ -436,6 +442,7 @@ namespace NKC_WF.WebUserControls } break; default: + lastObject = ""; break; }