|
|
@ -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>
|
|
|
|