diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index ba29432..1af1346 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -21,6 +21,8 @@ public class CommonMgr public BinInfoRepository _binInfoRepository { get; set; } public SwapAmtOrderRepository _amtOrderRepository { get; set; } public SwapOrderBatteryRepository _swapOrderBatteryRepository { get; set; } + + public SwapOrderReportCloudRepository _swapOrderReportCloudRepository { get; set; } /// /// 新增小步状态 @@ -233,5 +235,21 @@ public class CommonMgr } } + + /// + /// 换电完成新增上报云平台记录 + /// + /// + public void InsertCloudReportForSwapSuccess(SwappingStateMachine machine) + { + SwapOrder? machineSwapOrder = machine.SwapOrder; + _swapOrderReportCloudRepository.Insert(new SwapOrderReportCloud() + { + SwapOrderSn = machineSwapOrder.Sn, + SwapOrderId = machineSwapOrder.Id, + CloudReportStatus = 0, + Vin = machineSwapOrder.VehicleVin + }); + } } \ No newline at end of file diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index f88b64b..2e16866 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -37,7 +37,7 @@ public class SwapDoneState : IState { //上传云平台换电状态 machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel; - // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); + // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); } //云平台没有匹配的失败状态 @@ -56,9 +56,11 @@ public class SwapDoneState : IState return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None); } + //新增换电成功上报云平台数据 + _CommonMgr.InsertCloudReportForSwapSuccess(machine); //换电成功关于bininfo表的更新 _CommonMgr.UpdateBinInfoForSwapSuccess(machine); - + return new StateResult() { SwappingState = SwappingState.StationReady @@ -102,7 +104,7 @@ public class SwapDoneState : IState } }, () => { - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed()); + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar); }, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; } , 10, InvokeStatus.None);