using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SteamWare; using GMW_data; namespace GMW_Term.WebUserControls { public partial class mod_makeMov : System.Web.UI.UserControl { /// /// wrapper traduzione termini /// /// /// public string traduci(string lemma) { return user_std.UtSn.Traduci(lemma); } /// /// chiamata principale /// /// /// protected void Page_Load(object sender, EventArgs e) { updateMakeMov(); } /// /// aggiorna lo stato dell'operazione di movimentazione /// public void updateMakeMov() { // recupero barcode e controllo sia valido string _UDC = memLayer.ML.StringSessionObj("UDC_sel"); int _idxCella = memLayer.ML.IntSessionObj("IdxCella_sel"); string _codCella = memLayer.ML.StringSessionObj("codCella_sel"); // aggiorno labels standard lblCella.Text = traduci("lblCella"); lblUDC.Text = traduci("lblUDC"); btnConferma.Text = traduci("btnConferma"); btnAnnulla.Text = traduci("btnAnnulla"); // aggiorno labels valori lblCodCella.Text = _codCella; lblCodUDC.Text = _UDC; // controllo se ci siano UDC/Cella validi if (_UDC != "" && _codCella != "") { // SE cella vuota procedo! if (!MagClass.magazzino.cellaPiena(memLayer.ML.confReadString("codCS"), _idxCella)) { spostaUdc(_UDC, _idxCella, _codCella); } else { // se cella piena chiedo conferma btnConferma.Visible = true; btnAnnulla.Visible = true; } } else { btnConferma.Visible = false; btnAnnulla.Visible = false; } } /// /// effettua spostamento UDC sparato da barcode /// /// /// /// private void spostaUdc(string _UDC, int _idxCella, string _codCella) { // controllo UDC sia spostabile (ovvero NON in RLP bloccata) if (MagClass.magazzino.checkUDC_mov(_UDC)) { MagClass.magazzino.spostaUDC(memLayer.ML.confReadString("codCS"), _UDC, _idxCella, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName); btnConferma.Visible = false; btnAnnulla.Visible = false; lblEsito.Text = string.Format("{0} {1} --> {2} ", traduci("ConfermaSpostatoUDC"), _UDC, _codCella); } else { lblEsito.Text = string.Format("{0} {1}", traduci("UdcNonSpostabile"), _UDC); } resetAndUpdate(); } /// /// CONFERMA associazione UDC/CELLA /// /// /// protected void btnConferma_Click(object sender, EventArgs e) { // calcolo valori string _UDC = memLayer.ML.StringSessionObj("UDC_sel"); int _idxCella = memLayer.ML.IntSessionObj("IdxCella_sel"); string _codCella = memLayer.ML.StringSessionObj("codCella_sel"); // controllo UDC sia spostabile (ovvero NON in RLP bloccata) if (MagClass.magazzino.checkUDC_mov(_UDC)) { // sposto UDC precedente in posizione preimpostata da web.config string codCellaErroriAnime = memLayer.ML.confReadString("codCellaErroriAnime"); int idxCellaTo = MagClass.magazzino.taCelle.getByCodCella(codCellaErroriAnime)[0].IdxCella; string udc2move = MagClass.magazzino.udcInCella(memLayer.ML.confReadString("codCS"), _idxCella); // sposto udc in posizione "errori anime"... MagClass.magazzino.spostaUDC(memLayer.ML.confReadString("codCS"), udc2move, idxCellaTo, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName); lblEsito.Text = string.Format("{0} {1} --> {2} ", traduci("ConfermaSpostatoUDC"), _UDC, _codCella); // sposto "vero" UDC spostaUdc(_UDC, _idxCella, _codCella); } else { lblEsito.Text = string.Format("{0} {1}", traduci("UdcNonSpostabile"), _UDC); } resetAndUpdate(); } /// /// aggiorna visualizzazioni e resetta /// private void resetAndUpdate() { //memLayer.ML.emptySessionVal("UDC_sel"); //memLayer.ML.emptySessionVal("IdxCella_sel"); //memLayer.ML.emptySessionVal("codCella_sel"); GMW_data.TermClass.Ter.resetScanBarcode(true, true, false); // aggiorno visualizzazione updateMakeMov(); lblErrore.Visible = false; } /// /// annulla associazione UDC / CELLA /// /// /// protected void btnAnnulla_Click(object sender, EventArgs e) { resetAndUpdate(); } } }