| | |
| | | |
| | | private readonly Dictionary<string, OrderByType> _emptyAssignOrderBy = new() |
| | | { |
| | | { nameof(Dt_CachePoint.Depth), OrderByType.Desc }, |
| | | { nameof(Dt_CachePoint.Column), OrderByType.Asc }, |
| | | { nameof(Dt_CachePoint.Row), OrderByType.Asc }, |
| | | }; |
| | | |
| | | public Dt_CachePoint? AssignCachePoint(int areaId) |
| | | { |
| | | List<CachePointGroupDTO> cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.Free); |
| | | if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | { |
| | | CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusB == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = pointGroupDTO?.IdB ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.Free, LocationStatusEnum.Free); |
| | | if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | { |
| | | CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusA == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = pointGroupDTO?.IdA ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | //List<CachePointGroupDTO> cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.Free); |
| | | //if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | //{ |
| | | // CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusB == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = pointGroupDTO?.IdB ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | //cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.Free, LocationStatusEnum.Free); |
| | | //if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | //{ |
| | | // CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusA == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = pointGroupDTO?.IdA ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | |
| | | return BaseDal.QueryFirst(x => x.PointStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.AreaId == areaId), _emptyAssignOrderBy); |
| | | return BaseDal.QueryFirst(x => x.PointStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == StatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()), _emptyAssignOrderBy); |
| | | } |
| | | |
| | | public Dt_CachePoint? EmptyCachePoint(string toaddress) |
| | |
| | | |
| | | public Dt_CachePoint? GetIbStockCachePoint(int areaId) |
| | | { |
| | | List<CachePointGroupDTO> cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.Free); |
| | | if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | { |
| | | CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusA == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = pointGroupDTO?.IdA ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.InStock); |
| | | if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | { |
| | | CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusB == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | int id = pointGroupDTO?.IdB ?? 0; |
| | | return BaseDal.QueryFirst(x => x.Id == id); |
| | | } |
| | | //List<CachePointGroupDTO> cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.Free); |
| | | //if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | //{ |
| | | // CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusA == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatusA == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = pointGroupDTO?.IdA ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | //cachePointGroups = Repository.GetCachePointGroups(areaId, LocationStatusEnum.InStock, LocationStatusEnum.InStock); |
| | | //if (cachePointGroups != null && cachePointGroups.Count > 0) |
| | | //{ |
| | | // CachePointGroupDTO? pointGroupDTO = cachePointGroups.FirstOrDefault(x => x.EnableStatusB == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatusB == EnableStatusEnum.Normal.ObjToInt()); |
| | | // int id = pointGroupDTO?.IdB ?? 0; |
| | | // return BaseDal.QueryFirst(x => x.Id == id); |
| | | //} |
| | | |
| | | return BaseDal.QueryFirst(x => x.PointStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.AreaId == areaId), _emptyAssignOrderBy); |
| | | return BaseDal.QueryFirst(x => x.PointStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == StatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()), _emptyAssignOrderBy); |
| | | } |
| | | |
| | | public WebResponseContent GetEndPoints() |
| | |
| | | Dt_CachePoint cachePoints = BaseDal.QueryFirst(x => x.PointCode == stationcode); |
| | | if (cachePoints == null) |
| | | { |
| | | content = WebResponseContent.Instance.Error("为æ¾å°æ¤ç¼åæ¶"); |
| | | content = WebResponseContent.Instance.Error("æªæ¾å°æ¤ç¼åæ¶"); |
| | | } |
| | | content = WebResponseContent.Instance.OK(data: cachePoints); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | content = WebResponseContent.Instance.Error(ex.Message + "æªæ¾å°æ¤ç¼åæ¶"); |
| | | } |
| | | return content; |
| | | } |