对比新文件 |
| | |
| | | 锘縰sing SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicRepository |
| | | { |
| | | public class LocationInfoRepository : RepositoryBase<Dt_LocationInfo>, ILocationInfoRepository |
| | | { |
| | | public LocationInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | |
| | | } |
| | | |
| | | public List<LocationGroupDTO> GetAllLocationGroups(string roadway) |
| | | { |
| | | return QueryTabs<Dt_LocationInfo, Dt_LocationInfo, LocationGroupDTO>((a, b) => a.Column == b.Column && a.Layer == b.Layer && a.Row != b.Row && SqlFunc.Abs(a.Row - b.Row) == 1, (a, b) => new LocationGroupDTO { DepthA = a.Depth, DepthB = b.Depth, EnableStatusA = a.EnableStatus, EnableStatusB = b.EnableStatus, IdA = a.Id, IdB = b.Id, LocationCodeA = a.LocationCode, LocationCodeB = b.LocationCode, LocationStatusA = a.LocationStatus, LocationStatusB = b.LocationStatus, LocationTypeA = a.LocationType, LocationTypeB = b.LocationType }, a => a.Depth == 1 && a.RoadwayNo == roadway, b => b.Depth == 2 && b.RoadwayNo == roadway, x => true); |
| | | } |
| | | |
| | | public List<LocationGroupDTO> GetLocationGroups(string roadway, LocationStatusEnum locationAStatus, LocationStatusEnum locationBStatus) |
| | | { |
| | | return QueryTabs<Dt_LocationInfo, Dt_LocationInfo, LocationGroupDTO>( |
| | | (a, b) => a.Column == b.Column && a.Layer == b.Layer && a.Row != b.Row && SqlFunc.Abs(a.Row - b.Row) == 1, |
| | | (a, b) => new LocationGroupDTO { DepthA = a.Depth, DepthB = b.Depth, EnableStatusA = a.EnableStatus, EnableStatusB = b.EnableStatus, IdA = a.Id, IdB = b.Id, LocationCodeA = a.LocationCode, LocationCodeB = b.LocationCode, LocationStatusA = a.LocationStatus, LocationStatusB = b.LocationStatus, LocationTypeA = a.LocationType, LocationTypeB = b.LocationType }, |
| | | a => a.Depth == 1 && a.RoadwayNo == roadway && a.LocationStatus == locationAStatus.ObjToInt(), |
| | | b => b.Depth == 2 && b.RoadwayNo == roadway && b.LocationStatus == locationBStatus.ObjToInt(), |
| | | x => true); |
| | | } |
| | | |
| | | public override bool UpdateData(Dt_LocationInfo entity) |
| | | { |
| | | return base.UpdateData(entity); |
| | | } |
| | | |
| | | public List<string> GetCanOutLocationCodes(List<string> roadways, List<int> areaIds) |
| | | { |
| | | return QueryData(x => x.LocationCode, x => roadways.Contains(x.RoadwayNo) && (areaIds.Contains(x.AreaId) || x.AreaId == 0) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); |
| | | } |
| | | |
| | | public List<Dt_LocationInfo> GetLocationInfos(List<string> locationCodes) |
| | | { |
| | | return QueryData(x => locationCodes.Contains(x.LocationCode)); |
| | | } |
| | | |
| | | public void UpdateLocationStatus(List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus) |
| | | { |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.LocationStatus = locationStatus.ObjToInt(); |
| | | }); |
| | | UpdateData(locationInfos); |
| | | } |
| | | } |
| | | } |