You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
4 months ago
|
using HybirdFrameworkCore.Autofac.Attribute;
|
||
|
using log4net;
|
||
|
using Newtonsoft.Json;
|
||
|
using Repository.Station;
|
||
|
using Service.Cloud.Client;
|
||
|
using Service.Cloud.Common;
|
||
|
using Service.Cloud.Msg.Cloud.Resp;
|
||
|
using System.Drawing;
|
||
|
|
||
|
namespace Service.Cloud.Handler;
|
||
|
|
||
|
[Scope("InstancePerDependency")]
|
||
|
public class FaultReportResHandler : IBaseHandler
|
||
|
{
|
||
|
private static readonly ILog Log = LogManager.GetLogger(typeof(FaultReportResHandler));
|
||
|
|
||
|
public EquipAlarmRecordRepository equipAlarmRecordRepository { get; set; }
|
||
|
EquipAlarmProcessRecordRepository equipAlarmProcessRecordRepository { get; set; }
|
||
|
public void Handle(string t)
|
||
|
{
|
||
|
FaultReportRes? resp = JsonConvert.DeserializeObject<FaultReportRes>(t);
|
||
|
if (resp != null)
|
||
|
{
|
||
|
if (CloudClientMgr.CloudClient != null)
|
||
|
{
|
||
|
CloudClientMgr.CloudClient.RealTimeFault.SetResp(resp);
|
||
|
string? reqFc = CloudClientMgr.CloudClient.RealTimeFault.Req?.fc;
|
||
|
int? reqFg = CloudClientMgr.CloudClient.RealTimeFault.Req?.fg;
|
||
|
|
||
|
Log.Info($"receive FaultReportRes fc={reqFc} {JsonConvert.SerializeObject(resp)}");
|
||
|
|
||
|
if (!string.IsNullOrWhiteSpace(reqFc) && resp.re == 0)
|
||
|
{
|
||
|
if (reqFg == 1)
|
||
|
{
|
||
|
equipAlarmRecordRepository.Update(it => it.UploadStatus == 1, it => it.ErrorCode == reqFc);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
equipAlarmProcessRecordRepository.Update(it => it.UploadStatus == 1, it => it.ErrorCode == reqFc);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public bool CanHandle(string cmd)
|
||
|
{
|
||
|
return CloudConst.faultReportRes == cmd;
|
||
|
}
|
||
|
}
|