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.

39 lines
1.3 KiB

6 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;
namespace Service.Cloud.Handler;
[Scope("InstancePerDependency")]
public class UploadSwapOrderResHandler : IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(UploadSwapOrderResHandler));
public SwapOrderRepository SwapOrderRepository { get; set; }
public void Handle(string t)
{
StaSwapRecordRes? resp = JsonConvert.DeserializeObject<StaSwapRecordRes>(t);
6 months ago
if (resp != null)
{
if (CloudClientMgr.CloudClient != null)
{
CloudClientMgr.CloudClient.UploadPowerChange.SetResp(resp);
string? reqSon = CloudClientMgr.CloudClient.UploadPowerChange.Req?.son;
Log.Info($"receive UploadSwapOrderRes swapOrderNo={reqSon} {JsonConvert.SerializeObject(resp)}");
if (!string.IsNullOrWhiteSpace(reqSon) && resp.re == 0)
{
SwapOrderRepository.Update(it => it.CloudReportStatus == 1, it => it.Sn == reqSon);
}
}
}
}
public bool CanHandle(string cmd)
{
return CloudConst.staSwapRecordRes == cmd;
}
}