換點主流程測試修改

master
lxw 5 months ago
parent 87f84412d8
commit 821c6041ef

@ -1,4 +1,5 @@
using Entity.Attr;
using System.Runtime.InteropServices;
using Entity.Attr;
namespace Entity.Constant;
@ -43,6 +44,7 @@ public class InfoEnum
[Info("换电站处于本地模式,不能远程换电","换电站处于本地模式,不能远程换电")] InfoStationModelRemoteErr,
[Info("车辆驶入","车辆驶入")] CarInInfo,
}

@ -36,7 +36,7 @@ public class BinInfoRepository : BaseRepository<BinInfo>
return selectPackDto;
}
list = list.Where(i => i.ChargeStatus == 2).ToList();
list = list.Where(i => i.ChargeStatus == 2 || i.ChargeStatus==4).ToList();
if (list.Count <= 0 && cacheBinBattery == null)
{
selectPackDto.Info = InfoEnum.SelectBinStatusInfo.LessOfFinishCharging;

@ -10,7 +10,7 @@ public class TBoxApi
private static readonly ILog Log = LogManager.GetLogger(typeof(TBoxApi));
//TODO::TBox 服务地址
private static readonly string BASE_URL = "http://localhost:5034";
private static readonly string BASE_URL = "http://localhost:5036";
private static readonly HttpClient _httpClient = new HttpClient()
{

@ -277,7 +277,7 @@ public class CarPrepareState : IState
SwapAmtOrder? swapAmtOrder = _CommonMgr.QueryAmtOrder(machine);
return Invoker.Invoke("selectPack", 500, 20, machine.IsCanceled,
return Invoker.Invoke("selectPack", 1000, 10, machine.IsCanceled,
() => machine.SelectPackFlag, () =>
{
@ -294,8 +294,8 @@ public class CarPrepareState : IState
if (orderBatteryInfo.CanSwap != InfoEnum.SelectBinStatusInfo.Success)
{
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
SoundTool.PlayOneSound((int)orderBatteryInfo.CanSwap);
Thread.Sleep(1000 * 3);
_log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}");
}
else
@ -306,6 +306,11 @@ public class CarPrepareState : IState
_CommonMgr.SaveSwapBattery(machine);
machine.SelectPackFlag = true;
}
}, () => { machine.ExceptionReason = ExceptionReason.SelectPackError; });
}, () =>
{
machine.ExceptionReason = ExceptionReason.SelectPackError;
SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack);
}
,false,() => { },10,InvokeStatus.None);
}
}

@ -121,7 +121,10 @@ public class DoSwappingState : IState
//查询车辆锁止状态
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
machine.SwapOrderBatteryInfo.UpBinInfo.No);
if (startSwapping)
//查詢當前任務狀態是否被更改
var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
if (startSwapping && readPlcTaskStatus)
{
machine.SwapOrder.SwapBeginTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine);
@ -152,6 +155,7 @@ public class DoSwappingState : IState
bool holdOn = PlcApi.HoldOn();
if (holdOn)
{
machine.PlcHoldFlag = true;
}
}

@ -87,7 +87,7 @@ public class StationReadyState : IState
public InvokeStatus PlcIsAuto(SwappingStateMachine machine)
{
bool isAuto = false;
return Invoker.Invoke("check plc remote", 1000, 5, machine.IsCanceled, () => isAuto,
return Invoker.Invoke("check plc auto", 1000, 5, machine.IsCanceled, () => isAuto,
() =>
{
if (PlcApi.IsAuto())

@ -119,6 +119,7 @@ public class SwapDoneState : IState
if (!PlcApi.ExitRadar())
{
_log.Info("exist radar false");
}
else
{

@ -150,10 +150,17 @@ public class MonitorService
}
var result = PlcMgr.DistributeTask(putBinNo, removeBinNo, 2) ? Result<bool>.Success() : Result<bool>.Fail();
if (!result.IsSuccess)
{
return Result<bool>.Fail();
}
var succ = PlcMgr.HoldOn();
if (!succ)
{
return Result<bool>.Fail();
}
//如果是缓存仓 更新缓存仓的数据
if (putBin.CacheBinFlag == 1)

Loading…
Cancel
Save