From febca725f1025035c64fdb83e87b43c768068612 Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Mon, 1 Jul 2024 00:29:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BB=93=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Execute/Step/DoSwappingState.cs | 15 +++++---------- Service/Execute/Step/SwapDoneState.cs | 2 ++ Service/Execute/SwappingStateMachine.cs | 6 ++---- Service/Station/MonitorService.cs | 3 ++- 4 files changed, 11 insertions(+), 15 deletions(-) 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);