新增plc状态检测

master
zby 2 months ago
parent 362c38834a
commit 6def413890

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

@ -33,6 +33,22 @@ public class SwapOrderDto
[ExporterHeader(DisplayName = "车辆mac", IsBold = true)] [ExporterHeader(DisplayName = "车辆mac", IsBold = true)]
public string VehicleMac { get; set; } 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> /// <summary>
/// Desc:车辆vin码 /// Desc:车辆vin码
/// Default: /// Default:

@ -116,13 +116,13 @@ public class CarPrepareState : IState
} }
} }
if (StaticStationInfo.TboxStateBreak) //if (StaticStationInfo.TboxStateBreak)
{ //{
if (status?.Break == 1) // if (status?.Break == 1)
{ // {
succCount++; // succCount++;
} // }
} //}
if (StaticStationInfo.TboxStateN) if (StaticStationInfo.TboxStateN)
{ {
@ -136,7 +136,6 @@ public class CarPrepareState : IState
if (succCount == successCount) if (succCount == successCount)
{ {
machine.VehiclesInPlaceFlag = true; machine.VehiclesInPlaceFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
machine); machine);
} }
@ -145,7 +144,8 @@ public class CarPrepareState : IState
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address06")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address06"));
//TODO::播报请熄火挂N挡拉手刹 //TODO::播报请熄火挂N挡拉手刹
SoundClient.SoundPlay(SoundEnum.music06);
// SoundClient.SoundPlay(SoundEnum.music06);
machine.ExceptionReason = ExceptionReason.CarInPositionError; machine.ExceptionReason = ExceptionReason.CarInPositionError;
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed());
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout);
@ -255,14 +255,12 @@ public class CarPrepareState : IState
}, () => { machine.ExceptionReason = ExceptionReason.LocalCheckVarError; }, true, () => }, () => { machine.ExceptionReason = ExceptionReason.LocalCheckVarError; }, true, () =>
{ {
machine.ExceptionReason = ExceptionReason.LocalCheckVarError; machine.ExceptionReason = ExceptionReason.LocalCheckVarError;
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music108); SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000); Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109); SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000); Thread.Sleep(3000);
} }
, 30, InvokeStatus.TimeOut); , 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, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine); machine);
@ -74,6 +61,24 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None); 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) 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, return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
() => { PadarMgr._PadarClient?.PadarControl(flag); }); () => { PadarMgr._PadarClient?.PadarControl(flag); });
} }
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine) public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{ {
@ -200,9 +205,13 @@ public class StationReadyState : IState
if (PadarMgr._PadarClient?.CarState == 6) if (PadarMgr._PadarClient?.CarState == 6)
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed()); if (PadarMgr._PadarClient?.CarState == 6)
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag, {
machine); LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed());
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine);
}
} }
return PadarMgr._PadarClient?.CarState == 6; return PadarMgr._PadarClient?.CarState == 6;
@ -225,6 +234,7 @@ public class StationReadyState : IState
SoundClient.SoundPlay(SoundEnum.music100); SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(3000); Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music101); SoundClient.SoundPlay(SoundEnum.music101);
Thread.Sleep(3000);
che = 1; che = 1;
} }

@ -192,19 +192,18 @@ public class SwapDoneState : IState
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
//查询车辆锁止状态 //查询车辆锁止状态
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)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag, //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine); // machine);
var SoundClient = AppInfo.Container.Resolve<SoundClient>(); var SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music77); SoundClient.SoundPlay(SoundEnum.music77);
Thread.Sleep(4000); Thread.Sleep(4000);
SoundClient.SoundPlay(SoundEnum.music76); SoundClient.SoundPlay(SoundEnum.music76);
Thread.Sleep(3000);
machine.BoxCarInfoModel = carInfo.Result; machine.BoxCarInfoModel = carInfo.Result;
SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success

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

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

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

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Transactions; using System.Transactions;
using AutoMapper; using AutoMapper;
using Entity.Api.Req; using Entity.Api.Req;
@ -28,6 +29,7 @@ public class SwapOrderController : ControllerBase
private readonly SwapOrderBatteryService swapOrderBatteryService; private readonly SwapOrderBatteryService swapOrderBatteryService;
private readonly SwapOrderStepService swapOrderStepService; private readonly SwapOrderStepService swapOrderStepService;
private readonly SwapOrderReportCloudRepository swapOrderReportCloudRepository; private readonly SwapOrderReportCloudRepository swapOrderReportCloudRepository;
private readonly VehicleService vehicleService;
public SwapOrderController(SwapOrderService swapOrderService, SwapOrderBatteryService swapOrderBatteryService, public SwapOrderController(SwapOrderService swapOrderService, SwapOrderBatteryService swapOrderBatteryService,
SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository) SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository)
@ -36,6 +38,7 @@ public class SwapOrderController : ControllerBase
this.swapOrderBatteryService = swapOrderBatteryService; this.swapOrderBatteryService = swapOrderBatteryService;
this.swapOrderStepService = swapOrderStepService; this.swapOrderStepService = swapOrderStepService;
this.swapOrderReportCloudRepository = swapOrderReportCloudRepository; this.swapOrderReportCloudRepository = swapOrderReportCloudRepository;
} }
/// <summary> /// <summary>
@ -355,6 +358,7 @@ public class SwapOrderController : ControllerBase
List<SwapOrderBattery> batteryList = List<SwapOrderBattery> batteryList =
swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn)); swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
// 根据语言设置不同的映射配置 // 根据语言设置不同的映射配置
var config = new MapperConfiguration(cfg => var config = new MapperConfiguration(cfg =>
{ {
@ -375,6 +379,7 @@ public class SwapOrderController : ControllerBase
if (language == "en") if (language == "en")
{ {
SwapOrderDto2 dto = list2[i]; SwapOrderDto2 dto = list2[i];
SwapOrderBatteryResp? swapOrderBatteryResp = SwapOrderBatteryResp? swapOrderBatteryResp =
swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn);
if (swapOrderBatteryResp != null) if (swapOrderBatteryResp != null)

Loading…
Cancel
Save