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.
56 lines
1.5 KiB
56 lines
1.5 KiB
using Entity.Constant;
|
|
using Entity.DbModel.Station;
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using Newtonsoft.Json;
|
|
using Repository.Station;
|
|
using Service.Cloud.Client;
|
|
using Service.Cloud.Common;
|
|
using Service.Cloud.Msg.Cloud.Req;
|
|
using Service.Cloud.Msg.Host.Resp;
|
|
|
|
namespace Service.Cloud.Handler;
|
|
|
|
[Scope("InstancePerDependency")]
|
|
public class CancelAmtBatHandler : IBaseHandler
|
|
{
|
|
private SwapAmtOrderRepository _swapAmtOrderRepository;
|
|
|
|
public CancelAmtBatHandler(SwapAmtOrderRepository swapAmtOrderRepository)
|
|
{
|
|
_swapAmtOrderRepository = swapAmtOrderRepository;
|
|
}
|
|
|
|
public bool CanHandle(string cmd)
|
|
{
|
|
return CloudConst.cancleAmtBat == cmd;
|
|
}
|
|
|
|
public void Handle(string t)
|
|
{
|
|
CancelAmt? amtBat = JsonConvert.DeserializeObject<CancelAmt>(t);
|
|
|
|
if (amtBat==null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
List<SwapAmtOrder> swapAmtOrderList = _swapAmtOrderRepository.QueryListByClause(i =>
|
|
i.CarNo ==amtBat.carNo&&i.Status==(byte)InfoEnum.AmtOrderStatus.Success);
|
|
|
|
|
|
if (swapAmtOrderList.Any())
|
|
{
|
|
swapAmtOrderList.ForEach(order => order.Status = (byte)InfoEnum.AmtOrderStatus.Cancel);
|
|
_swapAmtOrderRepository.Update(swapAmtOrderList);
|
|
}
|
|
|
|
CancelAmtRes res = new CancelAmtRes
|
|
{
|
|
stationNo = amtBat.stationNo,
|
|
result = 0,
|
|
carNo = amtBat.carNo
|
|
};
|
|
|
|
CloudClientMgr.CloudClient?.Publish(res);
|
|
}
|
|
} |