移仓非缓存仓数据更新问题

master
lxw 4 months ago
parent 541c9684aa
commit faeb6e0c80

@ -389,7 +389,7 @@ public class CarPrepareState : IState
//选包成功
_CommonMgr.LockBinAndUpdateAmt(orderBatteryInfo);
machine.SwapOrderBatteryInfo = orderBatteryInfo;
_CommonMgr.SaveSwapBattery(machine);
machine.SelectPackFlag = true;
}
}, () =>

@ -29,11 +29,13 @@ public class SwapDoneState : IState
/// <returns></returns>
public StateResult Handle(SwappingStateMachine machine)
{
//更新换电订单
machine.SwapOrder!.SwapResult = machine.SwapStatus;
machine.SwapOrder.SwapEndTime = DateTime.Now;
machine.SwapOrder.FailReason = machine.SwapFailReason;
_CommonMgr.UpdateSwapOrder(machine);
_CommonMgr.SaveSwapBattery(machine);
//修改预约单
@ -80,8 +82,6 @@ public class SwapDoneState : IState
{
return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None);
}
return new StateResult()
{
SwappingState = SwappingState.StationReady

@ -47,9 +47,10 @@ public class UpdateDownBatteryInfoTask : ITask
return;
}
List<string> downBatteryBinNos = batterys.Select(i => i.DownBatteryBinNo.ToString()).ToList();
Dictionary<string, BinInfo> binInfosMap = _BinInfoRepository
.QueryListByClause(i => downBatteryBinNos.Contains(i.No)).ToDictionary(i => i.No);
.QueryListByClause(i => downBatteryBinNos.Contains(i.No) && i.Exists==1).ToDictionary(i => i.No);
List<SwapOrderBattery> updateDbBattery = new List<SwapOrderBattery>();
@ -66,6 +67,10 @@ public class UpdateDownBatteryInfoTask : ITask
continue;
}
if (!info.BatteryNo.Equals(battery.DownBatteryNo))
{
continue;
}
battery.DownBatteryNo = info.BatteryNo;
battery.DownBatterySoc = info.Soc;
battery.DownBatterySoe = info.Soe;

@ -66,6 +66,7 @@ public class MonitorService
return "新增id" + moveBinRecord.Id;
}
public virtual async Task<bool> Update(UpdateMoveBinRecordReq Req)
{
return await MoveBinRecordRepository.UpdateAsync(Req);
@ -79,6 +80,7 @@ public class MonitorService
throw new ArgumentException($"不存在");
return await MoveBinRecordRepository.DeleteAsync(user);
}
public Result<SwapMonitorScreenResp> GetSwapMonitorData()
{
var configBinInfo =
@ -274,7 +276,7 @@ public class MonitorService
Type = type,
CreatedTime = DateTime.Now
};
moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord);
moveBinRecord = MoveBinRecordRepository.Insert(moveBinRecord);
result = PlcMgr.HoldOn();
if (!result)
@ -299,6 +301,7 @@ public class MonitorService
MoveBinRecordRepository.Update(moveBinRecord);
return Result<bool>.Fail();
}
Log.Info($"move battery success update moveBin={JsonConvert.SerializeObject(moveBinRecord)}");
//如果是缓存仓 更新缓存仓的数据
@ -315,14 +318,12 @@ public class MonitorService
}
if (removeBin.CacheBinFlag == 1)
{
removeBin.Exists = 0;
removeBin.BatteryNo = "-1";
removeBin.Soc = -1;
removeBin.Soe = -1;
removeBin.Soh = -1;
}
removeBin.BatteryEnterSeq = 0;
BinInfoRepository.Update(removeBin);
@ -336,10 +337,10 @@ public class MonitorService
Log.Error($"move battery fail e={e.Message}");
if (moveBinRecord != null)
{
moveBinRecord.Status = 3;
MoveBinRecordRepository.Update(moveBinRecord);
}
PlcMgr.PlcClient?.ResetTaskNo();
return Result<bool>.Fail();

Loading…
Cancel
Save