diff --git a/SlnMesnac.Business/FixedPointBusiness.cs b/SlnMesnac.Business/FixedPointBusiness.cs index acd218f..7578794 100644 --- a/SlnMesnac.Business/FixedPointBusiness.cs +++ b/SlnMesnac.Business/FixedPointBusiness.cs @@ -144,9 +144,14 @@ namespace SlnMesnac.Business } } + public readonly RealTemperatureInfo _realTemperatureInfo = new RealTemperatureInfo(); + public delegate void GimbaRotationControl(string wPanPos, string wTiltPos, string wZoomPos); public event GimbaRotationControl GimbaRotationControlEvent; + public delegate void CaptureAlarmPicture(string sJpegPicFileName); + public event CaptureAlarmPicture CaptureAlarmPictureEvent; + private void SendLiftMotorDict(base_busbar_info busbar) { @@ -164,6 +169,68 @@ namespace SlnMesnac.Business { GimbaRotationControlEvent?.Invoke(busbar.wPanPos, busbar.wTiltPos, busbar.wZoomPos); } + + _log.Info($"5S后开始测温"); + Task.Delay(5000).Wait(); + _log.Info($"温度测量完成,最高温度:{_realTemperatureInfo.fMaxTemperature};最低温度:{_realTemperatureInfo.fMinTemperature};平均温度:{_realTemperatureInfo.fAverageTemperature};温差:{_realTemperatureInfo.fTemperatureDiff}"); + this.SaveBusbarTemp(busbar.busbarCode, busbar.cabinetCode, _realTemperatureInfo, busbar.isPictures); + Task.Delay(1000).Wait(); + } + + /// + /// 保存母排测温数据 + /// + /// + /// + /// + private void SaveBusbarTemp(int? busbarCode, int? cabinetCode, RealTemperatureInfo realTemperatureInfo, int isPictures) + { + try + { + + var record = new record_busbar_temp() + { + busbarCode = busbarCode, + cabinetCode = cabinetCode, + tempMax = (decimal)realTemperatureInfo.fMaxTemperature, + tempMin = (decimal)realTemperatureInfo.fMinTemperature, + tempAvg = (decimal)realTemperatureInfo.fAverageTemperature, + tempDiff = (decimal)realTemperatureInfo.fTemperatureDiff, + recordTime = DateTime.Now, + }; + + if (realTemperatureInfo.fMaxTemperature > 65) + { + record.isAlarm = 1; + string sJpegPicFileName = $"{cabinetCode}_{busbarCode}_{DateTime.Now.ToString("yyyyMMddHHmmssffff")}.jpg"; + record.filePath = sJpegPicFileName; + CaptureAlarmPictureEvent?.Invoke(sJpegPicFileName); + } + else + { + if (isPictures == 1) + { + string sJpegPicFileName = $"{cabinetCode}_{busbarCode}_{DateTime.Now.ToString("yyyyMMddHHmmssffff")}.jpg"; + record.filePath = sJpegPicFileName; + CaptureAlarmPictureEvent?.Invoke(sJpegPicFileName); + } + } + + var res = _record_busbar_TempServices.Insert(record); + + if (res) + { + _log.Info($"{cabinetCode}号电柜{busbarCode}排数据保存成功"); + } + else + { + _log.Info($"{cabinetCode}号电柜{busbarCode}排数据保存失败"); + } + } + catch (Exception e) + { + _log.Info($"{cabinetCode}号电柜{busbarCode}排数据保存异常:{e.Message}"); + } } } diff --git a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs index dccaead..a921ab7 100644 --- a/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexControlViewModel.cs @@ -207,6 +207,11 @@ namespace SlnMesnac.WPF.ViewModel autoModeBusiness._realTemperatureInfo.fAverageTemperature = (float)Math.Round(ret.struLinePolygonThermCfg.fAverageTemperature, 1); autoModeBusiness._realTemperatureInfo.fTemperatureDiff = (float)Math.Round(ret.struLinePolygonThermCfg.fTemperatureDiff, 1); + fixedPointBusiness._realTemperatureInfo.fMaxTemperature = autoModeBusiness._realTemperatureInfo.fMaxTemperature; + fixedPointBusiness._realTemperatureInfo.fMinTemperature = autoModeBusiness._realTemperatureInfo.fMinTemperature; + fixedPointBusiness._realTemperatureInfo.fAverageTemperature = autoModeBusiness._realTemperatureInfo.fAverageTemperature; + fixedPointBusiness._realTemperatureInfo.fTemperatureDiff = autoModeBusiness._realTemperatureInfo.fTemperatureDiff; + } this.RealTemperature = new RealTemperatureInfo()