| | |
| | | public class WmsBasePlaceService : IDynamicApiController, ITransient |
| | | { |
| | | private readonly SqlSugarRepository<WmsBasePlace> _rep; |
| | | private readonly SqlSugarRepository<V_Station_Quan> _V_Station_Quan; |
| | | public WmsBasePlaceService(SqlSugarRepository<WmsBasePlace> rep, |
| | | SqlSugarRepository<V_Station_Quan> V_Station_Quan_Rep) |
| | | public WmsBasePlaceService(SqlSugarRepository<WmsBasePlace> rep) |
| | | { |
| | | _rep = rep; |
| | | _V_Station_Quan = V_Station_Quan_Rep; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | .WhereIF(input.IsVirtually.HasValue, u => u.IsVirtually == input.IsVirtually) |
| | | .WhereIF(input.IsDisabled.HasValue, u => u.IsDisabled == input.IsDisabled) |
| | | .Select<WmsBasePlaceOutput>(); |
| | | if(input.CreateTimeRange != null && input.CreateTimeRange.Count >0) |
| | | { |
| | | DateTime? start= input.CreateTimeRange[0].Value; |
| | | query = query.WhereIF(start.HasValue, u => u.CreateTime >= start); |
| | | if (input.CreateTimeRange.Count >1 && input.CreateTimeRange[1].HasValue) |
| | | { |
| | | var end = input.CreateTimeRange[1].Value; |
| | | query = query.Where(u => u.CreateTime <= end); |
| | | } |
| | | } |
| | | if(input.UpdateTimeRange != null && input.UpdateTimeRange.Count >0) |
| | | { |
| | | DateTime? start= input.UpdateTimeRange[0].Value; |
| | | query = query.WhereIF(start.HasValue, u => u.UpdateTime >= start); |
| | | if (input.UpdateTimeRange.Count >1 && input.UpdateTimeRange[1].HasValue) |
| | | { |
| | | var end = input.UpdateTimeRange[1].Value; |
| | | query = query.Where(u => u.UpdateTime <= end); |
| | | } |
| | | } |
| | | return query; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 批量增加货位基础信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "BatchAdd")] |
| | | public async Task BatchAdd() |
| | | { |
| | | List<WmsBasePlace> places = new List<WmsBasePlace>(); |
| | | |
| | | for (int aisle = 1; aisle <= 6; aisle++)//排 |
| | | { |
| | | for (int column = 1; column <= 20; column++)//列 |
| | | { |
| | | for (int layer = 1; layer <= 3; layer++)//层 |
| | | { |
| | | PlaceTypeEnum placeTypeEnum = default(PlaceTypeEnum); |
| | | |
| | | if (layer == 1) |
| | | { |
| | | placeTypeEnum = PlaceTypeEnum.中货位; |
| | | } |
| | | else if (layer == 2) |
| | | { |
| | | placeTypeEnum = PlaceTypeEnum.小货位; |
| | | } |
| | | else if (layer == 3) |
| | | { |
| | | placeTypeEnum = PlaceTypeEnum.大货位; |
| | | } |
| | | |
| | | WmsBasePlace place = new WmsBasePlace(); |
| | | place.PlaceType = placeTypeEnum; |
| | | place.PlaceTypeName = placeTypeEnum.ToString(); |
| | | place.PlaceCode = aisle.ToString("00") + layer.ToString("00") + column.ToString("00"); |
| | | place.PlaceName = aisle.ToString("00") + layer.ToString("00") + column.ToString("00"); |
| | | place.AreaCode = ""; |
| | | place.PlaceStatus = PlaceStatusEnum.正常; |
| | | place.AreaName = "机器人岛缓存区"; |
| | | place.ColumnNo = column; |
| | | place.LayerNo = layer; |
| | | //place.DeepcellNo = 0; |
| | | //place.GoodsShelfNo = ""; |
| | | place.LaneNo = aisle; |
| | | place.IsVirtually = false; |
| | | //place.Line = 0; |
| | | //place.Islock = (int)YesNoEnum.N; |
| | | //place.EmptyContainer = (int)YesNoEnum.Y; |
| | | //place.PositionnoForSrm = ""; |
| | | |
| | | place.Length = new decimal(100); |
| | | place.Width = new decimal(100); |
| | | place.Height = new decimal(000); |
| | | //place.MaxWeight = 630; |
| | | //place.HeightLevel = (int)Heightlevel.DI; |
| | | //place.Priority = (int)PlacePriority.GAO; |
| | | places.Add(place); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | await _rep.InsertRangeAsync(places); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 不分页查询库位信息 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ApiDescriptionSettings(Name = "ListView")] |
| | | [Description("WmsBasePlace/ListView")] |
| | | public async Task<List<LocationViewOutput>> ListView([FromQuery] WmsBasePlaceInput input) |
| | | { |
| | | var query = await _V_Station_Quan.AsQueryable() |
| | | .WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u => |
| | | u.PlaceCode.Contains(input.SearchKey.Trim()) |
| | | // || u.WareContainerCode.Contains(input.SearchKey.Trim()) |
| | | //|| u.Lane==input.Lane |
| | | //|| u.Row==input.Row |
| | | ) |
| | | .OrderBy(u => u.LaneNo) |
| | | //.OrderBy(u => u.Row) |
| | | .OrderBy(u => u.LayerNo) |
| | | .OrderBy(u => u.ColumnNo) |
| | | .Select<LocationViewOutput>().ToListAsync(); |
| | | return query; |
| | | } |
| | | |
| | | } |
| | | |