新增plc状态检测

master
zby 2 months ago
parent 362c38834a
commit 6def413890

@ -108,6 +108,7 @@ public class InfoEnum
{
[Const("空闲")] Idel,
[Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag,
[Const("PLC状态检测")] Plc,
[Const("rfid扫描完成")] RfidReadFlag,
[Const("车辆到位")] CarInPositionFlag,
[Const("车辆解锁")] VelUnlockFlag,

@ -33,6 +33,22 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "车辆mac", IsBold = true)]
public string VehicleMac { get; set; }
/// <summary>
/// Desc: 公司
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "公司", IsBold = true)]
public string Firm { get; set; }
/// <summary>
/// Desc: 部门
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "部门", IsBold = true)]
public string Department { get; set; }
/// <summary>
/// Desc:车辆vin码
/// Default:

@ -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>();
//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>();
SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000);
}
, 30, InvokeStatus.TimeOut);
}

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

@ -192,19 +192,18 @@ public class SwapDoneState : IState
bool unLock = result.Result;
if (unLock)
{
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
//查询车辆锁止状态
Task<TboxCarInfoModel> 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>();
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

@ -41,6 +41,12 @@ public class PlcClient : TcpClient<IBaseHandler, Decoder, Encoder>
//初始化完成
public bool Init { get; set; }
#endregion

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

@ -54,8 +54,6 @@ public class SwapMonitorController : ControllerBase
var respList = _swapMonitorService.GetSwapMonitorData();
return respList;
}

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Transactions;
using AutoMapper;
using Entity.Api.Req;
@ -28,6 +29,7 @@ public class SwapOrderController : ControllerBase
private readonly SwapOrderBatteryService swapOrderBatteryService;
private readonly SwapOrderStepService swapOrderStepService;
private readonly SwapOrderReportCloudRepository swapOrderReportCloudRepository;
private readonly VehicleService vehicleService;
public SwapOrderController(SwapOrderService swapOrderService, SwapOrderBatteryService swapOrderBatteryService,
SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository)
@ -36,6 +38,7 @@ public class SwapOrderController : ControllerBase
this.swapOrderBatteryService = swapOrderBatteryService;
this.swapOrderStepService = swapOrderStepService;
this.swapOrderReportCloudRepository = swapOrderReportCloudRepository;
}
/// <summary>
@ -355,6 +358,7 @@ public class SwapOrderController : ControllerBase
List<SwapOrderBattery> 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)

Loading…
Cancel
Save