コード例 #1
0
        private bool Process4010(string palletID, ref Int16 re, ref string reStr)
        {
            if (palletID.Length < 12)
            {
                reStr = string.Format("{0}条码长度不足", palletID);
                if (this.db1ValsToSnd[1] != 1)
                {
                    logRecorder.AddDebugLog(nodeName, reStr);
                }
                currentTaskDescribe  = reStr;
                this.db1ValsToSnd[1] = 1;
                return(false);
            }
            string strRe = MesAcc.ParsePalletID(palletID);

            if (string.IsNullOrWhiteSpace(strRe))
            {
                reStr = string.Format("{0}筐码解析失败,电芯型号未配置", palletID);
                if (this.db1ValsToSnd[1] != 2)
                {
                    logRecorder.AddDebugLog(nodeName, reStr);
                }
                currentTaskDescribe  = reStr;
                this.db1ValsToSnd[1] = 2;
                return(false);
            }
            JObject parseObj   = JsonConvert.DeserializeObject(strRe) as JObject;
            short   palletCata = 0;

            if ((parseObj == null) || (parseObj["料筐内衬类型"] == null) || (!short.TryParse(parseObj["料筐内衬PLC值"].ToString(), out palletCata)))
            {
                reStr = string.Format("{0}筐码解析失败,电芯内衬型号未配置", palletID);
                if (this.db1ValsToSnd[1] != 2)
                {
                    logRecorder.AddDebugLog(nodeName, reStr);
                }
                this.db1ValsToSnd[1] = 2;
                return(false);
            }
            re = (short)(1 + palletCata);
            return(true);
        }