hutongqing
2024-12-23 a7f9f1c44f6a1201061e12dbb4c5424f4b44737c
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -45,6 +45,28 @@
            };
        }
        public bool LittleDepthLocationIsEmpty(Dt_LocationInfo locationInfo, PalletTypeEnum palletType)
        {
            Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == locationInfo.WarehouseId);
            if (warehouse == null)
            {
                throw new Exception($"未找到仓库信息");
            }
            return warehouse.WarehouseName switch
            {
                "板材仓" => false,
                "PP仓" => false,
                "干膜仓" => false,
                "测试架仓" => LittleDepthLocationIsEmpty_CSJ(locationInfo, palletType),
                "阻焊仓" => false,
                "油墨仓" => true,
                "成品仓" => true,
                "辅料仓" => true,
                _ => throw new Exception($"未找到仓库货位分配方法")
            };
        }
        private readonly static object _locker = new object();
        private static List<LocationCache> locationCaches = new List<LocationCache>();
        /// <summary>
@@ -146,7 +168,7 @@
        /// <param name="locationInfos"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        private List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location)
        public List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location)
        {
            List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location };
            int maxDepth = locationInfos.Max(x => x.Depth);
@@ -169,6 +191,37 @@
            }
            return groupLocations;
        }
        /// <summary>
        /// èŽ·å–ä¸åŒæ·±åº¦çš„åŒç»„è´§ä½ä¿¡æ¯
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public List<Dt_LocationInfo> GetGroupLocations(Dt_LocationInfo location)
        {
            List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo && x.WarehouseId == location.WarehouseId);
            List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location };
            int maxDepth = locationInfos.Max(x => x.Depth);
            for (int j = location.Depth + 1; j <= maxDepth; j++)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
                }
            }
            for (int j = location.Depth - 1; j >= 1; j--)
            {
                Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer);
                if (locationInfo != null)
                {
                    groupLocations.Add(locationInfo);
                }
            }
            return groupLocations;
        }
    }
}