huanghongfeng
10 小时以前 b7f53ba61fbc1844d7b92ff852762b140d46ab54
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
@@ -82,11 +82,13 @@
            return LocationDisableStatus(new int[] { key });
        }
        //传入巷道号2   è´§æž¶ç±»åž‹10
        public Dt_LocationInfo? GetLocation(string roadway,int Locationtype)
        {
            lock (_locker)
            {
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//查询添加静态变量超过5分钟的货位
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 20).ToList();//查询添加静态变量超过20分钟的货位
                int count = removeItems.Count;
                for (int i = 0; i < count; i++)
                {
@@ -95,10 +97,10 @@
                List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList();
                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway  && x.LocationType == Locationtype);//查询巷道所有货位信息
                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway  && x.LocationType == Locationtype && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode));//查询巷道所有货位信息
                
                List<Dt_LocationInfo> emptyLocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()  && !lockLocations.Contains(x.LocationCode)).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenByDescending(x => x.Depth).ThenBy(x => x.Row).ToList();//查询空货位信息并排除5分钟内分配的货位,根据层、列、深度、行排序
                List<Dt_LocationInfo> emptyLocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()  && !lockLocations.Contains(x.LocationCode)).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenByDescending(x => x.Depth).ThenBy(x => x.Row).ToList();//查询空货位信息并排除20分钟内分配的货位,根据层、列、深度、行排序
                for (int i = 0; i < emptyLocations.Count; i++)
@@ -120,6 +122,7 @@
                    else
                    {
                        Dt_LocationInfo? sencondDepthLocation = locationInfos.FirstOrDefault(x => Math.Abs(x.Row - emptyLocations[i].Row) == 1 && x.Layer == emptyLocations[i].Layer && x.Column == emptyLocations[i].Column);//查询2深货位对应的1深货位是否为空
                        if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt())
                        {
                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
@@ -136,7 +139,7 @@
        {
            lock (_locker)
            {
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//查询添加静态变量超过5分钟的货位
                List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 20).ToList();//查询添加静态变量超过5分钟的货位
                int count = removeItems.Count;
                for (int i = 0; i < count; i++)
                {
@@ -145,7 +148,7 @@
                List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList();
                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway && x.LocationType == Locationtype && x.Column> Startingcolumn && x.Column< Terminationcolumn);//查询巷道所有货位信息
                List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway && x.LocationType == Locationtype && x.Column> Startingcolumn && x.Column< Terminationcolumn && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode));//查询巷道所有货位信息
                List<Dt_LocationInfo> emptyLocations = locationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode)).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenByDescending(x => x.Depth).ThenBy(x => x.Row).ToList();//查询空货位信息并排除5分钟内分配的货位,根据层、列、深度、行排序
@@ -163,12 +166,9 @@
                        }
                        else
                        {
                            if(sencondDepthLocation != null && (sencondDepthLocation.LocationStatus == LocationStatusEnum.InStock.ObjToInt() || sencondDepthLocation.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()))
                            {
                                locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
                                return emptyLocations[i];
                            }
                            locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode });
                            return emptyLocations[i];
                        }
                    }
                    else