wanshenmean
2026-03-09 1181f9f764b14abd6e9f598f89f8507b4bbfad0d
Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
@@ -1,6 +1,4 @@
using SqlSugar;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
@@ -115,12 +113,10 @@
                EnableStatus = EnableStatusEnum.Normal.GetHashCode(),
                LocationStatus = LocationStatusEnum.Free.GetHashCode(),
                LocationType = LocationTypeEnum.Undefined.GetHashCode(),
                LocationCode = $"{roadwayNo}-{row:D3}-{col:D3}-{layer:D3}-{depth:D2}",
                LocationCode = $"{row:D3}-{col:D3}-{layer:D3}",  //$"{roadwayNo}-{row:D3}-{col:D3}-{layer:D3}-{depth:D2}"
                LocationName = $"{roadwayNo}巷道{row:D3}行{col:D3}列{layer:D3}层{depth:D2}深"
            };
        }
        /// <summary>
        /// 获取空闲货位信息(根据巷道查询)
@@ -134,7 +130,7 @@
            return locations?
                .OrderBy(x => x.Layer)
                .ThenBy(x => x.Depth)
                .ThenByDescending(x => x.Depth)
                .ThenBy(x => x.Column)
                .ThenBy(x => x.Row)
                .FirstOrDefault();
@@ -148,9 +144,9 @@
            return await BaseDal.QueryFirstAsync(x => x.RoadwayNo == roadwayNo && x.LocationCode == locationCode);
        }
        public async Task<Dt_LocationInfo> GetLocationInfoAsync( string locationCode)
        public async Task<Dt_LocationInfo> GetLocationInfoAsync(string locationCode)
        {
            return await BaseDal.QueryFirstAsync(x=>x.LocationCode == locationCode);
            return await BaseDal.QueryFirstAsync(x => x.LocationCode == locationCode);
        }
        /// <summary>
@@ -161,14 +157,14 @@
            return await BaseDal.UpdateDataAsync(locationInfo);
        }
        /// <summary>
        /// 检查并生成移库任务或返回出库任务
        /// </summary>
        /// <param name="locationID">任务号</param>
        /// <returns>任务对象</returns>
        public async Task<Dt_Task> TransferCheckAsync(int taskNum)
        public async Task<WebResponseContent> TransferCheckAsync(int taskNum)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                // 根据任务号获取任务
@@ -190,22 +186,21 @@
                    // 如果新的库位没有找到对应的任务
                    if (internalTransferTask == null)
                    {
                        return await HandleNoTaskAtLocation(outboundTask.SourceAddress, newLocationID, outboundTask);
                        return content.OK("获取到移库任务", await HandleNoTaskAtLocation(outboundTask.SourceAddress, newLocationID, outboundTask));
                    }
                    // 直接返回一深位出库任务
                    return internalTransferTask;
                    return content.OK("获取到一深位出库任务", internalTransferTask);
                }
                // 返回当前库位的出库任务
                return outboundTask;
                return content.OK("当前出库任务", outboundTask);
            }
            catch (Exception)
            catch (Exception ex)
            {
                return null;
                return content.Error($"发生错误:{ex.Message}");
            }
        }
        #region 移库方法
@@ -295,6 +290,5 @@
        }
        #endregion 移库方法
    }
}
}