diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index 204eadf..ba29432 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -165,8 +165,10 @@ public class CommonMgr { List list = _binInfoRepository.QueryListByClause(i => + i.CacheBinFlag==0 && i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock && i.Exists == 0); + if (list.Count <= 0) { orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin; @@ -206,7 +208,30 @@ public class CommonMgr { _amtOrderRepository.Update(machine.SwapOrderBatteryInfo.swapAmtOrder); } - - + + /// + /// 换电成功关于binInfo表的处理 + /// + public void UpdateBinInfoForSwapSuccess(SwappingStateMachine machine) + { + SwapOrderBatteryInfo? machineSwapOrderBatteryInfo = machine.SwapOrderBatteryInfo; + + if (machineSwapOrderBatteryInfo != null) + { + var inBinInfo = machineSwapOrderBatteryInfo.InBinInfo; + inBinInfo.Soc = -1; + inBinInfo.Soe = -1; + inBinInfo.BatteryNo = "-1"; + _binInfoRepository.Update(inBinInfo); + + var upBinInfo = machineSwapOrderBatteryInfo.UpBinInfo; + upBinInfo.Soc = -1; + upBinInfo.Soe = -1; + upBinInfo.BatteryNo = "-1"; + _binInfoRepository.Update(upBinInfo); + } + } + + } \ No newline at end of file diff --git a/Service/Execute/Model/SwapOrderBatteryInfo.cs b/Service/Execute/Model/SwapOrderBatteryInfo.cs index a9ab377..0535fc0 100644 --- a/Service/Execute/Model/SwapOrderBatteryInfo.cs +++ b/Service/Execute/Model/SwapOrderBatteryInfo.cs @@ -13,5 +13,8 @@ public class SwapOrderBatteryInfo public InfoEnum.SelectBinStatusInfo CanSwap; public BinInfo UpBinInfo; + /// + /// downBinNo + /// public BinInfo InBinInfo; } \ No newline at end of file diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index caa9d98..c4e34c4 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -175,7 +175,9 @@ public class DoSwappingState : IState // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoUnPack.GetLed()); SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); - if (PlcApi.ReadPlcTaskStatus() == 1002) + int status = PlcApi.ReadPlcTaskStatus(); + //处理程序太快,plc还没有初始值的状态 + if (status==1002 || status!=1003) { SoundTool.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); } @@ -184,8 +186,6 @@ public class DoSwappingState : IState machine.UnOldBatteryFlag = true; } - - if (machine.UnOldBatteryFlag) { _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag, diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index cf329bd..f88b64b 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -56,6 +56,9 @@ public class SwapDoneState : IState return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None); } + //换电成功关于bininfo表的更新 + _CommonMgr.UpdateBinInfoForSwapSuccess(machine); + return new StateResult() { SwappingState = SwappingState.StationReady @@ -111,7 +114,6 @@ public class SwapDoneState : IState return Invoker.Invoke("wait exist radar", 1000, 5, machine.IsCanceled, () => machine.RadarOutFlag, () => { - //TODO::邏輯更改 if (!PlcApi.ExitRadar()) { _log.Info("exist radar false"); diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index f9a12d7..1ef202b 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -113,7 +113,6 @@ public class MonitorService public Result SwapAndChargingCount() { - SwapAndChargingCountResp chargingCountResp = new() { ChargeTodayCount = ChargeOrderRepository.GetCount(i => DateUtils.IsDateTimeToday(i.EndTime)), @@ -157,18 +156,30 @@ public class MonitorService } //如果是缓存仓 更新缓存仓的数据 - if (putBinNo == 1) + if (putBin.CacheBinFlag == 1) { putBin.Exists = 1; + putBin.BatteryNo = removeBin.BatteryNo; putBin.Soc = removeBin.Soc; putBin.Soe = removeBin.Soe; putBin.Soh = removeBin.Soh; BinInfoRepository.Update(putBin); } + if (removeBin.CacheBinFlag == 1) + { + removeBin.Exists = 0; + removeBin.BatteryNo = "-1"; + removeBin.Soc = -1; + removeBin.Soe = -1; + removeBin.Soh = -1; + BinInfoRepository.Update(removeBin); + } + return Result.Success(); } + public Result> GetChargeBinOption() { List queryListByClause = BinInfoRepository.Query(); diff --git a/WebStarter/obj/Debug/net6.0/staticwebassets.build.json b/WebStarter/obj/Debug/net6.0/staticwebassets.build.json index 6f60ec1..4271680 100644 --- a/WebStarter/obj/Debug/net6.0/staticwebassets.build.json +++ b/WebStarter/obj/Debug/net6.0/staticwebassets.build.json @@ -1,6 +1,6 @@ { "Version": 1, - "Hash": "LS9utnIO5mfHvtDI6/Yvv5jVnmRGtwfQUGBjyueTZQE=", + "Hash": "kIfehZk8TWWy62IgCKeVJMphEP8JJ0AGeTvs9NqLTfU=", "Source": "WebStarter", "BasePath": "_content/WebStarter", "Mode": "Default", @@ -10,17 +10,17 @@ { "Name": "WebStarter\\wwwroot", "Source": "WebStarter", - "ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", + "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\", "BasePath": "_content/WebStarter", "Pattern": "**" } ], "Assets": [ { - "Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240523\\0.jpg", + "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240523\\0.jpg", "SourceId": "WebStarter", "SourceType": "Discovered", - "ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", + "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\", "BasePath": "_content/WebStarter", "RelativePath": "20240523/0.jpg", "AssetKind": "All", @@ -36,10 +36,10 @@ "OriginalItemSpec": "wwwroot\\20240523\\0.jpg" }, { - "Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240524\\0.jpg", + "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.jpg", "SourceId": "WebStarter", "SourceType": "Discovered", - "ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", + "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\", "BasePath": "_content/WebStarter", "RelativePath": "20240524/0.jpg", "AssetKind": "All", @@ -55,10 +55,10 @@ "OriginalItemSpec": "wwwroot\\20240524\\0.jpg" }, { - "Identity": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\20240524\\0.png", + "Identity": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.png", "SourceId": "WebStarter", "SourceType": "Discovered", - "ContentRoot": "C:\\Users\\Administrator\\Desktop\\01主服务\\01主服务\\WebStarter\\wwwroot\\", + "ContentRoot": "D:\\lxw\\work\\pro\\c#\\hn_back_main\\WebStarter\\wwwroot\\", "BasePath": "_content/WebStarter", "RelativePath": "20240524/0.png", "AssetKind": "All",