diff --git a/Entity/Api/Req/StationConfigReq.cs b/Entity/Api/Req/StationConfigReq.cs
index 61810f7..eda4b8f 100644
--- a/Entity/Api/Req/StationConfigReq.cs
+++ b/Entity/Api/Req/StationConfigReq.cs
@@ -59,4 +59,10 @@ public class StationConfigReq
/// 附加费
///
public int AppendTotalFee { get; set; }
+
+ ///
+ /// 是否手动选包 (0: 自动选包 1:手动选包)
+ ///
+ public int SelectPackManually { get; set; }
+
}
\ No newline at end of file
diff --git a/Entity/Api/Resp/RadarResp.cs b/Entity/Api/Resp/RadarResp.cs
new file mode 100644
index 0000000..d9b8172
--- /dev/null
+++ b/Entity/Api/Resp/RadarResp.cs
@@ -0,0 +1,18 @@
+namespace Entity.Api.Resp;
+
+///
+///
+/// 雷达数据
+///
+public class RadarResp
+{
+
+
+
+ ///
+ ///0-雷达不工作;1-无车;2-无电池,3-角度偏移过大;4-车辆靠后;5-车辆靠前;6-车辆到位
+ ///
+ public int? CarStatus { get; set; }
+
+
+}
\ No newline at end of file
diff --git a/Entity/Api/Resp/StationConfigResp.cs b/Entity/Api/Resp/StationConfigResp.cs
index 0235baf..b46c0f3 100644
--- a/Entity/Api/Resp/StationConfigResp.cs
+++ b/Entity/Api/Resp/StationConfigResp.cs
@@ -50,6 +50,11 @@ public class StationConfigResp
///
public int VehicleManually { get; set; }
+ ///
+ /// 是否手动选包 (0: 自动选包 1:手动选包)
+ ///
+ public int SelectPackManually { get; set; }
+
///
/// 服务费
diff --git a/Entity/Api/Resp/SwapMonitorScreenResp.cs b/Entity/Api/Resp/SwapMonitorScreenResp.cs
index d8b8204..9e4a068 100644
--- a/Entity/Api/Resp/SwapMonitorScreenResp.cs
+++ b/Entity/Api/Resp/SwapMonitorScreenResp.cs
@@ -12,6 +12,11 @@ public class SwapMonitorScreenResp
/// plc模式
///
public PlcSwapModelResp? PlcSwapModel { get; set; }
+
+ ///
+ /// 雷达数据
+ ///
+ public RadarResp? RadarResp { get; set; }
///
/// 换电状态
diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs
index d06654a..500be47 100644
--- a/Entity/Constant/InfoEnum.cs
+++ b/Entity/Constant/InfoEnum.cs
@@ -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,
diff --git a/Entity/Constant/StationParamConst.cs b/Entity/Constant/StationParamConst.cs
index 38e4243..7f0811e 100644
--- a/Entity/Constant/StationParamConst.cs
+++ b/Entity/Constant/StationParamConst.cs
@@ -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";
diff --git a/Entity/Constant/SwapConstant.cs b/Entity/Constant/SwapConstant.cs
index 1c8db53..01dff74 100644
--- a/Entity/Constant/SwapConstant.cs
+++ b/Entity/Constant/SwapConstant.cs
@@ -6,6 +6,22 @@ namespace Entity.Constant;
public class SwapConstant
{
+
+ ///
+ /// 手动/自动
+ ///
+ public enum AutoOrManual
+ {
+
+ [Const("自动")]
+ Auto,
+ [Const("手动")]
+ Manual,
+
+
+
+ }
+
///
/// 通讯类型
///
@@ -95,5 +111,6 @@ public class SwapConstant
}
+
}
\ No newline at end of file
diff --git a/Entity/Dto/SelectPackDto.cs b/Entity/Dto/SelectPackDto.cs
index 2716dd1..6613468 100644
--- a/Entity/Dto/SelectPackDto.cs
+++ b/Entity/Dto/SelectPackDto.cs
@@ -13,4 +13,6 @@ public class SelectPackDto
public InfoEnum.SelectBinStatusInfo Info { get; set; }
public BinInfo BinInfo { get; set; }
+
+ public List CanSwapBinInfo { get; set; } = new List();
}
\ No newline at end of file
diff --git a/Repository/Station/BinInfoRepository.cs b/Repository/Station/BinInfoRepository.cs
index 7d3d683..1daf748 100644
--- a/Repository/Station/BinInfoRepository.cs
+++ b/Repository/Station/BinInfoRepository.cs
@@ -50,8 +50,6 @@ public class BinInfoRepository : BaseRepository
"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
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
}
+ public SelectPackDto SelectPackInBin()
+ {
+ _log.Info($"BinInfoRepository SelctPackInBin ");
+ SelectPackDto selectPackDto = new()
+ {
+ SuccessFlag = false,
+ };
+ List 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;
+ }
+
+
///
/// 选择缓存仓的电池
///
diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs
index 9118b58..e6815a2 100644
--- a/Service/Execute/Mgr/CommonMgr.cs
+++ b/Service/Execute/Mgr/CommonMgr.cs
@@ -40,7 +40,7 @@ public class CommonMgr
/// 新增小步状态
///
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;
-
}
-
+
///
/// 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
/// 不能选正在执行移仓的电池
///
///
- 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
///
public void InBin(SwapOrderBatteryInfo orderBatteryInfo, SwappingStateMachine machine)
{
- List 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;
+
+ }
+ }
+
}
///
diff --git a/Service/Execute/Model/SwapOrderBatteryInfo.cs b/Service/Execute/Model/SwapOrderBatteryInfo.cs
index 0535fc0..3501111 100644
--- a/Service/Execute/Model/SwapOrderBatteryInfo.cs
+++ b/Service/Execute/Model/SwapOrderBatteryInfo.cs
@@ -12,6 +12,9 @@ public class SwapOrderBatteryInfo
public InfoEnum.SelectBinStatusInfo CanSwap;
+ public List CanUpBin = new List();
+ public List CanDownBin = new List();
+
public BinInfo UpBinInfo;
///
/// downBinNo
diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs
index c8ce9a4..a358a61 100644
--- a/Service/Execute/Step/CarPrepareState.cs
+++ b/Service/Execute/Step/CarPrepareState.cs
@@ -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);
}
}, () =>
{
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index 90256b3..939e728 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -190,7 +190,8 @@ public class StationReadyState : IState
///
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);
}
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index a6a5d2d..0445af1 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -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());
diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs
index 109ab87..7c3b3eb 100644
--- a/Service/Execute/SwappingStateMachine.cs
+++ b/Service/Execute/SwappingStateMachine.cs
@@ -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;
}
diff --git a/Service/Init/StaticStationInfo.cs b/Service/Init/StaticStationInfo.cs
index fd465b3..fc50c0d 100644
--- a/Service/Init/StaticStationInfo.cs
+++ b/Service/Init/StaticStationInfo.cs
@@ -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
diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs
index fb68934..38ad889 100644
--- a/Service/Station/MonitorService.cs
+++ b/Service/Station/MonitorService.cs
@@ -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> CanSelectPackBin()
+ {
+ //出仓位
+ SelectPackDto selectPackDtoUpBin = BinInfoRepository.SelectPack(StaticStationInfo.SwapSoc,
+ StaticStationInfo.SwapFinishChargeTime,
+ "");
+ //入仓位
+ SelectPackDto selectPackInBin = BinInfoRepository.SelectPackInBin();
+
+ return new List>()
+ {
+ selectPackDtoUpBin.CanSwapBinInfo, selectPackInBin.CanSwapBinInfo
+ };
+ }
+
+ //手动选包
+ public Result 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.Success();
+ }
+
+
[DisplayName("获取移仓分页")]
public async Task> Page(PageMoveBinRecordReq input)
{
RefAsync 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 Add(AddMoveBinRecordReq input)
{
string result = "";
MoveBinRecord moveBinRecord = await MoveBinRecordRepository.InsertAsync(input);
-
+
return "新增id:" + moveBinRecord.Id;
}
+
public virtual async Task Update(UpdateMoveBinRecordReq Req)
{
return await MoveBinRecordRepository.UpdateAsync(Req);
}
-
-
+
+
public virtual async Task 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 GetSwapMonitorData()
{
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
-
-
+
+
List stateInfoList = new List();
ConcurrentDictionary dictionary = StationSoftMgr.SwappingStateMachine.StepModel;
stateInfoList = dictionary.Values
.OrderBy(model => model.StepNo)
.Select(model => mapperBinInfo.Map(model))
.ToList();
-
-
+
+
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
List 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.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.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>.Success(mapperBinInfo.Map>(queryListByClause));
}
-}
+}
\ No newline at end of file
diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
index 11a771b..62bcb00 100644
--- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
+++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs
@@ -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;
diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs
index 2410939..cfb484b 100644
--- a/WebStarter/Controllers/SwapMonitorController.cs
+++ b/WebStarter/Controllers/SwapMonitorController.cs
@@ -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> GetSwapMonitorData()
{
-
var respList = _swapMonitorService.GetSwapMonitorData();
return respList;
}
-
+
///
/// 手动写入车辆vin码
///
///
[HttpPost("WriteVin")]
- public Result WriteVin([FromBody] RfidReadModel req)
+ public Result WriteVin([FromBody] RfidReadModel req)
{
-
if (StaticStationInfo.VehicleManually != 1)
{
return Result.Fail("此模式不支持手动写车辆数据,请先切换换电执行模式");
@@ -75,11 +73,11 @@ public class SwapMonitorController : ControllerBase
{
return Result.Fail("目前换电进行中,请勿修改数据");
}
-
+
StationSoftMgr.SwappingStateMachine.BeginRfidReadFlag = true;
StationSoftMgr.SwappingStateMachine.RfidReadModel = req;
-
+
return Result.Success();
}
@@ -263,7 +261,7 @@ public class SwapMonitorController : ControllerBase
return Result>.Success(carInfoList.Where(i => i.CarNo.Length >= 17).ToList());
}
-
+
///
/// 确认上锁成功
///
@@ -273,7 +271,7 @@ public class SwapMonitorController : ControllerBase
StationSoftMgr.SwappingStateMachine.ManualConfirmLockCar();
return Result.Success();
}
-
+
///
/// 确认解锁成功
///
@@ -283,4 +281,53 @@ public class SwapMonitorController : ControllerBase
StationSoftMgr.SwappingStateMachine.ManualConfirmUnLockCar();
return Result.Success();
}
+
+ ///
+ /// 手动跳过雷达
+ ///
+ [HttpGet("")]
+ public Result>> skipTheRadar()
+ {
+ return Result>>.Success(_swapMonitorService.CanSelectPackBin());
+ }
+ ///
+ /// 可选仓位
+ ///
+ [HttpGet("CanSelectPackBin")]
+ public Result>> CanSelectPackBin()
+ {
+ return Result>>.Success(_swapMonitorService.CanSelectPackBin());
+ }
+
+ ///
+ /// 手动选仓
+ ///
+ ///
+ [HttpPost("SelectPackManual/{upBinId}/{inBinId}")]
+ public Result SelectPackManual(int upBinId, int inBinId)
+ {
+ if (StaticStationInfo.SelectPackManually != (int)SwapConstant.AutoOrManual.Manual)
+ {
+ return Result.Fail("此模式不支持手动选仓,请先切换选包模式");
+ }
+
+ if (StationSoftMgr.SwappingStateMachine.SelectPackFlag)
+ {
+ return Result.Fail("目前换电进行中,请勿修改数据");
+ }
+
+ return _swapMonitorService.SelectPackManual(upBinId, inBinId);
+ }
+
+ ///
+ /// 手动跳过雷达
+ ///
+ ///
+ [HttpGet("SkipRadarManual")]
+ public Result SkipRadarManual()
+ {
+ StationSoftMgr.SwappingStateMachine!.ManualSkipRadar = true;
+
+ return Result.Success();
+ }
}
\ No newline at end of file
diff --git a/WebStarter/db/国庆版本.sql b/WebStarter/db/国庆版本.sql
new file mode 100644
index 0000000..cf765f7
--- /dev/null
+++ b/WebStarter/db/国庆版本.sql
@@ -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');