/// <summary> /// 指定行列生成料盘,并按指定状态填充模组 /// </summary> /// <param name="row">行数</param> /// <param name="col">列数</param> /// <param name="res">模组状态 -3:随机生成,-2:为空,-1:待测,0:OK,>0:NG</param> public Tray(int row, int col, EM_CM_RES res = EM_CM_RES.UNTEST) { this.row = row; this.col = col; CreatePos(row, col, new ST_XYZA(), new ST_XYZA(), new ST_XYZA()); //添加模组 foreach (PosInf pos in list_pos) { MdDat md = new MdDat(); if (res == EM_CM_RES.RANDOM) { Random rdm = new Random(); res = (EM_CM_RES)rdm.Next(-2, 1); } if (res != EM_CM_RES.EMPTY) { md.res = (int)res; } else { md = null; } pos.md = md; } }
/// <summary> /// 提取指定状态,指定位置的模组 /// </summary> /// <param name="md">接受返回模组</param> /// <param name="idx">指定位置,默认不指定</param> /// <param name="res">指定状态,默认待测模组</param> /// <returns></returns> public EM_RES Pull(ref MdDat md, int idx = -1, EM_CM_RES res = EM_CM_RES.UNTEST) { PosInf posInf = list_pos.Find(s => { if (idx == -1 || s.idx == idx) { if (s.md != null && s.md.res == (int)res) { return(true); } } return(false); }); if (posInf != null) { md = posInf.md.Clone(); posInf.md = null; } else { md = null; return(EM_RES.END); } return(EM_RES.OK); }
/// <summary> /// 从文件加载料盘,并按指定状态填充模组 /// </summary> /// <param name="res">模组状态 -3:随机生成,-2:为空,-1:待测,0:OK,>0:NG</param> public Tray(string filename, EM_CM_RES res = EM_CM_RES.UNTEST) { if (filename.Length > 0) { strCfgPath = filename; } else { filename = strCfgPath; } LoadDat(filename); //添加模组 foreach (PosInf pos in list_pos) { MdDat md = new MdDat(); if (res == EM_CM_RES.RANDOM) { Random rdm = new Random(); res = (EM_CM_RES)rdm.Next(-2, 1); } if (res != EM_CM_RES.EMPTY) { md.res = (int)res; } else { md = null; } pos.md = md; } }
public List <PosInf> GetPosList(EM_CM_RES res = EM_CM_RES.UNTEST, int ngcode = -10000) { //NG分区 List <int> ls_idx = new List <int>(); List <int> ls_all_idx = new List <int>(); //if (ngcode != 0 && ngcode != -10000 && NGDef != null) //{ // ls_idx = NGDef.GetPosIdxListByNGCode(ngcode); // if (ls_idx.Count == 0) ls_all_idx = NGDef.GetPosIdxListDefByNGCode(); //} return(list_pos.FindAll(s => { if (s.isDisable == true) { return false; } switch (res) { //视觉NG case EM_CM_RES.CAMERR: if (s.md != null && s.md.res == (int)EM_CM_RES.CAMERR) { return true; } break; //空位 case EM_CM_RES.EMPTY: if (s.md == null) { //分区 if (ls_idx.Count != 0) { if (ls_idx.Contains(s.idx)) { return true; } } //未被定义分区 else if (ls_all_idx.Count != 0) { if (!ls_all_idx.Contains(s.idx)) { return true; } } else { return true; } } break; //待测 case EM_CM_RES.UNTEST: if (s.md != null && s.md.res == (int)EM_CM_RES.UNTEST) { return true; } break; //OK case EM_CM_RES.OK: if (s.md != null && s.md.res == (int)EM_CM_RES.OK) { return true; } break; //NG case EM_CM_RES.NG: if (s.md != null && s.md.res > 0) { //指定NG码 if (ngcode != -10000) { if (s.md.res == ngcode) { return true; } } else { return true; } } break; } return false; })); }