关于 1.手动选包功能 2.手动跳过雷达功能 3.雷达数据展示

master
lxw 2 months ago
parent 1de55a2287
commit 4dc6f56c89

@ -59,4 +59,10 @@ public class StationConfigReq
/// 附加费 /// 附加费
/// </summary> /// </summary>
public int AppendTotalFee { get; set; } public int AppendTotalFee { get; set; }
/// <summary>
/// 是否手动选包 0: 自动选包 1:手动选包)
/// </summary>
public int SelectPackManually { get; set; }
} }

@ -0,0 +1,18 @@
namespace Entity.Api.Resp;
/// <summary>
///
/// 雷达数据
/// </summary>
public class RadarResp
{
/// <summary>
///0-雷达不工作1-无车2-无电池3-角度偏移过大4-车辆靠后5-车辆靠前6-车辆到位
/// </summary>
public int? CarStatus { get; set; }
}

@ -50,6 +50,11 @@ public class StationConfigResp
/// </summary> /// </summary>
public int VehicleManually { get; set; } public int VehicleManually { get; set; }
/// <summary>
/// 是否手动选包 0: 自动选包 1:手动选包)
/// </summary>
public int SelectPackManually { get; set; }
/// <summary> /// <summary>
/// 服务费 /// 服务费

@ -13,6 +13,11 @@ public class SwapMonitorScreenResp
/// </summary> /// </summary>
public PlcSwapModelResp? PlcSwapModel { get; set; } public PlcSwapModelResp? PlcSwapModel { get; set; }
/// <summary>
/// 雷达数据
/// </summary>
public RadarResp? RadarResp { get; set; }
/// <summary> /// <summary>
/// 换电状态 /// 换电状态
/// </summary> /// </summary>

@ -76,6 +76,9 @@ public class InfoEnum
[Const("符合soc限制数量不足")] LessOfSoc, [Const("符合soc限制数量不足")] LessOfSoc,
[Const("结束充电大于3分钟的数量不足")] LessOf3Minute, [Const("结束充电大于3分钟的数量不足")] LessOf3Minute,
[Const("预约电池异常")] AmtError, [Const("预约电池异常")] AmtError,
[Const("等待手动选包")] WaitManually,
[Const("等待选择换下电池包仓位")] WaitSelectDownBin,
} }
@ -117,6 +120,7 @@ public class InfoEnum
[Const("rfid扫描完成")] RfidReadFlag, [Const("rfid扫描完成")] RfidReadFlag,
[Const("车辆到位")] CarInPositionFlag, [Const("车辆到位")] CarInPositionFlag,
[Const("二次雷达检测")] Carradar, [Const("二次雷达检测")] Carradar,
[Const("选包成功")] SelectPackSuccess,
[Const("车辆解锁")] VelUnlockFlag, [Const("车辆解锁")] VelUnlockFlag,
[Const("下发plc选包")] DistributeSelectPackFlag, [Const("下发plc选包")] DistributeSelectPackFlag,
[Const("开始换电")] StartSwappingFlag, [Const("开始换电")] StartSwappingFlag,

@ -215,6 +215,8 @@ public class StationParamConst
public static readonly string StationModel = "Station.StationModel"; public static readonly string StationModel = "Station.StationModel";
//是否手动输入换电车辆启动换电流程 //是否手动输入换电车辆启动换电流程
public static readonly string VehicleManually = "Station.VehicleManually"; public static readonly string VehicleManually = "Station.VehicleManually";
//是否手动选仓
public static readonly string SelectPackManually = "Station.SelectPackManually";
//站号 //站号
public static readonly string StationNumber="Station.StationNumber"; public static readonly string StationNumber="Station.StationNumber";

@ -6,6 +6,22 @@ namespace Entity.Constant;
public class SwapConstant public class SwapConstant
{ {
/// <summary>
/// 手动/自动
/// </summary>
public enum AutoOrManual
{
[Const("自动")]
Auto,
[Const("手动")]
Manual,
}
/// <summary> /// <summary>
/// 通讯类型 /// 通讯类型
/// </summary> /// </summary>
@ -96,4 +112,5 @@ public class SwapConstant
} }
} }

@ -13,4 +13,6 @@ public class SelectPackDto
public InfoEnum.SelectBinStatusInfo Info { get; set; } public InfoEnum.SelectBinStatusInfo Info { get; set; }
public BinInfo BinInfo { get; set; } public BinInfo BinInfo { get; set; }
public List<BinInfo> CanSwapBinInfo { get; set; } = new List<BinInfo>();
} }

@ -50,8 +50,6 @@ public class BinInfoRepository : BaseRepository<BinInfo>
"in_time asc"); "in_time asc");
_log.Info($"BinInfoRepository SelectPack list1={JsonConvert.SerializeObject(list)}"); _log.Info($"BinInfoRepository SelectPack list1={JsonConvert.SerializeObject(list)}");
// BinInfo? cacheBinBattery = ChooseCacheBinBattery(swapSoc);
if (list.Count <= 0) if (list.Count <= 0)
{ {
_log.Info($"list1 return"); _log.Info($"list1 return");
@ -91,9 +89,11 @@ public class BinInfoRepository : BaseRepository<BinInfo>
list = socList; list = socList;
selectPackDto.BinInfo = list[0];
selectPackDto.BinInfo = list[0];
selectPackDto.CanSwapBinInfo = list;
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.Success; selectPackDto.Info = InfoEnum.SelectBinStatusInfo.Success;
selectPackDto.SuccessFlag = true; selectPackDto.SuccessFlag = true;
@ -102,6 +102,39 @@ public class BinInfoRepository : BaseRepository<BinInfo>
} }
public SelectPackDto SelectPackInBin()
{
_log.Info($"BinInfoRepository SelctPackInBin ");
SelectPackDto selectPackDto = new()
{
SuccessFlag = false,
};
List<BinInfo> list =
QueryListByClause(i =>
i.CacheBinFlag == 0 &&
i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock
&& i.Exists == 0);
if (list.Count <= 0)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
return selectPackDto;
}
/*var value = QueryMoveBinNo()[1];
if (!string.IsNullOrWhiteSpace(value))
{
list = list.Where(i => i.No != value).ToList();
}*/
selectPackDto.CanSwapBinInfo = list;
selectPackDto.BinInfo = list[0];
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.Success;
selectPackDto.SuccessFlag = true;
return selectPackDto;
}
/// <summary> /// <summary>
/// 选择缓存仓的电池 /// 选择缓存仓的电池
/// </summary> /// </summary>

@ -40,7 +40,7 @@ public class CommonMgr
/// 新增小步状态 /// 新增小步状态
/// </summary> /// </summary>
public void InsertStep(InfoEnum.BusinessSwappingStep step, SwappingStateMachine machine, public void InsertStep(InfoEnum.BusinessSwappingStep step, SwappingStateMachine machine,
string desc="" ,string param=null,int type=(int)SwapConstant.StepType.AUTO) string desc = "", string param = null, int type = (int)SwapConstant.StepType.AUTO)
{ {
var stepModel = new StepModel var stepModel = new StepModel
{ {
@ -58,10 +58,8 @@ public class CommonMgr
{ {
if (!string.IsNullOrEmpty(machine.SwapOrder.Sn)) if (!string.IsNullOrEmpty(machine.SwapOrder.Sn))
_swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn, _swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn,
desc,param,type); desc, param, type);
} }
} }
@ -109,7 +107,6 @@ public class CommonMgr
{ {
return SwapOrderStepRepository.GetCount(i => return SwapOrderStepRepository.GetCount(i =>
i.SwapOrderSn == swapOrderSn && i.StepType == (int)SwapConstant.StepType.MANUAL) > 0; i.SwapOrderSn == swapOrderSn && i.StepType == (int)SwapConstant.StepType.MANUAL) > 0;
} }
@ -167,8 +164,6 @@ public class CommonMgr
} }
/// 1.仓位状态:启动 /// 1.仓位状态:启动
/// 2.电池在位 /// 2.电池在位
/// 3.充电状态:不在充电中 /// 3.充电状态:不在充电中
@ -186,7 +181,7 @@ public class CommonMgr
public SwapOrderBatteryInfo SelectPackNotArm(SwappingStateMachine machine) public SwapOrderBatteryInfo SelectPackNotArm(SwappingStateMachine machine)
{ {
SwapOrderBatteryInfo orderBatteryInfo = new SwapOrderBatteryInfo(); SwapOrderBatteryInfo orderBatteryInfo = new SwapOrderBatteryInfo();
UpBin(orderBatteryInfo); UpBin(machine, orderBatteryInfo);
_log.Info($"UpBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}"); _log.Info($"UpBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}");
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success) if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{ {
@ -195,6 +190,30 @@ public class CommonMgr
InBin(orderBatteryInfo, machine); InBin(orderBatteryInfo, machine);
_log.Info($"InBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}"); _log.Info($"InBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}");
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{
return orderBatteryInfo;
}
//手动选包
ManualSelectPack(machine, orderBatteryInfo);
if (orderBatteryInfo.CanSwap == InfoEnum.SelectBinStatusInfo.Success)
{
orderBatteryInfo.InBinInfo.BatteryNo = "-1";
orderBatteryInfo.InBinInfo.Soc = -1;
orderBatteryInfo.InBinInfo.Soe = -1;
orderBatteryInfo.InBinInfo.Soh = -1;
var carInfoBatteryInfos = machine.BoxCarInfoModel?.CarInfo?.BatteryInfos;
if (carInfoBatteryInfos != null && carInfoBatteryInfos.Count > 0)
{
orderBatteryInfo.InBinInfo.BatteryNo = carInfoBatteryInfos[0].BatteryNo;
// orderBatteryInfo.InBinInfo.Soc = carInfoBatteryInfos[0].Soc;
orderBatteryInfo.InBinInfo.Soe = carInfoBatteryInfos[0].Soe;
orderBatteryInfo.InBinInfo.Soh = carInfoBatteryInfos[0].Soh;
}
}
return orderBatteryInfo; return orderBatteryInfo;
} }
@ -227,12 +246,12 @@ public class CommonMgr
/// 不能选正在执行移仓的电池 /// 不能选正在执行移仓的电池
/// </summary> /// </summary>
/// <param name="orderBatteryInfo"></param> /// <param name="orderBatteryInfo"></param>
public void UpBin(SwapOrderBatteryInfo orderBatteryInfo) public void UpBin(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
{ {
SelectPackDto selectPack = SelectPackDto selectPack =
_binInfoRepository.SelectPack(StaticStationInfo.SwapSoc, StaticStationInfo.SwapFinishChargeTime, _binInfoRepository.SelectPack(StaticStationInfo.SwapSoc, StaticStationInfo.SwapFinishChargeTime,
QueryMoveBinNo()[0]); QueryMoveBinNo()[0]);
orderBatteryInfo.CanUpBin = selectPack.CanSwapBinInfo;
orderBatteryInfo.UpBinInfo = selectPack.BinInfo; orderBatteryInfo.UpBinInfo = selectPack.BinInfo;
orderBatteryInfo.CanSwap = selectPack.Info; orderBatteryInfo.CanSwap = selectPack.Info;
} }
@ -264,7 +283,6 @@ public class CommonMgr
public void ceshi() public void ceshi()
{ {
} }
@ -274,45 +292,62 @@ public class CommonMgr
/// <param name="orderBatteryInfo"></param> /// <param name="orderBatteryInfo"></param>
public void InBin(SwapOrderBatteryInfo orderBatteryInfo, SwappingStateMachine machine) public void InBin(SwapOrderBatteryInfo orderBatteryInfo, SwappingStateMachine machine)
{ {
List<BinInfo> list = orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.WaitSelectDownBin;
_binInfoRepository.QueryListByClause(i => SelectPackDto selectPackDto= _binInfoRepository.SelectPackInBin();
i.CacheBinFlag == 0 &&
i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock orderBatteryInfo.CanDownBin = selectPackDto.CanSwapBinInfo;
&& i.Exists == 0); orderBatteryInfo.InBinInfo = selectPackDto.BinInfo;
orderBatteryInfo.CanSwap = selectPackDto.Info;
}
if (list.Count <= 0)
//手动选包
public void ManualSelectPack(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
{
if ((int)SwapConstant.AutoOrManual.Auto == StaticStationInfo.SelectPackManually)
{ {
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
return; return;
} }
var value = QueryMoveBinNo()[1]; //手动等待选包
if (!string.IsNullOrWhiteSpace(value)) orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.WaitManually;
orderBatteryInfo.UpBinInfo = null;
orderBatteryInfo.InBinInfo = null;
if (machine.SwapOrderBatteryInfo?.UpBinInfo == null
|| machine.SwapOrderBatteryInfo?.InBinInfo == null)
{ {
list = list.Where(i => i.No != value).ToList(); _log.Info("等待手动选包..........");
//TODO:: 增加播报
return;
} }
if (list.Count <= 0) if (orderBatteryInfo.CanUpBin.Count > 0)
{ {
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin; BinInfo? binInfo =
return; orderBatteryInfo.CanUpBin.First(i => i.Id == machine.SwapOrderBatteryInfo?.UpBinInfo.Id);
if (binInfo != null)
{
orderBatteryInfo.CanSwap =InfoEnum.SelectBinStatusInfo.WaitSelectDownBin;
orderBatteryInfo.UpBinInfo = binInfo;
}
} }
orderBatteryInfo.InBinInfo = list[0]; if (orderBatteryInfo.CanDownBin.Count > 0)
orderBatteryInfo.InBinInfo.BatteryNo = "-1";
orderBatteryInfo.InBinInfo.Soc = -1;
orderBatteryInfo.InBinInfo.Soe = -1;
orderBatteryInfo.InBinInfo.Soh = -1;
var carInfoBatteryInfos = machine.BoxCarInfoModel?.CarInfo?.BatteryInfos;
if (carInfoBatteryInfos != null && carInfoBatteryInfos.Count > 0)
{ {
orderBatteryInfo.InBinInfo.BatteryNo = carInfoBatteryInfos[0].BatteryNo; BinInfo? binInfo =
// orderBatteryInfo.InBinInfo.Soc = carInfoBatteryInfos[0].Soc; orderBatteryInfo.CanDownBin.First(i => i.Id == machine.SwapOrderBatteryInfo?.InBinInfo.Id);
orderBatteryInfo.InBinInfo.Soe = carInfoBatteryInfos[0].Soe;
orderBatteryInfo.InBinInfo.Soh = carInfoBatteryInfos[0].Soh; if (binInfo != null)
{
orderBatteryInfo.CanSwap =InfoEnum.SelectBinStatusInfo.Success;
orderBatteryInfo.InBinInfo = binInfo;
}
} }
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
} }
/// <summary> /// <summary>

@ -12,6 +12,9 @@ public class SwapOrderBatteryInfo
public InfoEnum.SelectBinStatusInfo CanSwap; public InfoEnum.SelectBinStatusInfo CanSwap;
public List<BinInfo> CanUpBin = new List<BinInfo>();
public List<BinInfo> CanDownBin = new List<BinInfo>();
public BinInfo UpBinInfo; public BinInfo UpBinInfo;
/// <summary> /// <summary>
/// downBinNo /// downBinNo

@ -176,11 +176,11 @@ public class CarPrepareState : IState
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarInPosition.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
if (PadarMgr._PadarClient?.CarState == 6) if (PadarMgr._PadarClient?.CarState == 6 || machine.ManualSkipRadar)
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed());
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Carradar, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Carradar,
machine); machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
} }
@ -407,6 +407,9 @@ public class CarPrepareState : IState
machine.SwapOrderBatteryInfo = orderBatteryInfo; machine.SwapOrderBatteryInfo = orderBatteryInfo;
machine.SelectPackFlag = true; machine.SelectPackFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.SelectPackSuccess,
machine,"手动选包",param: JsonConvert.SerializeObject(machine.SwapOrderBatteryInfo)
,type:(int)SwapConstant.StepType.MANUAL);
} }
}, () => }, () =>
{ {

@ -190,7 +190,8 @@ public class StationReadyState : IState
/// <returns></returns> /// <returns></returns>
public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag) public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
{ {
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0, return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0
|| machine.ManualSkipRadar,
() => { PadarMgr._PadarClient?.PadarControl(flag); }); () => { PadarMgr._PadarClient?.PadarControl(flag); });
} }
@ -208,11 +209,11 @@ public class StationReadyState : IState
PadarMgr._PadarClient?.CarState.ToString(),(int)SwapConstant.CommunicationType.Receive); PadarMgr._PadarClient?.CarState.ToString(),(int)SwapConstant.CommunicationType.Receive);
if (PadarMgr._PadarClient?.CarState == 6) if (PadarMgr._PadarClient?.CarState == 6 || machine.ManualSkipRadar)
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed());
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine); machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
} }

@ -282,13 +282,21 @@ public class SwapDoneState : IState
() => machine.RadarOutFlag, () => () => machine.RadarOutFlag, () =>
{ {
if (machine.ManualSkipRadar)
if (PadarMgr._PadarClient.CarState != 1)
{ {
_log.Info("exist radar false"); machine.RadarOutFlag = true;
} }
else else
{ {
if (PadarMgr._PadarClient!.CarState == 1)
{
machine.RadarOutFlag = true;
}
}
if ( machine.RadarOutFlag)
{
machine.ExceptionReason = ExceptionReason.None; machine.ExceptionReason = ExceptionReason.None;
_log.Info("exist radar true"); _log.Info("exist radar true");
@ -300,14 +308,14 @@ public class SwapDoneState : IState
machine.SwapOrder!.VehicleLeaveTime = DateTime.Now; machine.SwapOrder!.VehicleLeaveTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine); _CommonMgr.UpdateSwapOrder(machine);
machine.RadarOutFlag = true;
_CommonMgr.InsertStep( _CommonMgr.InsertStep(
machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? InfoEnum.BusinessSwappingStep.RadarOutFlag ? InfoEnum.BusinessSwappingStep.RadarOutFlag
: InfoEnum.BusinessSwappingStep.RadarOutFailFlag, : InfoEnum.BusinessSwappingStep.RadarOutFailFlag,
machine); machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
} }
}, () => }, () =>
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed());

@ -43,6 +43,10 @@ public class SwappingStateMachine : IDisposable
//手动确认解锁/上锁成功 //手动确认解锁/上锁成功
public bool ManualConfirmCarLockFlag { get; set; } public bool ManualConfirmCarLockFlag { get; set; }
//手动屏蔽雷达
public bool ManualSkipRadar { get; set; }
public OperateModel OperateModel = null; public OperateModel OperateModel = null;
public readonly LedTool? LedTool = null; public readonly LedTool? LedTool = null;
@ -357,6 +361,7 @@ public class SwappingStateMachine : IDisposable
OperateModel = null; OperateModel = null;
ManualConfirmCarUnlockFlag = false; ManualConfirmCarUnlockFlag = false;
ManualConfirmCarLockFlag = false; ManualConfirmCarLockFlag = false;
ManualSkipRadar = false;
CancelFlag = false; CancelFlag = false;
StopFlag = false; StopFlag = false;
} }

@ -81,6 +81,14 @@ public class StaticStationInfo
set => Set(StationParamConst.SwapSoc, value); set => Set(StationParamConst.SwapSoc, value);
} }
//手动选仓
public static int SelectPackManually
{
get => int.Parse(Resolve(StationParamConst.SelectPackManually));
set => Set(StationParamConst.SelectPackManually, value);
}
#region Tbox #region Tbox
public static bool TboxStateConnect public static bool TboxStateConnect

@ -6,6 +6,7 @@ using Common.Util;
using Entity.Api.Resp; using Entity.Api.Resp;
using Entity.Constant; using Entity.Constant;
using Entity.DbModel.Station; using Entity.DbModel.Station;
using Entity.Dto;
using Entity.Dto.Req; using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
@ -42,6 +43,40 @@ public class MonitorService
public SwapOrderBatteryRepository _SwapOrderBatteryRepository { get; set; } public SwapOrderBatteryRepository _SwapOrderBatteryRepository { get; set; }
public CommonMgr _CommonMgr { get; set; }
//可选仓位
public List<List<BinInfo>> CanSelectPackBin()
{
//出仓位
SelectPackDto selectPackDtoUpBin = BinInfoRepository.SelectPack(StaticStationInfo.SwapSoc,
StaticStationInfo.SwapFinishChargeTime,
"");
//入仓位
SelectPackDto selectPackInBin = BinInfoRepository.SelectPackInBin();
return new List<List<BinInfo>>()
{
selectPackDtoUpBin.CanSwapBinInfo, selectPackInBin.CanSwapBinInfo
};
}
//手动选包
public Result<bool> SelectPackManual(int upBinId, int inBinId)
{
var upBin = BinInfoRepository.QueryById(upBinId);
var inBin = BinInfoRepository.QueryById(inBinId);
if (StationSoftMgr.SwappingStateMachine?.SwapOrderBatteryInfo == null)
{
StationSoftMgr.SwappingStateMachine!.SwapOrderBatteryInfo = new SwapOrderBatteryInfo();
}
StationSoftMgr.SwappingStateMachine!.SwapOrderBatteryInfo.InBinInfo = inBin;
StationSoftMgr.SwappingStateMachine!.SwapOrderBatteryInfo.UpBinInfo = upBin;
return Result<bool>.Success();
}
[DisplayName("获取移仓分页")] [DisplayName("获取移仓分页")]
public async Task<PageResult<MoveBinRecord>> Page(PageMoveBinRecordReq input) public async Task<PageResult<MoveBinRecord>> Page(PageMoveBinRecordReq input)
@ -71,6 +106,7 @@ public class MonitorService
return "新增id" + moveBinRecord.Id; return "新增id" + moveBinRecord.Id;
} }
public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req) public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req)
{ {
return await MoveBinRecordRepository.UpdateAsync(Req); return await MoveBinRecordRepository.UpdateAsync(Req);
@ -84,6 +120,7 @@ public class MonitorService
throw new ArgumentException($"不存在"); throw new ArgumentException($"不存在");
return await MoveBinRecordRepository.DeleteAsync(user); return await MoveBinRecordRepository.DeleteAsync(user);
} }
public Result<SwapMonitorScreenResp> GetSwapMonitorData() public Result<SwapMonitorScreenResp> GetSwapMonitorData()
{ {
var configBinInfo = var configBinInfo =
@ -104,7 +141,7 @@ public class MonitorService
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1); List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
var plcSwapModel = new PlcSwapModelResp(); var plcSwapModel = new PlcSwapModelResp();
if(ClientMgr.PlcClient!=null) if (ClientMgr.PlcClient != null)
{ {
plcSwapModel.ModelState = ClientMgr.PlcClient.Auto ? 1010 : 1000; plcSwapModel.ModelState = ClientMgr.PlcClient.Auto ? 1010 : 1000;
plcSwapModel.ControlModel = ClientMgr.PlcClient.Remote ? 1010 : 1000; plcSwapModel.ControlModel = ClientMgr.PlcClient.Remote ? 1010 : 1000;
@ -120,7 +157,8 @@ public class MonitorService
monitorScreenResp.VehicleInfo.VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null monitorScreenResp.VehicleInfo.VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
: null; : null;
monitorScreenResp.VehicleInfo.LockStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.LockStatus : null; monitorScreenResp.VehicleInfo.LockStatus =
tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.LockStatus : null;
monitorScreenResp.VehicleInfo.KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.Keys : null; monitorScreenResp.VehicleInfo.KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.Keys : null;
monitorScreenResp.VehicleInfo.VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null monitorScreenResp.VehicleInfo.VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo ? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo
@ -153,7 +191,10 @@ public class MonitorService
monitorScreenResp.DeviceLogs = StationSoftMgr.DeviceLogs; monitorScreenResp.DeviceLogs = StationSoftMgr.DeviceLogs;
monitorScreenResp.RadarResp = new()
{
CarStatus = PadarMgr._PadarClient?.CarState
};
return Result<SwapMonitorScreenResp>.Success(monitorScreenResp); return Result<SwapMonitorScreenResp>.Success(monitorScreenResp);
} }
@ -190,7 +231,7 @@ public class MonitorService
// CloudConnectFlag = CloudClientMgr.CloudClient == null ? false : CloudClientMgr.CloudClient.Connected, // CloudConnectFlag = CloudClientMgr.CloudClient == null ? false : CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = ClientMgr.PlcClient != null && ClientMgr.PlcClient!.Connected, PlcConnectFlag = ClientMgr.PlcClient != null && ClientMgr.PlcClient!.Connected,
RfidConnectFlag = StationSoftMgr.SwappingStateMachine!.RfidConnectFlag, RfidConnectFlag = StationSoftMgr.SwappingStateMachine!.RfidConnectFlag,
RadarConnectFlag =PadarMgr._PadarClient != null && PadarMgr._PadarClient!.Connected RadarConnectFlag = PadarMgr._PadarClient != null && PadarMgr._PadarClient!.Connected
}; };
return Result<DeviceStateResp>.Success(resp); return Result<DeviceStateResp>.Success(resp);
@ -262,14 +303,13 @@ public class MonitorService
Type = type, Type = type,
CreatedTime = DateTime.Now CreatedTime = DateTime.Now
}; };
moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord); moveBinRecord = MoveBinRecordRepository.Insert(moveBinRecord);
//发送移仓任务 //发送移仓任务
MoveCommandReq MoveCommandReq = new MoveCommandReq((byte)removeBinNo,(byte)putBinNo); MoveCommandReq MoveCommandReq = new MoveCommandReq((byte)removeBinNo, (byte)putBinNo);
PlcServer PlcServer = new PlcServer(); PlcServer PlcServer = new PlcServer();
PlcServer.SendMoveCommandReq(MoveCommandReq); PlcServer.SendMoveCommandReq(MoveCommandReq);
//TODO::判断任务是否执行 //TODO::判断任务是否执行
} }
catch (Exception e) catch (Exception e)
{ {

@ -151,6 +151,7 @@ namespace WebStarter.Controllers.BasicConfig
stationBaseRespResp.StationStatus = StaticStationInfo.StationStatus; stationBaseRespResp.StationStatus = StaticStationInfo.StationStatus;
stationBaseRespResp.ChargeSoc = StaticStationInfo.ChargeSoc; stationBaseRespResp.ChargeSoc = StaticStationInfo.ChargeSoc;
stationBaseRespResp.VehicleManually = StaticStationInfo.VehicleManually; stationBaseRespResp.VehicleManually = StaticStationInfo.VehicleManually;
stationBaseRespResp.SelectPackManually = StaticStationInfo.SelectPackManually;
// 单价 // 单价
stationBaseRespResp.ServiceTotalFee = StaticStationInfo.ServiceTotalFee; stationBaseRespResp.ServiceTotalFee = StaticStationInfo.ServiceTotalFee;
stationBaseRespResp.ElectricityTotalFee = StaticStationInfo.ElectricityTotalFee; stationBaseRespResp.ElectricityTotalFee = StaticStationInfo.ElectricityTotalFee;
@ -177,7 +178,7 @@ namespace WebStarter.Controllers.BasicConfig
StaticStationInfo.ChargeSoc = input.ChargeSoc; StaticStationInfo.ChargeSoc = input.ChargeSoc;
StaticStationInfo.VehicleManually = input.VehicleManually; StaticStationInfo.VehicleManually = input.VehicleManually;
StaticStationInfo.SelectPackManually = input.SelectPackManually;
StaticStationInfo.ServiceTotalFee = input.ServiceTotalFee; StaticStationInfo.ServiceTotalFee = input.ServiceTotalFee;
StaticStationInfo.ElectricityTotalFee = input.ElectricityTotalFee; StaticStationInfo.ElectricityTotalFee = input.ElectricityTotalFee;

@ -3,6 +3,7 @@ using DotNetty.Common.Utilities;
using Entity.Api.Req; using Entity.Api.Req;
using Entity.Api.Resp; using Entity.Api.Resp;
using Entity.Constant; using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
@ -28,7 +29,6 @@ public class SwapMonitorController : ControllerBase
public SwapMonitorController(MonitorService swapMonitorService, BinInfoService binInfoService) public SwapMonitorController(MonitorService swapMonitorService, BinInfoService binInfoService)
{ {
_swapMonitorService = swapMonitorService; _swapMonitorService = swapMonitorService;
_binInfoService = binInfoService; _binInfoService = binInfoService;
} }
@ -51,7 +51,6 @@ public class SwapMonitorController : ControllerBase
[HttpPost("GetSwapMonitorData")] [HttpPost("GetSwapMonitorData")]
public async Task<Result<SwapMonitorScreenResp>> GetSwapMonitorData() public async Task<Result<SwapMonitorScreenResp>> GetSwapMonitorData()
{ {
var respList = _swapMonitorService.GetSwapMonitorData(); var respList = _swapMonitorService.GetSwapMonitorData();
return respList; return respList;
@ -65,7 +64,6 @@ public class SwapMonitorController : ControllerBase
[HttpPost("WriteVin")] [HttpPost("WriteVin")]
public Result<bool> WriteVin([FromBody] RfidReadModel req) public Result<bool> WriteVin([FromBody] RfidReadModel req)
{ {
if (StaticStationInfo.VehicleManually != 1) if (StaticStationInfo.VehicleManually != 1)
{ {
return Result<bool>.Fail("此模式不支持手动写车辆数据,请先切换换电执行模式"); return Result<bool>.Fail("此模式不支持手动写车辆数据,请先切换换电执行模式");
@ -283,4 +281,53 @@ public class SwapMonitorController : ControllerBase
StationSoftMgr.SwappingStateMachine.ManualConfirmUnLockCar(); StationSoftMgr.SwappingStateMachine.ManualConfirmUnLockCar();
return Result<bool>.Success(); return Result<bool>.Success();
} }
/// <summary>
/// 手动跳过雷达
/// </summary>
[HttpGet("")]
public Result<List<List<BinInfo>>> skipTheRadar()
{
return Result<List<List<BinInfo>>>.Success(_swapMonitorService.CanSelectPackBin());
}
/// <summary>
/// 可选仓位
/// </summary>
[HttpGet("CanSelectPackBin")]
public Result<List<List<BinInfo>>> CanSelectPackBin()
{
return Result<List<List<BinInfo>>>.Success(_swapMonitorService.CanSelectPackBin());
}
/// <summary>
/// 手动选仓
/// </summary>
/// <returns></returns>
[HttpPost("SelectPackManual/{upBinId}/{inBinId}")]
public Result<bool> SelectPackManual(int upBinId, int inBinId)
{
if (StaticStationInfo.SelectPackManually != (int)SwapConstant.AutoOrManual.Manual)
{
return Result<bool>.Fail("此模式不支持手动选仓,请先切换选包模式");
}
if (StationSoftMgr.SwappingStateMachine.SelectPackFlag)
{
return Result<bool>.Fail("目前换电进行中,请勿修改数据");
}
return _swapMonitorService.SelectPackManual(upBinId, inBinId);
}
/// <summary>
/// 手动跳过雷达
/// </summary>
/// <returns></returns>
[HttpGet("SkipRadarManual")]
public Result<bool> SkipRadarManual()
{
StationSoftMgr.SwappingStateMachine!.ManualSkipRadar = true;
return Result<bool>.Success();
}
} }

@ -0,0 +1,2 @@
INSERT INTO `sys_config` VALUES (1300000000184, 'Station.SelectPackManually', 'SelectPackManually', '10000', 2, 'Station', 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
Loading…
Cancel
Save