更改全流程

master
zby 3 months ago
parent 9075071f70
commit 74e096ab98

@ -120,6 +120,36 @@ public class CommonMgr
_amtOrderRepository.Update(swapAmtOrder);
}
/// <summary>
/// 1.解锁
/// 2.更改预约单
/// </summary>
public void LockBinAndUpdateAmts(SwapOrderBatteryInfo orderBatteryInfo)
{
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap<BinInfo, BinInfo>().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
BinInfo dbBinInfo = mapperBinInfo.Map<BinInfo>(orderBatteryInfo.UpBinInfo);
dbBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.UnLock;
_binInfoRepository.Update(dbBinInfo);
if (!orderBatteryInfo.isAmt)
{
return;
}
var configAmt =
new MapperConfiguration(cfg => cfg.CreateMap<SwapAmtOrder, SwapAmtOrder>().ReverseMap());
IMapper mapperAmt = configAmt.CreateMapper();
SwapAmtOrder swapAmtOrder = mapperAmt.Map<SwapAmtOrder>(orderBatteryInfo.swapAmtOrder);
swapAmtOrder.Status = (int)InfoEnum.AmtOrderStatus.SwapFinish;
_amtOrderRepository.Update(swapAmtOrder);
}
/// 1.仓位状态:启动
/// 2.电池在位
/// 3.充电状态:不在充电中
@ -213,6 +243,12 @@ public class CommonMgr
};
}
public void ceshi()
{
}
/// <summary>
/// 放电池判断:取出来的电池仓位能不能放
/// </summary>

@ -18,6 +18,7 @@ using Service.Init;
using Service.Led;
using Service.Sound.SoundClient;
using Service.Station;
using System.Runtime.CompilerServices;
namespace Service.Execute.Step;
@ -350,4 +351,9 @@ public class CarPrepareState : IState
}
, false, () => { }, 10, InvokeStatus.None);
}
public void ceshi(SwapOrderBatteryInfo orderBatteryInfo)
{
_CommonMgr.LockBinAndUpdateAmts(orderBatteryInfo);
}
}

@ -1,11 +1,15 @@
using Autofac;
using AutoMapper;
using Entity.Attr;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using log4net;
using Repository.Station;
using Service.Charger.Client;
using Service.Execute.Api;
using Service.Execute.Model;
using Service.Execute.Model.Tbox;
using Service.Execute.SwapException;
using Service.Execute.Utils;
@ -21,7 +25,7 @@ public class DoSwappingState : IState
private readonly ILog _log = LogManager.GetLogger(typeof(DoSwappingState));
private readonly CommonMgr _CommonMgr = AppInfo.Container.Resolve<CommonMgr>();
public BinInfoRepository _binInfoRepository { get; set; }
public static SoundClient? SoundClient { get; set; }
@ -89,6 +93,8 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
return new StateResult()
{
SwappingState = SwappingState.SwapDone
@ -96,6 +102,10 @@ public class DoSwappingState : IState
}
/// <summary>
/// 控制雷达启停
/// </summary>
@ -361,7 +371,7 @@ public class DoSwappingState : IState
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
if (v==0)
{
SoundClient.SoundPlay(SoundEnum.music59);
SoundClient.SoundPlay(SoundEnum.music77);
v = 1;
}

@ -90,9 +90,6 @@ public class StationReadyState : IState
}
return new StateResult()
{
SwappingState = SwappingState.CarPrepare,
@ -214,7 +211,7 @@ public class StationReadyState : IState
return Invoker.Invoke(" BeginRead read rfid", 1000, 20, machine.IsCanceled,
() => machine.BeginRfidReadFlag, () =>
{
Task<bool> open = RfidApi.Connect();
// Task<bool> open = RfidApi.Connect();
Task<bool> beginRead = RfidApi.BeginRead();
beginRead.Wait();
if (!beginRead.Result)
@ -299,9 +296,9 @@ public class StationReadyState : IState
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine);
RfidApi.StopRead();
// RfidApi.StopRead();
_log.Info("stop read rfid");
RfidApi.DisConnect();
// RfidApi.DisConnect();
machine.RfidReadFlag = true;
}
}, () =>

@ -438,6 +438,9 @@ public class SwappingStateMachine : IDisposable
//关于仓库锁定相关重置
private void ResetOrderAmtStatus()
{
BinInfoRepository.Update(it => new BinInfo { AmtLock = 0 },
it => it.AmtLock == 1);
//仓库解锁
if (SwapOrderBatteryInfo != null)
{

@ -42,6 +42,7 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler<Batte
it =>
new BinInfo(){
Exists = 0,
ChargeStatus=2,
BatteryNo = "-1",
Soc = (decimal)-1,
Soe = (decimal)-1,
@ -50,7 +51,7 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler<Batte
it => it.No == binNo);
else
BinInfoRepository.Update(it => it.Exists == 1,
BinInfoRepository.Update(it => new BinInfo { Exists = 1 },
it => it.No == binNo);
}

@ -139,7 +139,7 @@ public enum SoundEnum
music38,//车辆高压异常,请熄火车辆
music39,//车站通讯故障,请联系站务
music41=41,//[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music41,//[Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo=1,
music42,//[Info("标签读写失败", "标签读写失败")] ErrorReadRfid ,
music43,//[Info("车辆连接失败", "车辆连接失败,请联系站务人员")] ErrorTBoxConn ,
music44,//[Info("云端校验失败", "云端校验失败,请联系站务人员")] ErrorCloudCheck ,
@ -176,7 +176,7 @@ public enum SoundEnum
music74,//开始读取标签失败
music75,
music76,
music77,
music77,//[Info(" 换电完成,请驶离")] ErrStartSwap,
music78,
music79,
music80,

@ -152,7 +152,7 @@
"enable": true
},
"swap": {
"enable": false
"enable": true
},
"task": {
"enable": false

Loading…
Cancel
Save