private IList <TestBag> GenerateTestBag(byte GelIndex, IEnumerable <SKABO.Common.Models.NotDuplex.SampleInfo> infos, SKABO.Common.Enums.TestLevelEnum testLevel) { if (infos.Count() == 0) { return(null); } IList <TestBag> result = new List <TestBag>(); var gp = infos.GroupBy(item => item.RackIndex); var count = gp.Count(); T_Gel GelType = GelList[GelIndex]; for (int i = 0; i < count; i++) { var RackIndex = gp.ElementAt(i).Key; var CurentSR = SampleRacks.Where(item => item.Index == RackIndex).FirstOrDefault(); for (byte x = 0; x < CurentSR.Count; x++) { if (CurentSR.Values[x, 0] == null || CurentSR.Values[x, 0].ToString().EndsWith(",F")) { InvokeSetValue(CurentSR, x, 0, null); } } TestBag testBag = new TestBag(testLevel); testBag.GelType = GelType; foreach (var s in gp.ElementAt(i)) { testBag.Add(s.Barcode, s.RackIndex, s.Index); CurentSR.SetValue(s.Index, 0, s.Barcode); if (testBag.SamplesInfo.Count == TestBag.MaxCount) { result.Add(testBag); testBag = new TestBag(testLevel); testBag.GelType = GelType; } } if (testBag.SamplesInfo.Count < TestBag.MaxCount) { result.Add(testBag); } } return(result); }
public void Logic(ResInfoData resinfo, double dt) { switch (resinfo.GetActionAt(0)) { case ActionPointType.Hatch: { if (resinfo.Purpose == "1") { resinfo.HatchCurTime += dt; if (resinfo.HatchCurTime >= resinfo.HatchTime) { resinfo.RemoveActionAt(0); } } else if (!(resinfo.Purpose == "4" && actionmanager.getAllActionsCount(piercerDevice) != 0)) { var seque = Sequence.create(); var put_seat = resmanager.GetResByCode("null", "T_BJ_GelSeat", "", "1"); if (put_seat == null && resinfo.Purpose != "3") { put_seat = resmanager.GetResByCode("null", "T_BJ_GelSeat", "", "3"); } if (put_seat != null) { ResInfoData put_gel = null; if (resinfo.Purpose == "lxj") { //CentrifugeMDevice cendev = cenMrg.GetCentrifugeByCode(resinfo.CenCode); //seque.AddAction(MoveTo.create(cendev, 30000, -1, -1, 0)); //seque.AddAction(InitXyz.create(cendev, 30000, false, false, true)); put_gel = generater.GenerateTakeGelFromCent(resinfo, resinfo.CenCode, ref seque); } else { put_gel = generater.GenerateTakeGelFromNormal(resinfo, ref seque); } put_gel.HatchCurTime = 0; generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque); seque.runAction(handDevice); } } } break; case ActionPointType.Centrifugal: { if (resinfo.Purpose != "lxj" && !(resinfo.Purpose == "4" && actionmanager.getAllActionsCount(piercerDevice) != 0)) { foreach (var seat in resmanager.centrifuge_list) { CentrifugeMDevice cendev = cenMrg.GetCentrifugeByCode(seat.Code); if (seat.Status == 1 && cendev != null) { bool iscanputcen = IsCanPutCen(cendev); var seque = Sequence.create(); var put_seat = resmanager.GetResByCode("null", "T_BJ_Centrifuge", cendev.Centrifugem.Code.SetValue); if (iscanputcen == false) { put_seat = null; } if (put_seat == null && resinfo.Purpose != "3") { put_seat = resmanager.GetResByCode("null", "T_BJ_GelSeat", "", "3"); } if (put_seat != null) { var spaw = Spawn.create(); var put_seque = Sequence.create(); var put_gel = generater.GenerateTakeGelFromNormal(resinfo, ref put_seque); spaw.AddAction(put_seque); seque.AddAction(spaw); if (put_seat.Purpose == "lxj") { spaw.AddAction(MoveTo.create(cendev, 30001, -1, -1, put_seat.CenGelP[put_seat.CountX])); generater.GeneratePutGelToCent(cendev.Centrifugem.Code.SetValue, put_seat, put_gel, ref seque); } else { generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque); } seque.runAction(handDevice); break; } } } } } break; case ActionPointType.PutPeiGelBack: { var seque = Sequence.create(); var put_seat = resmanager.GetResByCode("null", "T_BJ_GelSeat", "", "2"); if (put_seat != null && resinfo.Purpose == "lxj") { //CentrifugeMDevice cendev = cenMrg.GetCentrifugeByCode(resinfo.CenCode); //seque.AddAction(MoveTo.create(cendev, 30000, -1, -1, 0)); //seque.AddAction(InitXyz.create(cendev, 30000, false, false, true)); var put_gel = generater.GenerateTakeGelFromCent(resinfo, resinfo.CenCode, ref seque); generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque); seque.AddAction(SkCallBackFun.create((ActionBase acttem) => { resinfo.RemoveActionAt(0); return(true); })); seque.runAction(handDevice); } } break; case ActionPointType.Camera: { var seque = Sequence.create(); var put_seat = resmanager.GetResByCode("", "T_BJ_Camera"); var wasted_seat = resmanager.GetResByCode("", "T_BJ_WastedSeat"); if (put_seat != null && wasted_seat != null && !(resinfo.Purpose == "4" && actionmanager.getAllActionsCount(piercerDevice) != 0)) { ResInfoData put_gel = null; if (resinfo.Purpose == "lxj") { //CentrifugeMDevice cendev = cenMrg.GetCentrifugeByCode(resinfo.CenCode); //seque.AddAction(MoveTo.create(cendev, 30000, -1, -1, 0)); //seque.AddAction(InitXyz.create(cendev, 30000, false, false, true)); put_gel = generater.GenerateTakeGelFromCent(resinfo, resinfo.CenCode, ref seque); } else { put_gel = generater.GenerateTakeGelFromNormal(resinfo, ref seque); } seque.AddAction(MoveTo.create(handDevice, 3000, -1, -1, 0)); seque.AddAction(MoveTo.create(handDevice, 3000, (int)put_seat.X, (int)(put_seat.Y), -1)); seque.AddAction(MoveTo.create(handDevice, 3000, -1, -1, (int)(put_seat.Z))); //拍照分析 seque.AddAction(SkCallBackFun.create((ActionBase acttem) => { bool result = true; if (cameraDevice.IsOpen == false) { result = cameraDevice.Open(); } var bm = cameraDevice.CaptureImage(); var bag = new TestBag(Common.Enums.TestLevelEnum.Normal); var gel = new Gel(resinfo.GetGelMask()); bag.GelType = resinfo.gel; bag.Add(resinfo.GetSampleBarcode(), (byte)resinfo.GetSampleRackIndex(), (byte)resinfo.CountX); bag.SetStartTime(resinfo.StartTime); gel.SampleBarcodes.Add(resinfo.GetSampleBarcode()); cameraDevice.Save(bag, gel, bm, "888"); //cameraDevice.Close(); put_gel.RemoveActionAt(0); return(true); })); seque.AddAction(MoveTo.create(handDevice, 3000, (int)wasted_seat.X, (int)(wasted_seat.Y))); seque.AddAction(HandPutCard.create(handDevice, 3000, (int)wasted_seat.ZPut, 0)); seque.runAction(handDevice); } } break; } }