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

master
lxw 2 months ago
parent 1de55a2287
commit 4dc6f56c89

@ -59,4 +59,10 @@ public class StationConfigReq
/// 附加费
/// </summary>
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>
public int VehicleManually { get; set; }
/// <summary>
/// 是否手动选包 0: 自动选包 1:手动选包)
/// </summary>
public int SelectPackManually { get; set; }
/// <summary>
/// 服务费

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

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

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

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

@ -13,4 +13,6 @@ public class SelectPackDto
public InfoEnum.SelectBinStatusInfo Info { 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");
_log.Info($"BinInfoRepository SelectPack list1={JsonConvert.SerializeObject(list)}");
// BinInfo? cacheBinBattery = ChooseCacheBinBattery(swapSoc);
if (list.Count <= 0)
{
_log.Info($"list1 return");
@ -91,8 +89,10 @@ public class BinInfoRepository : BaseRepository<BinInfo>
list = socList;
selectPackDto.BinInfo = list[0];
selectPackDto.CanSwapBinInfo = list;
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.Success;
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>

@ -40,7 +40,7 @@ public class CommonMgr
/// 新增小步状态
/// </summary>
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
{
@ -49,7 +49,7 @@ public class CommonMgr
StartTime = DateTime.Now,
Status = 1
};
machine.StepModel[stepModel.StepNo.ToString()] = stepModel;
@ -58,10 +58,8 @@ public class CommonMgr
{
if (!string.IsNullOrEmpty(machine.SwapOrder.Sn))
_swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn,
desc,param,type);
desc, param, type);
}
}
@ -103,15 +101,14 @@ public class CommonMgr
_swapOrderBatteryRepository.Insert(swapOrderBattery);
}
//查询是否有手动操作
public bool QueryHasManual(String swapOrderSn)
{
return SwapOrderStepRepository.GetCount(i =>
i.SwapOrderSn == swapOrderSn && i.StepType == (int)SwapConstant.StepType.MANUAL) > 0;
}
/// <summary>
/// 1.锁仓
@ -167,8 +164,6 @@ public class CommonMgr
}
/// 1.仓位状态:启动
/// 2.电池在位
/// 3.充电状态:不在充电中
@ -186,7 +181,7 @@ public class CommonMgr
public SwapOrderBatteryInfo SelectPackNotArm(SwappingStateMachine machine)
{
SwapOrderBatteryInfo orderBatteryInfo = new SwapOrderBatteryInfo();
UpBin(orderBatteryInfo);
UpBin(machine, orderBatteryInfo);
_log.Info($"UpBin orderBatteryInfo={JsonConvert.SerializeObject(orderBatteryInfo)}");
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{
@ -195,6 +190,30 @@ public class CommonMgr
InBin(orderBatteryInfo, machine);
_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;
}
@ -227,12 +246,12 @@ public class CommonMgr
/// 不能选正在执行移仓的电池
/// </summary>
/// <param name="orderBatteryInfo"></param>
public void UpBin(SwapOrderBatteryInfo orderBatteryInfo)
public void UpBin(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
{
SelectPackDto selectPack =
_binInfoRepository.SelectPack(StaticStationInfo.SwapSoc, StaticStationInfo.SwapFinishChargeTime,
QueryMoveBinNo()[0]);
orderBatteryInfo.CanUpBin = selectPack.CanSwapBinInfo;
orderBatteryInfo.UpBinInfo = selectPack.BinInfo;
orderBatteryInfo.CanSwap = selectPack.Info;
}
@ -264,7 +283,6 @@ public class CommonMgr
public void ceshi()
{
}
@ -274,45 +292,62 @@ public class CommonMgr
/// <param name="orderBatteryInfo"></param>
public void InBin(SwapOrderBatteryInfo orderBatteryInfo, SwappingStateMachine machine)
{
List<BinInfo> list =
_binInfoRepository.QueryListByClause(i =>
i.CacheBinFlag == 0 &&
i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock
&& i.Exists == 0);
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.WaitSelectDownBin;
SelectPackDto selectPackDto= _binInfoRepository.SelectPackInBin();
if (list.Count <= 0)
orderBatteryInfo.CanDownBin = selectPackDto.CanSwapBinInfo;
orderBatteryInfo.InBinInfo = selectPackDto.BinInfo;
orderBatteryInfo.CanSwap = selectPackDto.Info;
}
//手动选包
public void ManualSelectPack(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
{
if ((int)SwapConstant.AutoOrManual.Auto == StaticStationInfo.SelectPackManually)
{
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
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;
return;
BinInfo? binInfo =
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];
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)
if (orderBatteryInfo.CanDownBin.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;
}
BinInfo? binInfo =
orderBatteryInfo.CanDownBin.First(i => i.Id == machine.SwapOrderBatteryInfo?.InBinInfo.Id);
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.Success;
if (binInfo != null)
{
orderBatteryInfo.CanSwap =InfoEnum.SelectBinStatusInfo.Success;
orderBatteryInfo.InBinInfo = binInfo;
}
}
}
/// <summary>

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

@ -176,11 +176,11 @@ public class CarPrepareState : IState
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
if (PadarMgr._PadarClient?.CarState == 6)
if (PadarMgr._PadarClient?.CarState == 6 || machine.ManualSkipRadar)
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed());
_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.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>
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); });
}
@ -208,11 +209,11 @@ public class StationReadyState : IState
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());
_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, () =>
{
if (PadarMgr._PadarClient.CarState != 1)
if (machine.ManualSkipRadar)
{
_log.Info("exist radar false");
machine.RadarOutFlag = true;
}
else
{
if (PadarMgr._PadarClient!.CarState == 1)
{
machine.RadarOutFlag = true;
}
}
if ( machine.RadarOutFlag)
{
machine.ExceptionReason = ExceptionReason.None;
_log.Info("exist radar true");
@ -300,14 +308,14 @@ public class SwapDoneState : IState
machine.SwapOrder!.VehicleLeaveTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine);
machine.RadarOutFlag = true;
_CommonMgr.InsertStep(
machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? InfoEnum.BusinessSwappingStep.RadarOutFlag
: InfoEnum.BusinessSwappingStep.RadarOutFailFlag,
machine);
machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
}
}, () =>
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed());

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

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

@ -6,6 +6,7 @@ using Common.Util;
using Entity.Api.Resp;
using Entity.Constant;
using Entity.DbModel.Station;
using Entity.Dto;
using Entity.Dto.Req;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
@ -38,18 +39,52 @@ public class MonitorService
public PlcTaskMgr PlcTaskMgr { get; set; }
public MoveBinRecordRepository MoveBinRecordRepository { 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("获取移仓分页")]
public async Task<PageResult<MoveBinRecord>> Page(PageMoveBinRecordReq input)
{
RefAsync<int> total = 0;
var items = await MoveBinRecordRepository.QueryPageAsync(
entity => true,
entity => true,
!string.IsNullOrWhiteSpace(input.UpBatterySoc), u => u.UpBatterySoc.Equals(input.UpBatterySoc.Trim()),
!string.IsNullOrWhiteSpace(input.UpBinNo), u => u.UpBinNo.Equals(input.UpBinNo.Trim()),
!string.IsNullOrWhiteSpace(input.UpBatteryNo), u => u.UpBatteryNo.Equals(input.UpBatteryNo.Trim()),
@ -62,21 +97,22 @@ public class MonitorService
Rows = items,
};
}
public async Task<string> Add(AddMoveBinRecordReq input)
{
string result = "";
MoveBinRecord moveBinRecord = await MoveBinRecordRepository.InsertAsync(input);
return "新增id" + moveBinRecord.Id;
}
public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req)
{
return await MoveBinRecordRepository.UpdateAsync(Req);
}
public virtual async Task<bool> Delete(DeleteMoveBinRecordReq input)
{
var user = await MoveBinRecordRepository.QueryByClauseAsync(u => u.Id == input.Id);
@ -84,27 +120,28 @@ public class MonitorService
throw new ArgumentException($"不存在");
return await MoveBinRecordRepository.DeleteAsync(user);
}
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
{
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap<StepModel, SwappingStateInfoResp>().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
List<SwappingStateInfoResp> stateInfoList = new List<SwappingStateInfoResp>();
ConcurrentDictionary<string, StepModel> dictionary = StationSoftMgr.SwappingStateMachine.StepModel;
stateInfoList = dictionary.Values
.OrderBy(model => model.StepNo)
.Select(model => mapperBinInfo.Map<SwappingStateInfoResp>(model))
.ToList();
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
var plcSwapModel = new PlcSwapModelResp();
if(ClientMgr.PlcClient!=null)
if (ClientMgr.PlcClient != null)
{
plcSwapModel.ModelState = ClientMgr.PlcClient.Auto ? 1010 : 1000;
plcSwapModel.ControlModel = ClientMgr.PlcClient.Remote ? 1010 : 1000;
@ -115,30 +152,31 @@ public class MonitorService
monitorScreenResp.StateInfo = stateInfoList;
monitorScreenResp.VehicleInfo = new SwapVehicleResp();
monitorScreenResp.VehicleInfo.OrderNo = StationSoftMgr.SwappingStateMachine.SwapOrder != null
? StationSoftMgr.SwappingStateMachine.SwapOrder.Sn
: null;
? StationSoftMgr.SwappingStateMachine.SwapOrder.Sn
: null;
monitorScreenResp.VehicleInfo.VelMac = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
: null;
monitorScreenResp.VehicleInfo.LockStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.LockStatus : null;
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelMac
: null;
monitorScreenResp.VehicleInfo.LockStatus =
tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.LockStatus : null;
monitorScreenResp.VehicleInfo.KeyStatus = tboxCarInfoModel != null ? tboxCarInfoModel.CarStatus?.Keys : null;
monitorScreenResp.VehicleInfo.VelNo = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelNo
: null;
monitorScreenResp.VehicleInfo.VelVin = StationSoftMgr.SwappingStateMachine.RfidReadModel != null
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
: null;
? StationSoftMgr.SwappingStateMachine.RfidReadModel.VelVin
: null;
monitorScreenResp.VehicleInfo.Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break;
monitorScreenResp.VehicleInfo.Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear;
monitorScreenResp.BatteryInfo = new();
monitorScreenResp.BatteryInfo.BatteryTotalCount = binInfos.Count;
monitorScreenResp.BatteryInfo.UsingSwapBatteryCount = binInfos.Select(i => i.ChargeStatus == 2 &&
i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
i.Soc > StaticStationInfo.SwapSoc &&
new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes >
StaticStationInfo.SwapFinishChargeTime).Count();
i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock &&
i.Soc > StaticStationInfo.SwapSoc &&
new TimeSpan(DateTime.Now.Ticks -
i.LastChargeFinishTime.ToDateTime().Ticks)
.TotalMinutes >
StaticStationInfo.SwapFinishChargeTime).Count();
if (monitorScreenResp.VehicleInfo.OrderNo != null)
{
@ -149,11 +187,14 @@ public class MonitorService
monitorScreenResp.VehicleInfo.DownBatteryBinNo = queryByClauseAsync.DownBatteryBinNo;
monitorScreenResp.VehicleInfo.UpBatteryBinNo = queryByClauseAsync.UpBatteryBinNo;
}
}
monitorScreenResp.DeviceLogs = StationSoftMgr.DeviceLogs;
}
monitorScreenResp.DeviceLogs = StationSoftMgr.DeviceLogs;
monitorScreenResp.RadarResp = new()
{
CarStatus = PadarMgr._PadarClient?.CarState
};
return Result<SwapMonitorScreenResp>.Success(monitorScreenResp);
}
@ -187,10 +228,10 @@ public class MonitorService
DeviceStateResp resp = new()
{
BoxConnectFlag = isConnected,
// CloudConnectFlag = CloudClientMgr.CloudClient == null ? false : CloudClientMgr.CloudClient.Connected,
// CloudConnectFlag = CloudClientMgr.CloudClient == null ? false : CloudClientMgr.CloudClient.Connected,
PlcConnectFlag = ClientMgr.PlcClient != null && ClientMgr.PlcClient!.Connected,
RfidConnectFlag = StationSoftMgr.SwappingStateMachine!.RfidConnectFlag,
RadarConnectFlag =PadarMgr._PadarClient != null && PadarMgr._PadarClient!.Connected
RadarConnectFlag = PadarMgr._PadarClient != null && PadarMgr._PadarClient!.Connected
};
return Result<DeviceStateResp>.Success(resp);
@ -262,14 +303,13 @@ public class MonitorService
Type = type,
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.SendMoveCommandReq(MoveCommandReq);
//TODO::判断任务是否执行
}
catch (Exception e)
{
@ -296,4 +336,4 @@ public class MonitorService
return Result<List<BinInfoResp>>.Success(mapperBinInfo.Map<List<BinInfoResp>>(queryListByClause));
}
}
}

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

@ -3,6 +3,7 @@ using DotNetty.Common.Utilities;
using Entity.Api.Req;
using Entity.Api.Resp;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
@ -28,7 +29,6 @@ public class SwapMonitorController : ControllerBase
public SwapMonitorController(MonitorService swapMonitorService, BinInfoService binInfoService)
{
_swapMonitorService = swapMonitorService;
_binInfoService = binInfoService;
}
@ -51,21 +51,19 @@ public class SwapMonitorController : ControllerBase
[HttpPost("GetSwapMonitorData")]
public async Task<Result<SwapMonitorScreenResp>> GetSwapMonitorData()
{
var respList = _swapMonitorService.GetSwapMonitorData();
return respList;
}
/// <summary>
/// 手动写入车辆vin码
/// </summary>
/// <returns></returns>
[HttpPost("WriteVin")]
public Result<bool> WriteVin([FromBody] RfidReadModel req)
public Result<bool> WriteVin([FromBody] RfidReadModel req)
{
if (StaticStationInfo.VehicleManually != 1)
{
return Result<bool>.Fail("此模式不支持手动写车辆数据,请先切换换电执行模式");
@ -75,11 +73,11 @@ public class SwapMonitorController : ControllerBase
{
return Result<bool>.Fail("目前换电进行中,请勿修改数据");
}
StationSoftMgr.SwappingStateMachine.BeginRfidReadFlag = true;
StationSoftMgr.SwappingStateMachine.RfidReadModel = req;
return Result<bool>.Success();
}
@ -263,7 +261,7 @@ public class SwapMonitorController : ControllerBase
return Result<List<TboxCarInfoModel>>.Success(carInfoList.Where(i => i.CarNo.Length >= 17).ToList());
}
/// <summary>
/// 确认上锁成功
/// </summary>
@ -273,7 +271,7 @@ public class SwapMonitorController : ControllerBase
StationSoftMgr.SwappingStateMachine.ManualConfirmLockCar();
return Result<bool>.Success();
}
/// <summary>
/// 确认解锁成功
/// </summary>
@ -283,4 +281,53 @@ public class SwapMonitorController : ControllerBase
StationSoftMgr.SwappingStateMachine.ManualConfirmUnLockCar();
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