add test and outbound test
This commit is contained in:
1 parent
38ecbf82e5
commit
7f621dd553
23 files changed
+1301
-26
No files matched your search
@@ -107,4 +107,38 @@ public class InventoryRepository : BaseRepository<Inventory>, IInventoryReposito
|
||||
.WhereIF(inventoryKind == InventoryKind.EmptyContainer, x => x.ContainerCode == container)
|
||||
.FirstAsync();
|
||||
}
|
||||
|
||||
public async Task<List<Inventory>> GetAllocatableAsync(
|
||||
string tenantId,
|
||||
string ownerCode,
|
||||
string warehouseCode,
|
||||
string areaCode,
|
||||
InventoryKind inventoryKind,
|
||||
string? materialCode,
|
||||
string? containerCode,
|
||||
string? locationCode = null)
|
||||
{
|
||||
var tenant = tenantId.Trim();
|
||||
var owner = ownerCode.Trim();
|
||||
var warehouse = warehouseCode.Trim();
|
||||
var area = areaCode.Trim();
|
||||
var material = string.IsNullOrWhiteSpace(materialCode) ? null : materialCode.Trim();
|
||||
var container = string.IsNullOrWhiteSpace(containerCode) ? null : containerCode.Trim();
|
||||
var location = string.IsNullOrWhiteSpace(locationCode) ? null : locationCode.Trim();
|
||||
|
||||
return await Db.Queryable<Inventory>()
|
||||
.Where(x => !x.IsDeleted
|
||||
&& x.TenantId == tenant
|
||||
&& x.OwnerCode == owner
|
||||
&& x.WarehouseCode == warehouse
|
||||
&& x.AreaCode == area
|
||||
&& x.InventoryKind == inventoryKind
|
||||
&& x.Qty - x.PendingOutboundQty - x.FrozenQty > 0)
|
||||
.WhereIF(inventoryKind == InventoryKind.Material, x => x.MaterialCode == material)
|
||||
.WhereIF(inventoryKind == InventoryKind.EmptyContainer, x => x.ContainerCode == container)
|
||||
.WhereIF(location is not null, x => x.LocationCode == location)
|
||||
.OrderBy(x => x.CreateTime)
|
||||
.OrderBy(x => x.Id)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user