关于换电流程改表只改某些字段

master
lxw 1 month ago
parent bddb80b66b
commit fbab89c852

@ -111,13 +111,19 @@ public class CommonMgr
/// </summary>
public void LockBinAndUpdateAmt(SwapOrderBatteryInfo orderBatteryInfo)
{
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap<BinInfo, BinInfo>().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
BinInfo dbBinInfo = mapperBinInfo.Map<BinInfo>(orderBatteryInfo.UpBinInfo);
dbBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.Lock;
_binInfoRepository.Update(dbBinInfo);
orderBatteryInfo.UpBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.Lock;
_binInfoRepository.Update(i=>new()
{
AmtLock=(int)InfoEnum.AmtBatLockStatus.Lock,
},i=>i.Id==orderBatteryInfo.UpBinInfo.Id);
orderBatteryInfo.InBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.Lock;
_binInfoRepository.Update(i=>new()
{
AmtLock=(int)InfoEnum.AmtBatLockStatus.Lock,
},i=>i.Id==orderBatteryInfo.InBinInfo.Id);
if (!orderBatteryInfo.isAmt)
{
return;

@ -456,6 +456,11 @@ public class SwappingStateMachine : IDisposable
BinInfoRepository.Update(i => i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock,
i => i.Id == SwapOrderBatteryInfo.UpBinInfo.Id);
}
if (SwapOrderBatteryInfo?.InBinInfo != null) ;
{
BinInfoRepository.Update(i => i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock,
i => i.Id == SwapOrderBatteryInfo.InBinInfo.Id);
}
}
//预约单

@ -61,17 +61,17 @@ public class UpdateDownBatteryInfoTask : ITask
//更新换下电池包
binInfosMap.TryGetValue(battery.DownBatteryBinNo.ToString(), out BinInfo info);
if (info==null)
if (info == null)
{
continue;
}
if (info.BatteryNo == null || "".Equals(info.BatteryNo )|| "-1".Equals(info.BatteryNo))
if (info.BatteryNo == null || "".Equals(info.BatteryNo) || "-1".Equals(info.BatteryNo))
{
continue;
}
if (info.Soc == null || info.Soc <= 0 || info.Soc > 100 || info.NominalEnergy<=0)
if (info.Soc == null || info.Soc <= 0 || info.Soc > 100 || info.NominalEnergy <= 0)
{
continue;
}
@ -84,16 +84,19 @@ public class UpdateDownBatteryInfoTask : ITask
battery.DownBatterySoc = info.Soc;
battery.DownBatterySoe = info.Soe;
battery.DownNominalEnergy = info.NominalEnergy;
updateDbBattery.Add(battery);
}
if (updateDbBattery.Count > 0)
_swapOrderBatteryRepository.Update(i => new()
{
DownBatteryNo = battery.DownBatteryNo,
DownBatterySoc = battery.DownBatterySoc,
DownBatterySoe = battery.DownBatterySoe,
DownNominalEnergy = battery.DownNominalEnergy
}, i => i.Id == battery.Id);
Log.Info(
$" UpdateDownBatteryInfoTask update DowmBatteryInfo db={JsonConvert.SerializeObject(updateDbBattery)}");
_swapOrderBatteryRepository.Update(updateDbBattery);
$" UpdateDownBatteryInfoTask update DowmBatteryInfo db={JsonConvert.SerializeObject(battery)}");
}
}
catch (Exception e)
{

Loading…
Cancel
Save