//排序
        public void UpDataAction()
        {
            lock (mylock)
            {
                //融合两个试验
                foreach (var package in experiment_package_list)
                {
                    if (package.is_used_gel && package.action_list.Count != 0 && package.ren_fen != package.GetCurRenFen())
                    {
                        var exp_pack_tem = GetCombinationExpPackage(package);
                        if (exp_pack_tem != null)
                        {
                            if (exp_pack_tem.samples_barcode.Count == 1)
                            {
                                package.Combination(exp_pack_tem);
                            }
                            else
                            {
                                exp_pack_tem.Combination(package);
                            }
                        }
                    }
                }
                ClsAction();
                //把交叉配血卡的动作ID更新
                //foreach (var package in experiment_package_list)
                //{
                //    if (package.is_crossmatching) package.UpDataCrossMatchingSetpIndex();
                //}
                inj_action_list = new List <T_GelStep>();
                List <List <T_GelStep> > action_group = new List <List <T_GelStep> >();
                int index         = 0;
                int max_goup_size = 12;
                //按有孵育的就组
                experiment_package_list = experiment_package_list.OrderByDescending(a => a.sort_index).ToList();
                //12个一组
                int group_last_gel_test_id = -1;
                for (int i = 0; i < experiment_package_list.Count; i++)
                {
                    //不同卡为一组
                    if (experiment_package_list[i].is_jyjs == false)
                    {
                        if (index % max_goup_size == 0 || (group_last_gel_test_id != experiment_package_list[i].gel_test_id))
                        {
                            action_group.Add(new List <T_GelStep>());
                            index = 1;
                        }
                        else
                        {
                            index++;
                        }
                        action_group[action_group.Count - 1] = action_group[action_group.Count - 1].Concat(experiment_package_list[i].action_list).ToList();
                        group_last_gel_test_id = experiment_package_list[i].gel_test_id;
                    }
                }

                for (int i = 0; i < action_group.Count; i++)
                {
                    action_group[i] = action_group[i].OrderBy(u => u.StepIndex).ToList();
                    inj_action_list = inj_action_list.Concat(action_group[i]).ToList();
                }
                //试剂(最多两个针头加样,分配,把脱针去掉,把加样去掉,把容量合并)
                //查找连续试剂(如果超过三个就合并)
                AgentiaCombination(inj_action_list, 0);
                SlysCombination(inj_action_list, 0);
                //交叉配血合并
                CrossMatchingCombination(inj_action_list, 0);
                //破空器返回
                int pier_y      = 0;
                var pier_device = new ActionDevice(piercerDevice);
                pier_device.GetRealY(ref pier_y);
                if (pier_y != 0 && inj_action_list.Count != 0 && inj_action_list[0].StepClass != TestStepEnum.KaiKongGel)
                {
                    var pier_back = MoveTo.create(piercerDevice, 3000, -1, 0, -1);
                    pier_back.runAction();
                }
            }
        }
Example #2
0
        //排序
        public void UpDataAction()
        {
            lock (mylock)
            {
                //融合两个试验
                foreach (var package in experiment_package_list)
                {
                    if (package.is_used_gel && package.action_list.Count != 0 && package.ren_fen != package.GetCurRenFen())
                    {
                        var exp_pack_tem = GetCombinationExpPackage(package);
                        if (exp_pack_tem != null)
                        {
                            if (exp_pack_tem.action_list.Count != 1)
                            {
                                package.Combination(exp_pack_tem);
                            }
                            else
                            {
                                exp_pack_tem.Combination(package);
                            }
                        }
                    }
                }
                ClsAction();
                inj_action_list = new List <T_GelStep>();
                List <List <T_GelStep> > action_group = new List <List <T_GelStep> >();
                int index         = 0;
                int max_goup_size = 12;
                //加载卡打孔12个一组
                for (int i = 0; i < experiment_package_list.Count; i++)
                {
                    if (experiment_package_list[i].is_jyjs == false)
                    {
                        if (index % max_goup_size == 0)
                        {
                            action_group.Add(new List <T_GelStep>());
                        }
                        var loadgel_list    = experiment_package_list[i].action_list.Where(item => item.StepClass == TestStepEnum.LoadGel);
                        var kaikonggel_list = experiment_package_list[i].action_list.Where(item => item.StepClass == TestStepEnum.KaiKongGel);
                        action_group[action_group.Count - 1] = action_group[action_group.Count - 1].Concat(loadgel_list).ToList();
                        action_group[action_group.Count - 1] = action_group[action_group.Count - 1].Concat(kaikonggel_list).ToList();
                        index++;
                    }
                }
                //加样动作4个一组
                index         = 0;
                max_goup_size = 4;
                for (int i = 0; i < experiment_package_list.Count; i++)
                {
                    if (experiment_package_list[i].is_jyjs == false)
                    {
                        if (index % max_goup_size == 0)
                        {
                            action_group.Add(new List <T_GelStep>());
                        }
                        var jyact_list   = experiment_package_list[i].action_list.Where(item => item.StepClass == TestStepEnum.JYJS).ToList();
                        int jyjs_index   = jyact_list.Count != 0?jyact_list[0].StepIndex:1000;
                        var nomoact_list = experiment_package_list[i].action_list.Where(item => item.StepIndex < jyjs_index && item.StepClass != TestStepEnum.LoadGel && item.StepClass != TestStepEnum.KaiKongGel);
                        action_group[action_group.Count - 1] = action_group[action_group.Count - 1].Concat(nomoact_list).ToList();
                        index++;
                    }
                }
                //加样后动作12个一组
                index         = 0;
                max_goup_size = 12;
                for (int i = 0; i < experiment_package_list.Count; i++)
                {
                    if (experiment_package_list[i].is_jyjs == false)
                    {
                        if (index % max_goup_size == 0)
                        {
                            action_group.Add(new List <T_GelStep>());
                        }
                        var jyact_list   = experiment_package_list[i].action_list.Where(item => item.StepClass == TestStepEnum.JYJS).ToList();
                        int jyjs_index   = jyact_list.Count != 0 ? jyact_list[0].StepIndex : 1000;
                        var nomoact_list = experiment_package_list[i].action_list.Where(item => item.StepIndex >= jyjs_index && item.StepClass != TestStepEnum.LoadGel && item.StepClass != TestStepEnum.KaiKongGel);
                        action_group[action_group.Count - 1] = action_group[action_group.Count - 1].Concat(nomoact_list).ToList();
                        index++;
                    }
                }

                for (int i = 0; i < action_group.Count; i++)
                {
                    action_group[i] = action_group[i].OrderBy(u => u.StepIndex).ToList();
                    inj_action_list = inj_action_list.Concat(action_group[i]).ToList();
                }
                //试剂(最多两个针头加样,分配,把脱针去掉,把加样去掉,把容量合并)
                //查找连续试剂(如果超过三个就合并)
                AgentiaCombination(inj_action_list, 0);
                //破空器返回
                int pier_y      = 0;
                var pier_device = new ActionDevice(piercerDevice);
                pier_device.GetRealY(ref pier_y);
                if (pier_y != 0 && inj_action_list.Count != 0 && inj_action_list[0].StepClass != TestStepEnum.KaiKongGel)
                {
                    var pier_back = MoveTo.create(piercerDevice, 3000, -1, 0, -1);
                    pier_back.runAction();
                }
            }
        }