From 471300768e46b4465505419b310196c9eb1ec0bd Mon Sep 17 00:00:00 2001 From: mtf Date: Fri, 6 Nov 2026 18:43:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E4=BC=B8=E4=BD=8D?= =?UTF-8?q?=E6=BB=A1=E5=85=A5=E8=8E=B7=E5=8F=96=E4=BB=93=E4=BD=8D=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/LocationVMs/LocationVM.cs | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs index 2058143..468e6d6 100644 --- a/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs +++ b/HHWMS.Web/Areas/Configs/ViewModels/LocationVMs/LocationVM.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -520,6 +520,33 @@ namespace HHWMS.Web public ResponseResult GetMoveLocation(Location outter) { + + // 新增:单边位、单伸位直接查找空仓位 + var roadwayType = GetRoadwayType(outter.RoadWay); + if (roadwayType == 1 || roadwayType == 2) + { + var location = DC.Set() + .AsNoTracking() + .Where(l => l.RoadWay == outter.RoadWay + && l.Type == outter.Type + && l.ID != outter.ID + && !l.IsStop + && l.Status == LocationStatusEnum.未锁 + && l.ContainerStatus == LocationStatus.空仓位 + && l.RowFlag == RowFlagEnum.Outer + && l.Height >= outter.Height + && l.Code != null && l.Code != "") + .OrderBy(l => Math.Abs(outter.Line - l.Line)) + .ThenBy(l => l.Layer) + .FirstOrDefault(); + + if (location == null) + return ResponseResult.Error("找不到可用的移库仓位!"); + + return ResponseResult.Success( + new { LocationCode = location.Code }); + } + // 查找移库仓位 // 一次性获取所需的所有数据,避免多次查询数据库 var locationPairs = DC.Set()