152 lines
5.1 KiB
C#
152 lines
5.1 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace MP_MAG.WebUserControls
|
|
{
|
|
public partial class cmp_listODL : BaseUserControl
|
|
{
|
|
#region Private Methods
|
|
|
|
private void Cmp_numRow_eh_doRefresh(object sender, EventArgs e)
|
|
{
|
|
grView.PageSize = cmp_numRow.numRow;
|
|
}
|
|
|
|
private void resetSelezione()
|
|
{
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
raiseReset();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// recupero ODL
|
|
int IdxODL = 0;
|
|
if (grView.SelectedIndex >= 0)
|
|
{
|
|
int.TryParse($"{grView.SelectedValue}", out IdxODL);
|
|
|
|
// salvo in cookie i dati idxODL, idxMacchina e QtaUdc x successivo impiego
|
|
string IdxMacchina = ddlMacchina.SelectedValue;
|
|
int QtaUdc = QtaUdcByOdl(IdxODL);
|
|
if (QtaUdc <= 0)
|
|
{
|
|
QtaUdc = 100;
|
|
}
|
|
bool isFinito = false;
|
|
string ArtCod = "";
|
|
string ArtDesc = "";
|
|
string CliCod = "";
|
|
string CliDescr = "";
|
|
string OrdRifExt = "";
|
|
int QtaConf = 0;
|
|
int QtaOdl = 0;
|
|
string Lotto = "";
|
|
string CodPost = IdxMacchina;
|
|
// recupero dati da tab LOTTI
|
|
var tabLotti = MagDataLayerObj.taEL.getByOdl(IdxODL);
|
|
if (tabLotti.Rows.Count > 0)
|
|
{
|
|
ArtCod = tabLotti[0].CodArt;
|
|
Lotto = tabLotti[0].Lotto;
|
|
var tabOdl = DataLayerObj.taODL.getByIdx(IdxODL, false);
|
|
var tabArt = MagDataLayerObj.taAA.getByKey(ArtCod);
|
|
if (tabArt.Rows.Count > 0)
|
|
{
|
|
isFinito = tabArt[0].CodStato == "FIN";
|
|
ArtCod = tabArt[0].CodArt;
|
|
ArtDesc = tabArt[0].DescrArt;
|
|
if (tabOdl.Rows.Count > 0)
|
|
{
|
|
QtaOdl = tabOdl[0].NumPezzi;
|
|
}
|
|
|
|
// cerco qta confermata
|
|
var tabDatiProdAct = DataLayerObj.taStatoProd.GetData(IdxMacchina, DateTime.Now);
|
|
if (tabDatiProdAct.Rows.Count > 0)
|
|
{
|
|
QtaConf = tabDatiProdAct[0].PzConfBuoni;
|
|
}
|
|
var tabAA2C = MagDataLayerObj.taAA2C.getByCodArt(ArtCod);
|
|
if (tabAA2C.Rows.Count > 0)
|
|
{
|
|
CliCod = tabAA2C[0].CodCliente;
|
|
}
|
|
}
|
|
}
|
|
MagData.prodPrintData newProdPrintData = new MagData.prodPrintData(MagData.MagDataLayer.man.currProdPrintData.MatrOpr, IdxODL, IdxMacchina, QtaUdc, isFinito, ArtCod, ArtDesc, CliCod, CliDescr, OrdRifExt, QtaConf, QtaOdl, Lotto, CodPost);
|
|
// salvo in oggetto dedicato...
|
|
MagData.MagDataLayer.man.currProdPrintData = newProdPrintData;
|
|
string tgtPage = "printCartOdl";
|
|
Response.Redirect($"~/SMART/{tgtPage}");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// comando reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
protected void lbtResetSearch_Click(object sender, EventArgs e)
|
|
{
|
|
// reset ricerca!
|
|
txtSearch.Text = "";
|
|
}
|
|
|
|
protected void lbtSearch_Click(object sender, EventArgs e)
|
|
{
|
|
// ricerca senza fare nulla
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
cmp_numRow.numRow = 10;
|
|
grView.PageSize = cmp_numRow.numRow;
|
|
}
|
|
cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh;
|
|
}
|
|
|
|
protected int QtaUdcByOdl(int idxOdl)
|
|
{
|
|
int answ = 1;
|
|
string codGrp = "IMB";
|
|
string codVal = "NUM_PZ_CONT";
|
|
// recupero dato da scheda tecnica della quantità per UDC
|
|
var tabSTAR = DataLayerObj.taSTAR.getByGrpOdlLbl(codGrp, codVal, idxOdl);
|
|
if (tabSTAR.Rows.Count > 0)
|
|
{
|
|
try
|
|
{
|
|
int.TryParse(tabSTAR[0].Value, out answ);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
|
{
|
|
// esegue update senza fare nulla
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |