public MdDat Clone() { MdDat md = new MdDat(); md.st_pos = new ST_XYZA(); md.st_pos.x = st_pos.x; md.st_pos.y = st_pos.y; md.st_pos.z = st_pos.z; md.st_pos.a = st_pos.a; md.pos = new ST_XYZA(); md.pos.x = pos.x; md.pos.y = pos.y; md.pos.z = pos.z; md.pos.a = pos.a; md.Num = Num; md.WS_ID = WS_ID; md.PC_ID = PC_ID; md.PC_IP = PC_IP; md.test_idx = test_idx; md.TestBox_ID = TestBox_ID; md.SN = SN; md.res = res; md.ct = ct; md.bardcode = bardcode; md.benable = benable; md.idx = idx; md.tray_barcode = tray_barcode; return(md); }
/// <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; } }
/// <summary> /// 放置模组到指定位置 /// </summary> /// <param name="md">要放置的模组</param> /// <param name="idx">指定位置</param> /// <returns></returns> public EM_RES Push(MdDat md, int idx = -1) { //获取空位置 List <PosInf> ls_pos = GetPosList(EM_CM_RES.EMPTY, md.res); if (ls_pos == null || ls_pos.Count == 0) { return(EM_RES.PARA_OUTOFRANG); } //如果指定位置 if (idx != -1) { idx = ls_pos.FindIndex(s => { return(s.idx == idx); }); } else { idx = 0; } if (idx < 0 || idx >= ls_pos.Count) { return(EM_RES.PARA_OUTOFRANG); } //push md.idx = idx; md.pos = ls_pos.ElementAt(idx).Pos; md.tray_barcode = barcode; ls_pos.ElementAt(idx).md = md.Clone(); //最后一个返回END if (list_pos.Count == 1) { return(EM_RES.END); } else { return(EM_RES.OK); } }