first commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using JSMachine.WMS.App.Dto;
|
||||
using JSMachine.WMS.App.Dto.Enum;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JSMachine.WMS.Business.StockIn.ServiceImpl.ResponsibilityChain
|
||||
{
|
||||
/// <summary>
|
||||
/// 放置在一个空白列列上
|
||||
/// </summary>
|
||||
public class StockInByNew : StockInHandler
|
||||
{
|
||||
public override async Task<StorageRackDto> CalculateWarehouse(
|
||||
TransportEnum startArea,
|
||||
FloorEnum floor,
|
||||
string materialBatch,
|
||||
List<StorageRackDto> storageRacks)
|
||||
{
|
||||
if (storageRacks.IsNullOrEmpty())
|
||||
{
|
||||
storageRacks = await base.GetStorageRackExceptStockout(floor);
|
||||
}
|
||||
|
||||
if (storageRacks.IsNullOrEmpty())
|
||||
{
|
||||
LogHelper.Info("没有可用库位");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<StorageRackDto> storageRacksSorted = storageRacks
|
||||
.OrderBy(p => p.AreaNumSort)
|
||||
.ThenBy(p => p.ReservoirAreaColumnId).ToList();
|
||||
|
||||
var groupByColumn = storageRacksSorted.GroupBy(p => p.ReservoirAreaColumnId);
|
||||
|
||||
StorageRackDto destWarehouse = null;
|
||||
foreach (IGrouping<long, StorageRackDto> column in groupByColumn)
|
||||
{
|
||||
if (column.All(p => p.IsEmpty()))
|
||||
{
|
||||
destWarehouse = column.OrderByDescending(p => p.NumSort).First();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (destWarehouse == null)
|
||||
{
|
||||
return await HandleByNext(startArea, floor,materialBatch, storageRacksSorted);
|
||||
}
|
||||
else
|
||||
{
|
||||
return destWarehouse;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user