|
|
|
@ -42,18 +42,56 @@ public class UpdateDownBatteryInfoTask : ITask
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Handle()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 更新换下电池
|
|
|
|
|
|
|
|
|
|
var listSwapOrderBattery =
|
|
|
|
|
_swapOrderBatteryRepository.QueryListByClause(i => i.DownBatteryNo == "-1" && i.DownBatterySoc == -1);
|
|
|
|
|
if (listSwapOrderBattery.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string SwapOrderSn = listSwapOrderBattery[listSwapOrderBattery.Count - 1].SwapOrderSn;
|
|
|
|
|
//查询两个仓位
|
|
|
|
|
var SwapOrderBatteryInfo1 = listSwapOrderBattery[listSwapOrderBattery.Count - 1];
|
|
|
|
|
var SwapOrderBatteryInfo2 = listSwapOrderBattery[listSwapOrderBattery.Count - 2];
|
|
|
|
|
|
|
|
|
|
var lstBinInfo = _BinInfoRepository.QueryListByClause(i => i.Exists == 1
|
|
|
|
|
&&
|
|
|
|
|
(i.No == SwapOrderBatteryInfo1.DownBatteryBinNo
|
|
|
|
|
.ToString() ||
|
|
|
|
|
i.No == SwapOrderBatteryInfo2.DownBatteryBinNo
|
|
|
|
|
.ToString())
|
|
|
|
|
&& i.Soc > 0
|
|
|
|
|
/*&& !string.IsNullOrEmpty(i.BatteryNo)*/
|
|
|
|
|
&&i.BatteryNo!="-1");
|
|
|
|
|
if (lstBinInfo.Count >= 2) //有换电电池包编码需要更新
|
|
|
|
|
{
|
|
|
|
|
var BinInfo0 = lstBinInfo.Where(i => i.No == SwapOrderBatteryInfo1.DownBatteryBinNo.ToString()).ToList()[0];
|
|
|
|
|
var BinInfo1 = lstBinInfo.Where(i => i.No == SwapOrderBatteryInfo2.DownBatteryBinNo.ToString()).ToList()[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_swapOrderBatteryRepository.Update(i =>new SwapOrderBattery()
|
|
|
|
|
{
|
|
|
|
|
DownBatterySoc = BinInfo0.Soc,
|
|
|
|
|
DownBatteryNo = BinInfo0.BatteryNo
|
|
|
|
|
},
|
|
|
|
|
i => i.SwapOrderSn.ToString() == SwapOrderBatteryInfo1.SwapOrderSn
|
|
|
|
|
&&i.DownBatteryBinNo==SwapOrderBatteryInfo1.DownBatteryBinNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_swapOrderBatteryRepository.Update(i => new SwapOrderBattery()
|
|
|
|
|
{
|
|
|
|
|
DownBatterySoc = BinInfo1.Soc,
|
|
|
|
|
DownBatteryNo = BinInfo1.BatteryNo
|
|
|
|
|
}, i => i.SwapOrderSn.ToString() == SwapOrderBatteryInfo2.SwapOrderSn&&i.DownBatteryBinNo==SwapOrderBatteryInfo2.DownBatteryBinNo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
/*try
|
|
|
|
|
{
|
|
|
|
|
List<SwapOrderBattery> batterys =
|
|
|
|
|
_swapOrderBatteryRepository.QueryListByClause(
|
|
|
|
|
i => (i.DownBatteryNo == null || i.DownBatterySoc<0) && i.DownBatteryBinNo != null);
|
|
|
|
|
i => (i.DownBatteryNo == null || i.DownBatterySoc < 0) && i.DownBatteryBinNo != null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (batterys.Count <= 0)
|
|
|
|
@ -75,7 +113,8 @@ public class UpdateDownBatteryInfoTask : ITask
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (info.Soc == null || info.Soc <=0)
|
|
|
|
|
|
|
|
|
|
if (info.Soc == null || info.Soc <= 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -96,7 +135,7 @@ public class UpdateDownBatteryInfoTask : ITask
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error($" UpdateDownBatteryInfoTask err e={e}");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Stoped()
|
|
|
|
|