| | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => keys.Contains(x.Id)); |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.EnableStatus = EnableEnum.Enable.ObjToInt(); |
| | | x.EnableStatus = EnableStatusEnum.Normal.ObjToInt(); |
| | | }); |
| | | Repository.UpdateData(locationInfos); |
| | | |
| | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => keys.Contains(x.Id)); |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.EnableStatus = EnableEnum.Disable.ObjToInt(); |
| | | x.EnableStatus = EnableStatusEnum.Disable.ObjToInt(); |
| | | }); |
| | | Repository.UpdateData(locationInfos); |
| | | |
| | |
| | | return LocationDisableStatus(new int[] { key }); |
| | | } |
| | | |
| | | public Dt_LocationInfo? GetLocation(string roadway) |
| | | |
| | | //ä¼ å
¥å··éå·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++) |
| | | { |
| | |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadway && x.LocationType==1);//æ¥è¯¢å··éææè´§ä½ä¿¡æ¯ |
| | | 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();//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤20åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | |
| | | |
| | | for (int i = 0; i < emptyLocations.Count; i++) |
| | | { |
| | | if (emptyLocations[i].Depth == 1)//夿æ¯å¦1æ·±è´§ä½ |
| | | { |
| | | 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æ·±è´§ä½æ¯å¦ä¸ºç©º,鲿¢åºç°åé
1深货ä½è2深货ä½ä¸ºç©ºçæ
åµ |
| | | if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = sencondDepthLocation.LocationCode }); |
| | | return sencondDepthLocation;//1深货ä½å2深货ä½é½ä¸ºç©ºçæ
åµä¸,ä¼å
åé
2æ·±è´§ä½ |
| | | } |
| | | else |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | 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 }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public Dt_LocationInfo? GetLocation2(string roadway, int Locationtype,int Startingcolumn,int Terminationcolumn) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 3).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | 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 && 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åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | |
| | | |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | //ä¼ å
¥å··éå·2 è´§æ¶ç±»å10 |
| | | public Dt_LocationInfo? GetLocation3(string roadway, int Locationtype) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | 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++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | 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();//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤20åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | |
| | | |
| | | for (int i = 0; i < emptyLocations.Count; i++) |
| | | { |
| | | if (emptyLocations[i].Depth == 1)//夿æ¯å¦1æ·±è´§ä½ |
| | | { |
| | | 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æ·±è´§ä½æ¯å¦ä¸ºç©º,鲿¢åºç°åé
1深货ä½è2深货ä½ä¸ºç©ºçæ
åµ |
| | | if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = sencondDepthLocation.LocationCode }); |
| | | return sencondDepthLocation;//1深货ä½å2深货ä½é½ä¸ºç©ºçæ
åµä¸,ä¼å
åé
2æ·±è´§ä½ |
| | | } |
| | | else |
| | | { |
| | | if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) //å¤æäºæ·±æ ä»»å¡ |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | } |
| | | 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 }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public Dt_LocationInfo? GetLocation4(string roadway, int Locationtype, int Startingcolumn, int Terminationcolumn) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | 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++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | 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 && 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åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | |
| | | |
| | | for (int i = 0; i < emptyLocations.Count; i++) |
| | | { |
| | | if (emptyLocations[i].Depth == 1)//夿æ¯å¦1æ·±è´§ä½ |
| | | { |
| | | 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æ·±è´§ä½æ¯å¦ä¸ºç©º,鲿¢åºç°åé
1深货ä½è2深货ä½ä¸ºç©ºçæ
åµ |
| | | if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = sencondDepthLocation.LocationCode }); |
| | | return sencondDepthLocation;//1深货ä½å2深货ä½é½ä¸ºç©ºçæ
åµä¸,ä¼å
åé
2æ·±è´§ä½ |
| | | } |
| | | else |
| | | { |
| | | if (sencondDepthLocation != null && sencondDepthLocation.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | locationCaches.Add(new LocationCache { DateTime = DateTime.Now, LocationCode = emptyLocations[i].LocationCode }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | } |
| | | 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 }); |
| | | return emptyLocations[i]; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public Dt_LocationInfo? GetLocationplatform(string LocationCode) |
| | | { |
| | | Dt_LocationInfo locationInfos = BaseDal.QueryFirst(x => x.LocationCode == LocationCode); |
| | |
| | | |
| | | public DateTime DateTime { get; set; } |
| | | } |
| | | |
| | | /*public WebResponseContent RetrieveStorageLocationInformation() |
| | | { |
| | | List<Dt_LocationInfo> dt_Locations = BaseDal.QueryData(); |
| | | |
| | | //è·åæååºä½æ°é(æ·±) |
| | | List<Dt_LocationInfo> Shallowlocation = dt_Locations.Where(x => x.RoadwayNo == "1" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()&& x.EnableStatus == (int)EnableStatusEnum.Normal && x.Layer <= 9 && x.Depth==1).ToList(); |
| | | List<Dt_LocationInfo> Finishedlocation = dt_Locations.Where(x => x.RoadwayNo == "1" && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()&& x.EnableStatus == (int)EnableStatusEnum.Normal && x.Layer <= 9 && x.Depth == 2).ToList(); |
| | | |
| | | //è·å14-37ååºä½æ°é |
| | | |
| | | //è·å空æåºä½æ°é |
| | | |
| | | //è·ååææåºä½æ°é |
| | | //è·åç©ºææ°é |
| | | }*/ |
| | | |
| | | public WebResponseContent RetrieveStorageLocationInformation() |
| | | { |
| | | // 1. æ¥æ¾æ·±åºä½ |
| | | List<Dt_LocationInfo> dt_Locations = BaseDal.QueryData( |
| | | x => x.RoadwayNo == "1" |
| | | && x.EnableStatus == 0 |
| | | && x.LocationStatus == 0 |
| | | && x.Depth == 2 |
| | | && x.Layer <= 9 |
| | | ); |
| | | |
| | | if (dt_Locations == null || !dt_Locations.Any()) |
| | | { |
| | | return WebResponseContent.Instance.OK(new List<string>().ToJson()); |
| | | } |
| | | |
| | | // 2. æ¥è¯¢æææµ
åºä½ |
| | | var allShallow = BaseDal.QueryData( |
| | | x => x.RoadwayNo == "1" && x.Depth == 1 |
| | | ); |
| | | |
| | | List<string> locationCodes = new List<string>(); |
| | | |
| | | if (allShallow != null) |
| | | { |
| | | // å¨å
åä¸è¿æ»¤å¹¶æåLocationCode |
| | | locationCodes = allShallow |
| | | .Where(x => |
| | | dt_Locations.Any(deep => |
| | | deep.Layer == x.Layer |
| | | && deep.RoadwayNo == x.RoadwayNo |
| | | && deep.Column == x.Column |
| | | && ((deep.Row == 1 && x.Row == 2) || (deep.Row != 1 && x.Row == 3)) |
| | | ) |
| | | && x.LocationStatus != 0 |
| | | ) |
| | | .Select(x => x.LocationCode) // åªéæ©LocationCodeåæ®µ |
| | | .ToList(); |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(locationCodes.ToJson()); |
| | | } |
| | | } |
| | | } |