Ejemplo n.º 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("");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 3
0
        public string Parse(List <byte> Data)
        {
            float v = MachineControlProtocol.HexConverToFloat(Data[9], Data[10], Data[11], Data[12], Data[13], Data[14]);

            myBatis.UpdateVoltageValue(v);

            return(null);
        }
Ejemplo n.º 4
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());
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }