diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx index ef69fb3..4f9f49a 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx @@ -1,80 +1,79 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_unloadSmart.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_unloadSmart" %> <%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %> +<%@ Register Src="~/WebUserControls/cmp_MachSelSmart.ascx" TagPrefix="uc1" TagName="cmp_MachSelSmart" %>
- - - -
-

<%: traduci("MachineUnloadSmart") %>

-
-
-
- - - - - - + + + +
+
+
-
- -
-
- - -
-
- -
-
- -
+ + + + + + +
+
+
+ +
+
+ + +
+
+ +
+
+ +
+
-
-
-
- +
+
+ +
-
-
-
- +
+
+ +
-
- -
-
-
<%: traduci("Cart") %>
+ +
+
+
<%: traduci("Cart") %>
+
+
+
<%: traduci("Bin") %>
+
+
+
<%: traduci("SecOp") %>
+
-
-
<%: traduci("Bin") %>
-
-
-
<%: traduci("SecOp") %>
-
-
- <%: traduci("ResetItemPickup") %> + <%: traduci("ResetItemPickup") %>
- -
- + +
+
- <%: traduci("scrapped") %> - <%: traduci("toPark") %> + <%: traduci("scrapped") %> + <%: traduci("toPark") %>
- <%: traduci("ResetSheetPickup") %> + <%: traduci("ResetSheetPickup") %>
-
-
-
+
\ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs index 7a2e115..1304659 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs @@ -9,561 +9,14 @@ namespace NKC_WF.WebUserControls { public partial class cmp_unloadSmart : BaseUserControl { - protected bool showBin - { - set - { - hfShowBin.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowBin.Value, out answ); - return answ; - } - } - protected bool showCart - { - set - { - hfShowCart.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowCart.Value, out answ); - return answ; - } - } - protected bool showSecOp - { - set - { - hfShowSecOp.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowSecOp.Value, out answ); - return answ; - } - } - /// - /// ID univoco da IP - /// - protected string DeviceId - { - set - { - hfDeviceId.Value = value; - } - get - { - return hfDeviceId.Value; - } - } + #region Protected Fields protected string redMachUnloadTable = "NKC:SERV:MACH_UNLOAD:TABLES"; - /// - /// Sheet selezionato... - /// - protected int SheetID - { - set - { - hfSheetID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - protected string secOp - { - get - { - return hfSecOp.Value; - } - set - { - hfSecOp.Value = value; - } - } - /// - /// Aggiorna dati correnti (IP, batch, sheet...) - /// - protected void updateCurrData() - { - // FORSE 5/5?!? - DataLayer DLMan = new DataLayer(); - var sheetList = DLMan.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) - { - resetShowData(); - resetMessages(); - resetButtons(); - updateCurrData(); - } - cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; - cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; - // resetto - lblLastBCode.Text = "------"; - lblDestination.Text = "--"; - } + #endregion Protected Fields - /// - /// Comando barcode letto - /// - protected string lastCmd - { - get - { - return hfLastBCode.Value; - } - set - { - hfLastBCode.Value = value; - lastValidCmd = value; - } - } - /// - /// ULTIMO Comando barcode VALIDO (!="") letto - /// - protected string lastValidCmd - { - get - { - return hfLastValidBCode.Value; - } - set - { - // solo se è !="" - if (!string.IsNullOrEmpty(value)) - { - hfLastValidBCode.Value = value; - } - } - } - private void Cmp_barcode_eh_doReset(object sender, EventArgs e) - { - resetMessages(); - resetButtons(); - } + #region Protected Properties - private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) - { - bool doRaiseEv = false; - // processo evento.. - lastCmd = cmp_barcode.inputAcquired.ToUpper(); - doRaiseEv = processLastCmd(doRaiseEv); - // reset comando - cmp_barcode.inputAcquired = ""; - ComLib.man.resetSheetUnload(SheetID); - // aggiorno... - doUpdate(); - if (doRaiseEv) - { - resetMessageDivs(); - } - } - - private bool processLastCmd(bool doRaiseEv) - { - if (string.IsNullOrEmpty(lastCmd)) doRaiseEv = true; - // processiamo barcode letto - decodedData decoData = DLMan.decodeBcode(lastCmd); - switch (decoData.codeType) - { - case codeType.UNK: - cmp_barcode.showOutput(cssClass.danger, $"Unknown Data: {decoData.rawData} --> no action"); - resetSelection(false); - doRaiseEv = true; - break; - case codeType.Item: - tryPickup(decoData.rawData); - cmp_barcode.showOutput(cssClass.success, $"Valid IT Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.ItemGeneric: - tryPickup(decoData.rawData); - cmp_barcode.showOutput(cssClass.success, $"Valid IG Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.Material: - cmp_barcode.showOutput(cssClass.warning, $"Material - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Sheet: - cmp_barcode.showOutput(cssClass.warning, $"Sheet - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Stack: - cmp_barcode.showOutput(cssClass.warning, $"BUNK - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.OtherItem: - cmp_barcode.showOutput(cssClass.warning, $"Generic PART - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Batch: - cmp_barcode.showOutput(cssClass.warning, $"Batch - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Cart: - cmp_barcode.showOutput(cssClass.success, $"Valid CR Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.Bin: - cmp_barcode.showOutput(cssClass.success, $"Valid BN Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.SecScreen: - cmp_barcode.showOutput(cssClass.success, $"Valid Screen Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - default: - cmp_barcode.showOutput(cssClass.danger, $"Unknown Data: {decoData.rawData} --> no action"); - resetSelection(false); - break; - } - - return doRaiseEv; - } - /// - /// Prova a fare pickup (SOLO SE il mio item è nel foglio corrente...) - /// - /// - protected void tryPickup(string itemDtmx) - { - // salvo in item sel... - updateCurrData(); - bool fatto = ComLib.saveItemPickup(SheetID, DeviceId, itemDtmx); - lgInfo($"cmp_unloadSmart | tryPickup | item: {itemDtmx} | SheetID: {SheetID} | DeviceId: {DeviceId} | done: {fatto}"); - } - /// - /// Processo il DataMatrix letto - /// - /// - /// - /// - private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) - { - displMessage("", false); - DS_App.ItemListDataTable tabItem = null; - DataLayer DLMan = new DataLayer(); - string message = ""; - // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) - switch (tipoCod) - { - case codeType.Item: - tabItem = DLMan.taIL.getBySearch(codeInt, rawData, 0, 999); - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.ItemGeneric: - // PRIMA CERCA SE ne ho in stato 1..3 - tabItem = DLMan.taIL.getBySearch(0, rawData, 1, 3); - if (tabItem.Count == 0) - { - // se NON ne trovo cerci FINO a stato 5... - tabItem = DLMan.taIL.getBySearch(0, rawData, 1, 5); - } - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.Cart: - // verifico NON SIA richiesto PAINT - if (showBin) - { - displError(traduci("WrongActionBinReq"), true); - } - else - { - if (currCartTab.Count >= 1) - { - // controllo se sia quello corretto - if (rawData != currCartTab[0].CartDtmx) - { - displError(traduci("WrongActionCart"), true); - } - else - { - // dichiaro che è depositato - DLMan.taIL.updateStatus(itemIdSelected, 3, PlaceId); - int cartIndex = 0; - try - { - cartIndex = currCartTab[0].CartIndex; - - } - catch - { } - message = $"{traduci("Part")} {itemIdSelected} {traduci("PutInCart")} C{cartIndex} {rawData}"; - lblDestination.Text = message; - lgInfo($"cmp_unloadSmart | Status --> 3 | {message} | PlaceId: {PlaceId}"); - resetSelection(false); - resetButtons(); - } - } - } - break; - case codeType.Bin: - // verifico NON SIA richiesto PAINT - if (showCart) - { - displError(traduci("WrongActionCartReq"), true); - } - else - { - if (currBinTab.Count == 1) - { - // controllo se sia quello corretto - if (rawData != currBinTab[0].BinDtmx) - { - displError(traduci("WrongActionBin"), true); - } - else - { - // dichiaro che è depositato - DLMan.taIL.updateStatus(itemIdSelected, 4, PlaceId); - message = $"{traduci("Part")} {itemIdSelected} {traduci("PutInBin")} {rawData}"; - lblDestination.Text = message; - lgInfo($"cmp_unloadSmart | Status --> 4 | {message} | PlaceId: {PlaceId}"); - resetSelection(false); - resetButtons(); - } - } - } - break; - case codeType.SecScreen: - // se item già letto - if (divItemDet.Visible) - { - int defaultSecScreenShowTimeout = memLayer.ML.CRI("defaultSecScreenShowTimeout"); - ComLib.setSecScreenRequest(rawData, lblItemDtmx.Text, 60 * defaultSecScreenShowTimeout); - message = $"{traduci("PartToSecScreen")} | {lblItemDtmx.Text} ! {defaultSecScreenShowTimeout} min"; - displMessage(message, false); - lgDebug($"cmp_unloadSmart | SecScreen | {message} | PlaceId: {PlaceId}"); - } - else - { - // chiedo di leggere un ITEM prima... - displError("Please read ITEM before Screen and Retry", true); - } - break; - default: - break; - } - } - /// - /// Mostra INFO ed effettua reset vari... - /// - /// - /// - protected void displMessage(string currMessage, bool resetStatus) - { - lblInfoMessage.Text = currMessage; - divInfoMessage.Visible = true; - resetSelection(resetStatus); - } - /// - /// Mostra errore ed effettua reset vari... - /// - /// - /// - protected void displError(string errorMessage, bool resetStatus) - { - lblErrorMsg.Text = errorMessage; - divItemError.Visible = true; - resetSelection(resetStatus); - } - - /// - /// Mostra o nasconde dettaglio su ITEM letto - /// - /// - /// - private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) - { - resetShowData(); - divItemDet.Visible = showItem; - divItemError.Visible = showError; - if (showError) - { - displError("Item not found", true); - } - if (showItem) - { - lblItemCode.Text = itemRow.ItemExtCode; - lblItemDesc.Text = itemRow.ItemDesc; - lblItemDtmx.Text = itemRow.ItemDtmx; - itemIdSelected = itemRow.ItemID; - // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... - switch (itemRow.StatusID) - { - case 0: - displError("ERROR: Item not ready", false); - break; - case 1: - case 2: - case 100: - // salvo che è in STATO 2 (picked up) - DataLayer currDataLayer = new DataLayer(); - currDataLayer.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); - // verifico cosa devo mostrare come PROX passaggio... - showCart = string.IsNullOrEmpty(itemRow.ProcessesReq); - showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); - secOp = itemRow.PostProcList; - showSecOp = (!string.IsNullOrEmpty(secOp)); - doUpdate(); - break; - case 3: - displError("Item already on CART!", false); - break; - case 4: - // fino a concorrenza qta richiesta sposto, POI do errori - displError("ALL Item already scanned on BIN!", false); - break; - case 5: - displError("Item already at KIT STATION!", false); - break; - case 990: - displError("Item declared SCRAP!", false); - break; - case 991: - displError("Item declared SCRAP with CNC program created!", false); - break; - default: - displError("ERROR: Item status UNKNOWN!", false); - break; - } - } - } - - public int itemIdSelected - { - get - { - int answ = 0; - int.TryParse(hfItemID.Value, out answ); - return answ; - } - set - { - hfItemID.Value = value.ToString(); - bool showBtn = value != 0; - // fix visibilità - lbtCancel.Visible = showBtn; - lbtScrapped.Visible = showBtn; - lbtParkArea.Visible = showBtn; - lbtResetSel.Visible = showBtn; - } - } - /// - /// Resetto testi - /// - private void resetMessages() - { - lblDestination.CssClass = "text-secondary"; - lblDestination.Text = ""; - lblLastBCode.Text = ""; - } - /// - /// resetto buttons azioni - /// - private void resetButtons() - { - lbtCancel.Visible = false; - lbtScrapped.Visible = false; - lbtParkArea.Visible = false; - lbtResetSel.Visible = false; - } - /// - /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload - /// - /// - protected void resetSelection(bool resetStatus) - { - if (resetStatus) - { - try - { - // SE item esiste... - var tabItem = DLMan.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); - if (tabItem.Count == 1) - { - // riposto item a status 1... - DLMan.taIL.updateStatus(itemIdSelected, 1, PlaceId); - lgDebug($"cmp_unloadSmart | resetSelection | Status --> 1 | itemIdSelected: {itemIdSelected} | PlaceId: {PlaceId}"); - } - } - catch - { } - // elimino item sel... - itemIdSelected = 0; - } - resetShowData(); - ComLib.resetItemPickup(SheetID, DeviceId); - lgDebug($"ComLib.resetItemPickup | SheetID {SheetID} | DeviceId: {DeviceId}"); - } - /// - /// Reset booleani visualizzazione - /// - private void resetShowData() - { - showCart = false; - showBin = false; - showSecOp = false; - } - /// - /// Resetta mesaggi ed errori - /// - protected void resetMessageDivs() - { - divInfoMessage.Visible = false; - lblInfoMessage.Text = ""; - divItemError.Visible = false; - lblErrorMsg.Text = ""; - } protected DS_App.BinsDataTable currBinTab { get @@ -587,6 +40,7 @@ namespace NKC_WF.WebUserControls return answ; } } + protected DS_App.CartsDataTable currCartTab { get @@ -611,6 +65,210 @@ namespace NKC_WF.WebUserControls } } + /// + /// ID univoco da IP + /// + protected string DeviceId + { + set + { + hfDeviceId.Value = value; + } + get + { + return hfDeviceId.Value; + } + } + + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfLastBCode.Value; + } + set + { + hfLastBCode.Value = value; + lastValidCmd = value; + } + } + + /// + /// ULTIMO Comando barcode VALIDO (!="") letto + /// + protected string lastValidCmd + { + get + { + return hfLastValidBCode.Value; + } + set + { + // solo se è !="" + if (!string.IsNullOrEmpty(value)) + { + hfLastValidBCode.Value = value; + } + } + } + + protected string secOp + { + get + { + return hfSecOp.Value; + } + set + { + hfSecOp.Value = value; + } + } + + /// + /// Sheet selezionato... + /// + protected int SheetID + { + set + { + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + + protected bool showBin + { + set + { + hfShowBin.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowBin.Value, out answ); + return answ; + } + } + + protected bool showCart + { + set + { + hfShowCart.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowCart.Value, out answ); + return answ; + } + } + + protected bool showSecOp + { + set + { + hfShowSecOp.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowSecOp.Value, out answ); + return answ; + } + } + + #endregion Protected Properties + + #region Public Properties + + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + + public int itemIdSelected + { + get + { + int answ = 0; + int.TryParse(hfItemID.Value, out answ); + return answ; + } + set + { + hfItemID.Value = value.ToString(); + bool showBtn = value != 0; + // fix visibilità + lbtCancel.Visible = showBtn; + lbtScrapped.Visible = showBtn; + lbtParkArea.Visible = showBtn; + lbtResetSel.Visible = showBtn; + } + } + + /// + /// Macchina letta + /// + public string MachineSel + { + get + { + return cmp_MachSelSmart.MachineSel; + } + set + { + cmp_MachSelSmart.MachineSel = value; + } + } + + #endregion Public Properties + + #region Private Methods + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + // reset comando + cmp_barcode.inputAcquired = ""; + ComLib.man.resetSheetUnload(SheetID); + // aggiorno... + doUpdate(); + if (doRaiseEv) + { + resetMessageDivs(); + } + } + + private void Cmp_barcode_eh_doReset(object sender, EventArgs e) + { + resetMessages(); + resetButtons(); + } + private void doUpdate() { // reset grafico @@ -664,6 +322,345 @@ namespace NKC_WF.WebUserControls } } + /// + /// Processo il DataMatrix letto + /// + /// + /// + /// + private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) + { + displMessage("", false); + DS_App.ItemListDataTable tabItem = null; + DataLayer DLMan = new DataLayer(); + string message = ""; + // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) + switch (tipoCod) + { + case codeType.Item: + tabItem = DLMan.taIL.getBySearch(codeInt, rawData, 0, 999); + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + + case codeType.ItemGeneric: + // PRIMA CERCA SE ne ho in stato 1..3 + tabItem = DLMan.taIL.getBySearch(0, rawData, 1, 3); + if (tabItem.Count == 0) + { + // se NON ne trovo cerci FINO a stato 5... + tabItem = DLMan.taIL.getBySearch(0, rawData, 1, 5); + } + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + + case codeType.Cart: + // verifico NON SIA richiesto PAINT + if (showBin) + { + displError(traduci("WrongActionBinReq"), true); + } + else + { + if (currCartTab.Count >= 1) + { + // controllo se sia quello corretto + if (rawData != currCartTab[0].CartDtmx) + { + displError(traduci("WrongActionCart"), true); + } + else + { + // dichiaro che è depositato + DLMan.taIL.updateStatus(itemIdSelected, 3, PlaceId); + int cartIndex = 0; + try + { + cartIndex = currCartTab[0].CartIndex; + } + catch + { } + message = $"{traduci("Part")} {itemIdSelected} {traduci("PutInCart")} C{cartIndex} {rawData}"; + lblDestination.Text = message; + lgInfo($"cmp_unloadSmart | Status --> 3 | {message} | PlaceId: {PlaceId}"); + resetSelection(false); + resetButtons(); + } + } + } + break; + + case codeType.Bin: + // verifico NON SIA richiesto PAINT + if (showCart) + { + displError(traduci("WrongActionCartReq"), true); + } + else + { + if (currBinTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currBinTab[0].BinDtmx) + { + displError(traduci("WrongActionBin"), true); + } + else + { + // dichiaro che è depositato + DLMan.taIL.updateStatus(itemIdSelected, 4, PlaceId); + message = $"{traduci("Part")} {itemIdSelected} {traduci("PutInBin")} {rawData}"; + lblDestination.Text = message; + lgInfo($"cmp_unloadSmart | Status --> 4 | {message} | PlaceId: {PlaceId}"); + resetSelection(false); + resetButtons(); + } + } + } + break; + + case codeType.SecScreen: + // se item già letto + if (divItemDet.Visible) + { + int defaultSecScreenShowTimeout = memLayer.ML.CRI("defaultSecScreenShowTimeout"); + ComLib.setSecScreenRequest(rawData, lblItemDtmx.Text, 60 * defaultSecScreenShowTimeout); + message = $"{traduci("PartToSecScreen")} | {lblItemDtmx.Text} ! {defaultSecScreenShowTimeout} min"; + displMessage(message, false); + lgDebug($"cmp_unloadSmart | SecScreen | {message} | PlaceId: {PlaceId}"); + } + else + { + // chiedo di leggere un ITEM prima... + displError("Please read ITEM before Screen and Retry", true); + } + break; + + default: + break; + } + } + + private bool processLastCmd(bool doRaiseEv) + { + if (string.IsNullOrEmpty(lastCmd)) doRaiseEv = true; + // processiamo barcode letto + decodedData decoData = DLMan.decodeBcode(lastCmd); + switch (decoData.codeType) + { + case codeType.UNK: + cmp_barcode.showOutput(cssClass.danger, $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + doRaiseEv = true; + break; + + case codeType.Item: + tryPickup(decoData.rawData); + cmp_barcode.showOutput(cssClass.success, $"Valid IT Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + + case codeType.ItemGeneric: + tryPickup(decoData.rawData); + cmp_barcode.showOutput(cssClass.success, $"Valid IG Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + + case codeType.Material: + cmp_barcode.showOutput(cssClass.warning, $"Material - ignored: {decoData.description}"); + doRaiseEv = true; + break; + + case codeType.Sheet: + cmp_barcode.showOutput(cssClass.warning, $"Sheet - ignored: {decoData.description}"); + doRaiseEv = true; + break; + + case codeType.Stack: + cmp_barcode.showOutput(cssClass.warning, $"BUNK - ignored: {decoData.description}"); + doRaiseEv = true; + break; + + case codeType.OtherItem: + cmp_barcode.showOutput(cssClass.warning, $"Generic PART - ignored: {decoData.description}"); + doRaiseEv = true; + break; + + case codeType.Batch: + cmp_barcode.showOutput(cssClass.warning, $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + + case codeType.Cart: + cmp_barcode.showOutput(cssClass.success, $"Valid CR Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + + case codeType.Bin: + cmp_barcode.showOutput(cssClass.success, $"Valid BN Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + + case codeType.SecScreen: + cmp_barcode.showOutput(cssClass.success, $"Valid Screen Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + + case codeType.MachSelection: + MachineSel = decoData.code; + cmp_barcode.showOutput(cssClass.success, $"{ traduci("MachineSel")}: {decoData.code}"); + break; + + default: + cmp_barcode.showOutput(cssClass.danger, $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + break; + } + + return doRaiseEv; + } + + /// + /// resetto buttons azioni + /// + private void resetButtons() + { + lbtCancel.Visible = false; + lbtScrapped.Visible = false; + lbtParkArea.Visible = false; + lbtResetSel.Visible = false; + } + + /// + /// Resetto testi + /// + private void resetMessages() + { + lblDestination.CssClass = "text-secondary"; + lblDestination.Text = ""; + lblLastBCode.Text = ""; + } + + /// + /// Reset booleani visualizzazione + /// + private void resetShowData() + { + showCart = false; + showBin = false; + showSecOp = false; + } + + /// + /// Mostra o nasconde dettaglio su ITEM letto + /// + /// + /// + private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) + { + resetShowData(); + divItemDet.Visible = showItem; + divItemError.Visible = showError; + if (showError) + { + displError("Item not found", true); + } + if (showItem) + { + lblItemCode.Text = itemRow.ItemExtCode; + lblItemDesc.Text = itemRow.ItemDesc; + lblItemDtmx.Text = itemRow.ItemDtmx; + itemIdSelected = itemRow.ItemID; + // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... + switch (itemRow.StatusID) + { + case 0: + displError("ERROR: Item not ready", false); + break; + + case 1: + case 2: + case 100: + // salvo che è in STATO 2 (picked up) + DataLayer currDataLayer = new DataLayer(); + currDataLayer.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); + // verifico cosa devo mostrare come PROX passaggio... + showCart = string.IsNullOrEmpty(itemRow.ProcessesReq); + showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); + secOp = itemRow.PostProcList; + showSecOp = (!string.IsNullOrEmpty(secOp)); + doUpdate(); + break; + + case 3: + displError("Item already on CART!", false); + break; + + case 4: + // fino a concorrenza qta richiesta sposto, POI do errori + displError("ALL Item already scanned on BIN!", false); + break; + + case 5: + displError("Item already at KIT STATION!", false); + break; + + case 990: + displError("Item declared SCRAP!", false); + break; + + case 991: + displError("Item declared SCRAP with CNC program created!", false); + break; + + default: + displError("ERROR: Item status UNKNOWN!", false); + break; + } + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Mostra errore ed effettua reset vari... + /// + /// + /// + protected void displError(string errorMessage, bool resetStatus) + { + lblErrorMsg.Text = errorMessage; + divItemError.Visible = true; + resetSelection(resetStatus); + } + + /// + /// Mostra INFO ed effettua reset vari... + /// + /// + /// + protected void displMessage(string currMessage, bool resetStatus) + { + lblInfoMessage.Text = currMessage; + divInfoMessage.Visible = true; + resetSelection(resetStatus); + } + protected void lbtCancel_Click(object sender, EventArgs e) { // resetto item selezionato... @@ -677,19 +674,7 @@ namespace NKC_WF.WebUserControls resetSelection(true); showItemDetail(false, null, false); } - protected void lbtResetSel_Click(object sender, EventArgs e) - { - var tabSheet = DLMan.taSHL.getByItemID(itemIdSelected); - if (tabSheet.Count == 1) - { - resetShowData(); - // resetto sheet selezionato... - DLMan.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); - lgInfo($"cmp_unloadSmart | updateSheetStatusPU | SheetID: {tabSheet[0].SheetID} | PlaceId: {PlaceId}"); - resetSelection(true); - showItemDetail(false, null, false); - } - } + /// /// imposto a parcheggiato /// @@ -705,6 +690,21 @@ namespace NKC_WF.WebUserControls lblLastBCode.Text = traduci("PartParked"); lblLastBCode.CssClass = "text-secondary"; } + + protected void lbtResetSel_Click(object sender, EventArgs e) + { + var tabSheet = DLMan.taSHL.getByItemID(itemIdSelected); + if (tabSheet.Count == 1) + { + resetShowData(); + // resetto sheet selezionato... + DLMan.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); + lgInfo($"cmp_unloadSmart | updateSheetStatusPU | SheetID: {tabSheet[0].SheetID} | PlaceId: {PlaceId}"); + resetSelection(true); + showItemDetail(false, null, false); + } + } + /// /// Imposto come danneggiato/scrapped da rilavorare offline /// @@ -724,5 +724,90 @@ namespace NKC_WF.WebUserControls processLastCmd(false); resetButtons(); } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetShowData(); + resetMessages(); + resetButtons(); + updateCurrData(); + } + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; + // resetto + lblLastBCode.Text = "------"; + lblDestination.Text = "--"; + } + + /// + /// Resetta mesaggi ed errori + /// + protected void resetMessageDivs() + { + divInfoMessage.Visible = false; + lblInfoMessage.Text = ""; + divItemError.Visible = false; + lblErrorMsg.Text = ""; + } + + /// + /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload + /// + /// + protected void resetSelection(bool resetStatus) + { + if (resetStatus) + { + try + { + // SE item esiste... + var tabItem = DLMan.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); + if (tabItem.Count == 1) + { + // riposto item a status 1... + DLMan.taIL.updateStatus(itemIdSelected, 1, PlaceId); + lgDebug($"cmp_unloadSmart | resetSelection | Status --> 1 | itemIdSelected: {itemIdSelected} | PlaceId: {PlaceId}"); + } + } + catch + { } + // elimino item sel... + itemIdSelected = 0; + } + resetShowData(); + ComLib.resetItemPickup(SheetID, DeviceId); + lgDebug($"ComLib.resetItemPickup | SheetID {SheetID} | DeviceId: {DeviceId}"); + } + + /// + /// Prova a fare pickup (SOLO SE il mio item è nel foglio corrente...) + /// + /// + protected void tryPickup(string itemDtmx) + { + // salvo in item sel... + updateCurrData(); + bool fatto = ComLib.saveItemPickup(SheetID, DeviceId, itemDtmx); + lgInfo($"cmp_unloadSmart | tryPickup | item: {itemDtmx} | SheetID: {SheetID} | DeviceId: {DeviceId} | done: {fatto}"); + } + + /// + /// Aggiorna dati correnti (IP, batch, sheet...) + /// + protected void updateCurrData() + { + // FORSE 5/5?!? + DataLayer DLMan = new DataLayer(); + var sheetList = DLMan.taSHL.getByMLStatus(BatchId, 3, 5); + if (sheetList.Count > 0) + { + SheetID = sheetList[0].SheetID; + } + DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs index 976f8a6..0789ac3 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ namespace NKC_WF.WebUserControls @@ -15,254 +15,263 @@ namespace NKC_WF.WebUserControls { /// - /// Controllo hfBatchID. + /// hfBatchID control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfBatchID; /// - /// Controllo hfSheetID. + /// hfSheetID control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfSheetID; /// - /// Controllo hfDeviceId. + /// hfDeviceId control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfDeviceId; /// - /// Controllo cmp_barcode. + /// cmp_MachSelSmart control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_MachSelSmart cmp_MachSelSmart; + + /// + /// cmp_barcode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode; /// - /// Controllo hfLastBCode. + /// hfLastBCode control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfLastBCode; /// - /// Controllo hfLastValidBCode. + /// hfLastValidBCode control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfLastValidBCode; /// - /// Controllo hfShowCart. + /// hfShowCart control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfShowCart; /// - /// Controllo hfShowBin. + /// hfShowBin control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfShowBin; /// - /// Controllo hfShowSecOp. + /// hfShowSecOp control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfShowSecOp; /// - /// Controllo divItemDet. + /// divItemDet control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divItemDet; /// - /// Controllo hfItemID. + /// hfItemID control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfItemID; /// - /// Controllo lblItemCode. + /// lblItemCode control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemCode; /// - /// Controllo lblItemDesc. + /// lblItemDesc control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemDesc; /// - /// Controllo lblItemDtmx. + /// lblItemDtmx control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblItemDtmx; /// - /// Controllo divItemError. + /// divItemError control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divItemError; /// - /// Controllo lblErrorMsg. + /// lblErrorMsg control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblErrorMsg; /// - /// Controllo divInfoMessage. + /// divInfoMessage control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divInfoMessage; /// - /// Controllo lblInfoMessage. + /// lblInfoMessage control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblInfoMessage; /// - /// Controllo hfSecOp. + /// hfSecOp control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfSecOp; /// - /// Controllo icnCart. + /// icnCart control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl icnCart; /// - /// Controllo icnBin. + /// icnBin control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl icnBin; /// - /// Controllo icnSecOp. + /// icnSecOp control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl icnSecOp; /// - /// Controllo lbtCancel. + /// lbtCancel control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtCancel; /// - /// Controllo lblLastBCode. + /// lblLastBCode control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblLastBCode; /// - /// Controllo lblDestination. + /// lblDestination control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblDestination; /// - /// Controllo lbtScrapped. + /// lbtScrapped control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtScrapped; /// - /// Controllo lbtParkArea. + /// lbtParkArea control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtParkArea; /// - /// Controllo lbtResetSel. + /// lbtResetSel control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lbtResetSel; } diff --git a/NKC_WF/site/MachineUnloadSmart.aspx b/NKC_WF/site/MachineUnloadSmart.aspx index 0833887..46f09ce 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx +++ b/NKC_WF/site/MachineUnloadSmart.aspx @@ -2,11 +2,20 @@ <%@ Register Src="~/WebUserControls/cmp_unloadSmart.ascx" TagPrefix="uc1" TagName="cmp_unloadSmart" %> - -
- - +
+
+

<%: traduci("MachineUnloadSmart") %>

+
+
+
+
+ + +
+
+
+
-
+ \ 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 00c20b0..29f3cfd 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs +++ b/NKC_WF/site/MachineUnloadSmart.aspx.designer.cs @@ -1,35 +1,35 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ namespace NKC_WF { - public partial class MachineUnloadSmart - { + 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; + /// + /// hfBatchID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + 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; - } + /// + /// cmp_unloadSmart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_unloadSmart cmp_unloadSmart; + } }