示例#1
0
        public void PutDownGel()
        {
            if (this.SelectedBJ == null)
            {
                return;
            }
            var resmanager = ResManager.getInstance();
            var generater  = ActionGenerater.getInstance();
            var seque      = Sequence.create();

            seque.AddAction(MoveTo.create(3000, -1, -1, 0));
            var put_gel = resmanager.handseat_resinfo;

            if (SelectedBJ is T_BJ_GelSeat gel_seat)
            {
                var put_seat = resmanager.SearchGelCard("T_BJ_GelSeat", gel_seat.Code, "", SeatIndex);
                generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque);
            }
            else if (SelectedBJ is T_BJ_Centrifuge cen_seat)
            {
                var put_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", cen_seat.Code, "", SeatIndex);
                generater.GeneratePutGelToCent(cen_seat.Code, put_seat, put_gel, ref seque);
            }
            else if (SelectedBJ is T_BJ_GelWarehouse ware_seat)
            {
                var put_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", ware_seat.Code, "", SeatIndex);
                generater.GeneratePutGelToWare(put_seat, put_gel, ref seque);
            }
            else if (SelectedBJ is T_BJ_WastedSeat wasted_seat)
            {
                var put_seat = resmanager.SearchGelCard("T_BJ_WastedSeat", "", "1", SeatIndex);
                generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque);
            }
            seque.runAction(handDevice);
        }
示例#2
0
        public void TakeGel()
        {
            if (this.SelectedBJ == null)
            {
                return;
            }
            var resmanager = ResManager.getInstance();
            var generater  = ActionGenerater.getInstance();
            var seque      = Sequence.create();

            seque.AddAction(MoveTo.create(handDevice, 3000, -1, -1, 0));
            if (SelectedBJ is T_BJ_GelSeat gel_seat)
            {
                var take_seat = resmanager.SearchGelCard("T_BJ_GelSeat", gel_seat.Code, "", SeatIndex);
                generater.GenerateTakeGelFromNormal(take_seat, ref seque);
            }
            else if (SelectedBJ is T_BJ_Centrifuge cen_seat)
            {
                var take_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", cen_seat.Code, "", SeatIndex);
                var act       = generater.GenerateTakeGelFromCent(take_seat, cen_seat.Code, ref seque);
            }
            else if (SelectedBJ is T_BJ_GelWarehouse ware_seat)
            {
                var take_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", ware_seat._Code, "", SeatIndex);
                var act       = generater.GenerateTakeGelFromWare(take_seat, ref seque);
            }
            seque.runAction(handDevice);
        }
示例#3
0
        public void Ok()
        {
            var resmanager = ResManager.getInstance();
            var actiongen  = ActionGenerater.getInstance();
            var GelList    = (this.View as ScanSampleView).GelList;
            List <T_GelStep> gelstep_list = new List <T_GelStep>();

            foreach (var sample in Samples)
            {
                var test_list = sample.GetTestList();
                var gel_list  = new List <ResInfoData>();
                foreach (var test in test_list)
                {
                    var ware_seat = resmanager.GetResByCode(GelList[test].GelMask + "*", "T_BJ_GelWarehouse", "", "", lastinfo_list);
                    if (ware_seat == null)
                    {
                        ErrorSystem.WriteActError("无卡", true, false);
                        return;
                    }
                    ware_seat.sampleinfo = sample;
                    lastinfo_list.Add(ware_seat);
                    gel_list.Add(ware_seat);
                }
                foreach (var ware_seat in gel_list)
                {
                    var gelend = new T_GelStep();
                    gelstep_list     = gelstep_list.Concat(actiongen.ResolveActions(ware_seat)).ToList();
                    gelend.StepClass = TestStepEnum.GELEND;
                    gelstep_list.Add(gelend);
                }
            }
            //破孔位还有多小个
            int paperseat_count = 9;

            for (int i = 0; i < gelstep_list.Count; i++)
            {
                if (gelstep_list[i].StepClass == TestStepEnum.LoadGel && paperseat_count > 0)
                {
                    gelstep_list[i].StepIndex = 10000 - i;
                    paperseat_count--;
                }
                else
                {
                    gelstep_list[i].StepIndex = 1000 - i;
                }
            }
            gelstep_list.Sort((T_GelStep a, T_GelStep b) => { return(a.StepIndex < b.StepIndex ? 1 : -1); });
            var action_tree = actiongen.DivideIntoGroups(gelstep_list, 1);

            InjLogicManager.getInstance().AddAction(action_tree);

            this.RequestClose();
        }
示例#4
0
        public void Ok()
        {
            var resmanager = ResManager.getInstance();
            var actiongen  = ActionGenerater.getInstance();
            var GelList    = (this.View as ScanSampleView).GelList;
            List <T_GelStep> gelstep_list = new List <T_GelStep>();
            bool             isRepeat     = Samples.Where(item => item.Barcode != "").GroupBy(i => i.Barcode).Any(g => g.Count() > 1);

            if (isRepeat)
            {
                ErrorSystem.WriteActError("样本条码有重复!", true, false);
            }
            else
            {
                var samples_list = Samples.Where(item => item.Barcode != "").ToList();
                foreach (var sample in samples_list)
                {
                    if (sample.Barcode != "")
                    {
                        var test_list = sample.GetTestList();
                        var gel_list  = new List <T_Gel>();
                        foreach (var test in test_list)
                        {
                            var gel = GelList[test].clone();
                            if (gel.IsCrossMatching)
                            {
                                //交叉配血
                                //寻找当前木样本架连续位
                                var sample_list = GetCrossMatchingSampleInfo(sample);
                                foreach (var sample_tem in sample_list)
                                {
                                    gel = GelList[test].clone();
                                    var exp_package = ExperimentPackage.Create(actiongen.ResolveActions(gel), gel.GelMask, sample.Barcode, sample_tem.Barcode, sample.GetLever(), gel.GelType, gel.GelRenFen, gel.AfterKKTime, gel.IsUsedGel, gel.ID, gel.IsCrossMatching, g_batch_id, is_double);
                                    ExperimentLogic.getInstance().AddPackage(exp_package);
                                }
                            }
                            else
                            {
                                var exp_package = ExperimentPackage.Create(actiongen.ResolveActions(gel), gel.GelMask, sample.Barcode, "", sample.GetLever(), gel.GelType, gel.GelRenFen, gel.AfterKKTime, gel.IsUsedGel, gel.ID, gel.IsCrossMatching, g_batch_id, is_double);
                                ExperimentLogic.getInstance().AddPackage(exp_package);
                            }
                        }
                    }
                }
                ExperimentLogic.getInstance().UpDataAction();
                this.RequestClose();
                g_batch_id++;
            }
        }
示例#5
0
        public override void run(double dt)
        {
            bool resultx               = true;
            bool resulty               = true;
            bool resultz               = true;
            int  device_rx             = 0;
            int  device_cx             = 0;
            AbstractCanDevice checkdev = null;
            var handdev   = ActionGenerater.getInstance().handDevice;
            var injectdev = ActionGenerater.getInstance().injectorDevice;

            if (CountTime(dt))
            {
                return;
            }
            var device = new ActionDevice(node);

            if (node is InjectorDevice)
            {
                checkdev  = ActionGenerater.getInstance().handDevice;
                device_cx = (int)handdev.Hand.XMotor.CurrentDistance;
            }
            else if (node is MachineHandDevice)
            {
                checkdev  = ActionGenerater.getInstance().injectorDevice;
                device_cx = (int)injectdev.Injector.XMotor.CurrentDistance;
            }
            switch (step)
            {
            case 0:
                if (x >= 0 && checkdev != null && false)
                {
                    sumdt      = 0;
                    wait_time += dt;
                    if (wait_time > 500)
                    {
                        wait_time = 0;
                        bool is_timeout = false;
                        if (checkdev is MachineHandDevice)
                        {
                            handdev.CanComm.ReadRegister(handdev.Hand.XMotor.RealDistance.Addr);
                            device_rx = handdev.CanComm.GetIntBlock(handdev.Hand.XMotor.RealDistance.Addr, 1000, out is_timeout);
                        }
                        else if (checkdev is InjectorDevice)
                        {
                            injectdev.CanComm.ReadRegister(injectdev.Injector.XMotor.RealDistance.Addr);
                            device_rx = injectdev.CanComm.GetIntBlock(injectdev.Injector.XMotor.RealDistance.Addr, 1000, out is_timeout);
                        }
                        if (is_timeout == false)
                        {
                            int device_max = 10000 - x;
                            if (device_max < 0)
                            {
                                device_max = 0;
                            }
                            if (device_rx <= device_max && device_cx <= device_max)
                            {
                                step++;
                            }
                            else if (ActionManager.getInstance().getAllRuningActionsCount(checkdev) == 0)
                            {
                                Sequence          sequ = null;
                                List <Enterclose> ents = new List <Enterclose>();
                                ents.Add(injectdev.Injector.Entercloses[0]);
                                if (checkdev is MachineHandDevice)
                                {
                                    sequ = Sequence.create(MoveTo.create(checkdev, 3000, -1, -1, 0), MoveTo.create(checkdev, 3000, device_max, -1, -1));
                                }
                                else if (checkdev is InjectorDevice)
                                {
                                    sequ = Sequence.create(InjectMoveTo.create(3000, ents.ToArray(), -1, IMask.Gen(-1), IMask.Gen(0)), MoveTo.create(checkdev, 3000, device_max, -1, -1));
                                }
                                sequ.runAction(checkdev);
                            }
                        }
                    }
                }
                else
                {
                }
                step++;
                break;

            case 1:
                if (x >= 0)
                {
                    resultx = device.MoveX((int)x);
                }
                if (y >= 0)
                {
                    resulty = device.MoveY((int)y);
                }
                if (z >= 0)
                {
                    resultz = device.MoveZ((int)z, speed);
                }
                if (resultx && resulty && resultz)
                {
                    step++;
                }
                break;

            case 2:
                if (xdone == false)
                {
                    xdone = device.DoneX();
                }
                if (ydone == false)
                {
                    ydone = device.DoneY();
                }
                if (zdone == false)
                {
                    zdone = device.DoneZ();
                }
                isfinish = xdone && ydone && zdone;
                break;
            }
        }
示例#6
0
        private bool RunLogic(IList <T_LogicStep> steps, out String msg)
        {
            msg = null;
            var seque_root = Sequence.create();
            var seque      = Sequence.create();
            var resmanager = ResManager.getInstance();
            var generater  = ActionGenerater.getInstance();
            int loop_times = 0;

            foreach (var step in steps)
            {
                switch (step.StepEnum)
                {
                case LogicStepEnum.Alert:
                    seque.AddAction(SkCallBackFun.create((ActionBase act_tem) =>
                    {
                        ErrorSystem.WriteActError(step.Parameters, true, false, 9999);
                        return(true);
                    }));
                    break;

                case LogicStepEnum.InitAll:
                    var act_init = opDevice.InitAllDevice();
                    seque.AddAction(act_init);
                    break;

                case LogicStepEnum.Centrifuge:
                {
                    CommonAction action = Convert2T <CommonAction>(step.Parameters);
                    var          cen    = cenMrg.GetCentrifugeByCode(action.Code);
                    if (cen != null)
                    {
                        if (action.DoAction == 0)        //正常离心程序
                        {
                            int hspeed  = (int)cen.Centrifugem.HightSpeed.SetValue;
                            int lspeed  = (int)cen.Centrifugem.LowSpeed.SetValue;
                            int htime   = (int)cen.Centrifugem.HightSpeedTime.SetValue;
                            int ltime   = (int)cen.Centrifugem.LowSpeedTime.SetValue;
                            int uphtime = (int)cen.Centrifugem.AddHSpeedTime.SetValue;
                            int upltime = (int)cen.Centrifugem.AddLSpeedTime.SetValue;
                            int stime   = (int)cen.Centrifugem.StopSpeedTime.SetValue;
                            var act     = CentrifugeStart.create(cen, 3000000, hspeed, lspeed, htime, ltime, uphtime, upltime, stime);
                            seque.AddAction(act);
                        }
                        else if (action.DoAction == 1)        //移动指定卡位
                        {
                            var resinfo = ResManager.getInstance().SearchGelCard("T_BJ_Centrifuge", action.Code, "", (int)action.SeatIndex);
                            var act     = MoveTo.create(cen, 30000, -1, -1, resinfo.CenGelP[resinfo.CountX], 5);
                            seque.AddAction(act);
                        }
                        else if (action.DoAction == 2)        //开舱门
                        {
                            var act = HandOpenCloseDoor.create(handDevice, 3000, action.Code, true);
                            seque.AddAction(act);
                        }
                        else if (action.DoAction == 3)        //关舱门
                        {
                            var act = HandOpenCloseDoor.create(handDevice, 3000, action.Code, false);
                            seque.AddAction(act);
                        }
                        else if (action.DoAction == 4)        //初始化
                        {
                            var act = InitXyz.create(cen, 3000, false, false, true);
                            seque.AddAction(act);
                        }
                    }
                    else
                    {
                        ErrorSystem.WriteActError("找不到指定离心机", true, false, 9999);
                    }
                }
                break;

                case LogicStepEnum.Couveuse:
                {
                }
                break;

                case LogicStepEnum.Delay:
                {
                    int DelayTime = Convert.ToInt32(step.Parameters);
                    seque.AddAction(SKSleep.create(DelayTime));
                }
                break;

                case LogicStepEnum.DetectSquid:
                {
                    DetectAction      action   = Convert2T <DetectAction>(step.Parameters);
                    List <Enterclose> iinjects = new List <Enterclose>();
                    foreach (var entindex in action.Indexs)
                    {
                        iinjects.Add(injDevice.Injector.Entercloses[entindex]);
                    }
                    seque.AddAction(InjectDetector.create(3000, iinjects.ToArray(), IMask.Gen((int)action.Start), IMask.Gen((int)action.ZLimit), IMask.Gen(0)));
                }
                break;

                case LogicStepEnum.SimpleAction:
                {
                    SimpleAction      action = Convert2T <SimpleAction>(step.Parameters);
                    AbstractCanDevice device = null;
                    switch (action.Device)
                    {
                    case "加样器":
                        device = injDevice;
                        break;

                    case "机械手":
                        device = handDevice;
                        break;

                    case "卡仓":
                        device = gelwareDevice;
                        break;

                    case "破孔器":
                        device = gelwareDevice;
                        break;
                    }
                    if (action.Action == "移动")
                    {
                        ActionBase act_move = null;
                        int        x        = action.Direction == "X" ? (int)action.Value : -1;
                        int        y        = action.Direction == "Y" ? (int)action.Value : -1;
                        int        z        = action.Direction == "Z"? (int)action.Value:-1;
                        if (action.Direction == "XYZ")
                        {
                            x = y = z = (int)action.Value;
                        }
                        if (device is InjectorDevice)
                        {
                            act_move = InjectMoveTo.create(device, 3000, injDevice.Injector.Entercloses, x, IMask.Gen(y), IMask.Gen(z));
                        }
                        else
                        {
                            act_move = MoveTo.create(device, 3000, x, y, z);
                        }
                        seque.AddAction(act_move);
                    }
                    else if (action.Action == "初始化")
                    {
                        ActionBase act_move = null;
                        bool       x        = action.Direction == "X" ? true : false;
                        bool       y        = action.Direction == "Y" ? true : false;
                        bool       z        = action.Direction == "Z" ? true : false;
                        if (action.Direction == "XYZ")
                        {
                            x = y = z = true;
                        }
                        if (device is InjectorDevice)
                        {
                            act_move = InitXyz.create(device, 30000, injDevice.Injector.Entercloses, x, y, z);
                        }
                        else
                        {
                            act_move = InitXyz.create(device, 30000, x, y, z);
                        }
                        seque.AddAction(act_move);
                    }
                }
                break;

                case LogicStepEnum.TakeAndPutDownGel:
                {
                    GelAction[] actions = Convert2T <GelAction[]>(step.Parameters);
                    seque.AddAction(MoveTo.create(handDevice, 3000, -1, -1, 0));
                    ResInfoData take_seat = null;
                    if (actions[0].BJType == "T_BJ_GelSeat")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_GelSeat", "", "", actions[0].Index, 0, true, actions[0].BJName);
                        generater.GenerateTakeGelFromNormal(take_seat, ref seque);
                    }
                    else if (actions[0].BJType == "T_BJ_Centrifuge")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", "", "", actions[0].Index, 0, true, actions[0].BJName);
                        var act = generater.GenerateTakeGelFromCent(take_seat, "", ref seque);
                    }
                    else if (actions[0].BJType == "T_BJ_GelWarehouse")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", "", "", actions[0].Index, 0, true, actions[0].BJName);
                        var act = generater.GenerateTakeGelFromWare(take_seat, ref seque);
                    }

                    if (actions[1].BJType == "T_BJ_GelSeat")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_GelSeat", "", "", actions[1].Index, 0, true, actions[1].BJName);
                        generater.GeneratePutGelToNormal(put_seat, take_seat, ref seque);
                    }
                    else if (actions[1].BJType == "T_BJ_Centrifuge")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", "", "", actions[1].Index, 0, true, actions[1].BJName);
                        generater.GeneratePutGelToCent(put_seat.CenCode, put_seat, take_seat, ref seque);
                    }
                    else if (actions[1].BJType == "T_BJ_GelWarehouse")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", "", "", actions[1].Index, 0, true, actions[1].BJName);
                        generater.GeneratePutGelToWare(put_seat, take_seat, ref seque);
                    }
                }
                break;

                case LogicStepEnum.TakeGel:
                {
                    GelAction   action    = Convert2T <GelAction>(step.Parameters);
                    ResInfoData take_seat = null;
                    if (action.BJType == "T_BJ_GelSeat")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_GelSeat", "", "", action.Index, 0, true, action.BJName);
                        generater.GenerateTakeGelFromNormal(take_seat, ref seque);
                    }
                    else if (action.BJType == "T_BJ_Centrifuge")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", "", "", action.Index, 0, true, action.BJName);
                        var act = generater.GenerateTakeGelFromCent(take_seat, "", ref seque);
                    }
                    else if (action.BJType == "T_BJ_GelWarehouse")
                    {
                        take_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", "", "", action.Index, 0, true, action.BJName);
                        var act = generater.GenerateTakeGelFromWare(take_seat, ref seque);
                    }
                    break;
                }

                case LogicStepEnum.PutDownGel:
                {
                    GelAction   action    = Convert2T <GelAction>(step.Parameters);
                    ResInfoData take_seat = resmanager.handseat_resinfo;
                    if (action.BJType == "T_BJ_GelSeat")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_GelSeat", "", "", action.Index, 0, true, action.BJName);
                        generater.GeneratePutGelToNormal(put_seat, take_seat, ref seque);
                    }
                    else if (action.BJType == "T_BJ_Centrifuge")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", "", "", action.Index, 0, true, action.BJName);
                        generater.GeneratePutGelToCent(put_seat.CenCode, put_seat, take_seat, ref seque);
                    }
                    else if (action.BJType == "T_BJ_GelWarehouse")
                    {
                        var put_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", "", "", action.Index, 0, true, action.BJName);
                        generater.GeneratePutGelToWare(put_seat, take_seat, ref seque);
                    }
                    break;
                }

                case LogicStepEnum.TakeTip:
                {
                    TakeTipAction      action   = Convert2T <TakeTipAction>(step.Parameters);
                    var                ents     = injDevice.Injector.Entercloses.Where(ent => ent.Valid && action.Indexs.Contains(ent.Index)).ToArray();
                    var                tipseat  = Constants.BJDict[typeof(T_BJ_Tip).Name].Where(item => item.Name == action.TipBoxName).FirstOrDefault() as T_BJ_Tip;
                    List <ActionPoint> tip_seat = new List <ActionPoint>();
                    foreach (var ent in ents)
                    {
                        int x     = (int)(tipseat.X - action.C * tipseat.GapX);
                        int y     = (int)(tipseat.Y + action.R * tipseat.GapY);
                        var point = new ActionPoint();
                        point.x     = x;
                        point.y     = y;
                        point.z     = (int)tipseat.Limit;
                        point.type  = TestStepEnum.JXZT;
                        point.index = ent.Index;
                        tip_seat.Add(point);
                    }
                    var sequ_taketip = Sequence.create();
                    var move_act     = InjectMoveActs.create(injDevice, 3000, tip_seat.ToArray(), false);
                    sequ_taketip.AddAction(InjectMoveTo.create(injDevice, 3000, ents, -1, IMask.Gen(-1), IMask.Gen(0)));
                    sequ_taketip.AddAction(move_act);
                    seque.AddAction(sequ_taketip);
                }
                break;

                case LogicStepEnum.OutTip:
                {
                    TakeTipAction      action        = Convert2T <TakeTipAction>(step.Parameters);
                    var                ents          = injDevice.Injector.Entercloses.Where(ent => ent.Valid && action.Indexs.Contains(ent.Index)).ToArray();
                    var                sequ_puttip   = Sequence.create();
                    List <ActionPoint> unload_seat   = new List <ActionPoint>();
                    var                inject_unload = resmanager.unload_list;
                    if (inject_unload.Count() == 1)
                    {
                        var unloader = inject_unload[0];
                        for (int i = 0; i < 4; i++)
                        {
                            var unload_point = new ActionPoint((int)unloader.X, (int)unloader.Y + i * (int)unloader.FZ, (int)unloader.Z, TestStepEnum.JXZT);
                            unload_point.puttip_x = (int)unloader.FirstX;
                            unload_seat.Add(unload_point);
                        }
                        sequ_puttip.AddAction(InjectMoveTo.create(injDevice, 3000, ents, -1, IMask.Gen(-1), IMask.Gen(0)));
                        sequ_puttip.AddAction(InjectMoveActs.create(injDevice, 3000, unload_seat.ToArray(), true));
                        seque.AddAction(sequ_puttip);
                    }
                }
                break;

                case LogicStepEnum.Piercer:
                {
                    var paper_seat = resmanager.GetResByCode("", "T_BJ_GelSeat", "", "4");
                    seque.AddAction(PaperCard.create(pieDevice, 3000, paper_seat, 0));
                }
                break;

                case LogicStepEnum.LoopStart:
                {
                    LogicLoop logicLoop = Convert2T <LogicLoop>(step.Parameters);
                    loop_times = logicLoop.Count;
                    seque_root.AddAction(seque);
                    seque = Sequence.create();
                }
                break;

                case LogicStepEnum.LoopEnd:
                {
                    var act_repat = Repeat.create(seque, loop_times);
                    seque_root.AddAction(act_repat);
                    seque      = Sequence.create();
                    loop_times = 0;
                }
                break;
                }
            }
            seque_root.AddAction(seque);
            seque_root.runAction(opDevice);
            return(true);
        }