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

master
lxw 1 month ago
parent bddb80b66b
commit fbab89c852

@ -111,13 +111,19 @@ public class CommonMgr
/// </summary> /// </summary>
public void LockBinAndUpdateAmt(SwapOrderBatteryInfo orderBatteryInfo) 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) if (!orderBatteryInfo.isAmt)
{ {
return; return;

@ -456,6 +456,11 @@ public class SwappingStateMachine : IDisposable
BinInfoRepository.Update(i => i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock, BinInfoRepository.Update(i => i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock,
i => i.Id == SwapOrderBatteryInfo.UpBinInfo.Id); 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); binInfosMap.TryGetValue(battery.DownBatteryBinNo.ToString(), out BinInfo info);
if (info==null) if (info == null)
{ {
continue; continue;
} }
if (info.BatteryNo == null || "".Equals(info.BatteryNo )|| "-1".Equals(info.BatteryNo)) if (info.BatteryNo == null || "".Equals(info.BatteryNo) || "-1".Equals(info.BatteryNo))
{ {
continue; 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; continue;
} }
@ -84,16 +84,19 @@ public class UpdateDownBatteryInfoTask : ITask
battery.DownBatterySoc = info.Soc; battery.DownBatterySoc = info.Soc;
battery.DownBatterySoe = info.Soe; battery.DownBatterySoe = info.Soe;
battery.DownNominalEnergy = info.NominalEnergy; battery.DownNominalEnergy = info.NominalEnergy;
_swapOrderBatteryRepository.Update(i => new()
updateDbBattery.Add(battery);
}
if (updateDbBattery.Count > 0)
{ {
DownBatteryNo = battery.DownBatteryNo,
DownBatterySoc = battery.DownBatterySoc,
DownBatterySoe = battery.DownBatterySoe,
DownNominalEnergy = battery.DownNominalEnergy
}, i => i.Id == battery.Id);
Log.Info( Log.Info(
$" UpdateDownBatteryInfoTask update DowmBatteryInfo db={JsonConvert.SerializeObject(updateDbBattery)}"); $" UpdateDownBatteryInfoTask update DowmBatteryInfo db={JsonConvert.SerializeObject(battery)}");
_swapOrderBatteryRepository.Update(updateDbBattery);
} }
} }
catch (Exception e) catch (Exception e)
{ {

Loading…
Cancel
Save