缓存仓数据丢失问题

master
rszn 5 months ago
parent 3fa025a609
commit febca725f1

@ -126,7 +126,7 @@ public class DoSwappingState : IState
//查询当前是否有任务执行 //查询当前是否有任务执行
var readTaskNo = PlcMgr.PlcClient?.ReadTaskNo(); var readTaskNo = PlcMgr.PlcClient?.ReadTaskNo();
if (readTaskNo == 0 || readTaskNo==1) if (readTaskNo == 0 || readTaskNo == 1)
{ {
PlcMgr.PlcClient?.ExChangeTaskNo(1); PlcMgr.PlcClient?.ExChangeTaskNo(1);
//查询车辆锁止状态 //查询车辆锁止状态
@ -137,7 +137,6 @@ public class DoSwappingState : IState
var readPlcTaskStatus = PlcApi.ReadTaskStatus(1); var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
if (startSwapping && readPlcTaskStatus) if (startSwapping && readPlcTaskStatus)
{ {
machine.SwapOrder.SwapBeginTime = DateTime.Now; machine.SwapOrder.SwapBeginTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine); _CommonMgr.UpdateSwapOrder(machine);
machine.SwapStatus = 0; machine.SwapStatus = 0;
@ -328,15 +327,11 @@ public class DoSwappingState : IState
if (PlcApi.ReadPlcTaskStatus() == 1007) if (PlcApi.ReadPlcTaskStatus() == 1007)
{ {
if (PlcApi.ReadTaskStatusReset()) SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
{ machine.ToSafePositionFlag = true;
PlcMgr.PlcClient?.ResetTaskNo(); machine.BusinessSwappingStateUpdateTime = DateTime.Now;
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
machine.ToSafePositionFlag = true;
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
machine.SwapStatus = 1; machine.SwapStatus = 1;
}
} }
}, () => { }); }, () => { });
} }

@ -11,6 +11,7 @@ using Service.Execute.StaticTools;
using Service.Execute.SwapException; using Service.Execute.SwapException;
using Service.Execute.Utils; using Service.Execute.Utils;
using Service.Init; using Service.Init;
using Service.Plc.Client;
using Service.Station; using Service.Station;
namespace Service.Execute.Step; namespace Service.Execute.Step;
@ -54,6 +55,7 @@ public class SwapDoneState : IState
//可人工确认换电成功标识 //可人工确认换电成功标识
machine.PlcSwapFlag = true; machine.PlcSwapFlag = true;
PlcMgr.PlcClient?.ResetTaskNo();
}); });
if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success) if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success)

@ -414,11 +414,9 @@ public class SwappingStateMachine : IDisposable
//仓库解锁 //仓库解锁
if (SwapOrderBatteryInfo != null) if (SwapOrderBatteryInfo != null)
{ {
var upBinInfo = SwapOrderBatteryInfo.UpBinInfo; if (SwapOrderBatteryInfo?.UpBinInfo != null) ;
if (null != upBinInfo)
{ {
upBinInfo.AmtLock = (int)InfoEnum.AmtBatLockStatus.UnLock; BinInfoRepository.Update(i=>i.AmtLock==(int)InfoEnum.AmtBatLockStatus.UnLock,i=>i.Id==SwapOrderBatteryInfo.UpBinInfo.Id);
BinInfoRepository.Update(upBinInfo);
} }
} }

@ -216,7 +216,8 @@ public class MonitorService
InBatterySoc = putBin.Soc.ToString(), InBatterySoc = putBin.Soc.ToString(),
InBinNo = putBinNo.ToString(), InBinNo = putBinNo.ToString(),
Status = 0, Status = 0,
Type = type Type = type,
CreatedTime = DateTime.Now
}; };
moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord); moveBinRecord= MoveBinRecordRepository.Insert(moveBinRecord);

Loading…
Cancel
Save