From 6def413890c2b1c16925ce3b00d5afbdd842adc4 Mon Sep 17 00:00:00 2001
From: zby <24947@USER>
Date: Thu, 19 Sep 2024 15:37:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eplc=E7=8A=B6=E6=80=81?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Constant/InfoEnum.cs | 1 +
Entity/Dto/SwapOrderDto.cs | 16 +++++++
Service/Execute/Step/CarPrepareState.cs | 20 ++++-----
Service/Execute/Step/StationReadyState.cs | 44 ++++++++++++-------
Service/Execute/Step/SwapDoneState.cs | 9 ++--
Service/Plc/Client/PlcClient.cs | 6 +++
.../Plc/Handler/SummaryFailuresReqHandler.cs | 2 +
.../Controllers/SwapMonitorController.cs | 2 -
WebStarter/Controllers/SwapOrderController.cs | 5 +++
9 files changed, 70 insertions(+), 35 deletions(-)
diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs
index 4b6a702..590a57d 100644
--- a/Entity/Constant/InfoEnum.cs
+++ b/Entity/Constant/InfoEnum.cs
@@ -108,6 +108,7 @@ public class InfoEnum
{
[Const("空闲")] Idel,
[Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag,
+ [Const("PLC状态检测")] Plc,
[Const("rfid扫描完成")] RfidReadFlag,
[Const("车辆到位")] CarInPositionFlag,
[Const("车辆解锁")] VelUnlockFlag,
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index f9da947..c81b7f0 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -33,6 +33,22 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "车辆mac", IsBold = true)]
public string VehicleMac { get; set; }
+ ///
+ /// Desc: 公司
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "公司", IsBold = true)]
+ public string Firm { get; set; }
+
+ ///
+ /// Desc: 部门
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "部门", IsBold = true)]
+ public string Department { get; set; }
+
///
/// Desc:车辆vin码
/// Default:
diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs
index 906bcb9..01de243 100644
--- a/Service/Execute/Step/CarPrepareState.cs
+++ b/Service/Execute/Step/CarPrepareState.cs
@@ -116,13 +116,13 @@ public class CarPrepareState : IState
}
}
- if (StaticStationInfo.TboxStateBreak)
- {
- if (status?.Break == 1)
- {
- succCount++;
- }
- }
+ //if (StaticStationInfo.TboxStateBreak)
+ //{
+ // if (status?.Break == 1)
+ // {
+ // succCount++;
+ // }
+ //}
if (StaticStationInfo.TboxStateN)
{
@@ -136,7 +136,6 @@ public class CarPrepareState : IState
if (succCount == successCount)
{
machine.VehiclesInPlaceFlag = true;
-
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
machine);
}
@@ -145,7 +144,8 @@ public class CarPrepareState : IState
SoundClient = AppInfo.Container.Resolve();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address06"));
//TODO::播报请熄火挂N挡拉手刹
- SoundClient.SoundPlay(SoundEnum.music06);
+
+ // SoundClient.SoundPlay(SoundEnum.music06);
machine.ExceptionReason = ExceptionReason.CarInPositionError;
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed());
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout);
@@ -255,14 +255,12 @@ public class CarPrepareState : IState
}, () => { machine.ExceptionReason = ExceptionReason.LocalCheckVarError; }, true, () =>
{
machine.ExceptionReason = ExceptionReason.LocalCheckVarError;
-
SoundClient = AppInfo.Container.Resolve();
SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000);
-
}
, 30, InvokeStatus.TimeOut);
}
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index fed9d75..bd2c888 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -44,19 +44,6 @@ public class StationReadyState : IState
}
- //plc是否是自动模式
- var plcIsAuto = PlcIsAuto(machine);
- if (InvokeStatus.Done != plcIsAuto)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(plcIsAuto, ExceptionReason.None);
- }
-
- ////plc是否是远程模式
- var plcIsRemote = PlcIsRemote(machine);
- if (InvokeStatus.Done != plcIsRemote)
- {
- return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
- }
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine);
@@ -74,6 +61,24 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
+
+ //plc是否是自动模式
+ var plcIsAuto = PlcIsAuto(machine);
+ if (InvokeStatus.Done != plcIsAuto)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(plcIsAuto, ExceptionReason.None);
+ }
+
+ ////plc是否是远程模式
+ var plcIsRemote = PlcIsRemote(machine);
+ if (InvokeStatus.Done != plcIsRemote)
+ {
+ return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
+ }
+
+ _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Plc,
+ machine);
+
//手动模式
if (StaticStationInfo.VehicleManually == 1)
{
@@ -188,7 +193,7 @@ public class StationReadyState : IState
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
() => { PadarMgr._PadarClient?.PadarControl(flag); });
}
-
+
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{
@@ -200,9 +205,13 @@ public class StationReadyState : IState
if (PadarMgr._PadarClient?.CarState == 6)
{
- LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed());
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
- machine);
+ if (PadarMgr._PadarClient?.CarState == 6)
+ {
+ LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed());
+ _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
+ machine);
+ }
+
}
return PadarMgr._PadarClient?.CarState == 6;
@@ -225,6 +234,7 @@ public class StationReadyState : IState
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music101);
+ Thread.Sleep(3000);
che = 1;
}
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index 2a629d0..3d928e2 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -192,19 +192,18 @@ public class SwapDoneState : IState
bool unLock = result.Result;
if (unLock)
{
-
+ _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
+ machine);
//查询车辆锁止状态
Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag)
{
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
- machine);
+ //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
+ // machine);
var SoundClient = AppInfo.Container.Resolve();
SoundClient.SoundPlay(SoundEnum.music77);
Thread.Sleep(4000);
SoundClient.SoundPlay(SoundEnum.music76);
- Thread.Sleep(3000);
-
machine.BoxCarInfoModel = carInfo.Result;
SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
diff --git a/Service/Plc/Client/PlcClient.cs b/Service/Plc/Client/PlcClient.cs
index 4aa98f9..3b3a665 100644
--- a/Service/Plc/Client/PlcClient.cs
+++ b/Service/Plc/Client/PlcClient.cs
@@ -41,6 +41,12 @@ public class PlcClient : TcpClient
//初始化完成
public bool Init { get; set; }
+
+
+
+
+
+
#endregion
diff --git a/Service/Plc/Handler/SummaryFailuresReqHandler.cs b/Service/Plc/Handler/SummaryFailuresReqHandler.cs
index a7ac27e..5ac160a 100644
--- a/Service/Plc/Handler/SummaryFailuresReqHandler.cs
+++ b/Service/Plc/Handler/SummaryFailuresReqHandler.cs
@@ -40,5 +40,7 @@ public class SummaryFailuresReqHandler : SimpleChannelInboundHandler
@@ -355,6 +358,7 @@ public class SwapOrderController : ControllerBase
List batteryList =
swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
+
// 根据语言设置不同的映射配置
var config = new MapperConfiguration(cfg =>
{
@@ -375,6 +379,7 @@ public class SwapOrderController : ControllerBase
if (language == "en")
{
SwapOrderDto2 dto = list2[i];
+
SwapOrderBatteryResp? swapOrderBatteryResp =
swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn);
if (swapOrderBatteryResp != null)