From 74e096ab9801f9d6ade478312bdb6206fc2cfb53 Mon Sep 17 00:00:00 2001
From: zby <24947@USER>
Date: Wed, 4 Sep 2024 14:39:11 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=85=A8=E6=B5=81=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Service/Execute/Mgr/CommonMgr.cs | 36 +++++++++++++++++++
Service/Execute/Step/CarPrepareState.cs | 6 ++++
Service/Execute/Step/DoSwappingState.cs | 14 ++++++--
Service/Execute/Step/StationReadyState.cs | 9 ++---
Service/Execute/SwappingStateMachine.cs | 3 ++
.../BatteryStatusReportedReqHandler.cs | 5 +--
Service/Sound/SoundClient/SoundClient.cs | 6 ++--
WebStarter/appsettings.dev.json | 2 +-
8 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs
index e177da4..5407947 100644
--- a/Service/Execute/Mgr/CommonMgr.cs
+++ b/Service/Execute/Mgr/CommonMgr.cs
@@ -120,6 +120,36 @@ public class CommonMgr
_amtOrderRepository.Update(swapAmtOrder);
}
+
+ ///
+ /// 1.解锁
+ /// 2.更改预约单
+ ///
+ public void LockBinAndUpdateAmts(SwapOrderBatteryInfo orderBatteryInfo)
+ {
+ var configBinInfo =
+ new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap());
+ IMapper mapperBinInfo = configBinInfo.CreateMapper();
+ BinInfo dbBinInfo = mapperBinInfo.Map(orderBatteryInfo.UpBinInfo);
+
+ dbBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.UnLock;
+ _binInfoRepository.Update(dbBinInfo);
+ if (!orderBatteryInfo.isAmt)
+ {
+ return;
+ }
+
+ var configAmt =
+ new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap());
+ IMapper mapperAmt = configAmt.CreateMapper();
+ SwapAmtOrder swapAmtOrder = mapperAmt.Map(orderBatteryInfo.swapAmtOrder);
+ swapAmtOrder.Status = (int)InfoEnum.AmtOrderStatus.SwapFinish;
+ _amtOrderRepository.Update(swapAmtOrder);
+ }
+
+
+
+
/// 1.仓位状态:启动
/// 2.电池在位
/// 3.充电状态:不在充电中
@@ -213,6 +243,12 @@ public class CommonMgr
};
}
+ public void ceshi()
+ {
+
+ }
+
+
///
/// 放电池判断:取出来的电池仓位能不能放
///
diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs
index 1089a67..ab4588a 100644
--- a/Service/Execute/Step/CarPrepareState.cs
+++ b/Service/Execute/Step/CarPrepareState.cs
@@ -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);
+ }
}
diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs
index 46da3a0..f855db1 100644
--- a/Service/Execute/Step/DoSwappingState.cs
+++ b/Service/Execute/Step/DoSwappingState.cs
@@ -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();
-
+ 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
}
+
+
+
+
///
/// 控制雷达启停
///
@@ -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;
}
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index e5af31c..5916521 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -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 open = RfidApi.Connect();
+ // Task open = RfidApi.Connect();
Task 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;
}
}, () =>
diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs
index eac0185..89ae4c4 100644
--- a/Service/Execute/SwappingStateMachine.cs
+++ b/Service/Execute/SwappingStateMachine.cs
@@ -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)
{
diff --git a/Service/Plc/Handler/BatteryStatusReportedReqHandler.cs b/Service/Plc/Handler/BatteryStatusReportedReqHandler.cs
index af24c4e..e918605 100644
--- a/Service/Plc/Handler/BatteryStatusReportedReqHandler.cs
+++ b/Service/Plc/Handler/BatteryStatusReportedReqHandler.cs
@@ -42,6 +42,7 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler
new BinInfo(){
Exists = 0,
+ ChargeStatus=2,
BatteryNo = "-1",
Soc = (decimal)-1,
Soe = (decimal)-1,
@@ -49,8 +50,8 @@ public class BatteryStatusReportedReqHandler : SimpleChannelInboundHandler it.No == binNo);
else
-
- BinInfoRepository.Update(it => it.Exists == 1,
+
+ BinInfoRepository.Update(it => new BinInfo { Exists = 1 },
it => it.No == binNo);
}
diff --git a/Service/Sound/SoundClient/SoundClient.cs b/Service/Sound/SoundClient/SoundClient.cs
index 6bb0a15..053dd0a 100644
--- a/Service/Sound/SoundClient/SoundClient.cs
+++ b/Service/Sound/SoundClient/SoundClient.cs
@@ -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 ,
@@ -169,14 +169,14 @@ public enum SoundEnum
music68,//[Info("换电任务启动","换电任务启动")] StartSwapInfo,
music69,//[Info("航车拍照中,请稍后","航车拍照中,请稍后")] CarTakePhotoInfo,
music70,//[Info("启动换电失败,请联系站务人员","启动换电失败,请联系站务人员")] ErrStartSwap,
-
+
music71,//即将进行消防移仓,请通道车辆驶离
music72,//电池移仓中//
music73,//消防移仓中
music74,//开始读取标签失败
music75,
music76,
- music77,
+ music77,//[Info(" 换电完成,请驶离")] ErrStartSwap,
music78,
music79,
music80,
diff --git a/WebStarter/appsettings.dev.json b/WebStarter/appsettings.dev.json
index 036c366..79dc59b 100644
--- a/WebStarter/appsettings.dev.json
+++ b/WebStarter/appsettings.dev.json
@@ -152,7 +152,7 @@
"enable": true
},
"swap": {
- "enable": false
+ "enable": true
},
"task": {
"enable": false