diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 71d6d88..5b48633 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -1,4 +1,5 @@ -using Entity.Attr; +using System.Runtime.InteropServices; +using Entity.Attr; namespace Entity.Constant; @@ -43,6 +44,7 @@ public class InfoEnum [Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr, [Info("车辆驶入","车辆驶入")] CarInInfo, + } diff --git a/Repository/Station/BinInfoRepository.cs b/Repository/Station/BinInfoRepository.cs index 2650f64..9a1c0ff 100644 --- a/Repository/Station/BinInfoRepository.cs +++ b/Repository/Station/BinInfoRepository.cs @@ -36,7 +36,7 @@ public class BinInfoRepository : BaseRepository return selectPackDto; } - list = list.Where(i => i.ChargeStatus == 2).ToList(); + list = list.Where(i => i.ChargeStatus == 2 || i.ChargeStatus==4).ToList(); if (list.Count <= 0 && cacheBinBattery == null) { selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfFinishCharging; diff --git a/Service/Execute/Api/TboxApi.cs b/Service/Execute/Api/TboxApi.cs index 65ee2ea..e46e524 100644 --- a/Service/Execute/Api/TboxApi.cs +++ b/Service/Execute/Api/TboxApi.cs @@ -10,7 +10,7 @@ public class TBoxApi private static readonly ILog Log = LogManager.GetLogger(typeof(TBoxApi)); //TODO::TBox 服务地址 - private static readonly string BASE_URL = "http://localhost:5034"; + private static readonly string BASE_URL = "http://localhost:5036"; private static readonly HttpClient _httpClient = new HttpClient() { diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs index 1ba6495..0b59fe9 100644 --- a/Service/Execute/Step/CarPrepareState.cs +++ b/Service/Execute/Step/CarPrepareState.cs @@ -277,7 +277,7 @@ public class CarPrepareState : IState SwapAmtOrder? swapAmtOrder = _CommonMgr.QueryAmtOrder(machine); - return Invoker.Invoke("selectPack", 500, 20, machine.IsCanceled, + return Invoker.Invoke("selectPack", 1000, 10, machine.IsCanceled, () => machine.SelectPackFlag, () => { @@ -294,8 +294,8 @@ public class CarPrepareState : IState if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success) { // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed()); - SoundTool.PlayOneSound((int)orderBatteryInfo.CanSwap); - Thread.Sleep(1000 * 3); + + _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}"); } else @@ -306,6 +306,11 @@ public class CarPrepareState : IState _CommonMgr.SaveSwapBattery(machine); machine.SelectPackFlag = true; } - }, () => { machine.ExceptionReason = ExceptionReason.SelectPackError; }); + }, () => + { + machine.ExceptionReason = ExceptionReason.SelectPackError; + SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack); + } + ,false,() => { },10,InvokeStatus.None); } } \ No newline at end of file diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index c4e34c4..c424dc7 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -121,7 +121,10 @@ public class DoSwappingState : IState //查询车辆锁止状态 var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No, machine.SwapOrderBatteryInfo.UpBinInfo.No); - if (startSwapping) + + //查詢當前任務狀態是否被更改 + var readPlcTaskStatus = PlcApi.ReadTaskStatus(1); + if (startSwapping && readPlcTaskStatus) { machine.SwapOrder.SwapBeginTime = DateTime.Now; _CommonMgr.UpdateSwapOrder(machine); @@ -152,6 +155,7 @@ public class DoSwappingState : IState bool holdOn = PlcApi.HoldOn(); if (holdOn) { + machine.PlcHoldFlag = true; } } diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 0c5a7fe..a485342 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -87,7 +87,7 @@ public class StationReadyState : IState public InvokeStatus PlcIsAuto(SwappingStateMachine machine) { bool isAuto = false; - return Invoker.Invoke("check plc remote", 1000, 5, machine.IsCanceled, () => isAuto, + return Invoker.Invoke("check plc auto", 1000, 5, machine.IsCanceled, () => isAuto, () => { if (PlcApi.IsAuto()) diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index 2e16866..3698260 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -119,6 +119,7 @@ public class SwapDoneState : IState if (!PlcApi.ExitRadar()) { _log.Info("exist radar false"); + } else { diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index 1ef202b..f39a166 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -150,10 +150,17 @@ public class MonitorService } var result = PlcMgr.DistributeTask(putBinNo, removeBinNo, 2) ? Result.Success() : Result.Fail(); + if (!result.IsSuccess) { return Result.Fail(); } + var succ = PlcMgr.HoldOn(); + + if (!succ) + { + return Result.Fail(); + } //如果是缓存仓 更新缓存仓的数据 if (putBin.CacheBinFlag == 1)