From 36419e8b246a4d1846a97afc2d1dbed8729ced84 Mon Sep 17 00:00:00 2001 From: lxw Date: Fri, 14 Jun 2024 09:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A5=E4=BB=93=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/DbModel/Station/BinInfo.cs | 10 ++++++++-- Service/Execute/Mgr/CommonMgr.cs | 28 ++++++++++++++-------------- Service/MyTask/BatteryMoveTask.cs | 7 ------- Service/Station/MonitorService.cs | 10 +++++++--- WebStarter/db/lxw0607.sql | 5 ++++- 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs index e78c5fb..f6f3a84 100644 --- a/Entity/DbModel/Station/BinInfo.cs +++ b/Entity/DbModel/Station/BinInfo.cs @@ -165,7 +165,7 @@ namespace Entity.DbModel.Station [SugarColumn(ColumnName = "status")] public int? Status { get; set; } - + /// /// Desc:最后结束充电时间 结束充电后更新 /// Default: @@ -174,7 +174,6 @@ namespace Entity.DbModel.Station [SugarColumn(ColumnName = "last_charge_finish_time")] public DateTime? LastChargeFinishTime { get; set; } - /// /// 缓存仓标记 0:不是 1:是 @@ -193,5 +192,12 @@ namespace Entity.DbModel.Station /// [SugarColumn(ColumnName = "can_charge_flag")] public int? CanChargeFlag { get; set; } + + + /// + /// 电池入仓时间 + /// + [SugarColumn(ColumnName = "int_time")] + public DateTime? InTime { get; set; } } } \ No newline at end of file diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index 5a95fa2..3528001 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -21,7 +21,7 @@ public class CommonMgr public BinInfoRepository _binInfoRepository { get; set; } public SwapAmtOrderRepository _amtOrderRepository { get; set; } public SwapOrderBatteryRepository _swapOrderBatteryRepository { get; set; } - + public SwapOrderReportCloudRepository _swapOrderReportCloudRepository { get; set; } /// @@ -50,8 +50,8 @@ public class CommonMgr swapOrder.SwapWay = (int)StationConstant.StationWay.Auto; swapOrder.CloudReportStatus = 0; swapOrder.SwapWay = 1; - swapOrder.CreatedTime=DateTime.Now; - _swapOrderRepository.Insert(swapOrder); + swapOrder.CreatedTime = DateTime.Now; + _swapOrderRepository.Insert(swapOrder); return swapOrder; } @@ -69,7 +69,7 @@ public class CommonMgr UpBatteryBinNo = int.Parse(UpBin.No), DownBatteryBinNo = int.Parse(InBin.No), }; - swapOrderBattery= _swapOrderBatteryRepository.Insert(swapOrderBattery); + swapOrderBattery = _swapOrderBatteryRepository.Insert(swapOrderBattery); } /// @@ -171,10 +171,10 @@ public class CommonMgr { List list = _binInfoRepository.QueryListByClause(i => - i.CacheBinFlag==0 && + i.CacheBinFlag == 0 && i.Status == 1 && i.AmtLock == (int)InfoEnum.AmtBatLockStatus.UnLock - && i.Exists == 0); - + && i.Exists == 0); + if (list.Count <= 0) { orderBatteryInfo.CanSwap = InfoEnum.SelectBinStatusInfo.LessOfEmptyBin; @@ -205,7 +205,7 @@ public class CommonMgr { _swapOrderRepository.Update(machine.SwapOrder); } - + /// /// 更新预约订单 /// @@ -230,21 +230,22 @@ public class CommonMgr inBinInfo.Soe = -1; inBinInfo.BatteryNo = "-1"; //修改入仓顺序 - BinInfo binInfo = _binInfoRepository.QueryListByClause(i=>i.BatteryEnterSeq!=null,"battery_enter_seq desc").First(); + BinInfo binInfo = _binInfoRepository + .QueryListByClause(i => i.BatteryEnterSeq != null, "battery_enter_seq desc").First(); inBinInfo.BatteryEnterSeq = binInfo.BatteryEnterSeq + 1; + inBinInfo.InTime = DateTime.Now; _binInfoRepository.Update(inBinInfo); - + + var upBinInfo = machineSwapOrderBatteryInfo.UpBinInfo; upBinInfo.Soc = -1; upBinInfo.Soe = -1; upBinInfo.BatteryNo = "-1"; _binInfoRepository.Update(upBinInfo); } - - } - + /// /// 换电完成新增上报云平台记录 /// @@ -260,5 +261,4 @@ public class CommonMgr Vin = machineSwapOrder.VehicleVin }); } - } \ No newline at end of file diff --git a/Service/MyTask/BatteryMoveTask.cs b/Service/MyTask/BatteryMoveTask.cs index 2662d2e..e787f6d 100644 --- a/Service/MyTask/BatteryMoveTask.cs +++ b/Service/MyTask/BatteryMoveTask.cs @@ -64,13 +64,6 @@ public class BatteryMoveTask : ITask //查询人物状态 if (success.IsSuccess) { - bool readPlcTaskStatus9000 = false; - while (!readPlcTaskStatus9000) - { - Thread.Sleep(1000); - readPlcTaskStatus9000 = PlcMgr.ReadPlcTaskStatus() == 9000; - } - Log.Info($"execute BatteryMoveTask success from binNo ={binInfo.No}"); } } diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index b9aa2e9..818fff7 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -32,7 +32,7 @@ public class MonitorService var configBinInfo = new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap()); IMapper mapperBinInfo = configBinInfo.CreateMapper(); - + List stateInfoList = mapperBinInfo.Map>(StationSoftMgr.SwappingStateMachine.StepModel); @@ -198,9 +198,12 @@ public class MonitorService putBin.Soc = removeBin.Soc; putBin.Soe = removeBin.Soe; putBin.Soh = removeBin.Soh; + putBin.BatteryEnterSeq = removeBin.BatteryEnterSeq; + putBin.InTime = removeBin.InTime; BinInfoRepository.Update(putBin); } + if (removeBin.CacheBinFlag == 1) { removeBin.Exists = 0; @@ -208,12 +211,13 @@ public class MonitorService removeBin.Soc = -1; removeBin.Soe = -1; removeBin.Soh = -1; - BinInfoRepository.Update(removeBin); } - return Result.Success(); + removeBin.BatteryEnterSeq = 0; + BinInfoRepository.Update(removeBin); + return Result.Success(); } diff --git a/WebStarter/db/lxw0607.sql b/WebStarter/db/lxw0607.sql index be36973..240c92a 100644 --- a/WebStarter/db/lxw0607.sql +++ b/WebStarter/db/lxw0607.sql @@ -41,4 +41,7 @@ CREATE TABLE `emeter_energy_change` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='电表小时'; -- 添加换电类型 -ALTER TABLE swap_order_report_cloud ADD `upload_time` datetime DEFAULT NULL COMMENT "上报时间" ; \ No newline at end of file +ALTER TABLE swap_order_report_cloud ADD `upload_time` datetime DEFAULT NULL COMMENT "上报时间" ; + +-- 添加入仓时间 +ALTER TABLE bin_info ADD `in_time` datetime DEFAULT NULL COMMENT "入仓时间" ;