Revert "修改全流程等"

This reverts commit 53c75f1c14.
master
zby 3 months ago
parent b0f84fcc6b
commit 365f7a9bf1

@ -58,7 +58,6 @@ public class InfoEnum
[Info("前进","前进")] advance,//34
[Info("后退", "后退")] Backoff,
[Info("停好了", "停好了")] Itparked,
[Info("退出重新停车", "退出重新停车")] upcar,
}

@ -103,11 +103,11 @@ public class RfidApi
Log.Info("RfidApi ReadRfid");
// string readUrl = BASE_URL + "/Api/BeginRead";
string readUrl = BASE_URL + "/Api/BeginRead";
string url = BASE_URL + "/Api/ReadRfidData";
try
{
// var vBeginRead = await _httpClient.GetStringAsync(readUrl);
var vBeginRead = await _httpClient.GetStringAsync(readUrl);
string s = await _httpClient.GetStringAsync(url);
Log.Info($"ReadRfid resp={s}");
if (s != String.Empty)

@ -91,22 +91,12 @@ public class CarCtrlState : IState
// SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrUnLockCar);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrUnLockCar.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
}, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError;
if (b == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music104);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music105);
Thread.Sleep(3000);
if (b == 0) {
SoundClient.SoundPlay(SoundEnum.music48);
b = 1;
}
}
}, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError; }
, 10, InvokeStatus.None);
}
}

@ -7,7 +7,6 @@ using Entity.Dto;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using log4net;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Repository.Station;
using Service.Execute.Api;
using Service.Execute.Model;
@ -162,7 +161,6 @@ public class CarPrepareState : IState
/// <returns></returns>
public InvokeStatus CheckTBoxConnectFlag(SwappingStateMachine machine)
{
int t = 0;
return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () =>
{
@ -173,31 +171,16 @@ public class CarPrepareState : IState
machine.BoxConnectFlag = true;
}
}, () =>
{
if (t==0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music103);
Thread.Sleep(3000);
}
SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () =>
{
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
if (t == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music102);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music103);
Thread.Sleep(3000);
}
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError;
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorTBoxConn.GetLed());
@ -256,7 +239,6 @@ public class CarPrepareState : IState
/// <returns></returns>
public InvokeStatus CheckTBoxVelLocalFlag(SwappingStateMachine machine)
{
int q = 0;
return Invoker.Invoke("check TBox VelLocal", 1000, 20, machine.IsCanceled,
() => machine.BoxLocalCheckFlag, () =>
{
@ -265,22 +247,12 @@ public class CarPrepareState : IState
if (tBoxCarInfoModel.CarNo!.Trim().Equals(machine.RfidReadModel!.VelVin.Trim()))
{
machine.BoxLocalCheckFlag = true;
machine.BoxCarInfoModel = tBoxCarInfoModel;
}
}, () => { machine.ExceptionReason = ExceptionReason.LocalCheckVarError; }, true, () =>
{
machine.ExceptionReason = ExceptionReason.LocalCheckVarError;
if (q == 0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music108);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music109);
Thread.Sleep(3000);
q = 1;
}
}
, 3, InvokeStatus.TimeOut);
}
@ -332,7 +304,6 @@ public class CarPrepareState : IState
/// <param name="machine"></param>
public InvokeStatus SelectPack(SwappingStateMachine machine)
{
int e = 0;
SwapAmtOrder? swapAmtOrder = _CommonMgr.QueryAmtOrder(machine);
@ -356,17 +327,7 @@ public class CarPrepareState : IState
LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorSelectPack.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
if (e==0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music106);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music107);
Thread.Sleep(3000);
e = 1;
}
SoundClient.SoundPlay(SoundEnum.music49);
// _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}");
@ -385,12 +346,7 @@ public class CarPrepareState : IState
machine.ExceptionReason = ExceptionReason.SelectPackError;
SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address09"));
if (e == 0)
{
SoundClient.SoundPlay(SoundEnum.music49);
e = 1;
}
// SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorSelectPack);
}
, false, () => { }, 10, InvokeStatus.None);

@ -144,7 +144,13 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
}
//车辆离开
var adjustCarByRadar = AdjustCarByRadar(machine);
machine.Reset();
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
@ -198,7 +204,29 @@ public class DoSwappingState : IState
//}
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled,
() =>
{
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine);
var carState = PadarMgr._PadarClient?.CarState;
return carState.HasValue && (carState.Value == 1 || carState.Value == 2 || carState.Value == 3 || carState.Value == 4 || carState.Value == 5);
},
() =>
{
switch (PadarMgr._PadarClient?.CarState)
{
case 6:
_log.Info("车辆未驶离");
break;
}
});
}
/// <summary>
/// 下发plc启动换电
@ -216,7 +244,17 @@ public class DoSwappingState : IState
{
var startSwapping = PlcApi.StartSwapping(machine.SwapOrderBatteryInfo.InBinInfo.No,
machine.SwapOrderBatteryInfo.UpBinInfo.No);
if (c==0)
{
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
machine);
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music91);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music90);
}
//查詢當前任務狀態是否被更改
if (startSwapping)
@ -280,7 +318,6 @@ public class DoSwappingState : IState
if(i==0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music51);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
i = 1;
@ -401,14 +438,16 @@ public class DoSwappingState : IState
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
if (v == 0)
{
SoundClient.SoundPlay(SoundEnum.music76);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music77);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine);
SoundClient.SoundPlay(SoundEnum.music77);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music76);
v = 1;
}
//断连Tbox

@ -190,7 +190,8 @@ public class StationReadyState : IState
/// <returns></returns>
public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
{
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine);
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
() => { PadarMgr._PadarClient?.PadarControl(flag); });
@ -201,7 +202,6 @@ public class StationReadyState : IState
public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine)
{
int che = 0;
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled,
() =>
@ -210,8 +210,6 @@ public class StationReadyState : IState
if (PadarMgr._PadarClient?.CarState==6)
{
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed());
}
@ -229,16 +227,6 @@ public class StationReadyState : IState
break;
case 3:
_log.Info("radar 角度偏移过大");
SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address25"));
if (che == 0)
{
LedClient.SendMsgByKey(InfoEnum.SwapInfo.upcar.GetLed());
SoundClient.SoundPlay(SoundEnum.music100);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music101);
che = 1;
}
break;
case 4:
_log.Info("radar 车辆靠后");
@ -315,12 +303,10 @@ public class StationReadyState : IState
private InvokeStatus ReadRfid(SwappingStateMachine machine)
{
int e = 0;
//开始读rifd
return Invoker.Invoke("read rfid", 3000, 20, machine.IsCanceled,
() => machine.RfidReadFlag,() =>
() => machine.RfidReadFlag, () =>
{
Task<RfidReadModel?> rfidReadModel = RfidApi.ReadRfid();
rfidReadModel.Wait();
var machineRfidReadModel = rfidReadModel.Result;
@ -360,12 +346,7 @@ public class StationReadyState : IState
machine.LedTool!.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address02"));
if (e == 0)
{
SoundClient.SoundPlay(SoundEnum.music42);
e = 1;
}
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
//LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
}, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10,

@ -57,16 +57,16 @@ public class SwapDoneState : IState
});
//if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success)
//{
// //上传云平台换电状态
// // machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel;
// // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
//}
if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success)
{
//上传云平台换电状态
// machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel;
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
}
////云平台没有匹配的失败状态
////车辆上锁 ,提示请驶离
InvokeStatus lockCar = LockCar(machine);
//InvokeStatus lockCar = LockCar(machine);
//if (lockCar != InvokeStatus.Done)
//{
@ -75,18 +75,6 @@ public class SwapDoneState : IState
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed());
//车辆离开
var adjustCarByRadar = AdjustCarByRadar(machine);
machine.Reset();
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
//出口雷达监测
//InvokeStatus existRadar = ExistRadar(machine);
//if (existRadar != InvokeStatus.Done)

@ -1,7 +1,6 @@
using System.Net.Sockets;
using HybirdFrameworkCore.Utils;
using log4net;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace Service.Led;
@ -93,7 +92,6 @@ public class LedClient
{"后退",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6E,0x64,0x75,0x72,0x00,0x00,0x0D,0x0A, }},
{"停好了",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x49,0x74,0x75,0x20,0x64,0x69,0x70,0x61,0x72,0x6B,0x69,0x72,0x00,0x00,0x0D,0x0A,}},
{"退出重新停车",new byte[]{ 0x55, 0xAA, 0x00, 0x00, 0x01, 0x01, 0x00, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x21, 0x00, 0x25, 0x64, 0x69, 0x73, 0x70, 0x30, 0x3B, 0x3A, 0x4B, 0x65, 0x6C, 0x75, 0x61, 0x72, 0x20, 0x64, 0x61, 0x6E, 0x20, 0x70, 0x61, 0x72, 0x6B, 0x69, 0x72, 0x20, 0x6B, 0x65, 0x6D, 0x62, 0x61, 0x6C, 0x69, 0x00, 0x00, 0x0D, 0x0A, }},
};
#endregion
@ -107,17 +105,10 @@ public class LedClient
{
_ip = ip;
_port = port;
InitClient();
// Connect();
Connect();
return _socket.Connected;
}
public static void InitClient()
{
Task.Run(Connect);
}
private static void Connect()
{
Log.Info($"begin connect {_ip}:{_port}");
@ -129,8 +120,7 @@ public class LedClient
public static bool InnerSend(byte[] bytes)
{
InitClient();
// Connect();
Connect();
if (_socket?.Connected ?? true)
{
_socket?.Send(bytes);

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

@ -193,17 +193,6 @@ public enum SoundEnum
music91,//[Info("换电开始印尼")] ErrStartSwap,
music92,//[Info(" 解锁成功中")] ErrStartSwap,
music93,//[Info(" 解锁成功印尼")] ErrStartSwap,
music100,//[Info(" 车辆停放不到位印尼")] ErrStartSwap,
music101,//[Info(" 车辆停放不到位")] ErrStartSwap,
music102,//[Info(" 正在等待车辆连接印尼")] ErrStartSwap,
music103,//[Info(" 正在等待车辆连接")] ErrStartSwap,
music104,//[Info(" 解锁失败印尼")] ErrStartSwap,
music105,//[Info(" 解锁失败")] ErrStartSwap,
music106,//[Info(" 选包失败印尼")] ErrStartSwap,
music107,//[Info(" 选包失败")] ErrStartSwap,
music108,//[Info(" 车辆验证失败印尼")] ErrStartSwap,
music109,//[Info(" 车辆验证失败")] ErrStartSwap,
/*

@ -22,14 +22,11 @@ public class UpsClient: ModbusTcpMaster
public EquipAlarmRecordRepository _equipAlarmRecordRepository=AppInfo.Container.Resolve<EquipAlarmRecordRepository>();
public EquipAlarmProcessRecordRepository _equipAlarmProcessRecordRepository=AppInfo.Container.Resolve<EquipAlarmProcessRecordRepository>();
public UpsClient()
{
ReadAction = BatchRead;
Ip = "192.168.3.100";
Port = 44;
Port = 23;
Duration = 1000;
AutoReConnect = true;
ByteSeq = EndingConst.ByteSeq.BA;

@ -186,7 +186,6 @@ if (AppSettingsHelper.GetBool("padar", "enable"))
}
if (AppSettingsHelper.GetBool("led", "enable"))
{
LedClient.Init(AppSettingsHelper.GetContent("led", "ip"), Convert.ToInt32(AppSettingsHelper.GetContent("led", "port")));
@ -205,9 +204,6 @@ if (AppSettingsHelper.GetBool("swap", "enable"))
AppInfo.Container = app.Services.GetAutofacRoot();
//ClientMgr.InitClient();
//UpsMgr.UpsInit();
//ups
if (AppSettingsHelper.GetBool("ups", "enable"))
{

@ -143,7 +143,7 @@
"Enabled": false
},
"led": {
"enable": false,
"enable": true,
"ip": "192.168.3.79",
"port": 10000
}

Loading…
Cancel
Save