预约锁仓的不充电

zw
rszn 6 months ago
parent 221eb378f9
commit 492fc06413

@ -16,7 +16,7 @@ namespace Entity.DbModel.Station
/// Desc:id /// Desc:id
/// Default: /// Default:
/// Nullable:False /// Nullable:False
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")] [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
public int Id { get; set; } public int Id { get; set; }
@ -43,7 +43,7 @@ namespace Entity.DbModel.Station
/// </summary> /// </summary>
[SugarColumn(ColumnName = "name")] [SugarColumn(ColumnName = "name")]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 在位状态0-不在位1-在位;其他-无效 /// 在位状态0-不在位1-在位;其他-无效
/// </summary> /// </summary>
@ -112,7 +112,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "amt_lock")] [SugarColumn(ColumnName = "amt_lock")]
public string AmtLock { get; set; } public int? AmtLock { get; set; }
/// <summary> /// <summary>
/// Desc:soc /// Desc:soc
@ -183,4 +183,4 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "can_charge_flag")] [SugarColumn(ColumnName = "can_charge_flag")]
public int CanChargeFlag { get; set; } public int CanChargeFlag { get; set; }
} }
} }

@ -44,7 +44,9 @@ public class ChargerService
return Result<bool>.Fail(@"充电机未连接"); return Result<bool>.Fail(@"充电机未连接");
} }
return chargerClient.StartCharge(); byte chargeSoc = StaticStationInfo.ChargeSoc;
float chargePower = StaticStationInfo.ChargePower;
return chargerClient.StartCharge(chargeSoc, chargePower);
} }
/// <summary> /// <summary>

@ -18,7 +18,6 @@ using Service.Charger.Msg.Charger.Req;
using Service.Charger.Msg.Charger.Resp; using Service.Charger.Msg.Charger.Resp;
using Service.Charger.Msg.Host.Req; using Service.Charger.Msg.Host.Req;
using Service.Charger.Msg.Host.Req.Bms; using Service.Charger.Msg.Host.Req.Bms;
using Service.Init;
namespace Service.Charger.Client; namespace Service.Charger.Client;
@ -481,7 +480,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Result<bool> StartCharge() public Result<bool> StartCharge(byte chargeSoc, float chargePower)
{ {
if (string.IsNullOrWhiteSpace(BinNo)) if (string.IsNullOrWhiteSpace(BinNo))
{ {
@ -505,7 +504,12 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
return Result<bool>.Fail($"charger-{BinNo} battery not exist"); return Result<bool>.Fail($"charger-{BinNo} battery not exist");
} }
if (binInfo.CanChargeFlag == 0) if (binInfo.AmtLock == 1)
{
return Result<bool>.Fail($"仓-{BinNo} 被锁定");
}
if (binInfo.CanChargeFlag == 0)
{ {
return Result<bool>.Fail($"仓-{BinNo} 被禁用"); return Result<bool>.Fail($"仓-{BinNo} 被禁用");
} }
@ -520,8 +524,6 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
redisHelper.SetKeyValueStr($"chargeNo{BinNo}Start", DateTime.Now.ToString("f"), TimeSpan.FromMinutes(1)); redisHelper.SetKeyValueStr($"chargeNo{BinNo}Start", DateTime.Now.ToString("f"), TimeSpan.FromMinutes(1));
byte chargeSoc = StaticStationInfo.ChargeSoc;
float chargePower = StaticStationInfo.ChargePower;
Result<string> chargeOrderNo = SendRemoteStartCharging(chargeSoc, chargePower); Result<string> chargeOrderNo = SendRemoteStartCharging(chargeSoc, chargePower);
if (!chargeOrderNo.IsSuccess) if (!chargeOrderNo.IsSuccess)
{ {

@ -153,8 +153,8 @@ public class AutoChargeTask : ITask
int number = 0; int number = 0;
foreach (var binInfo in canChargeList) foreach (var binInfo in canChargeList)
{ {
Result<string>? result = ClientMgr.GetBySn(binInfo.ChargerNo) Result<bool>? result = ClientMgr.GetBySn(binInfo.ChargerNo)
?.SendRemoteStartCharging(chargeSoc, chargePower); ?.StartCharge(chargeSoc, chargePower);
if (result is { IsSuccess: true }) if (result is { IsSuccess: true })
{ {
Log.Info($"auto start charge {binInfo.ChargerNo}"); Log.Info($"auto start charge {binInfo.ChargerNo}");

Loading…
Cancel
Save