update gestione PL Scanner
This commit is contained in:
@@ -6,13 +6,15 @@
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<div class="row px-1">
|
||||
<div class="col-12">
|
||||
<uc1:cmp_PackListSel runat="server" id="cmp_PackListSel" />
|
||||
<uc1:cmp_PackListSel runat="server" ID="cmp_PackListSel" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<asp:Label runat="server" ID="lblPL" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
|
||||
<asp:HiddenField runat="server" ID="hfLastBCode" />
|
||||
<asp:HiddenField runat="server" ID="hfLastValidBCode" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
PEDANA ATTIVA
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using MagData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -9,9 +10,370 @@ namespace MP_MAG.SMART
|
||||
{
|
||||
public partial class PLScanner : System.Web.UI.Page
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Comando ULTIMO barcode letto
|
||||
/// </summary>
|
||||
protected string lastCmd
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfLastBCode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfLastBCode.Value = value;
|
||||
lastValidCmd = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ULTIMO Comando barcode VALIDO (!="") letto
|
||||
/// </summary>
|
||||
protected string lastValidCmd
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfLastValidBCode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
// solo se è non nullo/vuoto
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
hfLastValidBCode.Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected 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 = "";
|
||||
// aggiorno...
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
private void Cmp_barcode_eh_doReset(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void doUpdate()
|
||||
{
|
||||
#if false
|
||||
// reset grafico
|
||||
icnCart.Attributes.Remove("class");
|
||||
icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary");
|
||||
icnBin.Attributes.Remove("class");
|
||||
icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary");
|
||||
icnSecOp.Attributes.Remove("class");
|
||||
icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary");
|
||||
|
||||
// in base al secondo mostro uno o altro...
|
||||
if (showCart)
|
||||
{
|
||||
icnCart.Attributes.Remove("class");
|
||||
icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success");
|
||||
lblMessage.Text = "Item recognized";
|
||||
// controllo SE HO cart
|
||||
if (currCartTab.Count == 1)
|
||||
{
|
||||
var cartRow = currCartTab[0];
|
||||
// imposto OUT
|
||||
lblDestination.Text = $"SEND TO CART <b>C{cartRow.CartIndex}</b> ({cartRow.CartDtmx})";
|
||||
}
|
||||
else
|
||||
{
|
||||
lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!";
|
||||
}
|
||||
lblDestination.CssClass = "text-success";
|
||||
}
|
||||
else if (showBin)
|
||||
{
|
||||
icnBin.Attributes.Remove("class");
|
||||
icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary");
|
||||
lblMessage.Text = "Item recognized";
|
||||
if (currBinTab.Count == 1)
|
||||
{
|
||||
var binRow = currBinTab[0];
|
||||
lblDestination.Text = $"SEND TO BIN <b>B{binRow.BinIndex}</b> ({binRow.BinDtmx})";
|
||||
}
|
||||
else
|
||||
{
|
||||
lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!";
|
||||
}
|
||||
lblDestination.CssClass = "text-primary";
|
||||
}
|
||||
if (showSecOp)
|
||||
{
|
||||
icnSecOp.Attributes.Remove("class");
|
||||
icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info");
|
||||
lblMessage.Text = "Item recognized";
|
||||
lblLastBCode.Text = $"DO SEC OP: {secOp}";
|
||||
lblLastBCode.CssClass = "text-info";
|
||||
}
|
||||
// fix btn reset!
|
||||
lbtResetSel.Visible = (itemIdSelected != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
private bool processLastCmd(bool doRaiseEv)
|
||||
{
|
||||
if (lastCmd == "") doRaiseEv = true;
|
||||
// processiamo barcode letto
|
||||
decodedData decoData = MagDataLayer.man.decodeBcode(lastValidCmd);
|
||||
switch (decoData.codeType)
|
||||
{
|
||||
case codeType.UNK:
|
||||
cmp_barcode.showOutput("text-danger", $"Codice sconosciuto: {decoData.rawData} --> ignoro");
|
||||
resetSelection(false);
|
||||
doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.Lotto:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
processSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
break;
|
||||
|
||||
case codeType.PackList:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
processSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.Pedana:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
processSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.LottoInt:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
//doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.Date:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
//processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
break;
|
||||
|
||||
case codeType.PartNumber:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
//processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
break;
|
||||
|
||||
case codeType.Quantity:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
//doRaiseEv = true;
|
||||
break;
|
||||
|
||||
case codeType.Udc:
|
||||
cmp_barcode.showOutput("badge badge-success", $"{decoData.description}");
|
||||
//doRaiseEv = true;
|
||||
break;
|
||||
//case codeType.Batch:
|
||||
// cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}");
|
||||
// doRaiseEv = true;
|
||||
// break;
|
||||
//case codeType.Cart:
|
||||
// cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}");
|
||||
// processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
// break;
|
||||
//case codeType.Bin:
|
||||
// cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}");
|
||||
// processLottoSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt);
|
||||
// break;
|
||||
//default:
|
||||
// cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action");
|
||||
// resetSelection(false);
|
||||
// break;
|
||||
}
|
||||
|
||||
return doRaiseEv;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processo il codice letto
|
||||
/// </summary>
|
||||
/// <param name="tipoCod"></param>
|
||||
/// <param name="rawData"></param>
|
||||
/// <param name="codeInt"></param>
|
||||
private void processSuggestion(codeType tipoCod, string rawData, int codeInt)
|
||||
{
|
||||
//DS_App.ItemListDataTable tabItem = null;
|
||||
// processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero)
|
||||
switch (tipoCod)
|
||||
{
|
||||
case codeType.PackList:
|
||||
// FARE!!! verificare packlist valida...
|
||||
if (true)
|
||||
{
|
||||
// seleziono PackList
|
||||
cmp_PackListSel.PackListID = codeInt;
|
||||
}
|
||||
#if false
|
||||
// IN PRIMIS cerco lotto valido
|
||||
DS_Mag.ElencoLottiDataTable tabLotti;
|
||||
tabLotti = MagDataLayer.man.taEL.getByKey(rawData, "*", codStatoIN);
|
||||
if (tabLotti.Count == 1)
|
||||
{
|
||||
// se trovato cerco in elenco --> aggiungo in lista se non c'è
|
||||
var currLotti = lottiSel;
|
||||
if (!currLotti.Contains(rawData))
|
||||
{
|
||||
currLotti.Add(rawData);
|
||||
lottiSel = currLotti;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case codeType.Pedana:
|
||||
// verifico e seleziono pedana
|
||||
//tabItem = DataLayer.man.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.Item:
|
||||
// tabItem = DataLayer.man.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 CERCSE ne ho in stato 1..3
|
||||
// tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3);
|
||||
// if (tabItem.Count == 0)
|
||||
// {
|
||||
// // se NON ne trovo cerci FINO a stato 5...
|
||||
// tabItem = DataLayer.man.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("PAINT: BIN REQUESTED: please retry", true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (currCartTab.Count == 1)
|
||||
// {
|
||||
// // controllo se sia quello corretto
|
||||
// if (rawData != currCartTab[0].CartDtmx)
|
||||
// {
|
||||
// displError("INCORRECT CART: please retry", true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // dichiaro che è depositato
|
||||
// DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId);
|
||||
// lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}";
|
||||
// resetSelection(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
//case codeType.Bin:
|
||||
// // verifico NON SIA richiesto PAINT
|
||||
// if (showCart)
|
||||
// {
|
||||
// displError("NOT PAINTED: CART REQUESTED: please retry", true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (currBinTab.Count == 1)
|
||||
// {
|
||||
// // controllo se sia quello corretto
|
||||
// if (rawData != currBinTab[0].BinDtmx)
|
||||
// {
|
||||
// displError("INCORRECT BIN: please retry", true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // dichiaro che è depositato
|
||||
// DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId);
|
||||
// lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}";
|
||||
// resetSelection(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// eventi barcode
|
||||
cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; ;
|
||||
// eventi reset lotti IN
|
||||
cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload
|
||||
/// </summary>
|
||||
/// <param name="resetStatus"></param>
|
||||
protected void resetSelection(bool resetStatus)
|
||||
{
|
||||
#if false
|
||||
if (resetStatus)
|
||||
{
|
||||
try
|
||||
{
|
||||
// SE item esiste...
|
||||
var tabItem = DataLayer.man.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999);
|
||||
if (tabItem.Count == 1)
|
||||
{
|
||||
// riposto item a status 1...
|
||||
DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
// elimino item sel...
|
||||
itemIdSelected = 0;
|
||||
resetShowData();
|
||||
ComLib.resetItemPickup(SheetID, DeviceId);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
Generated
+18
@@ -41,6 +41,24 @@ namespace MP_MAG.SMART
|
||||
/// </remarks>
|
||||
protected global::MP_MAG.WebUserControls.cmp_barcode cmp_barcode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfLastBCode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastBCode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfLastValidBCode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastValidBCode;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblAL.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header p-1">
|
||||
<asp:LinkButton runat="server" ID="lbtShow" class="btn btn-primary btn-block" data-toggle="collapse" data-target="#demo">
|
||||
<b>PACKLIST
|
||||
<b>PACKING LIST
|
||||
<asp:Label runat="server" ID="lblPackListID" />
|
||||
</b>
|
||||
</asp:LinkButton>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace MP_MAG.WebUserControls
|
||||
set
|
||||
{
|
||||
hfPackListID.Value = $"{value}";
|
||||
lblPackListID.Text = $"{value}";
|
||||
cmp_OrderList.PackListID = value;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+26
-24
@@ -6,28 +6,30 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MagData
|
||||
{
|
||||
/// <summary>
|
||||
/// tipologia di report (FILE rdlc) gestito in stampa...
|
||||
/// </summary>
|
||||
public enum reportRichiesto
|
||||
{
|
||||
ND,
|
||||
CartellinoFinitiOdette,
|
||||
CartellinoPedane,
|
||||
CartellinoSemilavorati
|
||||
}
|
||||
/// <summary>
|
||||
/// Tipi di barcode gestiti
|
||||
/// </summary>
|
||||
public enum codeType
|
||||
{
|
||||
UNK = 0,
|
||||
Lotto,
|
||||
LottoInt,
|
||||
PackList,
|
||||
Pedana,
|
||||
Date,
|
||||
PartNumber,
|
||||
Quantity,
|
||||
Udc
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipi di barcode gestiti
|
||||
/// </summary>
|
||||
public enum codeType
|
||||
{
|
||||
UNK = 0,
|
||||
Lotto,
|
||||
LottoInt,
|
||||
Date,
|
||||
PartNumber,
|
||||
Quantity,
|
||||
Udc
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// tipologia di report (FILE rdlc) gestito in stampa...
|
||||
/// </summary>
|
||||
public enum reportRichiesto
|
||||
{
|
||||
ND,
|
||||
CartellinoFinitiOdette,
|
||||
CartellinoPedane,
|
||||
CartellinoSemilavorati
|
||||
}
|
||||
}
|
||||
+19
-8
@@ -224,22 +224,38 @@ namespace MagData
|
||||
public decodedData decodeBcode(string bcValue)
|
||||
{
|
||||
decodedData answ = new decodedData();
|
||||
int codeInt = 0;
|
||||
answ.rawData = bcValue;
|
||||
if (bcValue.StartsWith("M"))
|
||||
{
|
||||
answ.codeType = codeType.LottoInt;
|
||||
answ.code = bcValue.Replace("M", "");
|
||||
answ.codeInt = 0;
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"Lotto: {answ.code}";
|
||||
}
|
||||
else if (bcValue.StartsWith("PED"))
|
||||
{
|
||||
answ.codeType = codeType.PackList;
|
||||
answ.code = bcValue.Replace("PED", "");
|
||||
int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt);
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"Pedana: {bcValue}";
|
||||
}
|
||||
else if (bcValue.StartsWith("PL"))
|
||||
{
|
||||
answ.codeType = codeType.PackList;
|
||||
answ.code = bcValue.Replace("PL", "");
|
||||
int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt);
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"PackList: {answ.code}";
|
||||
}
|
||||
else if (bcValue.StartsWith("P"))
|
||||
{
|
||||
// conrollo se data (6 numeri...) oppure part...
|
||||
// controllo se data (6 numeri...) oppure part...
|
||||
if (bcValue.Length == 7)
|
||||
{
|
||||
answ.codeType = codeType.Date;
|
||||
answ.code = bcValue.Replace("P", "");
|
||||
int codeInt = 0;
|
||||
int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt);
|
||||
answ.codeInt = 0;
|
||||
answ.description = $"Data YYMMDD: {answ.code}";
|
||||
@@ -248,7 +264,6 @@ namespace MagData
|
||||
{
|
||||
answ.codeType = codeType.PartNumber;
|
||||
answ.code = bcValue.Replace("P", "");
|
||||
int codeInt = 0;
|
||||
int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt);
|
||||
answ.codeInt = 0;
|
||||
answ.description = $"PartNumber Odette: {answ.code}";
|
||||
@@ -262,7 +277,6 @@ namespace MagData
|
||||
{
|
||||
answ.codeType = codeType.Quantity;
|
||||
answ.code = bcValue.Replace("Q", "");
|
||||
int codeInt = 0;
|
||||
int.TryParse(answ.code, NumberStyles.Integer, CultureInfo.InvariantCulture, out codeInt);
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"Qty Odette: {answ.code}";
|
||||
@@ -283,7 +297,6 @@ namespace MagData
|
||||
{
|
||||
answ.codeType = codeType.Udc;
|
||||
answ.code = bcValue.Replace("S", "");
|
||||
int codeInt = 0;
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"UDC Odette: {answ.code}";
|
||||
}
|
||||
@@ -297,7 +310,6 @@ namespace MagData
|
||||
var riga = tabLotti[0];
|
||||
answ.codeType = codeType.Lotto;
|
||||
answ.code = bcValue;
|
||||
int codeInt = 0;
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"Lotto: {answ.code}";
|
||||
}
|
||||
@@ -314,7 +326,6 @@ namespace MagData
|
||||
{
|
||||
answ.codeType = codeType.Udc;
|
||||
answ.code = bcValue;
|
||||
int codeInt = 0;
|
||||
answ.codeInt = codeInt;
|
||||
answ.description = $"UDC: {answ.code}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user