wanshenmean
2026-02-11 75f34e9ba2e8b249c96333f3d7936c8968e12ec7
Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
@@ -153,5 +153,72 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// 获取空闲货位信息(根据巷道查询)
        /// </summary>
        /// <param name="RoadwayNo">巷道</param>
        /// <returns></returns>
        public async Task<Dt_LocationInfo?> GetLocationInfo(string RoadwayNo)
        {
            try
            {
                var locations = await BaseDal.QueryDataAsync(x => x.EnableStatus == EnableStatusEnum.Normal.GetHashCode() && x.RoadwayNo == RoadwayNo && x.LocationStatus == LocationStatusEnum.Free.GetHashCode());
                if (locations == null || locations.Count == 0)
                {
                    return null;
                }
                return locations.OrderBy(x => x.Layer).ThenBy(x => x.Depth).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
            }
            catch (Exception)
            {
                return null;
            }
        }
        /// <summary>
        /// 获取空闲货位信息(根据巷道查询)
        /// </summary>
        /// <param name="RoadwayNo">巷道</param>
        /// <returns></returns>
        public async Task<Dt_LocationInfo?> GetLocationInfo(string RoadwayNo,string locationCode)
        {
            try
            {
                var locations = await BaseDal.QueryFirstAsync(x => x.RoadwayNo == RoadwayNo && x.LocationCode == locationCode);
                if (locations == null)
                {
                    return null;
                }
                return locations;
            }
            catch (Exception)
            {
                return null;
            }
        }
        /// <summary>
        /// 更新货位信息
        /// </summary>
        /// <param name="locationInfo"></param>
        /// <returns></returns>
        public async Task<bool> UpdateLocationInfoAsync(Dt_LocationInfo locationInfo)
        {
            try
            {
                return await BaseDal.UpdateDataAsync(locationInfo);
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}