增加时间差

master
zby 2 months ago
parent 7146351f4f
commit f5bf65c408

@ -6,7 +6,7 @@ namespace Entity.Dto;
/// <summary>
/// 换电订单导出
/// </summary>
[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; }
/// <summary>
/// Desc:车辆进场时间
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]
public DateTime? VehicleEnterTime { get; set; }
/// <summary>
/// Desc:车辆离场时间
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]
public DateTime? VehicleLeaveTime { get; set; }
///// <summary>
///// Desc:车辆进场时间
///// Default:
///// Nullable:True
///// </summary>
//[ExporterHeader(DisplayName = "车辆进场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
// AutoCenterColumn = true)]
//public DateTime? VehicleEnterTime { get; set; }
///// <summary>
///// Desc:车辆离场时间
///// Default:
///// Nullable:True
///// </summary>
//[ExporterHeader(DisplayName = "车辆离场时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
// AutoCenterColumn = true)]
//public DateTime? VehicleLeaveTime { get; set; }
/// <summary>
/// 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; }
/// <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>
/// Desc:换电结果;0-未知1-成功2-失败
/// Default:0
@ -114,6 +134,24 @@ public class SwapOrderDto
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>
/// Desc:换电类型:;1自动换电;2手动换电
/// Default:0
@ -239,24 +277,6 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "云平台订单号", IsBold = true)]
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>

@ -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);
}
}

@ -57,9 +57,9 @@ public class StationReadyState : IState
{
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
}
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine);
////开启雷达
var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar)

@ -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<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
@ -192,6 +192,7 @@ public class SwapDoneState : IState
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> 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);
}

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

@ -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")
};
}

Loading…
Cancel
Save