站外下发充电后,修改充电仓状态为占用,避免站内发送自动充电

zw
tq 4 months ago
parent 700df1b10a
commit c018353d12

@ -155,7 +155,7 @@ namespace Entity.DbModel.Station
public int? BatteryEnterSeq { get; set; } public int? BatteryEnterSeq { get; set; }
/// <summary> /// <summary>
/// Desc:充电状态;0-未知1-正在充电2-无电池3-禁用4-充电停止 /// Desc:充电状态;0-未知1-正在充电2-无电池3-禁用4-充电停止 增加5-站外下发占用
/// Default:0 /// Default:0
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>

@ -313,14 +313,15 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
return Result<string>.Fail($"充电机{BinNo}未连接"); return Result<string>.Fail($"充电机{BinNo}未连接");
} }
if (ChargerMode != mode) Result<bool> sendChangeChargeMode = SendChangeChargeMode(mode);
if (sendChangeChargeMode.IsSuccess)
{ {
Result<bool> sendChangeChargeMode = SendChangeChargeMode(mode); ChargerMode = mode;
if (sendChangeChargeMode.IsSuccess) Thread.Sleep(3000);
{ }
ChargerMode = mode; else
Thread.Sleep(3000); {
} return Result<string>.Fail("充电机切换充电模式发送失败");
} }
if (string.IsNullOrWhiteSpace(chargeOrderNo)) if (string.IsNullOrWhiteSpace(chargeOrderNo))

@ -172,7 +172,7 @@ public class AutoChargeTask : ITask
{ {
float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.ChargerNo); float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.ChargerNo);
float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower; float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower;
if (binInfo.ChargeStatus != 1) if (binInfo.ChargeStatus != 1 && binInfo.ChargeStatus != 5)
{ {
//没有充电时候在充电 //没有充电时候在充电
Result<bool>? result = ClientMgr.GetBySn(binInfo.ChargerNo) Result<bool>? result = ClientMgr.GetBySn(binInfo.ChargerNo)

@ -20,9 +20,12 @@ public class OutChargerController
{ {
private ChargeOrderRepository _chargeOrderRepository; private ChargeOrderRepository _chargeOrderRepository;
public OutChargerController(ChargeOrderRepository chargeOrderRepository) private BinInfoRepository _binInfoRepository;
public OutChargerController(ChargeOrderRepository chargeOrderRepository,BinInfoRepository binInfoRepository)
{ {
_chargeOrderRepository = chargeOrderRepository; _chargeOrderRepository = chargeOrderRepository;
_binInfoRepository = binInfoRepository;
} }
/// <summary> /// <summary>
@ -59,6 +62,9 @@ public class OutChargerController
byte chargeSoc = StaticStationInfo.ChargeSoc; byte chargeSoc = StaticStationInfo.ChargeSoc;
// 下发充电枪充电 // 下发充电枪充电
chargerClient.SendRemoteStartCharging((byte)ChargerModeConst.OutsideTheStation, chargeSoc, 360, 1, chargeGunOrder); chargerClient.SendRemoteStartCharging((byte)ChargerModeConst.OutsideTheStation, chargeSoc, 360, 1, chargeGunOrder);
_binInfoRepository.Update(i => i.ChargeStatus == 5, i => i.ChargerNo == chargerClient.Sn);
// 初始化订单 // 初始化订单
_chargeOrderRepository.SaveChargeGunOrder(chargeGunOrder, httpReq.con, chargerCode, httpReq.pn, _chargeOrderRepository.SaveChargeGunOrder(chargeGunOrder, httpReq.con, chargerCode, httpReq.pn,
chargerCode); chargerCode);
@ -86,6 +92,8 @@ public class OutChargerController
// 下发充电枪停止充电 // 下发充电枪停止充电
chargerClient.SendRemoteStopCharging(); chargerClient.SendRemoteStopCharging();
_binInfoRepository.Update(i => i.ChargeStatus == 4, i => i.ChargerNo == chargerClient.Sn);
return Result<bool>.Success(true); return Result<bool>.Success(true);
} }

Loading…
Cancel
Save