示例#1
0
        public string Parse(List <byte> data)
        {
            int          BlkNO = MachineControlProtocol.HexConverToDec(data[2], data[3], data[4]);
            int          index = 1;
            int          i     = 5;
            List <float> datas = new List <float>();

            while (index >= 120)
            {
                float PWL = MachineControlProtocol.HexConverToFloat(data[i], data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5]);

                datas.Add(PWL);

                i += 6;
            }

            string v = "";

            foreach (float e in datas)
            {
                v += e.ToString();
                v += "	";
            }

            //LogService.Log(BlkNO.ToString() + "	" + v, "CuvBlk.lg");

            return("");
        }
示例#2
0
        public string Parse(List <byte> Data)
        {
            CUVBLKService CUVBLKSer = new CUVBLKService();

            CUVBLKSer.BackupLastestToHistory();

            int i = 2;

            while (i < Data.Count - 3)
            {
                int cuvno = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1]);
                for (int j = i + 2, index = 0; j < i + 72; j = j + 6, index++)
                {
                    float blk = MachineControlProtocol.HexConverToFloat(Data[j], Data[j + 1], Data[j + 2], Data[j + 3], Data[j + 4], Data[j + 5]);
                    if (blk > -0.000001 && blk < 0.000001)
                    {
                        blk = 0.0000f;
                    }
                    else
                    {
                        blk = (float)Math.Log10(10 / blk) * MachineInfo.LightSpan;
                    }
                    CUVBLKSer.SaveLatestCuvBlkOfWaveAndCuvNO(MachineInfo.WaveLengthArray[index], cuvno, blk);
                }
                i += 74;
            }
            return("FinishUpdateCuvBlk");
        }
示例#3
0
        public string Parse(List <byte> data)
        {
            byte disk = data[2];

            for (int i = 3; i < data.Count - 3; i = i + 4)
            {
                int p = MachineControlProtocol.HexConverToDec(data[i], data[i + 1]);
                p = p > 90 ? (p - 90) : p;
                int v = MachineControlProtocol.HexConverToDec(data[i + 2], data[i + 3]);
                if (p != 0)
                {
                    switch (disk)
                    {
                    case 0x30: UpdateLatestRgtVol(1, p, v); break;

                    case 0x31: UpdateLatestRgtVol(2, p, v); break;
                    }
                }
            }
            for (int i = 0; i < data.Count; i++)
            {
                if (data[i] == 0x1C)
                {
                    TroubleLog trouble = new TroubleLog();
                    trouble.TroubleType = TROUBLETYPE.ERR;
                    trouble.TroubleUnit = "设备";
                    trouble.TroubleCode = string.Format("{0}{1}{2}{3}", (char)data[i + 1], (char)data[i + 2], (char)data[i + 3], (char)data[i + 4]);
                    trouble.TroubleInfo = null;
                    myBatis.TroubleLogSave("TroubleLogSave", trouble);
                }
            }
            return(null);
        }
示例#4
0
        public string Parse(List <byte> data)
        {
            int disk = 0;

            switch (data[2])
            {
            case 0x30: disk = 1; break;

            case 0x31: disk = 2; break;
            }

            int p = MachineControlProtocol.HexConverToDec(data[3], data[4]);

            p = p > 45 ? p - 45 : p;
            string barcode = null;

            for (int i = 5; i < data.Count; i++)
            {
                if (data[i] == 0x03)
                {
                    break;
                }

                string v = string.Format("{0}", (char)data[i]);
                barcode += v;
            }

            return(disk + "|" + p + "|" + barcode);
        }
示例#5
0
        //解码 0x9 0x3c
        public string Parse(List <byte> data)
        {
            string code = null;

            for (int i = 3, j = 1; j <= 53; i += 5, j++)
            {
                int    v     = MachineControlProtocol.HexConverToDec(data[i], data[i + 1], data[i + 2], data[i + 3], data[i + 4]);
                string data1 = string.Format("{0},{1}|", j, v);
                code += data1;
            }
            code = code.TrimEnd('|');

            return(code);
        }
示例#6
0
        public string Parse(List <byte> data)
        {
            int n = MachineControlProtocol.HexConverToDec(data[2], data[3], data[4]);

            TroubleLog trouble = new TroubleLog();

            trouble.TroubleType = TROUBLETYPE.ERR;
            trouble.TroubleUnit = "比色杯";
            trouble.TroubleCode = string.Format("CUV001");
            trouble.TroubleInfo = n + "号比色杯有污垢,测试无法在此号比色杯中进行";
            myBatis.TroubleLogSave("TroubleLogSave", trouble);

            return(n + "号比色杯有污垢");
        }
示例#7
0
        public string Parse(List <byte> data)
        {
            TroubleLogService TroubleLogSer = new TroubleLogService();

            int n = MachineControlProtocol.HexConverToDec(data[2], data[3]);

            TroubleLog trouble = new TroubleLog();

            trouble.TroubleType = TROUBLETYPE.ERR;
            trouble.TroubleUnit = MyResources.Instance.FindResource("Parse1101").ToString();
            trouble.TroubleCode = "CUV001";
            trouble.TroubleInfo = n + MyResources.Instance.FindResource("Parse1102").ToString();//string.Format("{0}号比色杯有污垢,测试无法在此号比色杯中进行. ", n); ;
            TroubleLogSer.Save(trouble);

            return(n + MyResources.Instance.FindResource("Parse1103").ToString());//string.Format("{0}号比色杯有污垢. ", n);
        }
示例#8
0
        public string Parse(List <byte> data)
        {
            int v = 0;
            int p = 0;

            for (int i = 3; i < data.Count - 3; i = i + 4)
            {
                p = MachineControlProtocol.HexConverToDec(data[i], data[i + 1]);
                v = MachineControlProtocol.HexConverToDec(data[i + 2], data[i + 3]);
            }
            if (v < 5)
            {
                return("DERR");
            }

            return(null);
        }
示例#9
0
        public string Parse(List <byte> data)
        {
            myBatis.UpdateLatestWaterState("UpdateLatestWaterState", new byte[] { data[2], data[3] });
            ProcessWaterStateA(data[2], data[3]);

            int   t  = MachineControlProtocol.HexConverToDec(data[4], data[5], data[6]);
            float tf = t * 0.1f;

            myBatis.UpdateLatestCUVPanelTemperature("UpdateLatestCUVPanelTemperature", tf);

            string temstr = tf.ToString("#0.0");

            if (temstr == "0.0")
            {
                temstr = "21.0";
            }

            return(temstr);
        }
示例#10
0
        public string Parse(List <byte> Data)
        {
            string snsrt = "";

            for (int i = 3; i < 3 + 8; i++)
            {
                snsrt += (char)Data[i];
            }
            string mstr = "";

            mstr += (char)Data[11];

            int n1 = MachineControlProtocol.HexConverToDec(Data[12], Data[13]);
            int n2 = MachineControlProtocol.HexConverToDec(Data[14], Data[15]);

            string str2 = "";

            str2 += (char)Data[16];

            return(snsrt + "|" + mstr + "|" + n1 + "|" + n2 + "|" + str2);
        }
示例#11
0
        public string Parse(List <byte> Data)
        {
            int i     = 2;
            int cuvno = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1], Data[i + 2]);

            if (cuvno == 1)
            {
                IsFisrt = true;
            }
            else
            {
                IsFisrt = false;
            }

            if (IsFisrt == true)
            {
                myBatis.BackupLastestToHistory();
                myBatis.ClearupCuvNewBlk();
            }

            for (int j = i + 3, index = 0; j < i + 72; j = j + 6, index++)
            {
                float blk = MachineControlProtocol.HexConverToFloat(Data[j], Data[j + 1], Data[j + 2], Data[j + 3], Data[j + 4], Data[j + 5]);
                if (blk > -0.000001 && blk < 0.000001)
                {
                    blk = 0.0000f;
                }
                else
                {
                    blk = (float)Math.Log10(10 / blk) * RunConfigureUtility.LightSpan;
                }
                myBatis.SaveLatestCuvBlkOfWaveAndCuvNO(System.Convert.ToInt32(RunConfigureUtility.WaveLengthList[index]), cuvno, blk);
            }

            return(cuvno.ToString());
        }
示例#12
0
        public string Parse(List <byte> Data)
        {
            RunService        RunSer        = new RunService();
            RGTPOSManager     RGTPOSMgr     = new RGTPOSManager();
            TroubleLogService TroubleLogSer = new TroubleLogService();

            int Pt1stWn  = 0;
            int Pt2ndWn  = 0;
            int Pt12thWn = 0;

            for (int i = 2; i < 886; i = i + 17)
            {
                int   WN  = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1], Data[i + 2]);
                int   PT  = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);
                float PWL = MachineControlProtocol.HexConverToFloat(Data[i + 5], Data[i + 6], Data[i + 7], Data[i + 8], Data[i + 9], Data[i + 10]);
                float SWL = MachineControlProtocol.HexConverToFloat(Data[i + 11], Data[i + 12], Data[i + 13], Data[i + 14], Data[i + 15], Data[i + 16]);

                if (PWL > -0.000001 && PWL < 0.000001)
                {
                    PWL = 6.8f;
                }
                else
                {
                    PWL = (float)Math.Log10(10 / PWL) * MachineInfo.LightSpan;
                }
                if (SWL > -0.000001 && SWL < 0.000001)
                {
                    SWL = 6.8f;
                }
                else
                {
                    SWL = (float)Math.Log10(10 / SWL) * MachineInfo.LightSpan;
                }

                //Console.WriteLine(string.Format("WN:{0}PT:{1}PWL:{2}SWL:{3}", WN, PT, PWL, SWL));
                if (WN != 0 && PT != 0)
                {
                    RealTimeCUVDataService.SaveABS(WN, PT, PWL, SWL);
                }

                if (PT == 2)
                {
                    Pt2ndWn = WN;
                }
                if (PT == 12)
                {
                    Pt12thWn = WN;
                }
            }
            //温度
            float tcv = MachineControlProtocol.HexConverToFloat(Data[887], Data[888], Data[889], Data[890]);

            RunSer.UpdateLatestCUVPanelTemperature(tcv);
            float tr1 = MachineControlProtocol.HexConverToFloat(Data[891], Data[892], Data[893], Data[894]);

            RunSer.UpdateLatestR1PanelTemperature(tr1);
            //Console.WriteLine(string.Format("the CUV-Panel temperature:{0};the R1-Panel temperature :{1}", tcv * 10, tr1 * 10));
            //试剂余量
            int R1P = MachineControlProtocol.HexConverToDec(Data[896], Data[897]);
            int R1V = MachineControlProtocol.HexConverToDec(Data[898], Data[899]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R1P, R1V);
            int R2P = MachineControlProtocol.HexConverToDec(Data[900], Data[901]);
            int R2V = MachineControlProtocol.HexConverToDec(Data[902], Data[903]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R2P, R2V);
            //Console.WriteLine(string.Format("R1P:{0} R1V:{1} R2P:{2} R2V:{3}", R1P, R1V, R2P, R2V));
            //错误信息
            if (Data[904] == 0x1C)
            {
                int errcount = Data[906] - 0x30;
                //Console.WriteLine(string.Format("there is {0} errors!", errcount));
                for (int i = 0; i < errcount; i++)
                {
                    int index = 907 + i * 7;
                    switch (Data[index] - 0x30)
                    {
                    case 0x02:
                        if (Pt2ndWn != 0)
                        {
                            RealTimeCUVDataService.RunningErrors(Pt2ndWn, "SMP");
                        }
                        break;    //SMP

                    case 0x03:
                        if (Pt1stWn != 0)
                        {
                            RealTimeCUVDataService.RunningErrors(Pt1stWn, "R1");
                        }
                        break;    //R1

                    case 0x04:
                        if (Pt12thWn != 0)
                        {
                            RealTimeCUVDataService.RunningErrors(Pt12thWn, "R2");
                        }
                        break;    //R2
                    }

                    TroubleLog trouble = new TroubleLog();
                    trouble.TroubleType = TROUBLETYPE.ERR;
                    trouble.TroubleUnit = MyResources.Instance.FindResource("TroubleUnit1").ToString();
                    trouble.TroubleCode = string.Format("{0}{1}{2}{3}", (char)Data[index + 1], (char)Data[index + 2], (char)Data[index + 3], (char)Data[index + 4]);
                    trouble.TroubleInfo = null;
                    TroubleLogSer.Save(trouble);
                }
            }
            return(null);
        }
示例#13
0
        public string Parse(List <byte> Data)
        {
            //LogService.Log("开始解析测试数据包--------------", LogType.Trace,"log083.lg");
            string machinestate = null;

            //int Pt1stWn = 0;
            //int Pt3ndWn = 0;
            //int Pt26thWn = 0;

            //空白值比色杯
            int blki = 0;

            for (int j = 0; j < Data.Count(); j++)
            {
                if (Data[j] == 0x2B)
                {
                    blki  = j;
                    blki += 8;
                    break;
                }
            }
            //比色表编号
            int BlkCUVNO = MachineControlProtocol.HexConverToDec(Data[blki + 1], Data[blki + 2], Data[blki + 3]);
            //测试编号
            int BlkWN = MachineControlProtocol.HexConverToDec(Data[2], Data[3], Data[4]);

            myBatis.SaveCuvNumber(BlkWN, BlkCUVNO);
            //LogService.Log(string.Format("比色杯:{0}空白值:{1}", BlkCUVNO, BlkWN), LogType.Debug);
            //生化数据包
            int i            = 2;
            int count        = 1;
            int PressErrorWn = 0;

            while (count <= 44)
            {
                //测试编号
                int WN = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1], Data[i + 2]);
                //比色杯测光点
                int PT = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);
                //主波长比色杯值
                float PWL = MachineControlProtocol.HexConverToFloat(Data[i + 5], Data[i + 6], Data[i + 7], Data[i + 8], Data[i + 9], Data[i + 10]);
                //次波长比色杯值
                float SWL = MachineControlProtocol.HexConverToFloat(Data[i + 11], Data[i + 12], Data[i + 13], Data[i + 14], Data[i + 15], Data[i + 16]);

                if (PWL > -0.000001 && PWL < 0.000001)
                {
                    PWL = 3.5f;
                }
                else
                {
                    PWL = (float)Math.Log10(10 / PWL) * RunConfigureUtility.LightSpan;
                }
                if (SWL > -0.000001 && SWL < 0.000001)
                {
                    SWL = 3.5f;
                }
                else
                {
                    SWL = (float)Math.Log10(10 / SWL) * RunConfigureUtility.LightSpan;
                }

                if (WN != 0 && PT != 0)
                {
                    SaveABS(WN, PT, PWL, SWL);
                }

                if (PT == 2)
                {
                    PressErrorWn = WN;
                }
                //R1,R2,SMP错误日志对照
                //if (PT == 1)1.10797185
                //{
                //    Pt1stWn = WN;
                //}
                //if (PT == 3)
                //{
                //    Pt3ndWn = WN;
                //}
                //if (PT == 26)
                //{
                //    Pt26thWn = WN;
                //}

                i = i + 17;

                //Console.WriteLine(string.Format("WN:{0}PT:{1}PWL:{2}SWL:{3}", WN, PT, PWL, SWL));
                //LogService.Log(string.Format("WN:{0}PT:{1}PWL:{2}SWL:{3}", WN, PT, PWL, SWL), LogType.Debug);

                count++;
            }

            //温度
            for (int j = 0; j < Data.Count; j++)
            {
                if (Data[j] == 0x0E)
                {
                    i = j;
                    break;
                }
            }
            myBatis.UpdateLatestWaterState(Data[i + 1], Data[i + 2]);
            ProcessWaterState(Data[i + 1], Data[i + 2]);
            //压力传感器有
            int s2 = Data[i + 2] - 0x30;

            if ((s2 & 0x02) == 0x02)
            {
                RunningErrors(PressErrorWn, "PE");
                RealTimeCUVDataInfo rt = new RealTimeCUVDataInfo();
                bool bExistRes         = new ResultService().GetResultBeExistFromRealTimeWorkNum(PressErrorWn, out rt);
                if (bExistRes)
                {
                    TroubleLog trouble = new TroubleLog();
                    trouble.TroubleCode = @"0000571";
                    trouble.TroubleType = TROUBLETYPE.ERR;
                    trouble.TroubleUnit = "设备";
                    trouble.TroubleInfo = "样本" + rt.SmpNo + "项目" + rt.Assay + "测试时检测到堵针" + "反应进程:" + rt.TC.ToString();// string.Format("样本{0}项目{1}测试时检测到堵针,反应进程{2}。", r.SMPNO, r.ItemName, r.TCNO);
                    myBatis.TroubleLogSave("TroubleLogSave", trouble);
                }
            }
            if (IsWaterExchangeEnable(Data[i + 1], Data[i + 2]) == false)
            {
                //标示设备液路有异常
                machinestate = "ME";
            }

            int inttemp = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4], Data[i + 5]);

            myBatis.UpdateLatestCUVPanelTemperature(inttemp * 0.1f);

            //LogService.Log(string.Format("反应盘温度:{0};", tcv * 10), LogType.Debug);
            //试剂余量
            for (int j = 0; j < Data.Count; j++)
            {
                if (Data[j] == 0x2B)
                {
                    i = j;
                    break;
                }
            }
            int R1P = MachineControlProtocol.HexConverToDec(Data[i + 1], Data[i + 2]);
            int R1V = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);

            //R1P = R1P > 45 ? (R1P - 45) : R1P;
            //UpdateLatestRgtVol(1, R1P, R1V);
            //修改试剂1余量和可测数量
            myBatis.UpdateReagentValidPercent(R1V, 1, R1P);
            RgtWarning(1, R1P);
            //LogService.Log(string.Format("R1位置:{0} R1体积:{1}", R1P, R1V), LogType.Trace, "log083.lg");
            int R2P = MachineControlProtocol.HexConverToDec(Data[i + 5], Data[i + 6]);
            int R2V = MachineControlProtocol.HexConverToDec(Data[i + 7], Data[i + 8]);

            //UpdateLatestRgtVol(2, R2P, R2V);
            //修改试剂2余量和可测数量
            myBatis.UpdateReagentValidPercent(R2V, 2, R2P);
            RgtWarning(2, R2P);
            //LogService.Log(string.Format("R2位置:{0} R2体积:{1}", R2P, R2V), LogType.Trace, "log083.lg");
            //查找错误报头
            int erindex = -1;

            for (int j = 0; j < Data.Count(); j++)
            {
                if (Data[j] == 0x1C)
                {
                    erindex = j;
                    break;
                }
            }
            if (erindex > 0)//发生设备故障
            {
                int errcount = Data[erindex + 2] - 0x30;
                for (int j = 0; j < errcount; j++)
                {
                    int index = (erindex + 3) + j * 10;

                    int    erwn   = MachineControlProtocol.HexConverToDec(Data[index], Data[index + 1], Data[index + 2]);
                    string ercode = string.Format("{0}{1}{2}{3}{4}{5}{6}", (char)Data[index + 3], (char)Data[index + 4], (char)Data[index + 5], (char)Data[index + 6], (char)Data[index + 7], (char)Data[index + 8], (char)Data[index + 9]);
                    if (ercode == "E000415" || ercode == "E000615" || ercode == "E000515")
                    {
                    }
                    else
                    {
                        TroubleLog t = new TroubleLog();
                        t.TroubleCode = ercode;
                        t.TroubleType = TROUBLETYPE.ERR;
                        t.TroubleUnit = "设备";
                        t.TroubleInfo = null;
                        myBatis.TroubleLogSave("TroubleLogSave", t);
                    }

                    RealTimeCUVDataInfo rt = new RealTimeCUVDataInfo();
                    bool   bExistRes       = new ResultService().GetResultBeExistFromRealTimeWorkNum(PressErrorWn, out rt);
                    string cmdname         = string.Format("{0}{1}", (char)Data[index + 3], (char)Data[index + 4]);
                    if (cmdname == "77" && Data[index + 5] == 0x30)//R1
                    {
                        RunningErrors(erwn, "R1");

                        if (bExistRes)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000770";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = "设备";
                            trouble.TroubleInfo = "样本" + rt.SmpNo + "项目" + rt.Assay + "添加试剂1失败" + "反应进程:" + rt.TC.ToString();//string.Format("样本{0}项目{1}反应进程{2},添加试剂1失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        }
                    }
                    if (cmdname == "77" && Data[index + 5] == 0x31)//R2
                    {
                        RunningErrors(erwn, "R2");

                        if (bExistRes)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000771";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = "设备";
                            trouble.TroubleInfo = "样本" + rt.SmpNo + "项目" + rt.Assay + "添加试剂2失败" + "反应进程:" + rt.TC.ToString(); //string.Format("样本{0}项目{1}反应进程{2},添加试剂2失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        }
                    }
                    if (cmdname == "57" && Data[index + 5] == 0x30)//SMP
                    {
                        RunningErrors(erwn, "SMP");

                        if (bExistRes)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000570";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = "设备";
                            trouble.TroubleInfo = "样本" + rt.SmpNo + "项目" + rt.Assay + "添加样本失败" + "反应进程:" + rt.TC.ToString(); //string.Format("样本{0}项目{1}反应进程{2},添加样本失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        }
                    }
                }
            }
            return(machinestate);
        }
示例#14
0
        public string Parse(List <byte> Data)
        {
            if (Data.Count < 904)
            {
                LogService.Log("非法数据包:" + MachineControlProtocol.BytelistToHexString(Data), LogType.Debug);
                return(null);
            }

            RunService             RunSer             = new RunService();
            RGTPOSManager          RGTPOSMgr          = new RGTPOSManager();
            TroubleLogService      TroubleLogSer      = new TroubleLogService();
            RealTimeCUVDataService RealTimeCUVDataSer = new RealTimeCUVDataService();

            int Pt1stWn  = 0;
            int Pt3ndWn  = 0;
            int Pt26thWn = 0;

            int BlkCUVNO = MachineControlProtocol.HexConverToDec(Data[904], Data[905], Data[906]);
            int BlkWN    = MachineControlProtocol.HexConverToDec(Data[2], Data[3], Data[4]);

            RealTimeCUVDataSer.SaveCuvNumber(BlkWN, BlkCUVNO);

            for (int i = 2; i < 886; i = i + 17)
            {
                int   WN  = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1], Data[i + 2]);
                int   PT  = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);
                float PWL = MachineControlProtocol.HexConverToFloat(Data[i + 5], Data[i + 6], Data[i + 7], Data[i + 8], Data[i + 9], Data[i + 10]);
                float SWL = MachineControlProtocol.HexConverToFloat(Data[i + 11], Data[i + 12], Data[i + 13], Data[i + 14], Data[i + 15], Data[i + 16]);

                if (PWL > -0.000001 && PWL < 0.000001)
                {
                    PWL = 3.5f;
                }
                else
                {
                    PWL = (float)Math.Log10(10 / PWL) * MachineInfo.LightSpan;
                }
                if (SWL > -0.000001 && SWL < 0.000001)
                {
                    SWL = 3.5f;
                }
                else
                {
                    SWL = (float)Math.Log10(10 / SWL) * MachineInfo.LightSpan;
                }

                if (WN != 0 && PT != 0)
                {
                    RealTimeCUVDataService.SaveABS(WN, PT, PWL, SWL);
                }
                if (PT == 1)
                {
                    Pt1stWn = WN;
                }
                if (PT == 3)
                {
                    Pt3ndWn = WN;
                }
                if (PT == 26)
                {
                    Pt26thWn = WN;
                }

                //Console.WriteLine(string.Format("WN:{0}PT:{1}PWL:{2}SWL:{3}", WN, PT, PWL, SWL));
            }
            //温度
            float tcv = MachineControlProtocol.HexConverToFloat(Data[887], Data[888], Data[889], Data[890]);

            RunSer.UpdateLatestCUVPanelTemperature(tcv * 10);
            float tr1 = MachineControlProtocol.HexConverToFloat(Data[891], Data[892], Data[893], Data[894]);

            RunSer.UpdateLatestR1PanelTemperature(tr1 * 10);
            LogService.Log(string.Format("反应盘温度:{0};试剂盘温度 :{1}", tcv * 10, tr1 * 10), LogType.Debug);
            //试剂余量
            int R1P = MachineControlProtocol.HexConverToDec(Data[896], Data[897]);
            int R1V = MachineControlProtocol.HexConverToDec(Data[898], Data[899]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R1P, R1V);
            RgtWarning(1, R1P);
            int R2P = MachineControlProtocol.HexConverToDec(Data[900], Data[901]);
            int R2V = MachineControlProtocol.HexConverToDec(Data[902], Data[903]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R2P, R2V);
            RgtWarning(1, R2P);
            LogService.Log(string.Format("R1位置:{0} R1体积:{1} R2位置:{2} R2体积:{3}", R1P, R1V, R2P, R2V), LogType.Debug);
            //查找错误报头
            int erindex = 0;

            for (int i = 0; i < Data.Count(); i++)
            {
                if (Data[i] == 0x1C)
                {
                    erindex = i;
                    break;
                }
            }
            //错误信息
            if (Data[erindex] == 0x1C)
            {
                LogService.Log(MachineControlProtocol.BytelistToHexString(Data), LogType.Debug);

                int errcount = Data[erindex + 2] - 0x30;
                //Console.WriteLine(string.Format("there is {0} errors!", errcount));
                for (int i = 0; i < errcount; i++)
                {
                    int index = (erindex + 3) + i * 7;

                    string cmdname = string.Format("{0}{1}", (char)Data[index], (char)Data[index + 1]);
                    if (cmdname == "77" && Data[index + 2] == 0x30)//R1
                    {
                        RealTimeCUVDataService.RunningErrors(Pt1stWn, "R1");

                        Result r = new RealTimeCUVDataService().GetResultFromRealTimeWorkNum(Pt1stWn);
                        if (r != null)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000770";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = @"设备";
                            trouble.TroubleInfo = string.Format("样本{0}项目{1}反应进程{2}:添加试剂1失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            TroubleLogSer.Save(trouble);
                        }
                    }
                    if (cmdname == "77" && Data[index + 2] == 0x31)//R2
                    {
                        RealTimeCUVDataService.RunningErrors(Pt26thWn, "R2");

                        Result r = new RealTimeCUVDataService().GetResultFromRealTimeWorkNum(Pt26thWn);
                        if (r != null)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000771";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = @"设备";
                            trouble.TroubleInfo = string.Format("样本{0}项目{1}反应进程{2}:添加试剂2失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            TroubleLogSer.Save(trouble);
                        }
                    }
                    if (cmdname == "57" && Data[index + 2] == 0x30)//SMP
                    {
                        RealTimeCUVDataService.RunningErrors(Pt3ndWn, "SMP");

                        Result r = new RealTimeCUVDataService().GetResultFromRealTimeWorkNum(Pt3ndWn);
                        if (r != null)
                        {
                            TroubleLog trouble = new TroubleLog();
                            trouble.TroubleCode = @"0000570";
                            trouble.TroubleType = TROUBLETYPE.ERR;
                            trouble.TroubleUnit = @"设备";
                            trouble.TroubleInfo = string.Format("样本{0}项目{1}反应进程{2}:添加样本失败. ", r.SMPNO, r.ItemName, r.TCNO);
                            TroubleLogSer.Save(trouble);
                        }
                    }


                    TroubleLog t = new TroubleLog();
                    t.TroubleCode = string.Format("{0}{1}{2}{3}{4}{5}{6}", (char)Data[index], (char)Data[index + 1], (char)Data[index + 2], (char)Data[index + 3], (char)Data[index + 4], (char)Data[index + 5], (char)Data[index + 6]);
                    t.TroubleType = TROUBLETYPE.ERR;
                    t.TroubleUnit = @"设备";
                    t.TroubleInfo = null;
                    TroubleLogSer.Save(t);

                    LogService.Log("测试运行设备发生错误:" + t.TroubleCode, LogType.Debug);
                }
            }
            return(null);
        }
示例#15
0
        public string Parse(List <byte> Data)
        {
            int i = 0;

            //温度
            for (int j = 0; j < Data.Count; j++)
            {
                if (Data[j] == 0x0E)
                {
                    i = j;
                    break;
                }
            }
            myBatis.UpdateLatestWaterState(Data[i + 1], Data[i + 2]);
            int inttemp = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4], Data[i + 5]);

            myBatis.UpdateLatestCUVPanelTemperature(inttemp * 0.1f);
            //LogService.Log(string.Format("反应盘温度:{0};", tcv * 10), LogType.Debug);
            //试剂余量
            for (int j = 0; j < Data.Count; j++)
            {
                if (Data[j] == 0x2B)
                {
                    i = j;
                    break;
                }
            }
            int R1P = MachineControlProtocol.HexConverToDec(Data[i + 1], Data[i + 2]);
            int R1V = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);

            UpdateLatestRgtVol(1, R1P, R1V);
            RgtWarning(1, R1P);
            int R2P = MachineControlProtocol.HexConverToDec(Data[i + 5], Data[i + 6]);
            int R2V = MachineControlProtocol.HexConverToDec(Data[i + 7], Data[i + 8]);

            UpdateLatestRgtVol(2, R2P, R2V);
            RgtWarning(2, R2P);
            //LogService.Log(string.Format("R1位置:{0} R1体积:{1} R2位置:{2} R2体积:{3}", R1P, R1V, R2P, R2V), LogType.Debug);
            //查找错误报头
            int erindex = -1;

            for (int j = 0; j < Data.Count(); j++)
            {
                if (Data[j] == 0x1C)
                {
                    erindex = j;
                    break;
                }
            }
            if (erindex > 0)//发生设备故障
            {
                int errcount = Data[erindex + 2] - 0x30;
                for (int j = 0; j < errcount; j++)
                {
                    int index = (erindex + 3) + j * 10;

                    int    erwn   = MachineControlProtocol.HexConverToDec(Data[index], Data[index + 1], Data[index + 2]);
                    string ercode = string.Format("{0}{1}{2}{3}{4}{5}{6}", (char)Data[index + 3], (char)Data[index + 4], (char)Data[index + 5], (char)Data[index + 6], (char)Data[index + 7], (char)Data[index + 8], (char)Data[index + 9]);
                    if (ercode == "E000415" || ercode == "E000615")
                    {
                    }
                    else
                    {
                        TroubleLog t = new TroubleLog();
                        t.TroubleCode = ercode;
                        t.TroubleType = TROUBLETYPE.ERR;
                        t.TroubleUnit = "设备";
                        t.TroubleInfo = null;
                        myBatis.TroubleLogSave("TroubleLogSave", t);
                    }

                    string cmdname = string.Format("{0}{1}", (char)Data[index + 3], (char)Data[index + 4]);
                    if (cmdname == "77" && Data[index + 5] == 0x30)//R1
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000770";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = "设备";
                        trouble.TroubleInfo = string.Format("试剂仓1清洗剂添加失败. ");
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                    }
                    if (cmdname == "77" && Data[index + 5] == 0x31)//R2
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000771";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = "设备";
                        trouble.TroubleInfo = string.Format("试剂仓2清洗剂添加失败. ");
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                    }
                    if (cmdname == "57" && Data[index + 5] == 0x30)//SMP
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000570";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = "设备";
                        trouble.TroubleInfo = string.Format("样本位清洗剂添加失败. ");
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                    }
                }
            }

            return(null);
        }
示例#16
0
        public string Parse(List <byte> Data)
        {
            ISECalibratedResult ISECalibratedResult = new ISECalibratedResult();

            int sate = MachineControlProtocol.HexConverToDec(Data[2], Data[3]);

            TroubleLog isestatetrouble = new TroubleLog();

            isestatetrouble.TroubleCode = @"ISE00" + sate.ToString("#00");
            isestatetrouble.TroubleUnit = @"ISE";
            if (sate <= 50)
            {
                isestatetrouble.TroubleType = TROUBLETYPE.WARN;
            }
            else
            {
                isestatetrouble.TroubleType = TROUBLETYPE.ERR;
            }
            new TroubleLogService().Save(isestatetrouble);

            if (sate == 73)
            {
                ISEItemSDTTable ISEItemSDTTable = new ISEItemSDTTableService().GetNewISEItemSDTTable();
                if (ISEItemSDTTable != null)
                {
                    ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA905").ToString();
                    ISEItemSDTTable.State  = "failed";
                    ISEItemSDTTable.IsUsed = false;
                    new ISEItemSDTTableService().DeleteNewISEItemSDTTable();
                    new ISEItemSDTTableService().Save(ISEItemSDTTable);
                }
            }

            ISECalibratedResult.ResultState = sate.ToString();

            int isecode = MachineControlProtocol.HexConverToDec(Data[4], Data[5], Data[6]);

            ISECalibratedResult.CalibratePosition = isecode.ToString();

            int index = 7;

            ISECalibratedResult.NaE = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.NaF = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.NaG = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));

            index += 9;
            ISECalibratedResult.KE = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.KF = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.KG = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));

            index += 9;
            ISECalibratedResult.ClE = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.ClF = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.ClG = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));

            index += 9;
            ISECalibratedResult.Th1H = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.Th1I = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));

            index += 9;
            ISECalibratedResult.Th2H = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));
            index += 9;
            ISECalibratedResult.Th2I = MachineControlProtocol.ConvertArrayToString(GetData(Data, index, 9));

            ISECalibratedResult.CalibrateCode = new RunService().GetISECalibrateCode() - 1;

            new ISECalibratedResultService().Save(ISECalibratedResult);

            return(null);
        }
示例#17
0
        public string Parse(List <byte> data)
        {
            ISEItemSDTTable ISEItemSDTTable = new ISEItemSDTTableService().GetNewISEItemSDTTable();

            if (ISEItemSDTTable == null)
            {
                return(null);
            }

            int index = 5;

            ISEItemSDTTable.NaHighSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.NaHighSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.NaLowSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.NaLowSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.NaSlope = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.NaDilRate = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KHighSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KHighSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KLowSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KLowSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KSlope = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.KDilRate = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClHighSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClHighSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClLowSampleValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClLowSampleBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClSlope = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.ClDilRate = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.HighThValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.HighThBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.LowThValue = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));
            index += 9;
            ISEItemSDTTable.LowThBase = MachineControlProtocol.HexConverToFloat(GetData(data, index, 9));

            int s = MachineControlProtocol.HexConverToDec(data[2], data[3]);

            switch (s)
            {
            case 01: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA901").ToString(); break;

            case 97: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA902").ToString(); break;

            case 94: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA903").ToString(); break;

            case 79: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA904").ToString(); break;

            case 78: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA905").ToString(); break;

            case 77: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA905").ToString(); break;

            case 76: ISEItemSDTTable.RunLog = MyResources.Instance.FindResource("ParseA905").ToString(); break;
            }
            new ISEItemSDTTableService().DeleteNewISEItemSDTTable();
            if (s == 1)
            {
                ISEItemSDTTable.State = "success";
                new ISEItemSDTTableService().Save(ISEItemSDTTable);
                new ISEItemSDTTableService().SetISEItemSDTTableUsing(ISEItemSDTTable);
            }

            TroubleLog isestatetrouble = new TroubleLog();

            isestatetrouble.TroubleCode = @"ISE00" + s.ToString("#00");
            isestatetrouble.TroubleUnit = @"ISE";
            if (s <= 50)
            {
                isestatetrouble.TroubleType = TROUBLETYPE.WARN;
            }
            else
            {
                isestatetrouble.TroubleType = TROUBLETYPE.ERR;
            }
            new TroubleLogService().Save(isestatetrouble);


            if (Math.Abs(ISEItemSDTTable.ClSlope) < 38 || Math.Abs(ISEItemSDTTable.ClSlope) > 65)
            {
                TroubleLog trouble = new TroubleLog();
                trouble.TroubleCode = @"ISE0000";
                trouble.TroubleType = TROUBLETYPE.ERR;
                trouble.TroubleUnit = @"ISE";
                trouble.TroubleInfo = MyResources.Instance.FindResource("ParseA906").ToString();
                new TroubleLogService().Save(trouble);
            }

            return(null);
        }
示例#18
0
        public string Parse(List <byte> data)
        {
            bool HasError = false;
            bool HasWarn  = false;

            for (int i = 2; i < 86; i = i + 7)
            {
                int WaveIndex = System.Convert.ToInt32(RunConfigureUtility.WaveLengthList[data[i] - '0']);
                int OffSet    = MachineControlProtocol.HexConverToDec(data[i + 1], data[i + 2], data[i + 3]);
                int Gain      = MachineControlProtocol.HexConverToDec(data[i + 4], data[i + 5], data[i + 6]);

                if (Gain < 60)
                {
                    TroubleLog trouble = new TroubleLog();
                    trouble.TroubleType = TROUBLETYPE.ERR;
                    trouble.TroubleUnit = "光度计";
                    trouble.TroubleInfo = "波长" + WaveIndex + "增益" + Gain + "低于60,光度计不能正常工作";// string.Format(@"波长{0}增益值{1}低于60,光度计不能正常工作。", WaveIndex, Gain);
                    trouble.TroubleCode = "00001";
                    myBatis.TroubleLogSave("TroubleLogSave", trouble);

                    HasError = true;
                }

                OffSetGain offgain = myBatis.GetLatestOffSetGain(WaveIndex);
                if (offgain == null)
                {
                    offgain             = new OffSetGain();
                    offgain.WaveLength  = WaveIndex;
                    offgain.OffSet      = OffSet;
                    offgain.Gain        = Gain;
                    offgain.InspectTime = DateTime.Now;
                    if (WaveIndex == 795)
                    {
                        offgain.InspectTime = DateTime.Now;
                    }
                    myBatis.AddLatestOffSetGain(offgain);
                }
                else
                {
                    if (Math.Abs(Gain - offgain.Gain) >= 30)
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleType = TROUBLETYPE.WARN;
                        trouble.TroubleUnit = "光度计";
                        trouble.TroubleInfo = "波长" + WaveIndex + "增益值波动幅度大于30";// string.Format(@"波长{0}增益值波动幅度{1},影响结果的准确性。", WaveIndex, Math.Abs(Gain - offgain.Gain));
                        trouble.TroubleCode = "00003";
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);

                        HasWarn = true;
                    }
                    myBatis.DeleteOldOffSetGain(WaveIndex);
                    myBatis.AddOldOffSetGain(offgain);
                    offgain.OffSet = OffSet;
                    offgain.Gain   = Gain;
                    if (WaveIndex == 795)
                    {
                        offgain.InspectTime = DateTime.Now;
                    }
                    myBatis.DeleteNewOffSetGain(WaveIndex);
                    myBatis.AddLatestOffSetGain(offgain);
                }
            }

            if (HasError == true)
            {
                return("PhotometerWrong");
            }

            if (HasWarn == true)
            {
                return("PhotometerWarn");
            }

            return("PhotometerRight");
        }
示例#19
0
        public string Parse(List <byte> Data)
        {
            if (Data.Count < 904)
            {
                LogService.Log("非法数据包:" + MachineControlProtocol.BytelistToHexString(Data), LogType.Debug);
                return(null);
            }

            RunService        RunSer        = new RunService();
            RGTPOSManager     RGTPOSMgr     = new RGTPOSManager();
            TroubleLogService TroubleLogSer = new TroubleLogService();

            int Pt1stWn  = 0;
            int Pt3ndWn  = 0;
            int Pt14thWn = 0;

            int BlkCUVNO = MachineControlProtocol.HexConverToDec(Data[904], Data[905], Data[906]);
            int BlkWN    = MachineControlProtocol.HexConverToDec(Data[2], Data[3], Data[4]);

            for (int i = 2; i < 886; i = i + 17)
            {
                int WN = MachineControlProtocol.HexConverToDec(Data[i], Data[i + 1], Data[i + 2]);
                int PT = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);


                if (PT == 1)
                {
                    Pt1stWn = WN;
                }
                if (PT == 3)
                {
                    Pt3ndWn = WN;
                }
                if (PT == 14)
                {
                    Pt14thWn = WN;
                }
            }
            //温度
            float tcv = MachineControlProtocol.HexConverToFloat(Data[887], Data[888], Data[889], Data[890]);

            RunSer.UpdateLatestCUVPanelTemperature(tcv * 10);
            float tr1 = MachineControlProtocol.HexConverToFloat(Data[891], Data[892], Data[893], Data[894]);

            RunSer.UpdateLatestR1PanelTemperature(tr1 * 10);
            LogService.Log(string.Format("反应盘温度:{0};试剂盘温度 :{1}", tcv * 10, tr1 * 10), LogType.Debug);
            //试剂余量
            int R1P = MachineControlProtocol.HexConverToDec(Data[896], Data[897]);
            int R1V = MachineControlProtocol.HexConverToDec(Data[898], Data[899]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R1P, R1V);
            RgtWarning(1, R1P);
            int R2P = MachineControlProtocol.HexConverToDec(Data[900], Data[901]);
            int R2V = MachineControlProtocol.HexConverToDec(Data[902], Data[903]);

            RGTPOSMgr.UpdateLatestRgtVol(1, R2P, R2V);
            RgtWarning(1, R2P);
            LogService.Log(string.Format("R1位置:{0} R1体积:{1} R2位置:{2} R2体积:{3}", R1P, R1V, R2P, R2V), LogType.Debug);
            //查找错误报头
            int erindex = 0;

            for (int i = 0; i < Data.Count(); i++)
            {
                if (Data[i] == 0x1C)
                {
                    erindex = i;
                    break;
                }
            }
            //错误信息
            if (Data[erindex] == 0x1C)
            {
                LogService.Log(MachineControlProtocol.BytelistToHexString(Data), LogType.Debug);

                int errcount = Data[erindex + 2] - 0x30;
                //Console.WriteLine(string.Format("there is {0} errors!", errcount));
                for (int i = 0; i < errcount; i++)
                {
                    int index = (erindex + 3) + i * 7;

                    string cmdname = string.Format("{0}{1}", (char)Data[index], (char)Data[index + 1]);
                    if (cmdname == "77" && Data[index + 2] == 0x30)//R1
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000770";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = @"设备";
                        trouble.TroubleInfo = string.Format("试剂位清洗液添加失败. ");
                        TroubleLogSer.Save(trouble);
                    }
                    if (cmdname == "77" && Data[index + 2] == 0x31)//R2
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000771";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = @"设备";
                        trouble.TroubleInfo = string.Format("试剂位清洗液添加失败. ");
                        TroubleLogSer.Save(trouble);
                    }
                    if (cmdname == "57" && Data[index + 2] == 0x30)//SMP
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000570";
                        trouble.TroubleType = TROUBLETYPE.ERR;
                        trouble.TroubleUnit = @"设备";
                        trouble.TroubleInfo = string.Format("样本位清洗液添加失败. ");
                        TroubleLogSer.Save(trouble);
                    }


                    TroubleLog t = new TroubleLog();
                    t.TroubleCode = string.Format("{0}{1}{2}{3}{4}{5}{6}", (char)Data[index], (char)Data[index + 1], (char)Data[index + 2], (char)Data[index + 3], (char)Data[index + 4], (char)Data[index + 5], (char)Data[index + 6]);
                    t.TroubleType = TROUBLETYPE.ERR;
                    t.TroubleUnit = @"设备";
                    t.TroubleInfo = null;
                    TroubleLogSer.Save(t);

                    LogService.Log("测试运行设备发生错误:" + t.TroubleCode, LogType.Debug);
                }
            }
            return(null);
        }
示例#20
0
        public string Parse(List <byte> Data)
        {
            try
            {
                //RunService RunSer = new RunService();
                //RGTPOSManager RGTPOSMgr = new RGTPOSManager();
                //TroubleLogService TroubleLogSer = new TroubleLogService();
                //RealTimeCUVDataService RealTimeCUVDataSer = new RealTimeCUVDataService();

                int i = 2;
                //温度
                for (int j = 0; j < Data.Count; j++)
                {
                    if (Data[j] == 0x0E)
                    {
                        i = j;
                        break;
                    }
                }
                float tcv = MachineControlProtocol.HexConverToFloat(Data[i + 2], Data[i + 3], Data[i + 4], Data[i + 5]);
                myBatis.UpdateLatestCUVPanelTemperature(tcv * 10);
                //LogService.Log(string.Format("React Panel Temp.:{0};", tcv * 10), LogType.Debug);
                //试剂余量
                for (int j = 0; j < Data.Count; j++)
                {
                    if (Data[j] == 0x2B)
                    {
                        i = j;
                        break;
                    }
                }
                int R1P = MachineControlProtocol.HexConverToDec(Data[i + 1], Data[i + 2]);
                int R1V = MachineControlProtocol.HexConverToDec(Data[i + 3], Data[i + 4]);
                R1P = R1P > 90 ? (R1P - 90) : R1P;
                UpdateLatestRgtVol(1, R1P, R1V);
                RgtWarning(1, R1P);
                int R2P = MachineControlProtocol.HexConverToDec(Data[i + 5], Data[i + 6]);
                int R2V = MachineControlProtocol.HexConverToDec(Data[i + 7], Data[i + 8]);
                UpdateLatestRgtVol(2, R2P, R2V);
                RgtWarning(2, R2P);
                //LogService.Log(string.Format("R1 Pos.:{0} R1 Vol:{1} R2 Pos.:{2} R2 Vol:{3}", R1P, R1V, R2P, R2V), LogType.Debug);
                //查找错误报头
                int erindex = 0;
                for (int j = 0; j < Data.Count(); j++)
                {
                    if (Data[j] == 0x1C)
                    {
                        erindex = j;
                        break;
                    }
                }
                int errcount = Data[erindex + 2] - 0x30;
                if (errcount > 0)
                {
                    for (int j = 0; j < errcount; j++)
                    {
                        int index = (erindex + 6) + j * 7;

                        TroubleLog t = new TroubleLog();
                        t.TroubleCode = string.Format("{0}{1}{2}{3}{4}{5}{6}", (char)Data[index], (char)Data[index + 1], (char)Data[index + 2], (char)Data[index + 3], (char)Data[index + 4], (char)Data[index + 5], (char)Data[index + 6]);
                        if (t.TroubleCode == "E000415" || t.TroubleCode == "E000615")
                        {
                        }
                        else
                        {
                            t.TroubleType = TROUBLETYPE.ERR;
                            t.TroubleUnit = "设备";
                            t.TroubleInfo = null;
                            myBatis.TroubleLogSave("TroubleLogSave", t);
                        }
                        //LogService.Log("Err code:" + t.TroubleCode, LogType.Debug);
                    }
                }
            }
            catch
            {
                TroubleLog t = new TroubleLog();
                t.TroubleCode = @"0X25001";
                t.TroubleType = TROUBLETYPE.ERR;
                t.TroubleUnit = "设备";
                t.TroubleInfo = null;
                myBatis.TroubleLogSave("TroubleLogSave", t);
            }
            return(null);
        }