diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs index 6840eee..cfe958b 100644 --- a/AppData/ComLib.cs +++ b/AppData/ComLib.cs @@ -126,23 +126,6 @@ namespace AppData return answ; } - //public object getEstAnsw(int BatchId) - //{ - // List answ = null; - - // var collNAA = database.GetCollection("NestAnswArchive"); - // // oggetto filtraggio x nest answ - // var builderNAA = Builders.Filter; - // var filtBatchId = builderNAA.Eq(u => u.BatchID, BatchId); - - // var datiCorrenti = collNAA.Find(filtBatchId); - // foreach (var item in datiCorrenti) - // { - - // } - // return answ; - //} - /// /// restitusice ultima chiamata REST registrata su REDIS /// @@ -186,8 +169,6 @@ namespace AppData #region definizione classi impiegate con PROD - - public static string PositionStatusDescr(object value) { string answ = ""; @@ -205,6 +186,12 @@ namespace AppData case BatchPosition.StackDone: answ = traduci("StackDone"); break; + case BatchPosition.Current: + answ = traduci("StackCurrent"); + break; + case BatchPosition.Completed: + answ = traduci("StackCompleted"); + break; default: break; } @@ -1629,7 +1616,12 @@ namespace AppData // sostituisco dictData.Remove(deviceId); } + // salvo! + rawData = JsonConvert.SerializeObject(dictData); + memLayer.ML.setRSV($"{redKeyBase}:ItemsSel", rawData); answ = true; + // reset memoria redis del CSS x obbligare refresh... + memLayer.ML.setRSV($"{redKeyBase}:Css", ""); } catch { } @@ -1704,6 +1696,163 @@ namespace AppData return currCss; } + /// + /// IP del device + /// + /// + public static string GetIPAddress() + { + HttpContext context = HttpContext.Current; + string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; + + if (!string.IsNullOrEmpty(ipAddress)) + { + string[] addresses = ipAddress.Split(','); + if (addresses.Length != 0) + { + return addresses[0]; + } + } + + return context.Request.ServerVariables["REMOTE_ADDR"]; + } + + /// + /// Calcola area REDIS per MACCHINA + /// + /// + /// + public static string machineArea(string machineCod) + { + string answ = memLayer.ML.redHash($"currMachineData:{machineCod}"); + return answ; + } + /// + /// Recupera prossimo batch da DB (NEXT... da db x status... ok SOLO x singola macchina) + /// + protected int getNextBatch + { + get + { + int answ = 0; + try + { + var currData = DataLayer.man.taBL.getNextAvailable(); + if (currData.Count > 0) + { + answ = currData[0].BatchID; + } + } + catch + { } + return answ; + } + } + /// + /// Recupera SHEET da batch e sstati permessi... + /// + /// + /// + /// + /// + protected int getSheetIdByBatch(int BatchID, int minVal, int maxVal) + { + int answ = 0; + try + { + var tabSheet = DataLayer.man.taSHL.getByMLStatus(BatchID, minVal, maxVal); + if (tabSheet.Count > 0) + { + answ = tabSheet[0].SheetID; + } + } + catch + { } + return answ; + } + /// + /// Fornisce un dictionary di valori ATTUALI per una specifica macchina + /// + /// + /// + public Dictionary getCurrMachineData(string machineCod) + { + Dictionary answ = new Dictionary(); + // cerco in REDIS + string rawData = memLayer.ML.getRSV(machineArea(machineCod)); + if (!string.IsNullOrEmpty(rawData)) + { + answ = JsonConvert.DeserializeObject>(rawData); + } + else + { + // recupero batch e sheet... + int batchId = getNextBatch; + // se non trovo creo un oggetto NUOVO e vuoto x ogni oggetto... e salvo... + answ.Add("BatchID", batchId.ToString()); + answ.Add("SheetID_load", getSheetIdByBatch(batchId, 0, 1).ToString()); + answ.Add("SheetID_print", getSheetIdByBatch(batchId, 1, 2).ToString()); + answ.Add("SheetID_work", getSheetIdByBatch(batchId, 2, 3).ToString()); + answ.Add("SheetID_unload", getSheetIdByBatch(batchId, 3, 5).ToString()); + // serializzo e salvo! + saveMachineData(machineCod, answ); + } + // restituisco! + return answ; + } + /// + /// Salvataggio array dati di una macchina + /// + /// + /// + /// + public bool saveMachineData(string machineCod, Dictionary paramsArray) + { + bool answ = false; + try + { + // serializzo e salvo! + string rawData = JsonConvert.SerializeObject(paramsArray); + memLayer.ML.setRSV(machineArea(machineCod), rawData); + answ = true; + } + catch + { } + // restituisco! + return answ; + } + /// + /// Fornisce un dictionary di valori ATTUALI per una specifica macchina + /// + /// + /// + /// + /// + public bool saveMachineParam(string machineCod, string Key, string Val) + { + bool answ = false; + // recupero i dati + try + { + var currData = getCurrMachineData(machineCod); + // aggiorno il record + if (currData.ContainsKey(Key)) + { + currData[Key] = Val; + } + // oppure aggiungo... + else + { + currData.Add(Key, Val); + } + // salvo... + saveMachineData(machineCod, currData); + answ = true; + } + catch + { } + return answ; + } #endregion diff --git a/Jenkinsfile b/Jenkinsfile index 58d5d60..12628cc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=211']) { + withEnv(['NEXT_BUILD_NUMBER=215']) { // env.versionNumber = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.versionNumberBeta = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') diff --git a/NKC_SDK/Objects.cs b/NKC_SDK/Objects.cs index 6cb2ad3..c302bb4 100644 --- a/NKC_SDK/Objects.cs +++ b/NKC_SDK/Objects.cs @@ -440,7 +440,6 @@ namespace NKC_SDK #endregion - #region classi per PROD /// @@ -609,5 +608,5 @@ namespace NKC_SDK #endregion - + } diff --git a/NKC_WF/WebUserControls/cmp_MU_bins.ascx b/NKC_WF/WebUserControls/cmp_MU_bins.ascx index 9c83e3b..2133eee 100644 --- a/NKC_WF/WebUserControls/cmp_MU_bins.ascx +++ b/NKC_WF/WebUserControls/cmp_MU_bins.ascx @@ -16,7 +16,7 @@ - + diff --git a/NKC_WF/WebUserControls/cmp_MU_carts.ascx b/NKC_WF/WebUserControls/cmp_MU_carts.ascx index a5f05c2..5174a46 100644 --- a/NKC_WF/WebUserControls/cmp_MU_carts.ascx +++ b/NKC_WF/WebUserControls/cmp_MU_carts.ascx @@ -16,7 +16,7 @@ - + diff --git a/NKC_WF/WebUserControls/cmp_taktList.ascx b/NKC_WF/WebUserControls/cmp_taktList.ascx index 4194632..5a5d685 100644 --- a/NKC_WF/WebUserControls/cmp_taktList.ascx +++ b/NKC_WF/WebUserControls/cmp_taktList.ascx @@ -39,7 +39,7 @@ - + diff --git a/NKC_WF/WebUserControls/cmp_taktList.ascx.cs b/NKC_WF/WebUserControls/cmp_taktList.ascx.cs index b549567..d731cdb 100644 --- a/NKC_WF/WebUserControls/cmp_taktList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_taktList.ascx.cs @@ -12,7 +12,7 @@ namespace NKC_WF.WebUserControls { protected void Page_Load(object sender, EventArgs e) { - if(!Page.IsPostBack) + if (!Page.IsPostBack) { checkVisibility(); } @@ -24,7 +24,7 @@ namespace NKC_WF.WebUserControls grView.Visible = !divSelected.Visible; // imposto css titolo... string titleClass = "row font-weight-bold"; - if(divSelected.Visible) + if (divSelected.Visible) { titleClass += " table-primary"; } @@ -78,11 +78,11 @@ namespace NKC_WF.WebUserControls return answ; } /// - /// Converte il codice POSITION in effettivo campo + /// Converte il codice POSITION di un BATCH in traduzione /// /// /// - public string PStatus(object _status) + public string BatchPositionStatus(object _status) { string answ = ComLib.PositionStatusDescr(_status); return answ; diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx index dc8e2b9..f4e051e 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx @@ -3,6 +3,9 @@ <%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %>
+ + +

<%: traduci("MachineUnloadSmart") %>

diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs index 4c810cd..10e08ad 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs @@ -12,35 +12,33 @@ namespace NKC_WF.WebUserControls /// /// ID univoco da IP /// - protected string deviceId = "AAA"; + protected string DeviceId + { + set + { + hfDeviceId.Value = value; + } + get + { + return hfDeviceId.Value; + } + } - /// - /// Batch selezionato - /// - protected int BatchID; /// /// Sheet selezionato... /// - protected int SheetID; - /// - /// IP del device - /// - /// - protected string GetIPAddress() + protected int SheetID { - System.Web.HttpContext context = System.Web.HttpContext.Current; - string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; - - if (!string.IsNullOrEmpty(ipAddress)) + set { - string[] addresses = ipAddress.Split(','); - if (addresses.Length != 0) - { - return addresses[0]; - } + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; } - - return context.Request.ServerVariables["REMOTE_ADDR"]; } protected string secOp { @@ -58,20 +56,34 @@ namespace NKC_WF.WebUserControls ///
protected void updateCurrData() { - //!!!FIXME!!! fare calcolo del VERO batch corrente... - BatchID = 242; // FORSE 5/5?!? - var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchID, 3, 5); + var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5); if (sheetList.Count > 0) { SheetID = sheetList[0].SheetID; } + DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { - deviceId = GetIPAddress().Replace(".", "_"); resetIcons(); updateCurrData(); } @@ -143,7 +155,7 @@ namespace NKC_WF.WebUserControls case codeType.UNK: cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); // elimino item sel... - ComLib.resetItemPickup(SheetID, deviceId); + ComLib.resetItemPickup(SheetID, DeviceId); doRaiseEv = true; break; case codeType.Item: @@ -183,7 +195,7 @@ namespace NKC_WF.WebUserControls default: cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); // elimino item sel... - ComLib.resetItemPickup(SheetID, deviceId); + ComLib.resetItemPickup(SheetID, DeviceId); break; } @@ -197,8 +209,7 @@ namespace NKC_WF.WebUserControls { // salvo in item sel... updateCurrData(); - deviceId = GetIPAddress().Replace(".", "0").Replace(":", "0"); - ComLib.saveItemPickup(SheetID, deviceId, itemDtmx); + ComLib.saveItemPickup(SheetID, DeviceId, itemDtmx); } /// @@ -257,7 +268,7 @@ namespace NKC_WF.WebUserControls DataLayer.man.taIL.updateStatus(itemIdSelected, 4, "WRK001"); lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; // elimino item sel... - ComLib.resetItemPickup(SheetID, deviceId); + ComLib.resetItemPickup(SheetID, DeviceId); } } break; @@ -277,7 +288,7 @@ namespace NKC_WF.WebUserControls DataLayer.man.taIL.updateStatus(itemIdSelected, 5, "WRK001"); lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; // elimino item sel... - ComLib.resetItemPickup(SheetID, deviceId); + ComLib.resetItemPickup(SheetID, DeviceId); } } break; diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs index f458543..73d796d 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs @@ -14,6 +14,33 @@ namespace NKC_WF.WebUserControls public partial class cmp_unloadSmart { + /// + /// Controllo hfBatchID. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfBatchID; + + /// + /// Controllo hfSheetID. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfSheetID; + + /// + /// Controllo hfDeviceId. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfDeviceId; + /// /// Controllo cmp_barcode. /// diff --git a/NKC_WF/site/MachineUnload.aspx b/NKC_WF/site/MachineUnload.aspx index 3852d07..e83fc30 100644 --- a/NKC_WF/site/MachineUnload.aspx +++ b/NKC_WF/site/MachineUnload.aspx @@ -27,7 +27,7 @@ - + diff --git a/NKC_WF/site/MachineUnloadSmart.aspx b/NKC_WF/site/MachineUnloadSmart.aspx index 4aba26d..c6a1bcd 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx +++ b/NKC_WF/site/MachineUnloadSmart.aspx @@ -5,5 +5,6 @@ + diff --git a/NKC_WF/site/MachineUnloadSmart.aspx.cs b/NKC_WF/site/MachineUnloadSmart.aspx.cs index 58d6fb3..0b42cc3 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx.cs +++ b/NKC_WF/site/MachineUnloadSmart.aspx.cs @@ -1,6 +1,41 @@ -namespace NKC_WF +using System; + +namespace NKC_WF { public partial class MachineUnloadSmart : BasePage { + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + doUpdate(); + } + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Aggiorna componente principale e child components + /// + private void doUpdate() + { + //!!!FIXME!!! fare calcolo del VERO batch corrente... + BatchId = 242; // fixed x test! + // aggiorno child + cmp_unloadSmart.BatchId = BatchId; + } } } \ No newline at end of file diff --git a/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs b/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs index 73704a3..00c20b0 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs +++ b/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs @@ -7,18 +7,29 @@ // //------------------------------------------------------------------------------ -namespace NKC_WF { - - - public partial class MachineUnloadSmart { - - /// - /// Controllo cmp_unloadSmart. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::NKC_WF.WebUserControls.cmp_unloadSmart cmp_unloadSmart; - } +namespace NKC_WF +{ + + + public partial class MachineUnloadSmart + { + + /// + /// Controllo hfBatchID. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfBatchID; + + /// + /// Controllo cmp_unloadSmart. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::NKC_WF.WebUserControls.cmp_unloadSmart cmp_unloadSmart; + } }