xianchang ceshi xiugai

master
lxw 6 months ago
parent 511939126a
commit fe82b0cdbb

@ -36,7 +36,7 @@ namespace Entity.Api.Req
/// Default:0 /// Default:0
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
public int CmdStatus { get; set; } public int? CmdStatus { get; set; }
/// <summary> /// <summary>
/// Desc:充电机编号 /// Desc:充电机编号
@ -55,12 +55,12 @@ namespace Entity.Api.Req
/// 0站内充电 1站外充电 /// 0站内充电 1站外充电
/// </summary> /// </summary>
public int ChargeMode { get; set; } public int? ChargeMode { get; set; }
/// <summary> /// <summary>
/// 1站控启动 2本地启动 /// 1站控启动 2本地启动
/// </summary> /// </summary>
public int StartMode { get; set; } public int? StartMode { get; set; }
/// <summary> /// <summary>
/// Desc:充电开始时间 /// Desc:充电开始时间
@ -89,7 +89,7 @@ namespace Entity.Api.Req
/// Default:0 /// Default:0
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
public int StopReason { get; set; } public int? StopReason { get; set; }
/// <summary> /// <summary>
/// Desc:电价版本号 /// Desc:电价版本号
@ -110,7 +110,7 @@ namespace Entity.Api.Req
/// Default:0 /// Default:0
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
public int CloudReportStatus { get; set; } public int? CloudReportStatus { get; set; }
/// <summary> /// <summary>

@ -21,7 +21,7 @@ public class InfoEnum
[Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar , [Info("解锁车辆失败", "解锁车辆失败")] ErrUnLockCar ,
[Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack , [Info("选包失败,请驶离", "选包失败,请驶离")] ErrorSelectPack ,
[Info("通道拍照定位失败,请重新调整车辆位置", "通道拍照定位失败,请重新调整车辆位置")]ErrChannelStatus, [Info("通道拍照定位失败,请在三分钟内重新调整车辆位置", "通道拍照定位失败,请在三分钟内重新调整车辆位置")]ErrChannelStatus,
[Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack , [Info("电池拆卸中,请稍后", "电池拆卸中,请稍后")] InfoUnPack ,
@ -47,7 +47,10 @@ public class InfoEnum
[Info("换电任务启动","换电任务启动")] StartSwapInfo, [Info("换电任务启动","换电任务启动")] StartSwapInfo,
[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo, [Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
[Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap, [Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap,
[Info("即将进行消防移仓,请车辆驶离","即将进行消防移仓,请车辆驶离")] InfoFireRemoveLabel,
[Info("电池移仓中","电池移仓中")] InfoBatteryMove, [Info("电池移仓中","电池移仓中")] InfoBatteryMove,
[Info("消防移仓中","消防移仓中")] InfoFireRemove,
[Info("拍照失败,请在三分钟内挪车","拍照失败,请在三分钟内挪车")] ErrChannel1020,
} }

@ -39,7 +39,7 @@ public class CloudClientMgr
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>(); RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>(); BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) => /*redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
{ {
try try
{ {
@ -83,7 +83,7 @@ public class CloudClientMgr
ot = 0xFF, ot = 0xFF,
bt = DateTime.Now bt = DateTime.Now
}; };
CloudClient?.SendChargeDevDataInfo(req); CloudClient?.SendChargeDevDataInfo(req);
} }
} }
} }
@ -91,6 +91,6 @@ public class CloudClientMgr
{ {
Log.Info("error", e); Log.Info("error", e);
} }
}); });*/
} }
} }

@ -19,15 +19,16 @@ public abstract class CloudApi
/// </summary> /// </summary>
/// <param name="rfidReadModel"></param> /// <param name="rfidReadModel"></param>
/// <returns></returns> /// <returns></returns>
public static VehicleCertificationResp VehicleCheck(RfidReadModel rfidReadModel, SwapOrder swapOrder) public static int VehicleCheck(RfidReadModel rfidReadModel, SwapOrder swapOrder)
{ {
VehicleCertification vehicleCertification = new() VehicleCertification vehicleCertification = new()
{ {
ty = 1, ty = 2,
rfid=rfidReadModel.VelVin,
cn = rfidReadModel.VelNo, cn = rfidReadModel.VelNo,
vi = rfidReadModel.VelVin, vi = rfidReadModel.VelVin,
mac = rfidReadModel.VelMac, // mac = rfidReadModel.VelMac,
en = 0, en = 0,
dt = swapOrder.VehicleEnterTime, dt = swapOrder.VehicleEnterTime,
mode = 0, mode = 0,
@ -36,13 +37,13 @@ public abstract class CloudApi
CloudClientMgr.CloudClient?.SendVehicleCertification(vehicleCertification, CloudClientMgr.CloudClient?.SendVehicleCertification(vehicleCertification,
global::System.TimeSpan.FromSeconds(TimeSpan)); global::System.TimeSpan.FromSeconds(TimeSpan));
return sendVehicleCertification;
/*if (sendVehicleCertification == null) if (sendVehicleCertification == null)
{ {
return -1; return -1;
} }
return sendVehicleCertification.re;*/ return sendVehicleCertification.re;
} }
/// <summary> /// <summary>
@ -56,8 +57,9 @@ public abstract class CloudApi
{ {
UploadSwapOrder uploadSwapOrder = new() UploadSwapOrder uploadSwapOrder = new()
{ {
rfid=swapOrder.VehicleVin,
sn=StaticStationInfo.StationNo, sn=StaticStationInfo.StationNo,
son = swapOrder.Sn, son = swapOrder.CloudSn,
cn = swapOrder.VehicleNo, cn = swapOrder.VehicleNo,
so = seq, so = seq,
ct = swapOrder.VehicleEnterTime, ct = swapOrder.VehicleEnterTime,
@ -65,7 +67,7 @@ public abstract class CloudApi
dbid = swapOrderBattery.UpBatteryNo, dbid = swapOrderBattery.UpBatteryNo,
deno = swapOrderBattery.UpBatteryBinNo, deno = swapOrderBattery.UpBatteryBinNo,
dsoc = swapOrderBattery.UpBatterySoc.ToInt(), dsoc = swapOrderBattery.UpBatterySoc.ToInt(),
dsoe = swapOrderBattery.UpBatterySoe.ToInt(), // dsoe = swapOrderBattery.UpBatterySoe.ToInt(),
et = swapOrder.SwapEndTime, et = swapOrder.SwapEndTime,
od = 0, od = 0,
ot = swapOrder.VehicleLeaveTime, ot = swapOrder.VehicleLeaveTime,
@ -75,7 +77,7 @@ public abstract class CloudApi
ubid = swapOrderBattery.DownBatteryNo, ubid = swapOrderBattery.DownBatteryNo,
ueno = swapOrderBattery.DownBatteryBinNo, ueno = swapOrderBattery.DownBatteryBinNo,
usoc = swapOrderBattery.DownBatterySoc.ToInt(), usoc = swapOrderBattery.DownBatterySoc.ToInt(),
usoe = swapOrderBattery.DownBatterySoe.ToInt(), // usoe = swapOrderBattery.DownBatterySoe.ToInt(),
vin = swapOrder.VehicleVin, vin = swapOrder.VehicleVin,
wt = new TimeSpan((swapOrder.SwapEndTime.ToDateTime().Ticks - swapOrder.SwapBeginTime.ToDateTime().Ticks)) wt = new TimeSpan((swapOrder.SwapEndTime.ToDateTime().Ticks - swapOrder.SwapBeginTime.ToDateTime().Ticks))
.TotalSeconds.ToInt(), .TotalSeconds.ToInt(),

@ -68,9 +68,9 @@ public class PlcApi
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
public static bool WriteEntranceLamp(int data) public static bool WriteEntranceLamp(ushort data)
{ {
return PlcMgr.WriteEntranceLamp((byte)data); return PlcMgr.WriteEntranceLamp(data);
} }
/// <summary> /// <summary>
@ -80,7 +80,7 @@ public class PlcApi
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
public static bool WriteExistLamp(int data) public static bool WriteExistLamp(ushort data)
{ {
return PlcMgr.WriteExistLamp(data); return PlcMgr.WriteExistLamp(data);
} }

@ -18,6 +18,15 @@ public class RfidApi
public static async Task<bool> BeginRead() public static async Task<bool> BeginRead()
{ {
var disConnect =await DisConnect();
//断连
var connect = await Connect();
if (!connect)
{
Log.Info("Rfid connect fail");
return false;
}
Log.Info("BeginRead"); Log.Info("BeginRead");
string url = BASE_URL + "/Api/BeginRead"; string url = BASE_URL + "/Api/BeginRead";
try try
@ -90,18 +99,14 @@ public class RfidApi
public static async Task<RfidReadModel?> ReadRifd() public static async Task<RfidReadModel?> ReadRifd()
{ {
//断连
var connect = await Connect();
if (!connect)
{
Log.Info("Rfid connect fail");
return null;
}
Log.Info("ReadRifd"); Log.Info("ReadRifd");
string readUrl = BASE_URL + "/Api/BeginRead";
string url = BASE_URL + "/Api/ReadRfidData"; string url = BASE_URL + "/Api/ReadRfidData";
try try
{ {
var vBeginRead = await _httpClient.GetStringAsync(readUrl);
string s = await _httpClient.GetStringAsync(url); string s = await _httpClient.GetStringAsync(url);
Log.Info($"ReadRifd resp={s}"); Log.Info($"ReadRifd resp={s}");
if (s != String.Empty) if (s != String.Empty)

@ -47,6 +47,7 @@ public class CommonMgr
/// <returns></returns> /// <returns></returns>
public SwapOrder SaveOrder(SwapOrder swapOrder) public SwapOrder SaveOrder(SwapOrder swapOrder)
{ {
swapOrder.CloudReportStatus = 0;
_swapOrderRepository.Insert(swapOrder); _swapOrderRepository.Insert(swapOrder);
return swapOrder; return swapOrder;
} }

@ -51,11 +51,12 @@ public class CarCtrlState : IState
() => machine.VelUnlockFlag, () => () => machine.VelUnlockFlag, () =>
{ {
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin); Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {
//查询车辆锁止状态 //查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo); Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var resultHeartBeatMsg = carInfo.Result.HeartBeatMsg; var resultHeartBeatMsg = carInfo.Result.HeartBeatMsg;
if (resultHeartBeatMsg.LockStatus == 1 || resultHeartBeatMsg.LockStatus==0) if (resultHeartBeatMsg.LockStatus == 1 || resultHeartBeatMsg.LockStatus==0)
{ {

@ -40,11 +40,11 @@ public class CarPrepareState : IState
} }
//云平台车辆认证 //云平台车辆认证
/*var cloudCheckVel = CloudCheckVel(machine); var cloudCheckVel = CloudCheckVel(machine);
if (cloudCheckVel != InvokeStatus.Done) if (cloudCheckVel != InvokeStatus.Done)
{ {
return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None);
}*/ }
//检查tbox链接状态 //检查tbox链接状态
InvokeStatus checkTBoxConnect = CheckTBoxConnectFlag(machine); InvokeStatus checkTBoxConnect = CheckTBoxConnectFlag(machine);
@ -62,7 +62,7 @@ public class CarPrepareState : IState
//云端数据上报 //云端数据上报
// InvokeStatus cloudTBox = CloudTBoxFlag(machine); // InvokeStatus cloudTBox = CloudTBoxFlag(machine);
/*if (cloudTBox != InvokeStatus.Done) /*if (cloudTBox != InvokeStatus.Done)
{ {
return SwappingStateMachine.ReturnWithInvokeErr(cloudTBox, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(cloudTBox, ExceptionReason.None);
@ -109,16 +109,16 @@ public class CarPrepareState : IState
//写入口等 :红灯 //写入口等 :红灯
if (PlcApi.WriteEntranceLamp(1020)) if (PlcApi.WriteEntranceLamp(1020))
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoCarInPosition); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoCarInPosition);
machine.VehiclesInPlaceFlag = true; machine.VehiclesInPlaceFlag = true;
//告知云平台换电准备完成 //告知云平台换电准备完成
machine.BusinessSwappingForCloudState = machine.BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.SwapReady; InfoEnum.BusinessSwappingForCloudState.SwapReady;
machine.ExceptionReason = ExceptionReason.None; machine.ExceptionReason = ExceptionReason.None;
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
//清除下发的指令,等待新的指令 //清除下发的指令,等待新的指令
// CloudApi.ClearCarCanStartInfo(); // CloudApi.ClearCarCanStartInfo();
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
machine); machine);
@ -127,7 +127,7 @@ public class CarPrepareState : IState
}, () => }, () =>
{ {
machine.ExceptionReason = ExceptionReason.CarInPositionError; machine.ExceptionReason = ExceptionReason.CarInPositionError;
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCarInPositionTimeout.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCarInPositionTimeout);
}, false, () => { } }, false, () => { }
, 20, InvokeStatus.None); , 20, InvokeStatus.None);
@ -143,37 +143,29 @@ public class CarPrepareState : IState
return Invoker.Invoke("cloud check vehicle", 500, 20, machine.IsCanceled, return Invoker.Invoke("cloud check vehicle", 500, 20, machine.IsCanceled,
() => machine.CloudVelCheckFlag, () => () => machine.CloudVelCheckFlag, () =>
{ {
if (BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>( int vehicleCheck = -1;
StaticStationInfo.StationModel) == StationConstant.StationModel.Remote) vehicleCheck= CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
{
int vehicleCheck = -1;
//CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
if (vehicleCheck != 0)
{
_log.Info("cloud check vehicle error");
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
}
else
{
machine.ExceptionReason = ExceptionReason.None;
_log.Info("cloud check vehicle done");
machine.CloudVelCheckFlag = true;
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
//TODO:: if (vehicleCheck != 0)
// machine.SwapOrder.CloudSn= {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag, _log.Info("cloud check vehicle error");
machine); // machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
}
} }
else else
{ {
machine.ExceptionReason = ExceptionReason.None;
_log.Info("cloud check vehicle done");
machine.CloudVelCheckFlag = true; machine.CloudVelCheckFlag = true;
// machine.LedTool?.WriteProgramContent("换电准备中:云平台车辆验证完成");
//TODO::
// machine.SwapOrder.CloudSn=
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine);
} }
}, () => }, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCloudCheck); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorCloudCheck);
}, false, () => { machine.ExceptionReason = ExceptionReason.CloudCheckError; } }, false, () => { machine.ExceptionReason = ExceptionReason.CloudCheckError; }
, 20, InvokeStatus.None); , 20, InvokeStatus.None);
@ -195,12 +187,14 @@ public class CarPrepareState : IState
{ {
machine.BoxConnectFlag = true; machine.BoxConnectFlag = true;
} }
}, () => { machine.ExceptionReason = ExceptionReason.ConnTBoxError; }, () =>
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);}, false, () => {
machine.ExceptionReason = ExceptionReason.ConnTBoxError;
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () =>
{ {
machine.ExceptionReason = ExceptionReason.ConnTBoxError; machine.ExceptionReason = ExceptionReason.ConnTBoxError;
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
} }
, 20, InvokeStatus.None); , 20, InvokeStatus.None);
} }
@ -217,8 +211,8 @@ public class CarPrepareState : IState
{ {
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var tBoxCarInfoModel = carInfo.Result; var tBoxCarInfoModel = carInfo.Result;
//TODO::不知道Tbox给的CardNo是什么
if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelNo.Trim())) if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelVin.Trim()))
{ {
machine.BoxLocalCheckFlag = true; machine.BoxLocalCheckFlag = true;
machine.BoxCarInfoModel = tBoxCarInfoModel; machine.BoxCarInfoModel = tBoxCarInfoModel;
@ -248,17 +242,14 @@ public class CarPrepareState : IState
if (tBoxCarInfoModel.Connected) if (tBoxCarInfoModel.Connected)
{ {
//将数据上报云平台 //将数据上报云平台
// CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel); // CloudApi.UploadTBoxCarInfo(machine.SwapOrder!, machine.BoxCarInfoModel);
} }
} }
}, () => }, () =>
{ {
// machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员"); // machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员");
// SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack); // SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack);
}, false, () => }, false, () => { machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError; }
{
machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError;
}
, 20, InvokeStatus.None); , 20, InvokeStatus.None);
} }
@ -295,9 +286,9 @@ public class CarPrepareState : IState
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success) if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
_log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}"); _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}");
} }
else else
@ -310,9 +301,9 @@ public class CarPrepareState : IState
} }
}, () => }, () =>
{ {
machine.ExceptionReason = ExceptionReason.SelectPackError; machine.ExceptionReason = ExceptionReason.SelectPackError;
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack);
} }
,false,() => { },10,InvokeStatus.None); , false, () => { }, 10, InvokeStatus.None);
} }
} }

@ -366,7 +366,7 @@ public class DoSwappingState : IState
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed()); // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrChannelStatus.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrChannelStatus);
//等待2分钟 //等待2分钟
Thread.Sleep(60000); Thread.Sleep(3*60 *1000);
machine.VehiclesInPlace2Flag = false; machine.VehiclesInPlace2Flag = false;
machine.StartSwappingFlag = false; machine.StartSwappingFlag = false;
machine.PlcHoldFlag = false; machine.PlcHoldFlag = false;

@ -151,7 +151,7 @@ public class StationReadyState : IState
public InvokeStatus BeginRead(SwappingStateMachine machine) public InvokeStatus BeginRead(SwappingStateMachine machine)
{ {
return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled, return Invoker.Invoke(" BeginRead read rfid", 1000, 20, machine.IsCanceled,
() => machine.BeginRfidReadFlag, () => () => machine.BeginRfidReadFlag, () =>
{ {
Task<bool> beginRead = RfidApi.BeginRead(); Task<bool> beginRead = RfidApi.BeginRead();
@ -171,7 +171,7 @@ public class StationReadyState : IState
// machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); // machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
}, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; } }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }
, 3, InvokeStatus.TimeOut); , 3, InvokeStatus.None);
} }
/// <summary> /// <summary>
@ -205,14 +205,17 @@ public class StationReadyState : IState
private InvokeStatus ReadRfid(SwappingStateMachine machine) private InvokeStatus ReadRfid(SwappingStateMachine machine)
{ {
//开始读rifd //开始读rifd
return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled, return Invoker.Invoke("read rfid", 3000, 20, machine.IsCanceled,
() => machine.RfidReadFlag, () => () => machine.RfidReadFlag, () =>
{ {
Task<RfidReadModel?> rfidReadModel = RfidApi.ReadRifd(); Task<RfidReadModel?> rfidReadModel = RfidApi.ReadRifd();
rfidReadModel.Wait(); rfidReadModel.Wait();
if ( /*rfidReadModel.IsCompletedSuccessfully &&*/ rfidReadModel.Result != null) var machineRfidReadModel = rfidReadModel.Result;
if ( rfidReadModel.IsCompletedSuccessfully && machineRfidReadModel != null && machineRfidReadModel.Result==1)
{ {
machine.RfidReadModel = rfidReadModel.Result; machine.RfidReadModel = machineRfidReadModel;
_log.Info($"read rfid={JsonConvert.SerializeObject(machine.RfidReadModel)}"); _log.Info($"read rfid={JsonConvert.SerializeObject(machine.RfidReadModel)}");
machine.ExceptionReason = ExceptionReason.None; machine.ExceptionReason = ExceptionReason.None;
@ -237,8 +240,8 @@ public class StationReadyState : IState
{ {
// machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); // machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
}, true, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10, }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10,
InvokeStatus.Exception); InvokeStatus.None);
} }

@ -45,6 +45,7 @@ public class PlcTaskMgr
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoBatteryMove); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoBatteryMove);
}else if (taskNo == 5) }else if (taskNo == 5)
{ {
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoFireRemove);
} }
}, true, () => { } }, true, () => { }
, 5, InvokeStatus.Exception); , 5, InvokeStatus.Exception);

@ -68,7 +68,7 @@ public class SwapOrderMgr
{ {
//更新换下电池包 //更新换下电池包
binInfosMap.TryGetValue(swapOrderBattery.DownBatteryBinNo.ToString(), out BinInfo info); binInfosMap.TryGetValue(swapOrderBattery.DownBatteryBinNo.ToString(), out BinInfo info);
if (info.BatteryNo == null || info.BatteryNo == "") if (info.BatteryNo == null || info.BatteryNo == "" || info.BatteryNo=="-1")
{ {
continue; continue;
} }

@ -43,7 +43,7 @@ public class PlcMgr
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static bool WriteEntranceLamp(byte value) public static bool WriteEntranceLamp(ushort value)
{ {
if (PlcClient != null) if (PlcClient != null)
{ {

@ -52,31 +52,15 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.BatteryNo == chargeOrder.BatteryNo; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.BatteryNo == chargeOrder.BatteryNo;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
} }
if (chargeOrder.CmdStatus!=0)
{
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CmdStatus == chargeOrder.CmdStatus;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
}
if (!string.IsNullOrEmpty(chargeOrder.ChargerNo)) if (!string.IsNullOrEmpty(chargeOrder.ChargerNo))
{ {
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargerNo == chargeOrder.ChargerNo; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargerNo == chargeOrder.ChargerNo;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
} }
if (!string.IsNullOrEmpty(chargeOrder.ChargerGunNo))
{
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargerGunNo == chargeOrder.ChargerGunNo;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
}
if (chargeOrder.ChargeMode != 0)
{
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargeMode == chargeOrder.ChargeMode;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
}
if (chargeOrder.StartMode!=0)
{
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StartMode == chargeOrder.StartMode;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
}
if (chargeOrder.StartTime != null && chargeOrder.StartTime != DateTime.MinValue) if (chargeOrder.StartTime != null && chargeOrder.StartTime != DateTime.MinValue)
{ {
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StartTime == chargeOrder.StartTime; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StartTime == chargeOrder.StartTime;
@ -87,12 +71,12 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.EndTime == chargeOrder.EndTime; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.EndTime == chargeOrder.EndTime;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
} }
if (chargeOrder.ChargeTimeCount!=0) if (chargeOrder.ChargeTimeCount!=null)
{ {
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargeTimeCount == chargeOrder.ChargeTimeCount; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.ChargeTimeCount == chargeOrder.ChargeTimeCount;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
} }
if (chargeOrder.StopReason != 0) if (chargeOrder.StopReason != null)
{ {
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StopReason == chargeOrder.StopReason; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.StopReason == chargeOrder.StopReason;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
@ -107,7 +91,7 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.SwapOrderSn == chargeOrder.SwapOrderSn; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.SwapOrderSn == chargeOrder.SwapOrderSn;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);
} }
if (chargeOrder.CloudReportStatus != 0) if (chargeOrder.CloudReportStatus != null)
{ {
Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CloudReportStatus == chargeOrder.CloudReportStatus; Expression<Func<ChargeOrder, bool>> condition2Expr = u => u.CloudReportStatus == chargeOrder.CloudReportStatus;
where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); where = where == null ? condition2Expr : Expression.Lambda<Func<ChargeOrder, bool>>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter);

@ -226,25 +226,13 @@ public class SwapMonitorController : ControllerBase
[HttpGet("GetCarList")] [HttpGet("GetCarList")]
public async Task<Result<List<TboxCarInfoModel>>> GetCarList() public async Task<Result<List<TboxCarInfoModel>>> GetCarList()
{ {
/*var carInfoList = await TBoxApi.GetCarInfoList(); var carInfoList = await TBoxApi.GetCarInfoList();
if (carInfoList == null || carInfoList.Count <= 0) if (carInfoList == null || carInfoList.Count <= 0)
{ {
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>()); return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>());
} }
return Result<List<TboxCarInfoModel>>.Success(carInfoList);*/ return Result<List<TboxCarInfoModel>>.Success(carInfoList);
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>()
{
new TboxCarInfoModel()
{
Connected = true,
CarNo = "carNo1",
},
new TboxCarInfoModel()
{
Connected = true,
CarNo = "carNo2",
}
});
} }
} }

@ -42,6 +42,7 @@ public class GenController : ControllerBase
Console.WriteLine("生成完毕"); Console.WriteLine("生成完毕");
} }
/*
[HttpGet("CloudTestVelCheck")] [HttpGet("CloudTestVelCheck")]
public Result<VehicleCertificationResp> CloudTestVelCheck() public Result<VehicleCertificationResp> CloudTestVelCheck()
{ {
@ -55,7 +56,7 @@ public class GenController : ControllerBase
VehicleEnterTime = DateTime.Now VehicleEnterTime = DateTime.Now
}); });
return Result<VehicleCertificationResp>.Success(vehicleCertificationResp); return Result<VehicleCertificationResp>.Success(vehicleCertificationResp);
} }*/
[HttpGet("test115")] [HttpGet("test115")]
public void Test115() public void Test115()

Loading…
Cancel
Save