123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- using MeterVision.Config;
- using MeterVision.model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MeterVision.db
- {
- public class TPatchDetail
- {
- public string PatchDetailId { get; set; }
- public string PatchId { get; set; }
- public string CreateTime { get; set; }
- public string StandDetailId { get; set; }
- public string StandValue { get; set; }
- public string SrcImage { get; set; }
- public int RunFlag { get; set; }
- public string RunTime { get; set; }
- public string DstImage { get; set; }
- public int MeterType { get; set; }
- public int DigitCount { get; set; }
- public int PointerCount { get; set; }
- public string LastUnit { get; set; }
- public int ResultType { get; set; }
- public string RawValue { get; set; }
- public string FinalValue { get; set; }
- public int EqualFlag { get; set; }
- public string AiVer { get; set; }
- public string DebugInfo { get; set; }
- public string LogPath { get; set; }
- public string Memo { get; set; }
- // 构造函数,初始化默认值
- public TPatchDetail()
- {
- PatchDetailId = string.Empty;
- PatchId = string.Empty;
- CreateTime = string.Empty;
- StandDetailId = string.Empty;
- StandValue = string.Empty;
- SrcImage = string.Empty;
- RunFlag = 0;
- RunTime = string.Empty;
- DstImage = string.Empty;
- MeterType = 0;
- DigitCount = 0;
- PointerCount = 0;
- LastUnit = string.Empty;
- ResultType = 0;
- RawValue = string.Empty;
- FinalValue = string.Empty;
- EqualFlag = 0;
- AiVer = string.Empty;
- DebugInfo = string.Empty;
- LogPath = string.Empty;
- Memo = string.Empty;
- }
- public TPatchDetail(PatchDetailItem patchDetail, ResultModel resultModel)
- {
- PatchDetailId = patchDetail.PatchDetailId;
- PatchId = patchDetail.PatchId;
- CreateTime = patchDetail.CreateTime;
- StandDetailId = patchDetail.StandDetailId;
- StandValue = patchDetail.StandValue;
- SrcImage = patchDetail.SrcImage;
- RunFlag = 1;
- RunTime = ThisApp.GetNowTime_yyyyMMddHHmmss();
- DstImage = resultModel.DstImage;
- //MeterType = resultModel.MeterType;
- LastUnit = resultModel.SLastUnit;
- ResultType = resultModel.ResultType;
- RawValue = resultModel.SRawValue;
- FinalValue = resultModel.sFinalValue;
- AiVer = resultModel.AiVer;
- LogPath = resultModel.LogPath;
- // 使用 LINQ 进行转换和条件判断
- var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
- DebugInfo = string.Join(",", formattedBytes);
- //EqualFlag,这里需要判断,是否相等、约等、不等
- //先简单判断
- if (string.IsNullOrWhiteSpace(StandValue))
- {
- EqualFlag = 2;
- }
- else
- {
- //EqualFlag = (FinalValue.Equals(StandValue) ? 1 : 0);
- EqualFlag = PatchDetailItem.CheckEquailityWithStandValue(StandValue, FinalValue) ? 1 : 0;
- }
- }
- //设置结果
- public void SetResult(ResultModel resultModel)
- {
- RunFlag = 1;
- RunTime = ThisApp.GetNowTime_yyyyMMddHHmmss();
- DstImage = resultModel.DstImage;
- MeterType = resultModel.MeterType;
- //DigitCount = resultModel.DigitCount;
- //PointerCount = resultModel.PointerCount;
- LastUnit = resultModel.SLastUnit;
- ResultType = resultModel.ResultType;
- RawValue = resultModel.SRawValue;
- FinalValue = resultModel.sFinalValue;
- AiVer = resultModel.AiVer;
- LogPath = resultModel.LogPath;
- // 使用 LINQ 进行转换和条件判断
- var formattedBytes = resultModel.DebugInfoBytes.Select(b => b == 88 ? "" : b.ToString());
- DebugInfo = string.Join(",", formattedBytes);
- //EqualFlag,这里需要判断,是否相等、约等、不等
- //先简单判断
- if (string.IsNullOrWhiteSpace(StandValue))
- {
- EqualFlag = 2;
- }
- else
- {
- //EqualFlag = (FinalValue.Equals(StandValue) ? 1 : 0);
- EqualFlag = PatchDetailItem.CheckEquailityWithStandValue(StandValue, FinalValue) ? 1 : 0;
- }
- }
- //----------------------------------------------
- //判读标准值与结果指是否相等
- public bool CheckEquaility()
- {
- bool blEqual = false;
- //ConfigItem config = ConfigItem.GetConfigItem();
- if(MeterType == 1)
- {
- //数字+指针
- }
- else if(MeterType == 2)
- {
- //全指针
- }
- else if(MeterType == 3)
- {
- //全数字
- }
- else
- {
- //非水表
- blEqual = false;
- }
- return blEqual;
- }
- }
- ////////////////////////////////////////////////////////////
- }
|