From 0dcc62299bbf5171ce6b85b407b5bf89f1dbcaf6 Mon Sep 17 00:00:00 2001
From: zby <2494737567@qq.com>
Date: Mon, 7 Oct 2024 10:29:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E8=A1=A8?=
=?UTF-8?q?=E6=A0=BC=EF=BC=8C=E5=8E=BB=E9=99=A4=E4=B8=A4=E4=B8=AA=E5=AD=97?=
=?UTF-8?q?=E6=AE=B5=EF=BC=8C=E5=8E=BB=E9=99=A4=E6=8D=A2=E7=94=B5=E6=AD=A5?=
=?UTF-8?q?=E9=AA=A4=E6=8D=A2=E7=94=B5=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=8F=91?=
=?UTF-8?q?=E9=80=81=E7=BA=A2=E7=BB=BF=E7=81=AF=E5=91=BD=E4=BB=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Api/Resp/SwapOrderResp.cs | 4 ++--
Entity/Constant/InfoEnum.cs | 2 +-
Entity/Dto/SwapOrderDto.cs | 10 +++++----
Service/Execute/Api/PlcApi.cs | 13 ++++++++++++
Service/Execute/Step/StationReadyState.cs | 1 +
Service/Execute/Step/SwapDoneState.cs | 4 ++--
Service/Plc/Client/PlcClient.cs | 21 +++++++++++++++++++
.../Plc/Handler/WarehousCompleteReqHandler.cs | 3 ---
.../Plc/Msg/Host/Req/InboundCommandsReq.cs | 2 +-
Service/Station/SwapOrderService.cs | 2 +-
WebStarter/Controllers/PlcController.cs | 8 ++++---
11 files changed, 53 insertions(+), 17 deletions(-)
diff --git a/Entity/Api/Resp/SwapOrderResp.cs b/Entity/Api/Resp/SwapOrderResp.cs
index b8d8a4e..47ae3cd 100644
--- a/Entity/Api/Resp/SwapOrderResp.cs
+++ b/Entity/Api/Resp/SwapOrderResp.cs
@@ -246,7 +246,7 @@ namespace Entity.Api.Resp
///
public string? UpBatterySocDto
{
- get { return UpBatterySoc.HasValue ? $"{UpBatterySoc.Value.ToString("0")}%" : null; }
+ get { return UpBatterySoc.HasValue ? $"{UpBatterySoc.Value.ToString("0")}" : null; }
}
@@ -281,7 +281,7 @@ namespace Entity.Api.Resp
///
public string? DownBatterySocDto
{
- get { return DownBatterySoc.HasValue ? $"{DownBatterySoc.Value.ToString("0")}%" : null; }
+ get { return DownBatterySoc.HasValue ? $"{DownBatterySoc.Value.ToString("0")}" : null; }
}
///
diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs
index 8c78cdd..b606ae6 100644
--- a/Entity/Constant/InfoEnum.cs
+++ b/Entity/Constant/InfoEnum.cs
@@ -129,7 +129,7 @@ public class InfoEnum
[Const("安装完成")] FinishNewBatteryFlag,
[Const("车辆上锁")] VelLockFlag,
[Const("换电完成(车辆驶离)")] RadarOutFlag,
- [Const("换电失败(车辆驶离)")] RadarOutFailFlag,
+ // [Const("换电失败(车辆驶离)")] RadarOutFailFlag,
}
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index 0abfa8c..ea84a1b 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -39,7 +39,8 @@ public class SwapOrderDto
public string VehicleNo { get; set; }
- [ExporterHeader(DisplayName = "车牌号", IsBold = true)]
+ // [ExporterHeader(DisplayName = "车牌号", IsBold = true)]
+ [ExporterHeader(IsIgnore = true)]
public string VehicleNoCode { get; set; }
///
@@ -47,7 +48,8 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
///
- [ExporterHeader(DisplayName = "所属公司", IsBold = true)]
+ //[ExporterHeader(DisplayName = "所属公司", IsBold = true)]
+ [ExporterHeader(IsIgnore = true)]
public string? Company {get;set;}
///
@@ -180,7 +182,7 @@ public class SwapOrderDto
{
get
{
- return UpBatterySoc.HasValue ? $"{UpBatterySoc.Value.ToString("0")}%" : null;
+ return UpBatterySoc.HasValue ? $"{UpBatterySoc.Value.ToString("0")}" : null;
}
}
@@ -223,7 +225,7 @@ public class SwapOrderDto
{
get
{
- return DownBatterySoc.HasValue ? $"{DownBatterySoc.Value.ToString("0")}%" : null;
+ return DownBatterySoc.HasValue ? $"{DownBatterySoc.Value.ToString("0")}" : null;
}
}
diff --git a/Service/Execute/Api/PlcApi.cs b/Service/Execute/Api/PlcApi.cs
index 10e787e..d501083 100644
--- a/Service/Execute/Api/PlcApi.cs
+++ b/Service/Execute/Api/PlcApi.cs
@@ -80,4 +80,17 @@ public class PlcApi
Log.Info($"PlcApi Init done");
return true;
}
+
+
+ ///
+ /// 发送红绿灯
+ ///
+ ///
+ public static bool Traffic(byte Light)
+ {
+ Log.Info($"PlcApi Init ");
+ ClientMgr.PlcClient?.SendInboundCommandsReq(Light);
+ Log.Info($"PlcApi Init done");
+ return true;
+ }
}
\ No newline at end of file
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index f607d4f..2e3729e 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -211,6 +211,7 @@ public class StationReadyState : IState
if (PadarMgr._PadarClient?.CarState == 6 || machine.ManualSkipRadar)
{
+ // PlcApi.Traffic(0);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.diparkir.GetLed());
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index 0445af1..3dcb940 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -300,7 +300,7 @@ public class SwapDoneState : IState
machine.ExceptionReason = ExceptionReason.None;
_log.Info("exist radar true");
-
+ // PlcApi.Traffic(1);
//出口写红灯
//更新车辆离场时间,上报云平台
//machine.BusinessSwappingForCloudState =
@@ -311,7 +311,7 @@ public class SwapDoneState : IState
_CommonMgr.InsertStep(
machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
? InfoEnum.BusinessSwappingStep.RadarOutFlag
- : InfoEnum.BusinessSwappingStep.RadarOutFailFlag,
+ : InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine,type: machine.ManualSkipRadar? (int)SwapConstant.StepType.MANUAL :(int)SwapConstant.StepType.AUTO);
}
diff --git a/Service/Plc/Client/PlcClient.cs b/Service/Plc/Client/PlcClient.cs
index 9b679bd..95f05d1 100644
--- a/Service/Plc/Client/PlcClient.cs
+++ b/Service/Plc/Client/PlcClient.cs
@@ -239,6 +239,26 @@ public class PlcClient : TcpClient
///
/// Plc编号
/// 消息
+ //public Result SendInboundCommandsReq(byte positionNumber)
+ //{
+ // if (!Connected)
+ // {
+ // return Result.Fail($"Plc{Sn}未连接");
+ // }
+ // InboundCommandsReq req = new InboundCommandsReq(positionNumber)
+ // {
+ // PositionNumber = positionNumber,
+ // };
+ // this.Channel.WriteAndFlushAsync(req);
+ // return Result.Success();
+ //}
+
+
+ ///
+ /// 发送入库命令修改为红绿灯
+ ///
+ /// Plc编号
+ /// 消息
public Result SendInboundCommandsReq(byte positionNumber)
{
if (!Connected)
@@ -253,6 +273,7 @@ public class PlcClient : TcpClient
return Result.Success();
}
+
///
/// 发送终止命令
///
diff --git a/Service/Plc/Handler/WarehousCompleteReqHandler.cs b/Service/Plc/Handler/WarehousCompleteReqHandler.cs
index d0a3826..a2d4df9 100644
--- a/Service/Plc/Handler/WarehousCompleteReqHandler.cs
+++ b/Service/Plc/Handler/WarehousCompleteReqHandler.cs
@@ -32,8 +32,5 @@ public class WarehousCompleteReqHandler : SimpleChannelInboundHandler
-/// 入库命令
+/// 入库命令改为红绿灯使用
///
public class InboundCommandsReq : ASDU {
diff --git a/Service/Station/SwapOrderService.cs b/Service/Station/SwapOrderService.cs
index 892a7dc..fb5e9d6 100644
--- a/Service/Station/SwapOrderService.cs
+++ b/Service/Station/SwapOrderService.cs
@@ -199,7 +199,7 @@ public class SwapOrderService : BaseServices
if (swapOrder.SwapBeginTime != null && swapOrder.SwapEndTime != null)
{
- Expression> condition2Expr = u => u.SwapBeginTime >= swapOrder.SwapBeginTime && u.SwapBeginTime <= swapOrder.SwapEndTime;
+ Expression> condition2Expr = u => u.VehicleEnterTime >= swapOrder.SwapBeginTime && u.VehicleEnterTime <= swapOrder.SwapEndTime;
where = where == null
? condition2Expr
: Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
diff --git a/WebStarter/Controllers/PlcController.cs b/WebStarter/Controllers/PlcController.cs
index 7a223bd..08473f9 100644
--- a/WebStarter/Controllers/PlcController.cs
+++ b/WebStarter/Controllers/PlcController.cs
@@ -134,7 +134,7 @@ public class PlcController : ControllerBase
{
return chargerClient.SendTrafficLightReq(trafficLight);
}
- return Result.Fail("充电机未连接");
+ return Result.Fail("PLC未连接");
}
///
@@ -185,9 +185,11 @@ public class PlcController : ControllerBase
{
return chargerClient.SendInboundCommandsReq(positionNumber);
}
- return Result.Fail("充电机未连接");
+ return Result.Fail("PLC未连接");
}
-
+
+
+
///
/// 发送终止命令
///