Exemple #1
0
 public void AddOldOffSetGain(OffSetGain offSetGain)
 {
     try
     {
         ism_SqlMap.Insert("EquipmentManage.AddOldOffSetGain", offSetGain);
     }
     catch (Exception e)
     {
         LogInfo.WriteErrorLog("AddOldOffSetGain(OffSetGain offSetGain)==" + e.ToString(), Module.System);
     }
 }
Exemple #2
0
        /// <summary>
        /// 获取历史光度计
        /// </summary>
        /// <param name="strMethodName"></param>
        /// <returns></returns>
        //public List<OffSetGain> QueryOldPhotemetricValue(string strMethodName)
        //{
        //    List<OffSetGain> lstPhotoGain = new List<OffSetGain>();
        //    try
        //    {
        //        lstPhotoGain = ism_SqlMap.QueryForList<OffSetGain>("EquipmentManage." + strMethodName, null) as List<OffSetGain>;
        //    }
        //    catch (Exception e)
        //    {
        //        LogInfo.WriteErrorLog("QueryOldPhotemetricValue(string strMethodName)==" + e.ToString(), Module.System);
        //    }

        //    return lstPhotoGain;
        //}

        public OffSetGain GetLatestOffSetGain(int waveLength)
        {
            OffSetGain offSetGain = new OffSetGain();

            try
            {
                offSetGain = ism_SqlMap.QueryForObject("EquipmentManage.GetLatestOffSetGain", waveLength) as OffSetGain;
            }
            catch (Exception e)
            {
                LogInfo.WriteErrorLog("GetLatestOffSetGain(int waveLength)==" + e.ToString(), Module.System);
            }
            return(offSetGain);
        }
Exemple #3
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");
        }