| | |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | private readonly IRecordService _recordService; |
| | | private readonly IRepository<Dt_Warehouse> _warehouseRepository; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | |
| | | IRepository<Dt_LocationInfo> baseDal, |
| | | IRepository<Dt_Task> taskRepository, |
| | | IRepository<Dt_StockInfo> stockInfoRepository, |
| | | IRepository<Dt_Warehouse> warehouseRepository, |
| | | IMapper mapper, |
| | | IRecordService recordService) : base(baseDal) |
| | | { |
| | |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _mapper = mapper; |
| | | _recordService = recordService; |
| | | _warehouseRepository = warehouseRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | x.LocationStatus == LocationStatusEnum.Free.GetHashCode()); |
| | | |
| | | return locations? |
| | | .OrderBy(x => x.Layer) |
| | | .ThenByDescending(x => x.Depth) |
| | | .ThenBy(x => x.Column) |
| | | .ThenBy(x => x.Row) |
| | | .OrderByDescending(x => x.Depth) // 1. 深度优先(从大到小) |
| | | .ThenBy(x => x.Layer) // 2. 层数 |
| | | .ThenBy(x => x.Column) // 3. 列 |
| | | .ThenBy(x => x.Row) // 4. 行 |
| | | .FirstOrDefault(); |
| | | } |
| | | |
| | |
| | | /// <param name="layer">层数</param> |
| | | /// <param name="depth">深度</param> |
| | | /// <returns>货位信息对象</returns> |
| | | private static Dt_LocationInfo CreateLocationInfo(string roadwayNo, int row, int col, int layer, int depth) |
| | | private Dt_LocationInfo CreateLocationInfo(string roadwayNo, int row, int col, int layer, int depth) |
| | | { |
| | | var warehouse = _warehouseRepository.QueryData(x => x.WarehouseCode == roadwayNo).FirstOrDefault(); |
| | | |
| | | if (warehouse == null) |
| | | { |
| | | throw new InvalidOperationException($"未找到巷道编号为 {roadwayNo} 的仓库信息"); |
| | | } |
| | | |
| | | return new Dt_LocationInfo |
| | | { |
| | | WarehouseId = 0, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | Row = row, |
| | | Column = col, |
| | | Layer = layer, |
| | |
| | | EnableStatus = EnableStatusEnum.Normal.GetHashCode(), |
| | | LocationStatus = LocationStatusEnum.Free.GetHashCode(), |
| | | LocationType = LocationTypeEnum.Undefined.GetHashCode(), |
| | | LocationCode = $"{row:D3}-{col:D3}-{layer:D3}", |
| | | LocationCode = $"{roadwayNo}-{row:D3}-{col:D3}-{layer:D3}", |
| | | LocationName = $"{roadwayNo}巷道{row:D3}行{col:D3}列{layer:D3}层{depth:D2}深" |
| | | }; |
| | | } |