xianchang ceshi xiugai

zw
lxw 6 months ago
parent 511939126a
commit fe82b0cdbb

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

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

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

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

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

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

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

@ -51,11 +51,12 @@ public class CarCtrlState : IState
() => machine.VelUnlockFlag, () =>
{
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result;
if (unLock)
{
//查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo);
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var resultHeartBeatMsg = carInfo.Result.HeartBeatMsg;
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)
{
return SwappingStateMachine.ReturnWithInvokeErr(cloudCheckVel, ExceptionReason.None);
}*/
}
//检查tbox链接状态
InvokeStatus checkTBoxConnect = CheckTBoxConnectFlag(machine);
@ -142,12 +142,9 @@ public class CarPrepareState : IState
{
return Invoker.Invoke("cloud check vehicle", 500, 20, machine.IsCanceled,
() => machine.CloudVelCheckFlag, () =>
{
if (BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
StaticStationInfo.StationModel) == StationConstant.StationModel.Remote)
{
int vehicleCheck = -1;
//CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
vehicleCheck= CloudApi.VehicleCheck(machine.RfidReadModel, machine.SwapOrder);
if (vehicleCheck != 0)
{
@ -166,11 +163,6 @@ public class CarPrepareState : IState
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine);
}
}
else
{
machine.CloudVelCheckFlag = true;
}
}, () =>
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorCloudCheck.GetLed());
@ -195,12 +187,14 @@ public class CarPrepareState : IState
{
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.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
}
, 20, InvokeStatus.None);
}
@ -217,8 +211,8 @@ public class CarPrepareState : IState
{
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
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.BoxCarInfoModel = tBoxCarInfoModel;
@ -255,10 +249,7 @@ public class CarPrepareState : IState
{
// machine.LedTool?.WriteProgramContent("车辆电池数据上报异常,请联系站务人员");
// SoundTool.PlayOneSound(InfoEnum.SwapInfo.ErrorSelectPack);
}, false, () =>
{
machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError;
}
}, false, () => { machine.ExceptionReason = ExceptionReason.CloudCarDataUploadError; }
, 20, InvokeStatus.None);
}

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

@ -151,7 +151,7 @@ public class StationReadyState : IState
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, () =>
{
Task<bool> beginRead = RfidApi.BeginRead();
@ -171,7 +171,7 @@ public class StationReadyState : IState
// machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
}, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }
, 3, InvokeStatus.TimeOut);
, 3, InvokeStatus.None);
}
/// <summary>
@ -205,14 +205,17 @@ public class StationReadyState : IState
private InvokeStatus ReadRfid(SwappingStateMachine machine)
{
//开始读rifd
return Invoker.Invoke("read rfid", 1000, 20, machine.IsCanceled,
return Invoker.Invoke("read rfid", 3000, 20, machine.IsCanceled,
() => machine.RfidReadFlag, () =>
{
Task<RfidReadModel?> rfidReadModel = RfidApi.ReadRifd();
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)}");
machine.ExceptionReason = ExceptionReason.None;
@ -237,8 +240,8 @@ public class StationReadyState : IState
{
// machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
}, true, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10,
InvokeStatus.Exception);
}, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10,
InvokeStatus.None);
}

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

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

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

@ -52,31 +52,15 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
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);
}
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))
{
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);
}
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)
{
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;
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;
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;
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;
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;
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")]
public async Task<Result<List<TboxCarInfoModel>>> GetCarList()
{
/*var carInfoList = await TBoxApi.GetCarInfoList();
var carInfoList = await TBoxApi.GetCarInfoList();
if (carInfoList == null || carInfoList.Count <= 0)
{
return Result<List<TboxCarInfoModel>>.Success(new List<TboxCarInfoModel>());
}
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",
}
});
return Result<List<TboxCarInfoModel>>.Success(carInfoList);
}
}

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

Loading…
Cancel
Save