using AppData; using SteamWare; using System; namespace NKC_WF { public partial class MachineUnload : BasePage { /// /// Codice macchina (HARD CODED x ora) /// protected string machine = "WRK001"; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((SiteMaster)this.Master).showSearch = false; BatchId = -1; SheetId = -1; doUpdate(); } } /// /// BatchId corrente... /// public int BatchId { set { hfBatchID.Value = value.ToString(); } get { int answ = 0; int.TryParse(hfBatchID.Value, out answ); return answ; } } /// /// SheetId corrente... /// public int SheetId { set { hfSheetID.Value = value.ToString(); } get { int answ = 0; int.TryParse(hfSheetID.Value, out answ); return answ; } } /// /// Aggiorna componente principale e child components /// private void doUpdate() { // imposto dati correnti bool doUpdate = setCurrData(); if (doUpdate) { // aggiorno child cmp_MU_stats.BatchId = BatchId; cmp_MU_bins.BatchId = BatchId; cmp_MU_carts.BatchId = BatchId; cmp_MU_svgViewer.BatchId = BatchId; cmp_MU_svgViewer.SheetId = SheetId; cmp_MU_svgViewer.doUpdate(); } } /// /// Imposta dati correnti (Bunk / Sheet) indicando SE fare update /// private bool setCurrData() { bool needUpdate = false; // recupero bunk corrente... DS_App.StackListRow currBunk = ComLib.getCurrBunk(); if (currBunk != null) { if (BatchId != currBunk.BatchID) { BatchId = currBunk.BatchID; needUpdate = true; } DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); if (currSheet != null) { if (SheetId != currSheet.SheetID) { SheetId = currSheet.SheetID; needUpdate = true; } } } else { BatchId = 0; ComLib.man.resetSheetUnload(0); } // se sheet/bunk 0 --> update! if (BatchId == 0 && SheetId == 0) { needUpdate = true; } return needUpdate; } protected void timerSvg_Tick(object sender, EventArgs e) { // in base al num di sec dell'ora decido cosa aggiornare... int counter = numWaitSvg; doUpdate(); // ogni x cicli if (counter % 10 == 0) { cmp_MU_stats.doUpdate(); upnlStats.Update(); } // faccio update bin/cart ogni pari/dispari... else if (counter % 2 == 0) { cmp_MU_carts.doUpdate(); upnlCarts.Update(); } else { cmp_MU_bins.doUpdate(); upnlBins.Update(); } incrNumWait(); } /// /// stringa x contatore refresh redis... /// protected string redProdReq { get { return $"{ComLib.redMachUnloadCount}:{Session.SessionID}"; } } /// /// stringa x contatore refresh redis... /// protected string redProdForceReload { get { return ComLib.redMachUnloadForce; } } protected int numWaitSvg { get { return memLayer.ML.getRCnt(redProdReq); } } /// /// Incrementa counter redis /// protected void incrNumWait() { if (numWaitSvg > 30) { memLayer.ML.resetRCnt(redProdReq); } memLayer.ML.setRCntI(redProdReq); } } }