diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index 2a72253..33521d2 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -126,7 +126,7 @@ public class DoSwappingState : IState //查询当前是否有任务执行 var readTaskNo = PlcMgr.PlcClient?.ReadTaskNo(); - if (readTaskNo == 0 || readTaskNo==1) + if (readTaskNo == 0 || readTaskNo == 1) { PlcMgr.PlcClient?.ExChangeTaskNo(1); //查询车辆锁止状态 @@ -137,7 +137,6 @@ public class DoSwappingState : IState var readPlcTaskStatus = PlcApi.ReadTaskStatus(1); if (startSwapping && readPlcTaskStatus) { - machine.SwapOrder.SwapBeginTime = DateTime.Now; _CommonMgr.UpdateSwapOrder(machine); machine.SwapStatus = 0; @@ -328,15 +327,11 @@ public class DoSwappingState : IState if (PlcApi.ReadPlcTaskStatus() == 1007) { - if (PlcApi.ReadTaskStatusReset()) - { - PlcMgr.PlcClient?.ResetTaskNo(); - SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition); - machine.ToSafePositionFlag = true; - machine.BusinessSwappingStateUpdateTime = DateTime.Now; + SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition); + machine.ToSafePositionFlag = true; + machine.BusinessSwappingStateUpdateTime = DateTime.Now; - machine.SwapStatus = 1; - } + machine.SwapStatus = 1; } }, () => { }); } diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index 569641b..75d0c98 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -11,6 +11,7 @@ using Service.Execute.StaticTools; using Service.Execute.SwapException; using Service.Execute.Utils; using Service.Init; +using Service.Plc.Client; using Service.Station; namespace Service.Execute.Step; @@ -54,6 +55,7 @@ public class SwapDoneState : IState //可人工确认换电成功标识 machine.PlcSwapFlag = true; + PlcMgr.PlcClient?.ResetTaskNo(); }); if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success) diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs index 4262583..6f11e30 100644 --- a/Service/Execute/SwappingStateMachine.cs +++ b/Service/Execute/SwappingStateMachine.cs @@ -414,11 +414,9 @@ public class SwappingStateMachine : IDisposable //仓库解锁 if (SwapOrderBatteryInfo != null) { - var upBinInfo = SwapOrderBatteryInfo.UpBinInfo; - if (null != upBinInfo) + if (SwapOrderBatteryInfo?.UpBinInfo != null) ; { - upBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.UnLock; - BinInfoRepository.Update(upBinInfo); + BinInfoRepository.Update(i=>i.AmtLock==(int)InfoEnum.AmtBatLockStatus.UnLock,i=>i.Id==SwapOrderBatteryInfo.UpBinInfo.Id); } } diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index 74cc76c..3979a93 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -216,7 +216,8 @@ public class MonitorService InBatterySoc = putBin.Soc.ToString(), InBinNo = putBinNo.ToString(), Status = 0, - Type = type + Type = type, + CreatedTime = DateTime.Now }; moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord);