| | |
| | | /// </summary> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation(int locationType) |
| | | { |
| | | if (locationType <= 0) |
| | | { |
| | | throw new ArgumentOutOfRangeException("ä»åºåºåé误ï¼"); |
| | | } |
| | | lock (_locker) |
| | | { |
| | | |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > locationCacheTime).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.RoadwayNo),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | var first = BaseDal.QueryFirst(x => x.LocationType == locationType && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | if (first != null) |
| | | { |
| | | locationCaches.Add(new LocationCache { LocationCode = first?.LocationCode, DateTime = DateTime.Now }); |
| | | } |
| | | |
| | | return first; |
| | | } |
| | | } |
| | | public Dt_LocationInfo? AssignLocation() |
| | | { |
| | | lock (_locker) |
| | |
| | | return first; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯åºåºè´§ä½ç¼å· |
| | | /// </summary> |