Ejemplo n.º 1
0
        //生成放卡在普通位
        public bool GeneratePutGelToNormal(T_Gel gel, ref Sequence seque, string code = "", int seatindex = -1)
        {
            var          resmanager = ResManager.getInstance();
            T_BJ_GelSeat gelselect  = (T_BJ_GelSeat)resmanager.SearchGelCard(typeof(T_BJ_GelSeat).Name, gel, false, code, seatindex);

            if (gelselect != null)
            {
                //抓手移动
                seque.AddAction(MoveTo.create(300000, (int)gelselect.X, (int)(gelselect.Y + gelselect.Gap * seatindex), 0));
                //抓手放卡
                seque.AddAction(HandPutCard.create(500000, (int)gelselect.ZPut, 0));
                //把测试卡放在Gel位中
                gelselect.Values[seatindex, 0] = gel;
                seque.destroyfun = (ActionBase act) =>
                {
                    gelselect.Values[seatindex, 0] = null;
                    return(true);
                };
            }
            else
            {
                ErrorSystem.WriteActError(gelselect.Code + "位已满");
            }
            return(gelselect != null);
        }
Ejemplo n.º 2
0
        //生成离心机抓卡动作
        public bool GenerateTakeGelFromCent(T_Gel gel, ref Sequence seque, string code = "", int seatindex = -1)
        {
            var             resmanager = ResManager.getInstance();
            T_BJ_Centrifuge gelselect  = (T_BJ_Centrifuge)resmanager.SearchGelCard(typeof(T_BJ_Centrifuge).Name, gel, true, code, seatindex);
            var             centrifuge = cenMrg.GetCentrifugeByCode(code);

            if (centrifuge == null)
            {
                centrifuge = cenMrg.GetFreeCentrifuge();
            }
            if (gelselect != null)
            {
                //离心机位移动
                //抓手移动到离心机位
                var move_act = Spawn.create(
                    MoveTo.create(centrifuge, 30000, -1, -1, (int)(seatindex * (double)gelselect.Gel0), 5),
                    MoveTo.create(handDevice, 30000, (int)gelselect.HandX, (int)gelselect.HandY));
                seque.AddAction(move_act);
                //抓手抓卡
                seque.AddAction(HandTakeCard.create(700000, (int)gelselect.HandZ, (int)gelselect.ZLimit, (int)gelselect.ZCatch, 0));
                //把测试卡放在离心Gel位中
                gelselect.Values[seatindex, 0] = null;
                seque.destroyfun = (ActionBase act) =>
                {
                    gelselect.Values[seatindex, 0] = gel;
                    return(true);
                };
            }
            else
            {
                ErrorSystem.WriteActError("离心机位打不到卡");
            }
            return(gelselect != null);
        }
Ejemplo n.º 3
0
        public T_Gel CopyGel(T_Gel SourceGel)
        {
            T_Gel NewGel = new T_Gel();

            TransExpUtil <T_Gel, T_Gel> .CopyValue(SourceGel, NewGel);

            NewGel.ID = 0;
            if (SourceGel.ResultMaps != null)
            {
                NewGel.ResultMaps = new List <T_ResultMap>();
                foreach (var item in SourceGel.ResultMaps)
                {
                    var obj = TransExpUtil <T_ResultMap, T_ResultMap> .Trans(item);

                    obj.ID = 0;
                    NewGel.ResultMaps.Add(obj);
                }
            }
            if (SourceGel.GelSteps != null)
            {
                NewGel.GelSteps = new List <T_GelStep>();
                foreach (var item in SourceGel.GelSteps)
                {
                    var obj = TransExpUtil <T_GelStep, T_GelStep> .Trans(item);

                    obj.ID = 0;
                    NewGel.GelSteps.Add(obj);
                }
            }
            gelDAO.InserOrUpdateGEL(NewGel);
            return(NewGel);
        }
Ejemplo n.º 4
0
        //动作解析(把分配红细胞分裂)
        public List <T_GelStep> ResolveActions(T_Gel gel)
        {
            List <T_GelStep> gelstep_list = new List <T_GelStep>();

            foreach (var gelstep in gel.GelSteps)
            {
                if (gelstep.StepClass == TestStepEnum.FPBRXSHXB || gelstep.StepClass == TestStepEnum.FPXXYXSHXB)
                {
                    var gelfphxb = gelstep.clone();
                    var gelfpxsy = gelstep.clone();
                    gelfphxb.StepClass   = defhxb.StepClass;
                    gelfpxsy.StepClass   = defxsy.StepClass;
                    gelfphxb.StepName    = defhxb.StepName;
                    gelfpxsy.StepName    = defxsy.StepName;
                    gelfphxb.InjectCount = 1;
                    gelfpxsy.InjectCount = 1;
                    gelfphxb.StepID      = defhxb.ID;
                    gelfpxsy.StepID      = defxsy.ID;
                    gelstep_list.Add(gelfphxb);
                    gelstep_list.Add(gelfpxsy);
                }
                else
                {
                    gelstep_list.Add(gelstep);
                }
            }
            gelstep_list.Sort((a, b) => a.ID.CompareTo(b.ID));
            return(gelstep_list);
        }
Ejemplo n.º 5
0
        public List <T_GelStep> ResolveActions(T_Gel gel)
        {
            List <T_GelStep> gelstep_list = new List <T_GelStep>();

            foreach (var gelstep in gel.GelSteps)
            {
                if (gelstep.StepClass == TestStepEnum.FPYT)
                {
                    FPYTStepParameter action = gelstep.GetFpytInfo();
                    int index = 0;
                    foreach (var item in action.LiquidList)
                    {
                        var gelfpyt = gelstep.clone();
                        gelfpyt.LiquidTypeIndex = index;
                        gelfpyt.MixCode         = "mix_code:" + G_MixCode;
                        gelfpyt.is_mix          = action.LiquidList.Count > 1;
                        gelfpyt.is_spu          = action.LiquidList.IndexOf(item) == action.LiquidList.Count - 1;
                        gelstep_list.Add(gelfpyt);
                        index++;
                    }
                    G_MixCode++;
                }
                else
                {
                    gelstep_list.Add(gelstep);
                }
            }
            return(gelstep_list);
        }
Ejemplo n.º 6
0
        private void showGelWin(T_Gel t_Gel)
        {
            var VM = IoC.Get <CreateOrModifyViewModel>();

            VM.t_Gel = t_Gel;
            windowManager.ShowDialog(VM);
        }
Ejemplo n.º 7
0
        private IList <TestBag> GenerateTestBag(byte GelIndex, IEnumerable <SampleInfo> infos, SKABO.Common.Enums.TestLevelEnum testLevel)
        {
            if (infos.Count() == 0)
            {
                return(null);
            }
            IList <TestBag> result  = new List <TestBag>();
            var             GelList = (this.View as ScanSampleView).GelList;
            var             gp      = infos.GroupBy(item => item.RackIndex).OrderBy(item => item.Key);

            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;
                var StartIndex = -1;
                foreach (var s in gp.ElementAt(i))
                {
                    if (s.Index - StartIndex > 1 && testBag.SamplesInfo.Count > 0)
                    {
                        result.Add(testBag);
                        testBag         = new TestBag(testLevel);
                        testBag.GelType = GelType;
                    }
                    StartIndex = s.Index;
                    testBag.Add(s.Barcode, s.RackIndex, s.Index);
                    CurentSR.SetValue(s.Index, 0, s.Barcode);
                    if (testBag.SamplesInfo.Count == TestBag.MaxCount * testBag.GelType.GelRenFen)
                    {
                        result.Add(testBag);
                        testBag         = new TestBag(testLevel);
                        testBag.GelType = GelType;
                    }
                }
                if (testBag.SamplesInfo.Count > 0 && testBag.SamplesInfo.Count < TestBag.MaxCount * GelType.GelRenFen)
                {
                    result.Add(testBag);
                }
            }



            return(result);
        }
Ejemplo n.º 8
0
        public bool InserOrUpdateGEL(T_Gel t_Gel)
        {
            if (t_Gel.ID == 0)
            {
                var session = mapper.BeginTransaction();
                try
                {
                    mapper.Insert("InsertT_Gel", t_Gel);
                    if (t_Gel.ResultMaps != null)
                    {
                        InserOrUpdateCollect(t_Gel.ResultMaps, "T_ResultMap", new KeyValuePair <String, Object>("GelID", t_Gel.ID));
                    }
                    if (t_Gel.GelSteps != null)
                    {
                        InserOrUpdateCollect(t_Gel.GelSteps, "T_GelStep", new KeyValuePair <String, Object>("GelID", t_Gel.ID));
                    }
                    mapper.CommitTransaction();
                    return(t_Gel.ID > 0);
                }
                catch (Exception ex)
                {
                    Tool.AppLogError(ex);
                    mapper.RollBackTransaction();
                    return(false);
                }
            }
            else
            {
                var result  = false;
                var session = mapper.BeginTransaction();
                try
                {
                    result = mapper.Update("UpdateT_Gel", t_Gel) > 0;
                    if (t_Gel.ResultMaps != null)
                    {
                        InserOrUpdateCollect(t_Gel.ResultMaps, "T_ResultMap", new KeyValuePair <String, Object>("GelID", t_Gel.ID));
                    }
                    if (t_Gel.GelSteps != null)
                    {
                        InserOrUpdateCollect(t_Gel.GelSteps, "T_GelStep", new KeyValuePair <String, Object>("GelID", t_Gel.ID));
                    }
                    mapper.CommitTransaction();
                    result = true;
                }
                catch (Exception ex)
                {
                    Tool.AppLogError(ex);
                    result = false;
                    mapper.RollBackTransaction();
                }

                return(result);
            }
        }
Ejemplo n.º 9
0
        //生成离心机放卡动作
        public bool GeneratePutGelToCent(T_Gel gel, ref Sequence seque, string code = "", int seatindex = -1)
        {
            int[] gelseatindex = { 0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11 };
            var   centrifuge   = cenMrg.GetCentrifugeByCode(code);

            if (centrifuge == null)
            {
                centrifuge = cenMrg.GetFreeCentrifuge();
            }
            var  gelseat        = centrifuge.GetGelSeatsInfo();
            var  gelseatsetting = centrifuge.GetGelSeatSetting();
            bool isfind         = seatindex != -1;

            if (seatindex == -1)
            {
                for (int i = 0; i < 12; i++)
                {
                    int index = gelseatindex[i];
                    if (gelseat[index] == false)
                    {
                        seatindex = index;
                        isfind    = true;
                        break;
                    }
                }
            }
            if (isfind)
            {
                //离心机位移动
                //抓手移动到离心机位
                var move_act = Spawn.create(
                    MoveTo.create(centrifuge, 30000, -1, -1, (int)(seatindex * (double)gelseatsetting.Gel0), 5),
                    MoveTo.create(handDevice, 30000, (int)gelseatsetting.HandX, (int)gelseatsetting.HandY));
                seque.AddAction(move_act);
                //抓手放卡
                seque.AddAction(HandPutCard.create(handDevice, 30000, (int)gelseatsetting.ZPut));
                //把测试卡放在离心Gel位中
                gelseatsetting.Values[seatindex, 0] = gel;
                seque.destroyfun = (ActionBase act) =>
                {
                    gelseatsetting.Values[seatindex, 0] = null;
                    return(true);
                };
            }
            else
            {
                ErrorSystem.WriteActError("离心机位已满");
            }
            return(isfind);
        }
Ejemplo n.º 10
0
        private void GetResultStr(String ComRes, T_Gel Gel, BloodSystemEnum BE, ref String Res, out String Color)
        {
            Color = null;
            var ResultMaps = Gel.ResultMaps.Where(c => c.BloodSystem == BE).ToList();

            if (ResultMaps != null && ResultMaps.Count() > 0)
            {
                var map = GetResultMap(ComRes, ResultMaps);
                if (map == null)
                {
                    Res = "?";
                }
                else
                {
                    Res  += map.ResultDesc;
                    Color = map.Color;
                }
            }
        }
Ejemplo n.º 11
0
        public bool DeleteGel(T_Gel Gel)
        {
            bool result  = false;
            var  session = mapper.BeginTransaction();

            try
            {
                if (Gel.GelSteps != null)
                {
                    String Ids = "";
                    foreach (var item in Gel.GelSteps)
                    {
                        Ids += (Ids == "" ? "" : ",") + item.ID.ToString();
                    }
                    if (Ids != "")
                    {
                        mapper.Delete("DeleteT_GelStepByIDs", Ids);
                    }
                }
                if (Gel.ResultMaps != null)
                {
                    String Ids = "";
                    foreach (var item in Gel.ResultMaps)
                    {
                        Ids += (Ids == "" ? "" : ",") + item.ID.ToString();
                    }
                    if (Ids != "")
                    {
                        mapper.Delete("DeleteT_ResultMapByIDs", Ids);
                    }
                }
                mapper.Delete("DeleteT_Gel", Gel);
                mapper.CommitTransaction();
                result = true;
            }
            catch (Exception ex)
            {
                Tool.AppLogError(ex);
                result = false;
                mapper.RollBackTransaction();
            }
            return(result);
        }
Ejemplo n.º 12
0
 public bool InserOrUpdateGEL(T_Gel t_Gel)
 {
     return(gelDAO.InserOrUpdateGEL(t_Gel));
 }
Ejemplo n.º 13
0
 public bool DeleteGel(T_Gel Gel)
 {
     return(gelDAO.DeleteGel(Gel));
 }
Ejemplo n.º 14
0
        /// <summary>
        /// 最终的结果描述
        /// </summary>
        /// <param name="Gel"></param>
        /// <param name="Results">单管结果集</param>
        /// <returns>返回最终的结果描述</returns>
        public string FinishResult(T_Gel Gel, out String Color, params ResultEnum[] Results)
        {
            Color = null;
            if (Results == null)
            {
                return("?");
            }
            String Res    = "";
            String ComRes = "";

            for (int i = 0; i < Results.Length; i++)
            {
                int ResInt = (int)Results[i];
                if (ResInt >= 0)
                {
                    ComRes += "+";
                }
                else if (ResInt == -1)
                {
                    ComRes += "-";
                }
                else
                {
                    Res = "?";
                    break;
                }
            }
            if (!String.IsNullOrEmpty(Res))
            {
                return(Res);
            }
            String Brush = null;

            GetResultStr(ComRes, Gel, BloodSystemEnum.ABO, ref Res, out Brush);
            if (!String.IsNullOrEmpty(Brush))
            {
                Color = Brush;
            }
            if (Res != "?")
            {
                GetResultStr(ComRes, Gel, BloodSystemEnum.CDE, ref Res, out Brush);
                if (!String.IsNullOrEmpty(Brush))
                {
                    Color = Brush;
                }
            }
            if (Res != "?")
            {
                GetResultStr(ComRes, Gel, BloodSystemEnum.Globulin, ref Res, out Brush);
                if (!String.IsNullOrEmpty(Brush))
                {
                    Color = Brush;
                }
            }
            if (Res != "?")
            {
                GetResultStr(ComRes, Gel, BloodSystemEnum.Other, ref Res, out Brush);
                if (!String.IsNullOrEmpty(Brush))
                {
                    Color = Brush;
                }
            }
            if (Res == "")
            {
                Res = "?";
            }
            return(Res);
        }