Example #1
0
        /// <summary>
        /// 查询MES分拣数据
        /// </summary>
        /// <param name="step"></param>
        /// <param name="palletID"></param>
        /// <param name="vals">只能查到NG的电芯,其它都认为OK,1:ok,2:NG</param>
        /// <param name="reStr"></param>
        /// <returns></returns>
        protected bool MESGetGraspVals(int step, string palletID, ref List <int> vals, ref string reStr)
        {
            try
            {
                int channelMax = 36;
                //JObject paramObj = new JObject(new JProperty("Step", "19"), new JProperty("TrayNo", "TP2001"));
                //paramObj["Step"] = step.ToString();
                //paramObj["TrayNo"] = palletID;
                //string jsonParam = string.Format(" \"Step\":\"{0}\",\"TrayNo\":\"{1}\" ", step, palletID);

                ANCCellSeparation graspRe = this.MesAcc.GetCellSeparation(step, palletID);
                if (graspRe.ResultCode != 0)
                {
                    reStr = "查询MES分拣结果,返回失败,ResultCode=" + graspRe.ResultCode.ToString();
                    return(false);
                }
                JArray graspArray = (JArray)JsonConvert.DeserializeObject(graspRe.CellList);
                if (graspArray == null)
                {
                    reStr = "解析分拣数据失败";
                    return(false);
                }
                vals = new List <int>();
                for (int i = 0; i < channelMax; i++)
                {
                    int channel = i + 1;


                    bool schOk = false;
                    foreach (JObject cellObj in graspArray)
                    {
                        if (cellObj["CHANNEL"].ToString() == channel.ToString())
                        {
                            vals.Add(2);
                            schOk = true;
                            break;
                        }
                    }
                    if (!schOk)
                    {
                        vals.Add(1);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }
        }
Example #2
0
 public ANCCellSeparation GetCellSeparation(int step, string trayNO)
 {
     try
     {
         return(MesAcc.GetCellSeparation(step, trayNO));
     }
     catch (Exception ex)
     {
         ANCCellSeparation re = new ANCCellSeparation();
         re.ResultCode = -1;
         re.ResultMsg  = "MES网络异常:" + ex.Message;
         return(re);
     }
 }