| | |
| | | using SqlSugar; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | |
| | | private Dt_LocationInfo StoredAssignLocation(string roadway) |
| | | { |
| | | List<LocationGroupDTO> locationGroups = BaseDal.GetLocationGroups(roadway, LocationStatusEnum.Free, LocationStatusEnum.InStock); |
| | | if (locationGroups != null) |
| | | { |
| | | LocationGroupDTO? locationGroup = locationGroups.FirstOrDefault(x => x.EnableStatusA == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = locationGroup?.IdA ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | locationGroups = BaseDal.GetLocationGroups(roadway, LocationStatusEnum.Free, LocationStatusEnum.Free); |
| | | if (locationGroups != null && locationGroups.Count > 0) |
| | | { |
| | | LocationGroupDTO? locationGroup = locationGroups.FirstOrDefault(x => x.EnableStatusB == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = locationGroup?.IdB ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | //List<LocationGroupDTO> locationGroups = BaseDal.GetLocationGroups(roadway, LocationStatusEnum.Free, LocationStatusEnum.InStock); |
| | | //if (locationGroups != null) |
| | | //{ |
| | | // LocationGroupDTO? locationGroup = locationGroups.FirstOrDefault(x => x.EnableStatusA == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = locationGroup?.IdA ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | //locationGroups = BaseDal.GetLocationGroups(roadway, LocationStatusEnum.Free, LocationStatusEnum.Free); |
| | | //if (locationGroups != null && locationGroups.Count > 0) |
| | | //{ |
| | | // LocationGroupDTO? locationGroup = locationGroups.FirstOrDefault(x => x.EnableStatusB == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = locationGroup?.IdB ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | |
| | | return BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.RoadwayNo == roadway), _emptyAssignOrderBy); |
| | | return BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() || x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.RoadwayNo == roadway), _emptyAssignOrderBy); |
| | | } |
| | | |
| | | public Dt_LocationInfo AdjacentDepthLocation(string locationCode) |
| | |
| | | { |
| | | return BaseDal.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo && x.Column == locationInfo.Column && x.Layer == locationInfo.Layer && x.Depth != locationInfo.Depth && x.Row != locationInfo.Row && (SqlFunc.Abs(x.Row - locationInfo.Row) == 1)); |
| | | } |
| | | |
| | | public WebResponseContent GetPosition(string position) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_LocationInfo locationInfo = BaseDal.QueryFirst(x => x.LocationCode == position); |
| | | if (locationInfo == null) throw new Exception("æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | //åé
ç©¿æ¢è½¦ç§»åºå°å |
| | | var locationInfos = BaseDal.QueryData(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && x.LocationCode != locationInfo.LocationCode);//éæ ¹æ®å
¥åºé»è¾æ¹å¨ |
| | | var location = locationInfos.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | //if (location != null) content.OK(message: location.LocationCode, data: location); |
| | | if (location != null) content.OK(location.LocationCode); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |