/// <summary>
        /// アルミロープログ解析を行う
        /// </summary>
        /// <param name="dipAlmiSlopeLog">骨塩アルミスロープログ</param>
        /// <param name="messageId">メッセージID</param>
        /// <param name="_analysisData">アルミスロープログ解析対象データ</param>
        /// <param name="_analysisResult">アルミスロープログ解析結果</param>
        /// <returns>成功した場合true、失敗した場合falseを返す</returns>
        public bool AnalyzeDipAlmiLog(DipAlmiSlopeLog dipAlmiSlopeLog, string messageId, out AlmiLogAnalysisData _analysisData, out AlmiLogAnalysisResult _analysisResult)
        {
            _analysisData   = new AlmiLogAnalysisData();
            _analysisResult = new AlmiLogAnalysisResult();

            try
            {
                _logger.EnterJson("{0}", new { dipAlmiSlopeLog, messageId });

                int gpValue = int.Parse(dipAlmiSlopeLog.GpValue);

                if (gpValue != 0 && (gpValue < GpMinValue || GpMaxValue < gpValue))
                {
                    string message = $"GP値が正しくありません。(機器管理番号:{dipAlmiSlopeLog?.SourceEquipmentUid})(解析ログファイル名:{dipAlmiSlopeLog?.FileName})(GP値:{gpValue})";
                    throw new RmsException(message);
                }

                bool isNormalized = gpValue == 0 ? false : true;

                var almiLogConfigResult = _dtAlmilogAnalysisConfigRepository.ReadDtAlmilogAnalysisConfig(dipAlmiSlopeLog.DetectorName, isNormalized, false);
                var blocLogConfigResult = _dtBloclogAnalysisConfigRepository.ReadDtBloclogAnalysisConfig(isNormalized, false);

                CreatetAnalysisData(dipAlmiSlopeLog, almiLogConfigResult, blocLogConfigResult, out _analysisData);

                int ret = NativeMethods.AnalyzeAlmiLog(ref _analysisData, ref _analysisResult);

                if (ret != 0)
                {
                    string message = $"(機器管理番号:{dipAlmiSlopeLog?.SourceEquipmentUid})(解析ログファイル名:{dipAlmiSlopeLog?.FileName})";
                    throw new RmsException(string.Format("LogAnalysisDll.AnalyzeAlmiLog() returned {0}. {1} {2}", ret, _analysisResult.ErrorMsg, message));
                }

                return(true);
            }
            catch (RmsException e)
            {
                _logger.Error(e, nameof(Resources.UT_DAA_DAA_005), new object[] { messageId });
                return(false);
            }
            finally
            {
                _logger.LeaveJson("{0}", new { _analysisData, _analysisResult });
            }
        }
        /// <summary>
        /// アルミロープログ解析結果をDBに登録する
        /// </summary>
        /// <param name="dipAlmiSlopeLog">骨塩アルミスロープログ</param>
        /// <param name="messageId">メッセージID</param>
        /// <param name="_analysisData">アルミスロープログ解析対象データ</param>
        /// <param name="_analysisResult">アルミスロープログ解析結果</param>
        /// <param name="model">DBへの登録結果</param>
        /// <returns>成功した場合true、失敗した場合falseを返す</returns>
        public bool RegistAlmiLogAnalysisResultToDb(DipAlmiSlopeLog dipAlmiSlopeLog, string messageId, AlmiLogAnalysisData _analysisData, AlmiLogAnalysisResult _analysisResult, out DtAlmilogAnalysisResult model)
        {
            model = null;

            try
            {
                _logger.EnterJson("{0}", new { dipAlmiSlopeLog, messageId, _analysisData, _analysisResult });

                var dtAlmilogAnalysisResult = new DtAlmilogAnalysisResult
                {
                    EquipmentUid              = dipAlmiSlopeLog.SourceEquipmentUid,
                    AnalysisResult            = _analysisResult.JudgeResult,
                    CalculateInclinationValue = _analysisResult.CulSlopeValue,
                    CalculateAreaValue        = _analysisResult.CulAreaValue,
                    MaxInclinationValue       = _analysisData.MaxSlopeValue,
                    MinInclinationValue       = _analysisData.MinSlopeValue,
                    StandardAreaValue         = _analysisResult.CulStdValue,
                    AlmilogMonth              = dipAlmiSlopeLog.OccurrenceYm,
                    DetectorName              = dipAlmiSlopeLog.DetectorName,
                    DetectorId               = dipAlmiSlopeLog.DetectorId,
                    GpValue                  = int.Parse(dipAlmiSlopeLog.GpValue),
                    ImageFileName            = dipAlmiSlopeLog.FileName,
                    FileNameNo               = short.Parse(dipAlmiSlopeLog.SNumber),
                    ReverseResult            = _analysisResult.SlopeReverseResult,
                    ReverseResultInclination = _analysisResult.Inclination,
                    IsAlarmJudged            = false,
                    IsBillTarget             = dipAlmiSlopeLog.ServiceFlg == true ? false : true,
                    LogFileName              = dipAlmiSlopeLog.LogFileName
                };

                model = _dtAlmilogAnalysisResultRepository.CreateDtAlmilogAnalysisResult(dtAlmilogAnalysisResult);

                return(true);
            }
            catch (RmsParameterException e)
            {
                _logger.Error(e, nameof(Resources.UT_DAA_DAA_006), new object[] { messageId });
                return(false);
            }
            catch (RmsException e)
            {
                _logger.Error(e, nameof(Resources.UT_DAA_DAA_006), new object[] { messageId });
                return(false);
            }
            finally
            {
                _logger.LeaveJson("{0}", new { model });
            }
        }
Beispiel #3
0
 public static extern int AnalyzeAlmiLog(ref AlmiLogAnalysisData analysisData, ref AlmiLogAnalysisResult analysisResult);