获取充电机功率设置

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

Loading…
Cancel
Save