仓位充电 换电启用禁用

master
lxw 6 months ago
parent 51362eaa0c
commit 9e3109cbcf

@ -0,0 +1,71 @@
using Entity.Api.Resp;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
using Service.Execute;
using Service.Execute.Api;
using Service.Init;
using Service.Plc.Client;
using Service.Station;
namespace WebStarter.Controllers;
/// <summary>
/// 换电大屏
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class BinInfoController : ControllerBase
{
private readonly BinInfoRepository _BinInfoRepository;
public BinInfoController(BinInfoRepository infoRepository)
{
_BinInfoRepository = infoRepository;
}
/// <summary>
/// 启用禁用充电
/// id:仓位id
/// flag 1启用 0:禁用
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("UpdateCanChargeFlag/{id}/{flag}")]
public async Task<Result<bool>> UpdateCanChargeFlag(int id, int flag)
{
BinInfo binInfo = new BinInfo()
{
Id = id,
CanChargeFlag = flag
};
_BinInfoRepository.Update(binInfo);
return Result<bool>.Success();
}
/// <summary>
/// 启用禁用换电
/// id:仓位id
/// flag 1启用 0:禁用
/// </summary>
/// <param name="removeBinNo"></param>
/// <param name="putBinNo"></param>
/// <returns></returns>
[HttpGet("UpdateCanSwapFlag/{id}/{flag}")]
public async Task<Result<bool>> UpdateCanSwapFlag(int id, int flag)
{
BinInfo binInfo = new BinInfo()
{
Id = id,
CanSwapFlag = flag
};
_BinInfoRepository.Update(binInfo);
return Result<bool>.Success();
}
}

@ -3,6 +3,7 @@ using Entity.Constant;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Execute;
using Service.Execute.Api;
using Service.Init;
using Service.Plc.Client;
using Service.Station;
@ -56,6 +57,38 @@ public class SwapMonitorController : ControllerBase
}
/// <summary>
/// 车辆手动上锁解锁
/// </summary>
/// <returns></returns>
[HttpPost("LockCar")]
public async Task<Result<bool>> LockCar()
{
if (StationSoftMgr.SwappingStateMachine.RfidReadModel == null)
{
return Result<bool>.Fail("暂无车辆");
}
var success = await TBoxApi.LockCarManyTimes(StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo);
return success ? Result<bool>.Success() : Result<bool>.Fail();
}
/// <summary>
/// 车辆手动解锁
/// </summary>
/// <returns></returns>
[HttpPost("UnLockCar")]
public async Task<Result<bool>> UnLockCar()
{
if (StationSoftMgr.SwappingStateMachine.RfidReadModel == null)
{
return Result<bool>.Fail("暂无车辆");
}
var success = await TBoxApi.UnLockCarManyTimes(StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo);
return success ? Result<bool>.Success() : Result<bool>.Fail();
}
/// <summary>
/// 获取充电监控大屏 充电次数 每五分钟获取一次
/// </summary>
@ -77,15 +110,6 @@ public class SwapMonitorController : ControllerBase
}
/// <summary>
/// 设置换电方式1:自动换电 2手动换电
/// </summary>
[HttpPost("SetSwapWay/{swapWay}")]
public async Task<Result<bool>> SetSwapWay(int stationSwapWay)
{
StaticStationInfo.StationWay = stationSwapWay;
return Result<bool>.Success();
}
/// <summary>
@ -125,7 +149,7 @@ public class SwapMonitorController : ControllerBase
[HttpPost("AllLightsOff")]
public async Task<Result<bool>> AllLightsOff()
{
return PlcMgr.AllLightsOff()? Result<bool>.Success(true):Result<bool>.Fail();
return PlcMgr.AllLightsOff() ? Result<bool>.Success(true) : Result<bool>.Fail();
}
/// <summary>
@ -135,8 +159,9 @@ public class SwapMonitorController : ControllerBase
[HttpPost("AllLightsOn")]
public async Task<Result<bool>> AllLightsOn()
{
return PlcMgr.AllLightsOn()? Result<bool>.Success(true):Result<bool>.Fail();
return PlcMgr.AllLightsOn() ? Result<bool>.Success(true) : Result<bool>.Fail();
}
/// <summary>
/// 得到现在灯光状态
/// </summary>
@ -144,7 +169,7 @@ public class SwapMonitorController : ControllerBase
[HttpPost("GetNowLightsOn")]
public async Task<Result<ushort>> GetNowLightsOn()
{
return Result<ushort>.Success(PlcMgr.GetNowLightsOn());
return Result<ushort>.Success(PlcMgr.GetNowLightsOn());
}
/// <summary>

@ -2,8 +2,7 @@
"ConnectionStrings": {
"ConfigId": "master",
"DbType": "MySql",
"SqlConnection": //"server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;",
"server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8;"
"SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;"
},
"Update": {
"AutoUpdate": "false",
@ -68,6 +67,6 @@
},
"HttpContextRequest": {
"Scheme": "http://192.168.2.17:5034"
"Scheme": "http://0.0.0.0:5034"
}
}

Loading…
Cancel
Save