增加时间差

master
zby 2 months ago
parent 7146351f4f
commit f5bf65c408

@ -6,7 +6,7 @@ namespace Entity.Dto;
/// <summary> /// <summary>
/// 换电订单导出 /// 换电订单导出
/// </summary> /// </summary>
[ExcelExporter(Name = "换电订单", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] [ExcelExporter(Name = "2号站换电记录", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
public class SwapOrderDto public class SwapOrderDto
{ {
@ -41,23 +41,23 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "车辆vin码", IsBold = true)] [ExporterHeader(DisplayName = "车辆vin码", IsBold = true)]
public string VehicleVin { get; set; } public string VehicleVin { get; set; }
/// <summary> ///// <summary>
/// Desc:车辆进场时间 ///// Desc:车辆进场时间
/// Default: ///// Default:
/// Nullable:True ///// Nullable:True
/// </summary> ///// </summary>
[ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", //[ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)] // AutoCenterColumn = true)]
public DateTime? VehicleEnterTime { get; set; } //public DateTime? VehicleEnterTime { get; set; }
/// <summary> ///// <summary>
/// Desc:车辆离场时间 ///// Desc:车辆离场时间
/// Default: ///// Default:
/// Nullable:True ///// Nullable:True
/// </summary> ///// </summary>
[ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", //[ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)] // AutoCenterColumn = true)]
public DateTime? VehicleLeaveTime { get; set; } //public DateTime? VehicleLeaveTime { get; set; }
/// <summary> /// <summary>
/// Desc:换电开始时间 /// Desc:换电开始时间
@ -76,6 +76,26 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "换电结束时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] [ExporterHeader(DisplayName = "换电结束时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)]
public DateTime? SwapEndTime { get; set; } public DateTime? SwapEndTime { get; set; }
/// <summary>
/// 换电时间(换电结束时间与换电开始时间之间的差值)
/// </summary>
[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");
}
}
/// <summary> /// <summary>
/// Desc:换电结果;0-未知1-成功2-失败 /// Desc:换电结果;0-未知1-成功2-失败
/// Default:0 /// Default:0
@ -114,6 +134,24 @@ public class SwapOrderDto
public string FailReason { get; set; } public string FailReason { get; set; }
/// <summary>
/// Desc:换电类型:;1自动换电;2手动换电
/// Default:0
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "换电类型", IsBold = true)]
public string SwapWayDisplay
{
get
{
return SwapWay switch
{
1 => "自动换电",
2 => "手动换电",
_ => "未知"
};
}
}
/// <summary> /// <summary>
/// Desc:换电类型:;1自动换电;2手动换电 /// Desc:换电类型:;1自动换电;2手动换电
/// Default:0 /// Default:0
@ -239,24 +277,6 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "云平台订单号", IsBold = true)] [ExporterHeader(DisplayName = "云平台订单号", IsBold = true)]
public string? CloudSn { get; set; } public string? CloudSn { get; set; }
/// <summary>
/// Desc:换电类型:;1自动换电;2手动换电
/// Default:0
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "换电类型", IsBold = true)]
public string SwapWayDisplay
{
get
{
return SwapWay switch
{
1 => "自动换电",
2 => "手动换电",
_ => "未知"
};
}
}
/// <summary> /// <summary>

@ -220,7 +220,7 @@ public class CarPrepareState : IState
{ {
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
// SoundClient.SoundPlay(SoundEnum.music43); //SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError; //machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () => }, false, () =>

@ -282,69 +282,4 @@ public class DoSwappingState : IState
} }
/// <summary>
/// 车辆上锁
/// </summary>
/// <returns></returns>
public InvokeStatus LockCar(SwappingStateMachine machine)
{
int v = 0;
return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.VelLockFlag, () =>
{
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> 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>();
//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);
}
} }

@ -43,7 +43,7 @@ public class StationReadyState : IState
return null; return null;
} }
//plc是否是自动模式 //plc是否是自动模式
var plcIsAuto = PlcIsAuto(machine); var plcIsAuto = PlcIsAuto(machine);
if (InvokeStatus.Done != plcIsAuto) if (InvokeStatus.Done != plcIsAuto)
@ -57,9 +57,9 @@ public class StationReadyState : IState
{ {
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
} }
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine); machine);
////开启雷达 ////开启雷达
var beginRadar = ControlRadar(machine, 1); var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar) if (InvokeStatus.Done != beginRadar)

@ -184,7 +184,7 @@ public class SwapDoneState : IState
public InvokeStatus LockCar(SwappingStateMachine machine) 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, () => () => machine.VelLockFlag, () =>
{ {
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin); Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
@ -192,6 +192,7 @@ public class SwapDoneState : IState
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {
//查询车辆锁止状态 //查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag) if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag)
@ -215,7 +216,6 @@ public class SwapDoneState : IState
: InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed()); : InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed());
machine.VelLockFlag = true; machine.VelLockFlag = true;
//断连Tbox //断连Tbox
if (StaticStationInfo.TboxStateDisConnect) if (StaticStationInfo.TboxStateDisConnect)
{ {
@ -234,7 +234,7 @@ public class SwapDoneState : IState
//TODO::加锁失败是否需要播报 //TODO::加锁失败是否需要播报
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed());
}, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; } }, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; }
, 3, InvokeStatus.None); , 5, InvokeStatus.None);
} }

@ -39,5 +39,6 @@ public class SummaryFailuresReqHandler : SimpleChannelInboundHandler<SummaryFail
ClientMgr.PlcClient.Auto = msg.T3 == 1; ClientMgr.PlcClient.Auto = msg.T3 == 1;
ClientMgr.PlcClient.Remote = msg.T3 == 1; ClientMgr.PlcClient.Remote = msg.T3 == 1;
ClientMgr.PlcClient.Init = msg.T6 == 1; ClientMgr.PlcClient.Init = msg.T6 == 1;
} }
} }

@ -32,7 +32,7 @@ public class SummaryFailuresReq : ASDU
[Property(7, 1 )] [Property(7, 1 )]
public Byte T8 {get;set;} public Byte T8 {get;set;}
///// <summary> ///// <summary>
///// 信息体地址 ///// 信息体地址
///// </summary> ///// </summary>

@ -441,7 +441,7 @@ public class SwapOrderController : ControllerBase
return new FileStreamResult(new MemoryStream(res), "application/octet-stream") return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
{ {
FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") +
(language == "en" ? "_Swap_Orders.xlsx" : "换电订单.xlsx") (language == "en" ? "_Swap_Orders.xlsx" : "2号站换电记录.xlsx")
}; };
} }

Loading…
Cancel
Save