|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
private readonly EquipInfoRepository _equipInfoRepository;
|
|
|
|
|
|
|
|
|
|
public BinInfoController(BinInfoRepository infoRepository,EquipInfoRepository equipInfoRepository)
|
|
|
|
|
{
|
|
|
|
|
_BinInfoRepository = infoRepository;
|
|
|
|
|
_equipInfoRepository = equipInfoRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 启用禁用充电 :
|
|
|
|
|
/// id:仓位id
|
|
|
|
|
/// flag :1:启用 0:禁用
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="removeBinNo"></param>
|
|
|
|
|
/// <param name="putBinNo"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("UpdateCanChargeFlag/{id}/{flag}")]
|
|
|
|
|
public Result<bool> UpdateCanChargeFlag(int id, int flag)
|
|
|
|
|
{
|
|
|
|
|
_BinInfoRepository.Update(it => it.CanChargeFlag == flag, it => it.Id == id);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet("insert")]
|
|
|
|
|
public Result<bool> insert()
|
|
|
|
|
{
|
|
|
|
|
_BinInfoRepository.Insert(new BinInfo()
|
|
|
|
|
{
|
|
|
|
|
No = "10"
|
|
|
|
|
});
|
|
|
|
|
BinInfo queryByClause = _BinInfoRepository.QueryByClause(i => i.Id == 16);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
_BinInfoRepository.Update(it => it.CanSwapFlag == flag, it => it.Id == id);
|
|
|
|
|
return Result<bool>.Success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 风机控制 1000:全部打开
|
|
|
|
|
///1010:全部关闭
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("AirBlowerControl/{cmd}")]
|
|
|
|
|
public Result<bool> AirBlower(ushort cmd)
|
|
|
|
|
{
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取仓位充电功率
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[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);
|
|
|
|
|
|
|
|
|
|
float? chargePower = equipInfo.ChargePower;
|
|
|
|
|
if (chargePower == null)
|
|
|
|
|
{
|
|
|
|
|
return Result<float>.Fail("该仓没有充电功率");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return Result<float>.Success((float)chargePower);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|