diff --git a/MP-TAB/WebUserControls/mod_dettMacchina.ascx.cs b/MP-TAB/WebUserControls/mod_dettMacchina.ascx.cs
index 5f3781f4..a470f99d 100644
--- a/MP-TAB/WebUserControls/mod_dettMacchina.ascx.cs
+++ b/MP-TAB/WebUserControls/mod_dettMacchina.ascx.cs
@@ -132,6 +132,33 @@ namespace MoonProTablet.WebUserControls
return answ;
}
+ ///
+ /// Determina se sia necessario richiedere un controllo per la macchina secondo condizione
+ /// - cerco ultimo controllo fatto
+ /// - se è più lontano di "intervalloControlli" --> attivo!
+ ///
+ public bool showReqControl(object IdxMacchina)
+ {
+ bool answ = false;
+ int intervalloControlli = memLayer.ML.CRI("intervalloControlli");
+ // cerco ultimo controllo fatto
+ DateTime lastControl = DateTime.Now.AddYears(-1);
+ try
+ {
+ var tab = DataLayer.obj.taRC.getLast(idxMacchina);
+ if (tab.Count > 0)
+ {
+ lastControl = tab[0].DataOra;
+ }
+ }
+ catch
+ { }
+ if (Math.Abs(DateTime.Now.Subtract(lastControl).TotalMinutes) >= intervalloControlli)
+ {
+ answ = true;
+ }
+ return answ;
+ }
public string urlDisegno(object _codArticolo)
{
// default è ND...
diff --git a/MapoDb/DS_ProdTempi.xsd b/MapoDb/DS_ProdTempi.xsd
index 0b8fbd16..350733d0 100644
--- a/MapoDb/DS_ProdTempi.xsd
+++ b/MapoDb/DS_ProdTempi.xsd
@@ -1867,6 +1867,17 @@ FROM v_RegistroControlli
+
+
+
+ dbo.stp_RC_getLast
+
+
+
+
+
+
+
@@ -2411,7 +2422,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2492,7 +2503,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2521,7 +2532,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2533,7 +2544,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2558,7 +2569,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2596,7 +2607,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2635,7 +2646,7 @@ FROM dbo.v_RegistroScarti
-
+
@@ -2701,7 +2712,7 @@ FROM dbo.v_RegistroScarti
-
+
diff --git a/MapoDb/DS_ProdTempi.xss b/MapoDb/DS_ProdTempi.xss
index fdb8b280..c5567033 100644
--- a/MapoDb/DS_ProdTempi.xss
+++ b/MapoDb/DS_ProdTempi.xss
@@ -4,7 +4,7 @@
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
-->
-
+
@@ -25,7 +25,7 @@
-
+
diff --git a/MapoDb/DS_ProdTempi1.Designer.cs b/MapoDb/DS_ProdTempi1.Designer.cs
index cb1bfbd1..ad4f00ea 100644
--- a/MapoDb/DS_ProdTempi1.Designer.cs
+++ b/MapoDb/DS_ProdTempi1.Designer.cs
@@ -24878,7 +24878,7 @@ FROM MappaStatoExpl";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
private void InitCommandCollection() {
- this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3];
+ this._commandCollection = new global::System.Data.SqlClient.SqlCommand[4];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT *\r\nFROM v_RegistroControlli";
@@ -24893,14 +24893,20 @@ FROM MappaStatoExpl";
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DataTo", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, 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_RC_insert";
+ this._commandCollection[2].CommandText = "dbo.stp_RC_getLast";
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("@IdxMacchina", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatrOpr", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@EsitoOk", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Note", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
- this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DataOra", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand();
+ this._commandCollection[3].Connection = this.Connection;
+ this._commandCollection[3].CommandText = "dbo.stp_RC_insert";
+ this._commandCollection[3].CommandType = global::System.Data.CommandType.StoredProcedure;
+ this._commandCollection[3].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[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IdxMacchina", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatrOpr", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@EsitoOk", global::System.Data.SqlDbType.Bit, 1, global::System.Data.ParameterDirection.Input, 1, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Note", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
+ this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DataOra", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -24956,11 +24962,28 @@ FROM MappaStatoExpl";
return dataTable;
}
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
+ [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+ [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
+ public virtual DS_ProdTempi.RegistroControlliDataTable getLast(string IdxMacchina) {
+ this.Adapter.SelectCommand = this.CommandCollection[2];
+ if ((IdxMacchina == null)) {
+ this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
+ }
+ else {
+ this.Adapter.SelectCommand.Parameters[1].Value = ((string)(IdxMacchina));
+ }
+ DS_ProdTempi.RegistroControlliDataTable dataTable = new DS_ProdTempi.RegistroControlliDataTable();
+ this.Adapter.Fill(dataTable);
+ return dataTable;
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int insertQuery(string IdxMacchina, global::System.Nullable MatrOpr, global::System.Nullable EsitoOk, string Note, global::System.Nullable DataOra) {
- global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
+ global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[3];
if ((IdxMacchina == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
diff --git a/MapoDb/DS_Utility.xss b/MapoDb/DS_Utility.xss
index ed24b105..f0c5e07a 100644
--- a/MapoDb/DS_Utility.xss
+++ b/MapoDb/DS_Utility.xss
@@ -14,7 +14,7 @@
-
+