缓存仓数据丢失问题

master
rszn 5 months ago
parent 3fa025a609
commit febca725f1

@ -126,7 +126,7 @@ public class DoSwappingState : IState
//查询当前是否有任务执行
var readTaskNo = PlcMgr.PlcClient?.ReadTaskNo();
if (readTaskNo == 0 || readTaskNo==1)
if (readTaskNo == 0 || readTaskNo == 1)
{
PlcMgr.PlcClient?.ExChangeTaskNo(1);
//查询车辆锁止状态
@ -137,7 +137,6 @@ public class DoSwappingState : IState
var readPlcTaskStatus = PlcApi.ReadTaskStatus(1);
if (startSwapping && readPlcTaskStatus)
{
machine.SwapOrder.SwapBeginTime = DateTime.Now;
_CommonMgr.UpdateSwapOrder(machine);
machine.SwapStatus = 0;
@ -328,15 +327,11 @@ public class DoSwappingState : IState
if (PlcApi.ReadPlcTaskStatus() == 1007)
{
if (PlcApi.ReadTaskStatusReset())
{
PlcMgr.PlcClient?.ResetTaskNo();
SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
machine.ToSafePositionFlag = true;
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.Utils;
using Service.Init;
using Service.Plc.Client;
using Service.Station;
namespace Service.Execute.Step;
@ -54,6 +55,7 @@ public class SwapDoneState : IState
//可人工确认换电成功标识
machine.PlcSwapFlag = true;
PlcMgr.PlcClient?.ResetTaskNo();
});
if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success)

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

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

Loading…
Cancel
Save