using Entity.Api.Req;
using Entity.Base;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.VisualBasic;
using Service.Plc.Client;
using Service.Station;
using Service.System;
namespace WebStarter.Controllers;
///
/// 充电大屏
///
[ApiController]
[Route("api/[controller]")]
public class ChargeMonitorController
{
private readonly BinInfoService _binInfoService;
public ChargeMonitorController(BinInfoService binInfoService)
{
_binInfoService = binInfoService;
}
///
/// 充电仓查询:条件:仓位编号 仓位名称
///
[HttpPost("ChargePositionQuery")]
public async Task> ChargePositionQuery([FromBody] ChargePositionQueryReq chargePositionQueryReq)
{
return await _binInfoService.ChargePositionQuery(chargePositionQueryReq);
}
///
/// 充电仓 0:禁用 1:启用
///
/// 仓位编号
/// 仓位状态:0-禁用、1-启用
///
///
[HttpPost("SetChargingBinStatus/{binNo}/{status}")]
public async Task> ChargingBinDisable(string binNo, int status)
{
BinInfo binInfo = await _binInfoService.QueryByClauseAsync(u => u.No == binNo);
if (binInfo == null)
throw new Exception("充电仓不存在");
binInfo.Status = status;
bool result = await _binInfoService.UpdateAsync(binInfo);
if (result)
return Result.Success(result);
else
return Result.Fail(result);
}
///
/// TODO:: 电池移仓
/// 电池移仓
///
/// 取仓号
/// 放仓号
///
[HttpGet("BatteryRelocation")]
public async Task> BatteryRelocation(ushort removeBinNo, ushort putBinNo)
{
// PlcMgr.DistributeBinNo();
return Result.Success();
}
///
/// TODO::移仓时下拉项 仓位电池状态
/// 移仓时下拉项 仓位电池状态
///
[HttpGet("GetChargeBinOption")]
public Result GetChargeBinOption()
{
return Result.Success();
}
}