|
|
|
@ -60,8 +60,6 @@ public class CommonMgr
|
|
|
|
|
_swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn,
|
|
|
|
|
desc, param, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -109,7 +107,6 @@ public class CommonMgr
|
|
|
|
|
{
|
|
|
|
|
return SwapOrderStepRepository.GetCount(i =>
|
|
|
|
|
i.SwapOrderSn == swapOrderSn && i.StepType == (int)SwapConstant.StepType.MANUAL) > 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -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();
|
|
|
|
|
|
|
|
|
|
orderBatteryInfo.CanDownBin = selectPackDto.CanSwapBinInfo;
|
|
|
|
|
orderBatteryInfo.InBinInfo = selectPackDto.BinInfo;
|
|
|
|
|
orderBatteryInfo.CanSwap = selectPackDto.Info;
|
|
|
|
|
|
|
|
|
|
if (list.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var value = QueryMoveBinNo()[1];
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(value))
|
|
|
|
|
|
|
|
|
|
//手动选包
|
|
|
|
|
public void ManualSelectPack(SwappingStateMachine machine, SwapOrderBatteryInfo orderBatteryInfo)
|
|
|
|
|
{
|
|
|
|
|
list = list.Where(i => i.No != value).ToList();
|
|
|
|
|
if ((int)SwapConstant.AutoOrManual.Auto == StaticStationInfo.SelectPackManually)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (list.Count <= 0)
|
|
|
|
|
//手动等待选包
|
|
|
|
|
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.WaitManually;
|
|
|
|
|
orderBatteryInfo.UpBinInfo = null;
|
|
|
|
|
orderBatteryInfo.InBinInfo = null;
|
|
|
|
|
if (machine.SwapOrderBatteryInfo?.UpBinInfo == null
|
|
|
|
|
|| machine.SwapOrderBatteryInfo?.InBinInfo == null)
|
|
|
|
|
{
|
|
|
|
|
orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin;
|
|
|
|
|
_log.Info("等待手动选包..........");
|
|
|
|
|
//TODO:: 增加播报
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.CanUpBin.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.CanUpBin.First(i => i.Id == machine.SwapOrderBatteryInfo?.UpBinInfo.Id);
|
|
|
|
|
|
|
|
|
|
if (binInfo != null)
|
|
|
|
|
{
|
|
|
|
|
orderBatteryInfo.CanSwap =InfoEnum.SelectBinStatusInfo.WaitSelectDownBin;
|
|
|
|
|
orderBatteryInfo.UpBinInfo = binInfo;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderBatteryInfo.CanDownBin.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
BinInfo? binInfo =
|
|
|
|
|
orderBatteryInfo.CanDownBin.First(i => i.Id == machine.SwapOrderBatteryInfo?.InBinInfo.Id);
|
|
|
|
|
|
|
|
|
|
if (binInfo != null)
|
|
|
|
|
{
|
|
|
|
|
orderBatteryInfo.CanSwap =InfoEnum.SelectBinStatusInfo.Success;
|
|
|
|
|
orderBatteryInfo.InBinInfo = binInfo;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|