From fe82b0cdbbfdfd2be078f4381f2afeb9adff2a39 Mon Sep 17 00:00:00 2001 From: lxw Date: Wed, 5 Jun 2024 16:43:35 +0800 Subject: [PATCH] xianchang ceshi xiugai --- Entity/Api/Req/QueryChargeOrderReq.cs | 10 +-- Entity/Constant/InfoEnum.cs | 5 +- Service/Cloud/Client/CloudClientMgr.cs | 6 +- Service/Execute/Api/CloudApi.cs | 20 +++-- Service/Execute/Api/PlcApi.cs | 6 +- Service/Execute/Api/RfidApi.cs | 19 ++-- Service/Execute/Mgr/CommonMgr.cs | 1 + Service/Execute/Step/CarCtrlState.cs | 3 +- Service/Execute/Step/CarPrepareState.cs | 87 +++++++++---------- Service/Execute/Step/DoSwappingState.cs | 2 +- Service/Execute/Step/StationReadyState.cs | 17 ++-- Service/Mgr/PlcTaskMgr.cs | 1 + Service/Mgr/SwapOrderMgr.cs | 2 +- Service/Plc/Client/PlcMgr.cs | 2 +- Service/Station/ChargeOrderService.cs | 30 ++----- .../Controllers/SwapMonitorController.cs | 18 +--- WebStarter/Controllers/Test/GenController.cs | 3 +- 17 files changed, 106 insertions(+), 126 deletions(-) diff --git a/Entity/Api/Req/QueryChargeOrderReq.cs b/Entity/Api/Req/QueryChargeOrderReq.cs index 423bad9..2371789 100644 --- a/Entity/Api/Req/QueryChargeOrderReq.cs +++ b/Entity/Api/Req/QueryChargeOrderReq.cs @@ -36,7 +36,7 @@ namespace Entity.Api.Req /// Default:0 /// Nullable:True /// - public int CmdStatus { get; set; } + public int? CmdStatus { get; set; } /// /// Desc:充电机编号 @@ -55,12 +55,12 @@ namespace Entity.Api.Req /// 0:站内充电 1:站外充电 /// - public int ChargeMode { get; set; } + public int? ChargeMode { get; set; } /// /// 1:站控启动 2:本地启动 /// - public int StartMode { get; set; } + public int? StartMode { get; set; } /// /// Desc:充电开始时间 @@ -89,7 +89,7 @@ namespace Entity.Api.Req /// Default:0 /// Nullable:True /// - public int StopReason { get; set; } + public int? StopReason { get; set; } /// /// Desc:电价版本号 @@ -110,7 +110,7 @@ namespace Entity.Api.Req /// Default:0 /// Nullable:True /// - public int CloudReportStatus { get; set; } + public int? CloudReportStatus { get; set; } /// diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 0d3e784..5621a4b 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -21,7 +21,7 @@ public class InfoEnum [Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar , [Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack , - [Info("通道拍照定位失败,请重新调整车辆位置", "通道拍照定位失败,请重新调整车辆位置")]ErrChannelStatus, + [Info("通道拍照定位失败,请在三分钟内重新调整车辆位置", "通道拍照定位失败,请在三分钟内重新调整车辆位置")]ErrChannelStatus, [Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack , @@ -47,7 +47,10 @@ public class InfoEnum [Info("换电任务启动","换电任务启动")] StartSwapInfo, [Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo, [Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap, + [Info("即将进行消防移仓,请车辆驶离","即将进行消防移仓,请车辆驶离")] InfoFireRemoveLabel, [Info("电池移仓中","电池移仓中")] InfoBatteryMove, + [Info("消防移仓中","消防移仓中")] InfoFireRemove, + [Info("拍照失败,请在三分钟内挪车","拍照失败,请在三分钟内挪车")] ErrChannel1020, } diff --git a/Service/Cloud/Client/CloudClientMgr.cs b/Service/Cloud/Client/CloudClientMgr.cs index 3888359..56c6e61 100644 --- a/Service/Cloud/Client/CloudClientMgr.cs +++ b/Service/Cloud/Client/CloudClientMgr.cs @@ -39,7 +39,7 @@ public class CloudClientMgr RedisHelper? redisHelper = AppInfo.Container.Resolve(); BinInfoRepository binInfoRepository = AppInfo.Container.Resolve(); - redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) => + /*redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) => { try { @@ -83,7 +83,7 @@ public class CloudClientMgr ot = 0xFF, bt = DateTime.Now }; - CloudClient?.SendChargeDevDataInfo(req); + CloudClient?.SendChargeDevDataInfo(req); } } } @@ -91,6 +91,6 @@ public class CloudClientMgr { Log.Info("error", e); } - }); + });*/ } } \ No newline at end of file diff --git a/Service/Execute/Api/CloudApi.cs b/Service/Execute/Api/CloudApi.cs index 636cb15..02e3898 100644 --- a/Service/Execute/Api/CloudApi.cs +++ b/Service/Execute/Api/CloudApi.cs @@ -19,15 +19,16 @@ public abstract class CloudApi /// /// /// - public static VehicleCertificationResp VehicleCheck(RfidReadModel rfidReadModel, SwapOrder swapOrder) + public static int VehicleCheck(RfidReadModel rfidReadModel, SwapOrder swapOrder) { VehicleCertification vehicleCertification = new() { - ty = 1, + ty = 2, + rfid=rfidReadModel.VelVin, cn = rfidReadModel.VelNo, vi = rfidReadModel.VelVin, - mac = rfidReadModel.VelMac, + // mac = rfidReadModel.VelMac, en = 0, dt = swapOrder.VehicleEnterTime, mode = 0, @@ -36,13 +37,13 @@ public abstract class CloudApi CloudClientMgr.CloudClient?.SendVehicleCertification(vehicleCertification, global::System.TimeSpan.FromSeconds(TimeSpan)); - return sendVehicleCertification; - /*if (sendVehicleCertification == null) + + if (sendVehicleCertification == null) { return -1; } - return sendVehicleCertification.re;*/ + return sendVehicleCertification.re; } /// @@ -56,8 +57,9 @@ public abstract class CloudApi { UploadSwapOrder uploadSwapOrder = new() { + rfid=swapOrder.VehicleVin, sn=StaticStationInfo.StationNo, - son = swapOrder.Sn, + son = swapOrder.CloudSn, cn = swapOrder.VehicleNo, so = seq, ct = swapOrder.VehicleEnterTime, @@ -65,7 +67,7 @@ public abstract class CloudApi dbid = swapOrderBattery.UpBatteryNo, deno = swapOrderBattery.UpBatteryBinNo, dsoc = swapOrderBattery.UpBatterySoc.ToInt(), - dsoe = swapOrderBattery.UpBatterySoe.ToInt(), + // dsoe = swapOrderBattery.UpBatterySoe.ToInt(), et = swapOrder.SwapEndTime, od = 0, ot = swapOrder.VehicleLeaveTime, @@ -75,7 +77,7 @@ public abstract class CloudApi ubid = swapOrderBattery.DownBatteryNo, ueno = swapOrderBattery.DownBatteryBinNo, usoc = swapOrderBattery.DownBatterySoc.ToInt(), - usoe = swapOrderBattery.DownBatterySoe.ToInt(), + // usoe = swapOrderBattery.DownBatterySoe.ToInt(), vin = swapOrder.VehicleVin, wt = new TimeSpan((swapOrder.SwapEndTime.ToDateTime().Ticks - swapOrder.SwapBeginTime.ToDateTime().Ticks)) .TotalSeconds.ToInt(), diff --git a/Service/Execute/Api/PlcApi.cs b/Service/Execute/Api/PlcApi.cs index b8276a2..117d564 100644 --- a/Service/Execute/Api/PlcApi.cs +++ b/Service/Execute/Api/PlcApi.cs @@ -68,9 +68,9 @@ public class PlcApi /// /// /// - public static bool WriteEntranceLamp(int data) + public static bool WriteEntranceLamp(ushort data) { - return PlcMgr.WriteEntranceLamp((byte)data); + return PlcMgr.WriteEntranceLamp(data); } /// @@ -80,7 +80,7 @@ public class PlcApi /// /// /// - public static bool WriteExistLamp(int data) + public static bool WriteExistLamp(ushort data) { return PlcMgr.WriteExistLamp(data); } diff --git a/Service/Execute/Api/RfidApi.cs b/Service/Execute/Api/RfidApi.cs index 4da8141..9ce4eff 100644 --- a/Service/Execute/Api/RfidApi.cs +++ b/Service/Execute/Api/RfidApi.cs @@ -18,6 +18,15 @@ public class RfidApi public static async Task BeginRead() { + var disConnect =await DisConnect(); + //断连 + var connect = await Connect(); + if (!connect) + { + Log.Info("Rfid connect fail"); + return false; + } + Log.Info("BeginRead"); string url = BASE_URL + "/Api/BeginRead"; try @@ -90,18 +99,14 @@ public class RfidApi public static async Task ReadRifd() { - //断连 - var connect = await Connect(); - if (!connect) - { - Log.Info("Rfid connect fail"); - return null; - } + Log.Info("ReadRifd"); + string readUrl = BASE_URL + "/Api/BeginRead"; string url = BASE_URL + "/Api/ReadRfidData"; try { + var vBeginRead = await _httpClient.GetStringAsync(readUrl); string s = await _httpClient.GetStringAsync(url); Log.Info($"ReadRifd resp={s}"); if (s != String.Empty) diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index 146960b..7143866 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -47,6 +47,7 @@ public class CommonMgr /// public SwapOrder SaveOrder(SwapOrder swapOrder) { + swapOrder.CloudReportStatus = 0; _swapOrderRepository.Insert(swapOrder); return swapOrder; } diff --git a/Service/Execute/Step/CarCtrlState.cs b/Service/Execute/Step/CarCtrlState.cs index a99d8a2..4a1a02c 100644 --- a/Service/Execute/Step/CarCtrlState.cs +++ b/Service/Execute/Step/CarCtrlState.cs @@ -51,11 +51,12 @@ public class CarCtrlState : IState () => machine.VelUnlockFlag, () => { Task result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin); + bool unLock = result.Result; if (unLock) { //查询车辆锁止状态 - Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo); + Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); var resultHeartBeatMsg = carInfo.Result.HeartBeatMsg; if (resultHeartBeatMsg.LockStatus == 1 || resultHeartBeatMsg.LockStatus==0) { diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs index 277e510..6dbfbfc 100644 --- a/Service/Execute/Step/CarPrepareState.cs +++ b/Service/Execute/Step/CarPrepareState.cs @@ -40,11 +40,11 @@ public class CarPrepareState : IState } //云平台车辆认证 - /*var cloudCheckVel = CloudCheckVel(machine); + var cloudCheckVel = CloudCheckVel(machine); if (cloudCheckVel != InvokeStatus.Done) { return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None); - }*/ + } //检查tbox链接状态 InvokeStatus checkTBoxConnect = CheckTBoxConnectFlag(machine); @@ -62,7 +62,7 @@ public class CarPrepareState : IState //云端数据上报 - // InvokeStatus cloudTBox = CloudTBoxFlag(machine); + // InvokeStatus cloudTBox = CloudTBoxFlag(machine); /*if (cloudTBox != InvokeStatus.Done) { return SwappingStateMachine.ReturnWithInvokeErr(cloudTBox, ExceptionReason.None); @@ -109,16 +109,16 @@ public class CarPrepareState : IState //写入口等 :红灯 if (PlcApi.WriteEntranceLamp(1020)) { - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed()); + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoCarInPosition); machine.VehiclesInPlaceFlag = true; //告知云平台换电准备完成 machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapReady; machine.ExceptionReason = ExceptionReason.None; - // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); + // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); //清除下发的指令,等待新的指令 - // CloudApi.ClearCarCanStartInfo(); + // CloudApi.ClearCarCanStartInfo(); _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, machine); @@ -127,7 +127,7 @@ public class CarPrepareState : IState }, () => { machine.ExceptionReason = ExceptionReason.CarInPositionError; - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed()); + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout); }, false, () => { } , 20, InvokeStatus.None); @@ -143,37 +143,29 @@ public class CarPrepareState : IState return Invoker.Invoke("cloud check vehicle", 500, 20, machine.IsCanceled, () => machine.CloudVelCheckFlag, () => { - if (BaseEnumExtensions.GetEnumByCode( - StaticStationInfo.StationModel) == StationConstant.StationModel.Remote) - { - int vehicleCheck = -1; - //CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder); - - if (vehicleCheck != 0) - { - _log.Info("cloud check vehicle error"); - // machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成"); - } - else - { - machine.ExceptionReason = ExceptionReason.None; - _log.Info("cloud check vehicle done"); - machine.CloudVelCheckFlag = true; - // machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成"); + int vehicleCheck = -1; + vehicleCheck= CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder); - //TODO:: - // machine.SwapOrder.CloudSn= - _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag, - machine); - } + if (vehicleCheck != 0) + { + _log.Info("cloud check vehicle error"); + // machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成"); } else { + machine.ExceptionReason = ExceptionReason.None; + _log.Info("cloud check vehicle done"); machine.CloudVelCheckFlag = true; + // machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成"); + + //TODO:: + // machine.SwapOrder.CloudSn= + _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag, + machine); } }, () => { - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed()); + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCloudCheck); }, false, () => { machine.ExceptionReason = ExceptionReason.CloudCheckError; } , 20, InvokeStatus.None); @@ -195,12 +187,14 @@ public class CarPrepareState : IState { machine.BoxConnectFlag = true; } - }, () => { machine.ExceptionReason = ExceptionReason.ConnTBoxError; - SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);}, false, () => + }, () => + { + machine.ExceptionReason = ExceptionReason.ConnTBoxError; + SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn); + }, false, () => { machine.ExceptionReason = ExceptionReason.ConnTBoxError; - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed()); - + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed()); } , 20, InvokeStatus.None); } @@ -217,8 +211,8 @@ public class CarPrepareState : IState { Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); var tBoxCarInfoModel = carInfo.Result; - //TODO::不知道Tbox给的CardNo是什么 - if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelNo.Trim())) + + if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelVin.Trim())) { machine.BoxLocalCheckFlag = true; machine.BoxCarInfoModel = tBoxCarInfoModel; @@ -248,17 +242,14 @@ public class CarPrepareState : IState if (tBoxCarInfoModel.Connected) { //将数据上报云平台 - // CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel); + // CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel); } } }, () => { - // machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员"); - // SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack); - }, false, () => - { - machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError; - } + // machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员"); + // SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack); + }, false, () => { machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError; } , 20, InvokeStatus.None); } @@ -295,9 +286,9 @@ public class CarPrepareState : IState if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success) { - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed()); - - + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed()); + + _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}"); } else @@ -310,9 +301,9 @@ public class CarPrepareState : IState } }, () => { - machine.ExceptionReason = ExceptionReason.SelectPackError; + machine.ExceptionReason = ExceptionReason.SelectPackError; SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack); } - ,false,() => { },10,InvokeStatus.None); + , 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 a033f0e..dbe18d0 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -366,7 +366,7 @@ public class DoSwappingState : IState // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus); //等待2分钟 - Thread.Sleep(60000); + Thread.Sleep(3*60 *1000); machine.VehiclesInPlace2Flag = false; machine.StartSwappingFlag = false; machine.PlcHoldFlag = false; diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 4684259..3fb1d07 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -151,7 +151,7 @@ public class StationReadyState : IState public InvokeStatus BeginRead(SwappingStateMachine machine) { - return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled, + return Invoker.Invoke(" BeginRead read rfid", 1000, 20, machine.IsCanceled, () => machine.BeginRfidReadFlag, () => { Task beginRead = RfidApi.BeginRead(); @@ -171,7 +171,7 @@ public class StationReadyState : IState // machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; } - , 3, InvokeStatus.TimeOut); + , 3, InvokeStatus.None); } /// @@ -205,14 +205,17 @@ public class StationReadyState : IState private InvokeStatus ReadRfid(SwappingStateMachine machine) { //开始读rifd - return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled, + return Invoker.Invoke("read rfid", 3000, 20, machine.IsCanceled, () => machine.RfidReadFlag, () => { Task rfidReadModel = RfidApi.ReadRifd(); rfidReadModel.Wait(); - if ( /*rfidReadModel.IsCompletedSuccessfully &&*/ rfidReadModel.Result != null) + var machineRfidReadModel = rfidReadModel.Result; + + + if ( rfidReadModel.IsCompletedSuccessfully && machineRfidReadModel != null && machineRfidReadModel.Result==1) { - machine.RfidReadModel = rfidReadModel.Result; + machine.RfidReadModel = machineRfidReadModel; _log.Info($"read rfid={JsonConvert.SerializeObject(machine.RfidReadModel)}"); machine.ExceptionReason = ExceptionReason.None; @@ -237,8 +240,8 @@ public class StationReadyState : IState { // machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); - }, true, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10, - InvokeStatus.Exception); + }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10, + InvokeStatus.None); } diff --git a/Service/Mgr/PlcTaskMgr.cs b/Service/Mgr/PlcTaskMgr.cs index a6cd56d..c8290ec 100644 --- a/Service/Mgr/PlcTaskMgr.cs +++ b/Service/Mgr/PlcTaskMgr.cs @@ -45,6 +45,7 @@ public class PlcTaskMgr SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoBatteryMove); }else if (taskNo == 5) { + SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoFireRemove); } }, true, () => { } , 5, InvokeStatus.Exception); diff --git a/Service/Mgr/SwapOrderMgr.cs b/Service/Mgr/SwapOrderMgr.cs index d11fb6c..c8b19ef 100644 --- a/Service/Mgr/SwapOrderMgr.cs +++ b/Service/Mgr/SwapOrderMgr.cs @@ -68,7 +68,7 @@ public class SwapOrderMgr { //更新换下电池包 binInfosMap.TryGetValue(swapOrderBattery.DownBatteryBinNo.ToString(), out BinInfo info); - if (info.BatteryNo == null || info.BatteryNo == "") + if (info.BatteryNo == null || info.BatteryNo == "" || info.BatteryNo=="-1") { continue; } diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs index 13a4272..024b232 100644 --- a/Service/Plc/Client/PlcMgr.cs +++ b/Service/Plc/Client/PlcMgr.cs @@ -43,7 +43,7 @@ public class PlcMgr /// /// /// - public static bool WriteEntranceLamp(byte value) + public static bool WriteEntranceLamp(ushort value) { if (PlcClient != null) { diff --git a/Service/Station/ChargeOrderService.cs b/Service/Station/ChargeOrderService.cs index e6496a1..84cebe3 100644 --- a/Service/Station/ChargeOrderService.cs +++ b/Service/Station/ChargeOrderService.cs @@ -52,31 +52,15 @@ public class ChargeOrderService : BaseServices Expression> condition2Expr = u => u.BatteryNo == chargeOrder.BatteryNo; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (chargeOrder.CmdStatus!=0) - { - Expression> condition2Expr = u => u.CmdStatus == chargeOrder.CmdStatus; - where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); - } + if (!string.IsNullOrEmpty(chargeOrder.ChargerNo)) { Expression> condition2Expr = u => u.ChargerNo == chargeOrder.ChargerNo; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (!string.IsNullOrEmpty(chargeOrder.ChargerGunNo)) - { - Expression> condition2Expr = u => u.ChargerGunNo == chargeOrder.ChargerGunNo; - where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); - } - if (chargeOrder.ChargeMode != 0) - { - Expression> condition2Expr = u => u.ChargeMode == chargeOrder.ChargeMode; - where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); - } - if (chargeOrder.StartMode!=0) - { - Expression> condition2Expr = u => u.StartMode == chargeOrder.StartMode; - where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); - } + + + if (chargeOrder.StartTime != null && chargeOrder.StartTime != DateTime.MinValue) { Expression> condition2Expr = u => u.StartTime == chargeOrder.StartTime; @@ -87,12 +71,12 @@ public class ChargeOrderService : BaseServices Expression> condition2Expr = u => u.EndTime == chargeOrder.EndTime; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (chargeOrder.ChargeTimeCount!=0) + if (chargeOrder.ChargeTimeCount!=null) { Expression> condition2Expr = u => u.ChargeTimeCount == chargeOrder.ChargeTimeCount; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (chargeOrder.StopReason != 0) + if (chargeOrder.StopReason != null) { Expression> condition2Expr = u => u.StopReason == chargeOrder.StopReason; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); @@ -107,7 +91,7 @@ public class ChargeOrderService : BaseServices Expression> condition2Expr = u => u.SwapOrderSn == chargeOrder.SwapOrderSn; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (chargeOrder.CloudReportStatus != 0) + if (chargeOrder.CloudReportStatus != null) { Expression> condition2Expr = u => u.CloudReportStatus == chargeOrder.CloudReportStatus; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs index 3d6e83f..e34e1cc 100644 --- a/WebStarter/Controllers/SwapMonitorController.cs +++ b/WebStarter/Controllers/SwapMonitorController.cs @@ -226,25 +226,13 @@ public class SwapMonitorController : ControllerBase [HttpGet("GetCarList")] public async Task>> GetCarList() { - /*var carInfoList = await TBoxApi.GetCarInfoList(); + var carInfoList = await TBoxApi.GetCarInfoList(); if (carInfoList == null || carInfoList.Count <= 0) { return Result>.Success(new List()); } - return Result>.Success(carInfoList);*/ - return Result>.Success(new List() - { - new TboxCarInfoModel() - { - Connected = true, - CarNo = "carNo1", - }, - new TboxCarInfoModel() - { - Connected = true, - CarNo = "carNo2", - } - }); + return Result>.Success(carInfoList); } + } \ No newline at end of file diff --git a/WebStarter/Controllers/Test/GenController.cs b/WebStarter/Controllers/Test/GenController.cs index 158d131..3341f87 100644 --- a/WebStarter/Controllers/Test/GenController.cs +++ b/WebStarter/Controllers/Test/GenController.cs @@ -42,6 +42,7 @@ public class GenController : ControllerBase Console.WriteLine("生成完毕"); } + /* [HttpGet("CloudTestVelCheck")] public Result CloudTestVelCheck() { @@ -55,7 +56,7 @@ public class GenController : ControllerBase VehicleEnterTime = DateTime.Now }); return Result.Success(vehicleCertificationResp); - } + }*/ [HttpGet("test115")] public void Test115()