From 9d99552d372631350abf733ad0a6415938f702de Mon Sep 17 00:00:00 2001 From: zby <2494737567@qq.com> Date: Tue, 24 Sep 2024 23:41:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0null=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=8C=E5=85=B3=E9=97=ADrfid=E5=BC=80=E5=90=AF=E4=B8=8E?= =?UTF-8?q?=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Constant/SwapConstant.cs | 35 ++++++++++++----------- Service/Execute/Step/StationReadyState.cs | 15 +++++----- Service/Station/MonitorService.cs | 14 +++++---- WebStarter/appsettings.prod.json | 6 +++- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Entity/Constant/SwapConstant.cs b/Entity/Constant/SwapConstant.cs index 9eefd26..1c8db53 100644 --- a/Entity/Constant/SwapConstant.cs +++ b/Entity/Constant/SwapConstant.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.Reflection; +using HybirdFrameworkCore.Attribute; namespace Entity.Constant; @@ -11,9 +12,9 @@ public class SwapConstant public enum CommunicationType { - [Description("发送")] + [Const("发送")] Send=1, - [Description("接受")] + [Const("接受")] Receive, } @@ -24,9 +25,9 @@ public class SwapConstant public enum StepType { - [Description("自动")] + [Const("自动")] AUTO=1, - [Description("手动")] + [Const("手动")] MANUAL, } @@ -37,9 +38,9 @@ public class SwapConstant public enum PlcProtocol { - [Description("初始化")] + [Const("初始化")] Init, - [Description("下发启动换电")] + [Const("下发启动换电")] StartSwap, } @@ -50,11 +51,11 @@ public class SwapConstant public enum RadarProtocol { - [Description("开启雷达")] + [Const("开启雷达")] Open, - [Description("关闭雷达")] + [Const("关闭雷达")] Close, - [Description("车辆状态")] + [Const("车辆状态")] CarStatus, } @@ -65,15 +66,15 @@ public class SwapConstant public enum RfidProtocol { - [Description("连接Rfid")] + [Const("连接Rfid")] Connect, - [Description("开始读")] + [Const("开始读")] BeginRead, - [Description("读取Rfid数据")] + [Const("读取Rfid数据")] ReadRfidData, - [Description("停止读Rfid")] + [Const("停止读Rfid")] StopRead, - [Description("断开连接")] + [Const("断开连接")] DisConnect, } @@ -85,11 +86,11 @@ public class SwapConstant public enum TboxProtocol { - [Description("心跳数据")] + [Const("心跳数据")] Heart, - [Description("加锁")] + [Const("加锁")] Lock, - [Description("解锁")] + [Const("解锁")] UnLock, diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index d9fcbca..90256b3 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -206,7 +206,7 @@ public class StationReadyState : IState StationSoftMgr.PutDeviceLog((int)StationConstant.DeviceCode.Radar,SwapConstant.RadarProtocol.CarStatus, - null,(int)SwapConstant.CommunicationType.Receive); + PadarMgr._PadarClient?.CarState.ToString(),(int)SwapConstant.CommunicationType.Receive); if (PadarMgr._PadarClient?.CarState == 6) { @@ -257,10 +257,9 @@ public class StationReadyState : IState return Invoker.Invoke(" BeginRead read rfid", 1000, 20, machine.IsCanceled, () => machine.BeginRfidReadFlag, () => { - Task open = RfidApi.Connect(); + // Task open = RfidApi.Connect(); - if (open.Result) - { + machine.RfidConnectFlag = true; Task beginRead = RfidApi.BeginRead(); beginRead.Wait(); @@ -274,7 +273,7 @@ public class StationReadyState : IState _log.Info("begin read done"); machine.BeginRfidReadFlag = true; } - } + }, () => @@ -343,9 +342,9 @@ public class StationReadyState : IState _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag, machine,param:JsonConvert.SerializeObject(machine.RfidReadModel)); - RfidApi.StopRead(); - _log.Info("stop read rfid"); - RfidApi.DisConnect(); + //RfidApi.StopRead(); + // _log.Info("stop read rfid"); + // RfidApi.DisConnect(); machine.RfidConnectFlag = false; machine.RfidReadFlag = true; } diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index ac7bab1..fb68934 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -140,12 +140,16 @@ public class MonitorService .TotalMinutes > StaticStationInfo.SwapFinishChargeTime).Count(); - if (monitorScreenResp.VehicleInfo.OrderNo!=null) + if (monitorScreenResp.VehicleInfo.OrderNo != null) { - SwapOrderBattery queryByClauseAsync = _SwapOrderBatteryRepository.QueryByClause(u => u.SwapOrderSn == monitorScreenResp.VehicleInfo.OrderNo); - monitorScreenResp.VehicleInfo.DownBatteryBinNo = queryByClauseAsync.DownBatteryBinNo; - monitorScreenResp.VehicleInfo.UpBatteryBinNo = queryByClauseAsync.UpBatteryBinNo; - } + SwapOrderBattery queryByClauseAsync = + _SwapOrderBatteryRepository.QueryByClause(u => u.SwapOrderSn == monitorScreenResp.VehicleInfo.OrderNo); + if (queryByClauseAsync != null) + { + monitorScreenResp.VehicleInfo.DownBatteryBinNo = queryByClauseAsync.DownBatteryBinNo; + monitorScreenResp.VehicleInfo.UpBatteryBinNo = queryByClauseAsync.UpBatteryBinNo; + } + } monitorScreenResp.DeviceLogs = StationSoftMgr.DeviceLogs; diff --git a/WebStarter/appsettings.prod.json b/WebStarter/appsettings.prod.json index c38ad2b..424abcc 100644 --- a/WebStarter/appsettings.prod.json +++ b/WebStarter/appsettings.prod.json @@ -2,7 +2,7 @@ "ConnectionStrings": { "ConfigId": "master", "DbType": "MySql", - "SqlConnection": "server=127.0.0.1;Port=3306;Database=eaxing_dev;Uid=root;Pwd=admin123;Charset=utf8;" + "SqlConnection": "server=127.0.0.1;Port=3306;Database=eaxing_test;Uid=root;Pwd=admin123;Charset=utf8;" }, "Update": { "AutoUpdate": "false", @@ -110,9 +110,13 @@ } } }, + "SignalR": { + "enable": true + }, "cloud": { "enable": false }, + "plc": { "enable": true },