一些需求新增tbox rifd跟新

master
lxw 6 months ago
parent 2aa09a8b28
commit fa4ba0c37b

@ -2,6 +2,7 @@ using Autofac;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.AutoTask;
using HybirdFrameworkCore.Entity;
using log4net;
using Repository.Station;
@ -16,62 +17,85 @@ namespace Service.BusinessTask.MyTask;
/// <summary>
/// 电池移仓任务
/// </summary>
public class BatteryMoveTask : AbstractTaskHandler
public class BatteryMoveTask : ITask
{
private static readonly ILog Log = LogManager.GetLogger(typeof(BatteryMoveTask));
private readonly BinInfoRepository _binInfoRepository =
AppInfo.Container.Resolve<BinInfoRepository>();
public BinInfoRepository _binInfoRepository { get; set; }
private readonly MonitorService _monitorService =
AppInfo.Container.Resolve<MonitorService>();
public MonitorService _monitorService { get; set; }
protected override int Interval()
private volatile bool _stop;
public string Name()
{
return "BatteryMoveTask";
}
public int Interval()
{
return 20 * 1000;
return 1000 * 20;
}
/// <summary>
/// 自动移仓 当缓存仓没有电池的时候 如果有电池充满了 就移仓
/// </summary>
protected override void Handle()
public void Handle()
{
var cacheBin = _binInfoRepository.QueryByClause(i => i.CacheBinFlag == 1);
if (cacheBin.Exists == 1)
try
{
return;
}
var cacheBin = _binInfoRepository.QueryByClause(i => i.CacheBinFlag == 1);
if (cacheBin.Exists == 1)
{
return;
}
List<BinInfo> queryListByClause = _binInfoRepository.QueryListByClause(i => i.ChargeStatus == 4 && i.CacheBinFlag==0, "battery_enter_seq asc");
List<BinInfo> queryListByClause =
_binInfoRepository.QueryListByClause(i => i.ChargeStatus == 4 && i.CacheBinFlag == 0,
"battery_enter_seq asc");
if (queryListByClause.Count<=0)
{
return;
}
if (queryListByClause.Count <= 0)
{
return;
}
var binInfo = queryListByClause[0];
var binInfo = queryListByClause[0];
Result<bool> success = _monitorService.BatteryRelocation(ushort.Parse(binInfo.No), ushort.Parse(cacheBin.No));
Result<bool> success =
_monitorService.BatteryRelocation(ushort.Parse(binInfo.No), ushort.Parse(cacheBin.No));
//查询人物状态
if (success.IsSuccess)
{
bool readPlcTaskStatus9000 = false;
while (!readPlcTaskStatus9000)
//查询人物状态
if (success.IsSuccess)
{
Thread.Sleep(1000);
readPlcTaskStatus9000 = PlcMgr.ReadPlcTaskStatus() == 9000;
}
bool readPlcTaskStatus9000 = false;
while (!readPlcTaskStatus9000)
{
Thread.Sleep(1000);
readPlcTaskStatus9000 = PlcMgr.ReadPlcTaskStatus() == 9000;
}
Log.Info($"execute BatteryMoveTask success from binNo ={binInfo.No}");
Log.Info($"execute BatteryMoveTask success from binNo ={binInfo.No}");
}
}
catch (Exception e)
{
Log.Error($" SwapOrderReportCloudTask err e={e}");
}
}
protected override string Name()
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
return "SwapOrderReportCloudTask";
_stop = false;
}
}

@ -1,12 +1,8 @@
using Autofac;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Execute;
using Service.Execute.Api;
using Service.Execute.Model;
using Service.Mgr;
namespace Service.BusinessTask.MyTask;
@ -14,30 +10,52 @@ namespace Service.BusinessTask.MyTask;
/// <summary>
/// 充电结束上报云平台task
/// </summary>
public class SwapOrderReportCloudTask : AbstractTaskHandler
[Scope]
public class SwapOrderReportCloudTask : ITask
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderReportCloudTask));
private readonly SwapOrderReportCloudRepository _reportCloudRepository =
AppInfo.Container.Resolve<SwapOrderReportCloudRepository>();
private volatile bool _stop;
public SwapOrderReportCloudRepository? ReportCloudRepository { get; set; }
private readonly SwapOrderMgr _swapOrderMgr =
AppInfo.Container.Resolve<SwapOrderMgr>();
public SwapOrderMgr? SwapOrderMgr { get; set; }
protected override int Interval()
public string Name()
{
return 20 * 1000;
return "SwapOrderReportCloudTask";
}
protected override void Handle()
public int Interval()
{
List<SwapOrderReportCloud> list = _reportCloudRepository.QueryListByClause(i => i.CloudReportStatus == 0);
return 1000 * 20;
}
_swapOrderMgr.UploadCloud(list);
public void Handle()
{
try
{
List<SwapOrderReportCloud> list = ReportCloudRepository.QueryListByClause(i => i.CloudReportStatus == 0);
SwapOrderMgr.UploadCloud(list);
}
catch (Exception e)
{
Log.Error($" SwapOrderReportCloudTask err e={e}");
}
}
protected override string Name()
public bool Stoped()
{
return "SwapOrderReportCloudTask";
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}

@ -7,18 +7,19 @@ namespace Service.Execute.Api;
public class RfidApi
{
private static readonly ILog Log = LogManager.GetLogger(typeof(RfidApi));
//TODO::Rfid 服务地址
private static readonly string BASE_URL = "http://localhost:7243";
private static readonly string BASE_URL = "http://localhost:5037";
private static readonly HttpClient _httpClient = new HttpClient()
{
Timeout = TimeSpan.FromSeconds(60)
};
public static async Task<bool> BeginRead()
{
Log.Info("BeginRead");
/*string url = BASE_URL + "/Api/BeginRead";
string url = BASE_URL + "/Api/BeginRead";
try
{
string s = await _httpClient.GetStringAsync(url);
@ -27,17 +28,16 @@ public class RfidApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"RfidApi BeginRead err e={e}");
return false;
}*/
return true;
}
}
public static async Task<bool> StopRead()
{
Log.Info("StopRead");
string url = BASE_URL + "/Api/StopRead";
/*try
try
{
string s = await _httpClient.GetStringAsync(url);
Log.Info($"StopRead resp = {s}");
@ -45,16 +45,15 @@ public class RfidApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"RfidApi StopRead err e={e}");
return false;
}*/
return true;
}
}
public static async Task<RfidReadModel?> ReadRifd()
{
Log.Info("ReadRifd");
/*string url = BASE_URL + "/Api/ReadRfidData";
string url = BASE_URL + "/Api/ReadRfidData";
try
{
string s = await _httpClient.GetStringAsync(url);
@ -70,16 +69,10 @@ public class RfidApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"RfidApi ReadRifd err e={e}");
return null;
}*/
}
return new RfidReadModel()
{
VelVin = "LC1HMYBF6R0004575",
VelNo = "LC1HMYBF6R0004575",
};
return null;
}
}

@ -9,20 +9,20 @@ public class TBoxApi
{
private static readonly ILog Log = LogManager.GetLogger(typeof(TBoxApi));
//TODO::TBox 服务地址
private static readonly string BASE_URL = "http://localhost:5036";
private static int _times = 5;
private static int _successTimes = 3;
private static readonly HttpClient _httpClient = new HttpClient()
{
Timeout = TimeSpan.FromSeconds(60)
};
public static async Task<TboxCarInfoModel> GetCarInfo()
public static async Task<TboxCarInfoModel> GetCarInfo(string carNo)
{
Log.Info("GetCarInfo");
string url = BASE_URL + "/getCarInfo";
string url = BASE_URL + "/getCarInfo/" + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
@ -37,15 +37,15 @@ public class TBoxApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"GetCarInfo e = {e}");
return null;
}
}
public static async Task<bool> Reset()
public static async Task<bool> Reset(string carNo)
{
Log.Info("Reset");
string url = BASE_URL + "/Clear";
string url = BASE_URL + "/Clear/" + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
@ -55,15 +55,15 @@ public class TBoxApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"Reset e = {e}");
return false;
}
}
public static async Task<bool> IsConnected()
public static async Task<bool> IsConnected(string carNo)
{
Log.Info("IsConnected");
string url = BASE_URL + "/getCarInfo";
string url = BASE_URL + "/getCarInfo/"+carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
@ -78,7 +78,7 @@ public class TBoxApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"IsConnected e = {e}");
return false;
}
}
@ -93,16 +93,13 @@ public class TBoxApi
var unLockCar = await UnLockCar(carNo);
if (unLockCar)
{
bools.Add(unLockCar);
}
}
return bools.Select(i => i).Count() > _successTimes;
}
public static async Task<bool> LockCarManyTimes(string carNo)
{
List<bool> bools = new List<bool>();
@ -112,13 +109,11 @@ public class TBoxApi
var unLockCar = await LockCar(carNo);
if (unLockCar)
{
bools.Add(unLockCar);
}
}
return bools.Select(i => i).Count() > _successTimes;
}
/// <summary>
@ -128,7 +123,7 @@ public class TBoxApi
public static async Task<bool> UnLockCar(string carNo)
{
Log.Info("UnLockCar");
string url = BASE_URL + "/unLock/"+carNo;
string url = BASE_URL + "/unLock/" + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
@ -139,11 +134,34 @@ public class TBoxApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"UnLockCar e = {e}");
return false;
}
}
public static async Task<List<TboxCarInfoModel>> GetCarInfoList()
{
Log.Info("GetCarInfoList");
string url = BASE_URL + "/getCarInfoList" ;
try
{
string s = await _httpClient.GetStringAsync(url);
List<TboxCarInfoModel>? tboxCarInfoModels = null;
if (!String.IsNullOrWhiteSpace(s))
{
tboxCarInfoModels = JsonConvert.DeserializeObject<List<TboxCarInfoModel>>(s);
}
Log.Info($"GetCarInfoList resp = {tboxCarInfoModels}");
return tboxCarInfoModels;
}
catch (Exception e)
{
Log.Error($"GetCarInfoList e = {e}");
return null;
}
}
/// <summary>
/// 车辆上锁
/// </summary>
@ -151,7 +169,7 @@ public class TBoxApi
public static async Task<bool> LockCar(string carNo)
{
Log.Info("LockCar");
string url = BASE_URL + "/lock/"+carNo;
string url = BASE_URL + "/lock/" + carNo;
try
{
string s = await _httpClient.GetStringAsync(url);
@ -162,7 +180,7 @@ public class TBoxApi
}
catch (Exception e)
{
Console.WriteLine(e);
Log.Error($"LockCar e = {e}");
return false;
}
}

@ -5,22 +5,13 @@ public class RfidReadModel
/// <summary>
/// 1成功 0:失败
/// </summary>
public string Result { get; set; }
public int Result { get; set; }
/// <summary>
/// 车辆VIN码
/// </summary>
public string VelVin { get; set; }
/// <summary>
/// 车辆电池包数
/// </summary>
public string BattNum { set; get; }
/// <summary>
/// 车辆配方-加解锁高度,整型,单位:mm
/// </summary>
public string VelRecp { set; get; }
/// <summary>
/// 车辆MAC地址

@ -9,33 +9,7 @@ namespace Service.Execute
public class StationSoftMgr
{
public static readonly SwappingStateMachine SwappingStateMachine = SwappingStateMachine.GetInstance();
private static readonly AbstractTaskHandler SwapOrderReportCloudTask = new SwapOrderReportCloudTask();
private static readonly AbstractTaskHandler BatteryMoveTask = new BatteryMoveTask();
#region Task
/// <summary>
/// 启动task
/// </summary>
public static void StartTasks()
{
SwapOrderReportCloudTask.Start();
BatteryMoveTask.Start();
}
/// <summary>
/// 停止task
/// </summary>
public static void StopTasks()
{
SwapOrderReportCloudTask.Stop();
}
#endregion Task
#region 换电流程

@ -50,12 +50,12 @@ public class CarCtrlState : IState
return Invoker.Invoke("UnLockCar", 500, 100, machine.IsCanceled,
() => machine.VelUnlockFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo();
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
var resultHeartBeatMsg = carInfo.Result.HeartBeatMsg;
if (resultHeartBeatMsg.LockStatus == 1 || resultHeartBeatMsg.LockStatus==0)
{

@ -100,7 +100,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("check CarInPosition", 500, 50, machine.IsCanceled,
() => machine.VehiclesInPlaceFlag, () =>
{
var result = TBoxApi.GetCarInfo();
var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
TboxCarInfoModel tboxCarInfoModel = result.Result;
if (tboxCarInfoModel.HeartBeatMsg.KeyStatus == 0)
@ -161,6 +161,8 @@ public class CarPrepareState : IState
machine.CloudVelCheckFlag = true;
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
//TODO::
// machine.SwapOrder.CloudSn=
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine);
}
@ -187,7 +189,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
Task<bool> result = TBoxApi.IsConnected();
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelVin);
bool isConnect = result.Result;
if (isConnect)
{
@ -213,7 +215,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("check TBox VelLocal", 1000, 20, machine.IsCanceled,
() => machine.BoxLocalCheckFlag, () =>
{
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo();
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var tBoxCarInfoModel = carInfo.Result;
//TODO::不知道Tbox给的CardNo是什么
if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelNo.Trim()))
@ -238,7 +240,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("cloud TBox upload", 500, 20, machine.IsCanceled,
() => machine.CloudTBoxFlag, () =>
{
Task<TboxCarInfoModel> result = TBoxApi.GetCarInfo();
Task<TboxCarInfoModel> result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
TboxCarInfoModel tBoxCarInfoModel = result.Result;
machine.BoxCarInfoModel = tBoxCarInfoModel;
if (tBoxCarInfoModel != null)

@ -115,7 +115,7 @@ public class DoSwappingState : IState
return Invoker.Invoke("UnLockCar", 1000, 5, machine.IsCanceled,
() => machine.StartSwappingFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
@ -360,7 +360,7 @@ public class DoSwappingState : IState
else if (channelStatus == 1020)
{
//需要移车 先解锁 提示移动车辆,等待3分钟
var lockCar = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelNo);
var lockCar = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
if (lockCar.Result)
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed());
@ -404,7 +404,7 @@ public class DoSwappingState : IState
return Invoker.Invoke("check CarInPosition2", 500, 50, machine.IsCanceled,
() => machine.VehiclesInPlace2Flag, () =>
{
var result = TBoxApi.GetCarInfo();
var result = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
TboxCarInfoModel tboxCarInfoModel = result.Result;
if (tboxCarInfoModel.HeartBeatMsg.KeyStatus == 0)

@ -207,7 +207,6 @@ public class StationReadyState : IState
return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled,
() => machine.RfidReadFlag, () =>
{
//TODO::开始读rfid RfidService.BeginRead();
Task<RfidReadModel?> rfidReadModel = RfidApi.ReadRifd();
rfidReadModel.Wait();
if ( /*rfidReadModel.IsCompletedSuccessfully &&*/ rfidReadModel.Result != null)

@ -76,12 +76,12 @@ public class SwapDoneState : IState
return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled,
() => machine.VelLockFlag, () =>
{
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelNo);
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo();
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result.HeartBeatMsg!.LockStatus == 2)
{
//设置出口的是绿灯

@ -227,15 +227,19 @@ public class SwappingStateMachine : IDisposable
{
Log.Info("reset data");
ResetOrderAmtStatus();
//wifi数据重置
TBoxApi.Reset();
if (RfidReadModel != null && RfidReadModel.VelNo != null)
{
//wifi数据重置
TBoxApi.Reset(RfidReadModel.VelVin);
}
//重置所有小步状态
ResetStep();
ResetData();
//重置云平台下发的指令
// CloudApi.ClearCarCanStartInfo();
// CloudApi.ClearCarCanStartInfo();
}
public bool Cancel()

@ -65,6 +65,17 @@ public class PlcMgr
return false;
}
public static ushort BlowerStatus()
{
if (PlcClient != null)
{
return PlcToHostData.ExhaustFanStatus.Value;
}
return 0;
}
/// <summary>
/// 是否远程模式

@ -27,13 +27,40 @@ public class MonitorService
public ChargeOrderRepository ChargeOrderRepository { get; set; }
public PlcTaskMgr PlcTaskMgr { get; set; }
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
{
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap<StepModel, SwappingStateInfoResp>().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
List<SwappingStateInfoResp> stateInfoList =
mapperBinInfo.Map<List<SwappingStateInfoResp>>(StationSoftMgr.SwappingStateMachine.StepModel);
List<SwappingStateInfoResp> stateInfoList = new List<SwappingStateInfoResp>()
{
new SwappingStateInfoResp()
{
StepName = "空闲1",
StepNo = 1,
StartTime = DateTime.Now
},
new SwappingStateInfoResp()
{
StepName = "空闲2",
StepNo = 2,
StartTime = DateTime.Now
},
new SwappingStateInfoResp()
{
StepName = "空闲3",
StepNo = 3,
StartTime = DateTime.Now
},
new SwappingStateInfoResp()
{
StepName = "空闲4",
StepNo = 4,
StartTime = DateTime.Now
},
};
/*List<SwappingStateInfoResp> stateInfoList =
mapperBinInfo.Map<List<SwappingStateInfoResp>>(StationSoftMgr.SwappingStateMachine.StepModel);*/
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
@ -102,14 +129,17 @@ public class MonitorService
/// 连接状态类
/// </summary>
/// <returns></returns>
public async Task<Result<DeviceStateResp>> GetDeviceState()
public Result<DeviceStateResp> GetDeviceState()
{
var isConnected = await TBoxApi.IsConnected();
bool isConnected = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel == null
? false
: StationSoftMgr.SwappingStateMachine.BoxCarInfoModel.Connected;
DeviceStateResp resp = new()
{
BoxConnectFlag = isConnected != null ? isConnected : false,
CloudConnectFlag = CloudClientMgr.CloudClient==null? false:CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = PlcMgr.PlcClient==null? false:PlcMgr.PlcClient.Connected
CloudConnectFlag = CloudClientMgr.CloudClient == null ? false : CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = PlcMgr.PlcClient == null ? false : PlcMgr.PlcClient.Connected
};
return Result<DeviceStateResp>.Success(resp);

@ -79,4 +79,17 @@ public class BinInfoController : ControllerBase
{
return PlcMgr.AirBlowerControl(cmd) ? Result<bool>.Success() : Result<bool>.Fail();
}
/// <summary>
/// 查询风机状态
/// <para>0无状态</para>
/// <para>1000已全部打开</para>
/// <para>1010已全部关闭</para>
/// </summary>
/// <returns></returns>
[HttpGet("AirBlowerStatus")]
public Result<ushort> AirBlowerStatus()
{
return Result<ushort>.Success(PlcMgr.BlowerStatus());
}
}

@ -1,9 +1,11 @@
using Entity.Api.Resp;
using Entity.Constant;
using HybirdFrameworkCore.Attribute;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Execute;
using Service.Execute.Api;
using Service.Execute.Model;
using Service.Init;
using Service.Plc.Client;
using Service.Station;
@ -32,9 +34,9 @@ public class SwapMonitorController : ControllerBase
/// </summary>
/// <returns></returns>
[HttpPost("GetDeviceState")]
public async Task<Result<DeviceStateResp>> GetDeviceState()
public Result<DeviceStateResp> GetDeviceState()
{
return await _swapMonitorService.GetDeviceState();
return _swapMonitorService.GetDeviceState();
}
/// <summary>
@ -64,14 +66,9 @@ public class SwapMonitorController : ControllerBase
/// </summary>
/// <returns></returns>
[HttpPost("LockCar")]
public async Task<Result<bool>> LockCar()
public async Task<Result<bool>> LockCar( string carNo)
{
if (StationSoftMgr.SwappingStateMachine.RfidReadModel == null)
{
return Result<bool>.Fail("暂无车辆");
}
var success = await TBoxApi.LockCarManyTimes(StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo);
var success = await TBoxApi.LockCarManyTimes(carNo);
return success ? Result<bool>.Success() : Result<bool>.Fail();
}
@ -80,14 +77,9 @@ public class SwapMonitorController : ControllerBase
/// </summary>
/// <returns></returns>
[HttpPost("UnLockCar")]
public async Task<Result<bool>> UnLockCar()
public async Task<Result<bool>> UnLockCar( string carNo)
{
if (StationSoftMgr.SwappingStateMachine.RfidReadModel == null)
{
return Result<bool>.Fail("暂无车辆");
}
var success = await TBoxApi.UnLockCarManyTimes(StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo);
var success = await TBoxApi.UnLockCarManyTimes(carNo);
return success ? Result<bool>.Success() : Result<bool>.Fail();
}
@ -226,4 +218,33 @@ public class SwapMonitorController : ControllerBase
return Result<bool>.Success();
}
/// <summary>
/// 获取所有连接车辆
/// </summary>
[HttpGet("GetCarList")]
public async Task<Result<List<TboxCarInfoModel>>> GetCarList()
{
/*var carInfoList = await TBoxApi.GetCarInfoList();
if (carInfoList == null || carInfoList.Count <= 0)
{
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>());
}
return Result<List<TboxCarInfoModel>>.Success(carInfoList);*/
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>()
{
new TboxCarInfoModel()
{
Connected = true,
CarNo = "carNo1",
},
new TboxCarInfoModel()
{
Connected = true,
CarNo = "carNo2",
}
});
}
}

@ -47,9 +47,9 @@ public class GenController : ControllerBase
{
VehicleCertificationResp vehicleCertificationResp = CloudApi.VehicleCheck(new RfidReadModel()
{
VelMac = "111",
VelNo = "LC1HMYBF6R0004575",
VelVin = "LC1HMYBF6R0004575",
//VelMac = "111",
VelNo = "晋C03733D",
// VelVin = "LC1HMYBF6R0004575",
}, new SwapOrder()
{
VehicleEnterTime = DateTime.Now

@ -163,11 +163,7 @@ if (AppSettingsHelper.GetBool("swap", "enable"))
StationSoftMgr.SwappingStateMachineStart();
}
//Task
if (AppSettingsHelper.GetBool("task", "enable"))
{
StationSoftMgr.StartTasks();
}
TaskInit.Init();

Loading…
Cancel
Save