diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index 62d72bfe..cb10bd9a 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -488,34 +488,36 @@ namespace IOB_WIN // altrimenti uso dati da TCiclo registrati... else { - currServerCount = utils.callUrl(urlGetPzCountRec); - lgInfo("Lettura contapezzi da TCiclo dall'url {0} --> num pz: {1}", urlGetPzCountRec, currServerCount); + // leggo PRIMA ODL .... lastIdxODL = utils.callUrl(urlGetCurrODL); lgInfo("Lettura ODL dall'url {0} --> {1}", urlGetPzCountRec, lastIdxODL); + // POI leggo i pezzi + currServerCount = utils.callUrl(urlGetPzCountRec); + lgInfo("Lettura contapezzi da TCiclo dall'url {0} --> num pz: {1}", urlGetPzCountRec, currServerCount); } - if (currServerCount != "") + // controllo: SE NON HO ODL... + if (lastIdxODL == "" || lastIdxODL == "0") { - // se "-1" resto a ultimo... - if (currServerCount != "-1") - { - int.TryParse(currServerCount, out contapezzi); - lgInfo("Ricevuta conferma da server di {0} pezzi registrati per ODL", currServerCount); - } - else - { - // NON AGGIORNO - contapezzi = lastCountCNC; - lgInfo("Errore lettura contapezzi (-1) - uso lastCountCNC --> " + contapezzi); - } + // NON AGGIORNO + contapezzi = lastCountCNC; + lgInfo(string.Format("Errore lettura ODL: {0} - uso lastCountCNC --> {1}", lastIdxODL, contapezzi)); } else { - // controllo SE HO ODL... - if (lastIdxODL == "" || lastIdxODL == "0") + if (currServerCount != "") { - // NON AGGIORNO - contapezzi = lastCountCNC; - lgInfo(string.Format("Errore lettura ODL: {0} - uso lastCountCNC --> {1}", lastIdxODL, contapezzi)); + // se "-1" resto a ultimo... + if (currServerCount != "-1") + { + int.TryParse(currServerCount, out contapezzi); + lgInfo("Ricevuta conferma da server di {0} pezzi registrati per ODL", currServerCount); + } + else + { + // NON AGGIORNO + contapezzi = lastCountCNC; + lgInfo("Errore lettura contapezzi (-1) - uso lastCountCNC --> " + contapezzi); + } } else { @@ -526,6 +528,7 @@ namespace IOB_WIN // segno contapezzi a zero... contapezzi = 0; lgInfo("RESET contapezzi (ZERO)"); + } } }