예제 #1
0
        ///// <summary>
        ///// db1 条码赋值
        ///// </summary>
        ///// <param name="barcode"></param>
        ///// <param name="db1StIndex">db1地址块索引起始,从0开始编号</param>
        //protected void BarcodeFillDB1(string barcode,int db1StIndex)
        //{
        //    byte[] barcodeBytes = System.Text.UTF8Encoding.Default.GetBytes(barcode);
        //    for (int i = 0; i < barcodeBytes.Count(); i++)
        //    {
        //        db1ValsToSnd[db1StIndex + i] = barcodeBytes[i];
        //    }
        //}

        ///// <summary>
        ///// 分析工位状态
        ///// </summary>
        ///// <param name="reStr"></param>
        ///// <returns></returns>
        //protected virtual bool NodeStatParse(ref string reStr)
        //{

        //    return true;
        //}
        #endregion
        #region MES接口的再封装

        /// <summary>
        /// 查询绑定数据
        /// </summary>
        /// <param name="palletID"></param>
        /// <returns></returns>
        protected bool MESGetProductsInPallet(string palletID, ref List <MesDBAccess.Model.ProductOnlineModel> batteryList, ref string reStr)
        {
            batteryList = new List <MesDBAccess.Model.ProductOnlineModel>();
            string strJsonCells = "";
            bool   re           = MesAcc.GetTrayBindingCell(palletID, out strJsonCells, ref reStr);

            if (!re)
            {
                reStr = "查询MES托盘电芯数据错误" + reStr;
                return(false);
            }
            JObject jsonCellObj = (JObject)JsonConvert.DeserializeObject(strJsonCells);

            if (jsonCellObj == null)
            {
                return(true);
            }
            for (int i = 0; i < SysCfg.SysCfgModel.TrayChannelMax; i++)
            {
                int    channel    = i + 1;
                string channelKey = "Cell" + channel.ToString();
                if (jsonCellObj[channelKey] == null)
                {
                    continue;
                }
                MesDBAccess.Model.ProductOnlineModel battery = new MesDBAccess.Model.ProductOnlineModel();
                battery.palletID     = palletID;
                battery.palletBinded = true;
                battery.productID    = jsonCellObj[channelKey].ToString().ToUpper();
                batteryList.Add(battery);
            }
            return(true);
        }
예제 #2
0
        ///// <summary>
        ///// db1 条码赋值
        ///// </summary>
        ///// <param name="barcode"></param>
        ///// <param name="db1StIndex">db1地址块索引起始,从0开始编号</param>
        //protected void BarcodeFillDB1(string barcode,int db1StIndex)
        //{
        //    byte[] barcodeBytes = System.Text.UTF8Encoding.Default.GetBytes(barcode);
        //    for (int i = 0; i < barcodeBytes.Count(); i++)
        //    {
        //        db1ValsToSnd[db1StIndex + i] = barcodeBytes[i];
        //    }
        //}

        ///// <summary>
        ///// 分析工位状态
        ///// </summary>
        ///// <param name="reStr"></param>
        ///// <returns></returns>
        //protected virtual bool NodeStatParse(ref string reStr)
        //{

        //    return true;
        //}
        #endregion
        #region MES接口的再封装

        /// <summary>
        /// 查询绑定数据
        /// </summary>
        /// <param name="palletID"></param>
        /// <returns></returns>
        protected bool MESGetProductsInPallet(string palletID, ref List <MesDBAccess.Model.ProductOnlineModel> batteryList, ref string reStr)
        {
            batteryList = new List <MesDBAccess.Model.ProductOnlineModel>();
            VMResultCells re = MesAcc.GetTrayBindingCell(palletID);

            if (re.ResultCode != 0)
            {
                reStr = "查询MES托盘电芯数据错误" + re.ResultMsg;
                return(false);
            }
            JObject jsonCellObj = (JObject)JsonConvert.DeserializeObject(re.Cells);

            if (jsonCellObj == null)
            {
                return(true);
            }
            for (int i = 0; i < 36; i++)
            {
                int    channel    = i + 1;
                string channelKey = "Cell" + channel.ToString();
                if (jsonCellObj[channelKey] == null)
                {
                    continue;
                }
                MesDBAccess.Model.ProductOnlineModel battery = new MesDBAccess.Model.ProductOnlineModel();
                battery.palletID     = palletID;
                battery.palletBinded = true;
                battery.tag1         = channel.ToString();
                battery.productID    = jsonCellObj[channelKey].ToString().ToUpper();
                batteryList.Add(battery);
            }
            return(true);
        }