From f5bf65c408c4cd477628824edb7b2eb026cb9424 Mon Sep 17 00:00:00 2001
From: zby <24947@USER>
Date: Mon, 16 Sep 2024 16:01:48 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=B6=E9=97=B4=E5=B7=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Entity/Dto/SwapOrderDto.cs | 92 +++++++++++--------
Service/Execute/Step/CarPrepareState.cs | 2 +-
Service/Execute/Step/DoSwappingState.cs | 65 -------------
Service/Execute/Step/StationReadyState.cs | 6 +-
Service/Execute/Step/SwapDoneState.cs | 6 +-
.../Plc/Handler/SummaryFailuresReqHandler.cs | 1 +
Service/Plc/Msg/Plc/Req/SummaryFailuresReq.cs | 2 +-
WebStarter/Controllers/SwapOrderController.cs | 2 +-
8 files changed, 66 insertions(+), 110 deletions(-)
diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs
index c5c654f..ea03d9c 100644
--- a/Entity/Dto/SwapOrderDto.cs
+++ b/Entity/Dto/SwapOrderDto.cs
@@ -6,7 +6,7 @@ namespace Entity.Dto;
///
/// 换电订单导出
///
-[ExcelExporter(Name = "换电订单", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
+[ExcelExporter(Name = "2号站换电记录", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
public class SwapOrderDto
{
@@ -41,23 +41,23 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "车辆vin码", IsBold = true)]
public string VehicleVin { get; set; }
- ///
- /// Desc:车辆进场时间
- /// Default:
- /// Nullable:True
- ///
- [ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
- AutoCenterColumn = true)]
- public DateTime? VehicleEnterTime { get; set; }
-
- ///
- /// Desc:车辆离场时间
- /// Default:
- /// Nullable:True
- ///
- [ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
- AutoCenterColumn = true)]
- public DateTime? VehicleLeaveTime { get; set; }
+ /////
+ ///// Desc:车辆进场时间
+ ///// Default:
+ ///// Nullable:True
+ /////
+ //[ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
+ // AutoCenterColumn = true)]
+ //public DateTime? VehicleEnterTime { get; set; }
+
+ /////
+ ///// Desc:车辆离场时间
+ ///// Default:
+ ///// Nullable:True
+ /////
+ //[ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
+ // AutoCenterColumn = true)]
+ //public DateTime? VehicleLeaveTime { get; set; }
///
/// Desc:换电开始时间
@@ -76,6 +76,26 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "换电结束时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
public DateTime? SwapEndTime { get; set; }
+
+ ///
+ /// 换电时间(换电结束时间与换电开始时间之间的差值)
+ ///
+ [ExporterHeader(DisplayName = "换电时间", Width = 30, Format = "c")]
+ public string SwapDuration
+ {
+ get
+ {
+ if (!SwapBeginTime.HasValue || !SwapEndTime.HasValue)
+ {
+ return "未知";
+ }
+
+ TimeSpan duration = SwapEndTime.Value - SwapBeginTime.Value;
+ return duration.ToString("c");
+ }
+ }
+
+
///
/// Desc:换电结果;0-未知;1-成功;2-失败
/// Default:0
@@ -114,6 +134,24 @@ public class SwapOrderDto
public string FailReason { get; set; }
+ ///
+ /// Desc:换电类型:;1自动换电;2手动换电
+ /// Default:0
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "换电类型", IsBold = true)]
+ public string SwapWayDisplay
+ {
+ get
+ {
+ return SwapWay switch
+ {
+ 1 => "自动换电",
+ 2 => "手动换电",
+ _ => "未知"
+ };
+ }
+ }
///
/// Desc:换电类型:;1自动换电;2手动换电
/// Default:0
@@ -239,24 +277,6 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "云平台订单号", IsBold = true)]
public string? CloudSn { get; set; }
- ///
- /// Desc:换电类型:;1自动换电;2手动换电
- /// Default:0
- /// Nullable:True
- ///
- [ExporterHeader(DisplayName = "换电类型", IsBold = true)]
- public string SwapWayDisplay
- {
- get
- {
- return SwapWay switch
- {
- 1 => "自动换电",
- 2 => "手动换电",
- _ => "未知"
- };
- }
- }
///
diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs
index 9ed07cd..f494690 100644
--- a/Service/Execute/Step/CarPrepareState.cs
+++ b/Service/Execute/Step/CarPrepareState.cs
@@ -220,7 +220,7 @@ public class CarPrepareState : IState
{
SoundClient = AppInfo.Container.Resolve();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
- // SoundClient.SoundPlay(SoundEnum.music43);
+ //SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () =>
diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs
index 7ff1efc..226681a 100644
--- a/Service/Execute/Step/DoSwappingState.cs
+++ b/Service/Execute/Step/DoSwappingState.cs
@@ -282,69 +282,4 @@ public class DoSwappingState : IState
}
-
- ///
- /// 车辆上锁
- ///
- ///
- public InvokeStatus LockCar(SwappingStateMachine machine)
- {
- int v = 0;
- return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
- () => machine.VelLockFlag, () =>
- {
- Task result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
-
- bool unLock = result.Result;
- if (unLock)
- {
- //查询车辆锁止状态
- Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
- if (carInfo.Result?.CarStatus?.LockStatus == 2)
- {
-
- machine.BoxCarInfoModel = carInfo.Result;
- SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
- ? (int)InfoEnum.SwapInfo.InfoCarLeave
- : (int)InfoEnum.SwapInfo.ErrInfoCarLeave);
-
- LedClient.SendMsgByKey(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success
- ? InfoEnum.SwapInfo.InfoCarLeave.GetLed()
- : InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());
- machine.VelLockFlag = true;
- var SoundClient = AppInfo.Container.Resolve();
- //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
- if (v == 0)
- {
-
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
- machine);
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
- machine);
-
- SoundClient.SoundPlay(SoundEnum.music77);
- Thread.Sleep(3000);
- SoundClient.SoundPlay(SoundEnum.music76);
-
- v = 1;
- }
- //断连Tbox
- if (StaticStationInfo.TboxStateDisConnect)
- {
- TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo);
- }
- //新增小步
-
- }
- }
- }, () =>
- {
- // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed());
- // SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar);
-
-
- LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed());
- }, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
- , 10, InvokeStatus.None);
- }
}
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index 7a93832..ef77103 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -43,7 +43,7 @@ public class StationReadyState : IState
return null;
}
-
+
//plc是否是自动模式
var plcIsAuto = PlcIsAuto(machine);
if (InvokeStatus.Done != plcIsAuto)
@@ -57,9 +57,9 @@ public class StationReadyState : IState
{
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
}
-
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
- machine);
+ machine);
+
////开启雷达
var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar)
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index 4a1da2b..e3f9a8e 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -184,7 +184,7 @@ public class SwapDoneState : IState
public InvokeStatus LockCar(SwappingStateMachine machine)
{
- return Invoker.Invoke("LockCar", 1000, 20, machine.IsCanceled, machine.IsManualSwapSucc,
+ return Invoker.Invoke("LockCar", 1000, 10, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.VelLockFlag, () =>
{
Task result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
@@ -192,6 +192,7 @@ public class SwapDoneState : IState
bool unLock = result.Result;
if (unLock)
{
+
//查询车辆锁止状态
Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag)
@@ -215,7 +216,6 @@ public class SwapDoneState : IState
: InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());
machine.VelLockFlag = true;
-
//断连Tbox
if (StaticStationInfo.TboxStateDisConnect)
{
@@ -234,7 +234,7 @@ public class SwapDoneState : IState
//TODO::加锁失败是否需要播报
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed());
}, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
- , 3, InvokeStatus.None);
+ , 5, InvokeStatus.None);
}
diff --git a/Service/Plc/Handler/SummaryFailuresReqHandler.cs b/Service/Plc/Handler/SummaryFailuresReqHandler.cs
index 6f2c10d..a7ac27e 100644
--- a/Service/Plc/Handler/SummaryFailuresReqHandler.cs
+++ b/Service/Plc/Handler/SummaryFailuresReqHandler.cs
@@ -39,5 +39,6 @@ public class SummaryFailuresReqHandler : SimpleChannelInboundHandler
///// 信息体地址
/////
diff --git a/WebStarter/Controllers/SwapOrderController.cs b/WebStarter/Controllers/SwapOrderController.cs
index 474d2cb..b3adce7 100644
--- a/WebStarter/Controllers/SwapOrderController.cs
+++ b/WebStarter/Controllers/SwapOrderController.cs
@@ -441,7 +441,7 @@ public class SwapOrderController : ControllerBase
return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
{
FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") +
- (language == "en" ? "_Swap_Orders.xlsx" : "换电订单.xlsx")
+ (language == "en" ? "_Swap_Orders.xlsx" : "2号站换电记录.xlsx")
};
}