换电订单数据更新查出新数据

master
lxw 1 month ago
parent 814764773f
commit e7ae93b695

@ -72,7 +72,6 @@ public class CommonMgr
{
swapOrder.SwapWay = (int)StationConstant.StationWay.Auto;
swapOrder.CloudReportStatus = 0;
swapOrder.SwapWay = 1;
swapOrder.CreatedTime = DateTime.Now;
_swapOrderRepository.Insert(swapOrder);
return swapOrder;
@ -368,9 +367,22 @@ public class CommonMgr
/// <param name="machine"></param>
public void UpdateSwapOrder(SwappingStateMachine machine)
{
_swapOrderRepository.Update(BuildParamForSwap(machine));
}
//赋值换电相关的数据,防止更新掉其他任务插入的数据
private SwapOrder BuildParamForSwap(SwappingStateMachine machine)
{
var old = machine.SwapOrder;
SwapOrder swapOrder = _swapOrderRepository.QueryById(machine.SwapOrder.Id);
machine.SwapOrder.CloudReportStatus = swapOrder.CloudReportStatus;
_swapOrderRepository.Update(machine.SwapOrder);
swapOrder.SwapWay = old.SwapWay;
swapOrder.SwapResult = old.SwapResult;
swapOrder.Remark = old.Remark;
swapOrder.CloudSn = old.CloudSn;
swapOrder.FailReason = old.FailReason;
swapOrder.SwapEndTime = old.SwapEndTime;
swapOrder.VehicleLeaveTime = old.VehicleLeaveTime;
return swapOrder;
}
/// <summary>

Loading…
Cancel
Save