|
@ -17,9 +17,11 @@ namespace Win_in.Sfs.Wms.Store.Application; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using IdentityModel; |
|
|
using IdentityModel; |
|
|
|
|
|
using Omu.ValueInjecter; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Domain.Entities; |
|
|
using Volo.Abp.Domain.Entities; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Event; |
|
|
using Win_in.Sfs.Shared.Event; |
|
@ -33,11 +35,14 @@ public class MesNoteAppService : |
|
|
IMesNoteAppService |
|
|
IMesNoteAppService |
|
|
{ |
|
|
{ |
|
|
private readonly ILocationAppService _locationAppService; |
|
|
private readonly ILocationAppService _locationAppService; |
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
private readonly IBomAppService _bomAppService; |
|
|
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
private readonly IBalanceAppService _balanceAppService; |
|
|
private readonly IBalanceAppService _balanceAppService; |
|
|
public MesNoteAppService( |
|
|
public MesNoteAppService( |
|
|
|
|
|
IBomAppService bomAppService, |
|
|
IMesNoteRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService,IBalanceAppService balanceAppService) : base(repository) |
|
|
IMesNoteRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService,IBalanceAppService balanceAppService) : base(repository) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_bomAppService = bomAppService; |
|
|
_locationAppService = locationAppService; |
|
|
_locationAppService = locationAppService; |
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
_balanceAppService = balanceAppService; |
|
|
_balanceAppService = balanceAppService; |
|
@ -51,22 +56,17 @@ public class MesNoteAppService : |
|
|
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(MesNote), entity.ActiveDate).ConfigureAwait(false) : entity.Number; |
|
|
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(MesNote), entity.ActiveDate).ConfigureAwait(false) : entity.Number; |
|
|
entity.SetIdAndNumberWithDetails(GuidGenerator, number); |
|
|
entity.SetIdAndNumberWithDetails(GuidGenerator, number); |
|
|
|
|
|
|
|
|
|
|
|
SfsInventoryRequestInputBase pm = new SfsInventoryRequestInputBase(); |
|
|
|
|
|
// pm.Condition.Filters.Add(new Filter() { Column="", Action= });
|
|
|
|
|
|
// _balanceAppService.GetBalancePagedListByFilterAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in entity.Details) |
|
|
foreach (var detail in entity.Details) |
|
|
{ |
|
|
{ |
|
|
var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
if (fromLocation == null) |
|
|
if (fromLocation == null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
throw new UserFriendlyException($"库位为空"); |
|
|
throw new UserFriendlyException($"库位为空"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); |
|
|
detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); |
|
|
detail.FromLocationArea = fromLocation.AreaCode; |
|
|
detail.FromLocationArea = fromLocation.AreaCode; |
|
@ -82,14 +82,12 @@ public class MesNoteAppService : |
|
|
detail.StdPackQty = itemBasicDto.StdPackQty; |
|
|
detail.StdPackQty = itemBasicDto.StdPackQty; |
|
|
|
|
|
|
|
|
#region 添加校验
|
|
|
#region 添加校验
|
|
|
|
|
|
|
|
|
//RecommendBalanceRequestInput rInput = new RecommendBalanceRequestInput();
|
|
|
//RecommendBalanceRequestInput rInput = new RecommendBalanceRequestInput();
|
|
|
//rInput.ItemCode = detail.ItemCode;
|
|
|
//rInput.ItemCode = detail.ItemCode;
|
|
|
//rInput.Locations = new List<string>() { detail.FromLocationCode };
|
|
|
//rInput.Locations = new List<string>() { detail.FromLocationCode };
|
|
|
//rInput.Qty = detail.Qty;
|
|
|
//rInput.Qty = detail.Qty;
|
|
|
//rInput.Statuses = new List<EnumInventoryStatus> { EnumInventoryStatus.OK };
|
|
|
//rInput.Statuses = new List<EnumInventoryStatus> { EnumInventoryStatus.OK };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false);
|
|
|
//var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false);
|
|
|
//var first = balanceLst.FirstOrDefault();
|
|
|
//var first = balanceLst.FirstOrDefault();
|
|
|
//if (first != null)
|
|
|
//if (first != null)
|
|
@ -103,6 +101,7 @@ public class MesNoteAppService : |
|
|
//{
|
|
|
//{
|
|
|
// throw new UserFriendlyException($"库存数量不足");
|
|
|
// throw new UserFriendlyException($"库存数量不足");
|
|
|
//}
|
|
|
//}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -129,4 +128,8 @@ public class MesNoteAppService : |
|
|
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, |
|
|
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, |
|
|
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); |
|
|
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|