获取充电机功率设置

master
rszn 5 months ago
parent 083bfca885
commit a919e0ad35

@ -1,14 +1,8 @@
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;
@ -20,7 +14,7 @@ namespace WebStarter.Controllers;
public class BinInfoController : ControllerBase
{
private readonly BinInfoRepository _BinInfoRepository;
private readonly EquipInfoRepository _equipInfoRepository;
public BinInfoController(BinInfoRepository infoRepository,EquipInfoRepository equipInfoRepository)
@ -82,7 +76,7 @@ public class BinInfoController : ControllerBase
{
return PlcMgr.AirBlowerControl(cmd) ? Result<bool>.Success() : Result<bool>.Fail();
}
/// <summary>
/// 查询风机状态
/// <para>0无状态</para>
@ -95,7 +89,7 @@ public class BinInfoController : ControllerBase
{
return Result<ushort>.Success(PlcMgr.BlowerStatus());
}
/// <summary>
/// 获取仓位充电功率
/// </summary>
@ -104,8 +98,16 @@ public class BinInfoController : ControllerBase
[HttpGet("ChargePower/{code}")]
public Result<float> ChargePower(string code)
{
string _code = _BinInfoRepository.QueryByClause(i => i.Code == code).ChargerNo;
EquipInfo equipInfo = _equipInfoRepository.QueryByClause(i => i.Code == _code);
BinInfo binInfo = _BinInfoRepository.QueryByClause(it => it.No == code);
if (binInfo == null)
{
return Result<float>.Fail("仓位不存在");
}
EquipInfo equipInfo = _equipInfoRepository.QueryByClause(i => i.Code == binInfo.ChargerNo);
if (equipInfo == null)
{
return Result<float>.Fail("充电机不存在");
}
float? chargePower = equipInfo.ChargePower;
if (chargePower == null)
@ -116,4 +118,5 @@ public class BinInfoController : ControllerBase
return Result<float>.Success((float)chargePower);
}
}
}

Loading…
Cancel
Save