|
|
@ -31,6 +31,7 @@ using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using NUglify.Helpers; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
@ -64,7 +65,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
private readonly IPostionLocationAppService _postionLocationAppService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly UnitOfWorkManager _unitOfWorkManager; |
|
|
|
|
|
|
|
public TransferNoteAppService( |
|
|
|
ITransferNoteRepository repository, |
|
|
@ -82,8 +83,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
IOptions<AgvOptions> agvOptions, |
|
|
|
IPostionLocationAppService postionLocationAppService, |
|
|
|
IItemBasicAppService itemBasicAppService, |
|
|
|
UnitOfWorkManager unitOfWorkManager, |
|
|
|
IExpectOutAppService expectOutAppService) : base(repository) |
|
|
|
{ |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
_transferNoteManager = transferNoteManager; |
|
|
|
_balanceAppService = balanceAppService; |
|
|
|
_locationAppService = locationAppService; |
|
|
@ -682,12 +685,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
Message = "OK", |
|
|
|
ReqCode = "", |
|
|
|
}; |
|
|
|
using var unitOfWork = _unitOfWorkManager.Begin(); |
|
|
|
try |
|
|
|
{ |
|
|
|
if (request.Data.Count > 0) |
|
|
|
{ |
|
|
|
var notes = request.Data; |
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in notes) |
|
|
|
{ |
|
|
|
TransferNoteEditInput transfer = new TransferNoteEditInput(); |
|
|
@ -695,9 +699,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
transfer.Type = EnumTransSubType.Agv_Transfer_WIP.ToString(); |
|
|
|
transfer.Worker = "Agv"; |
|
|
|
transfer.UseOnTheWayLocation = false; |
|
|
|
|
|
|
|
List<TransferNoteDetailInput> transferNoteDetailInputs = new List<TransferNoteDetailInput>(); |
|
|
|
|
|
|
|
TransferNoteDetailInput detailInput = new TransferNoteDetailInput(); |
|
|
|
var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); |
|
|
|
if (fromloc == null) |
|
|
@ -738,6 +740,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
detailInput.ItemCode = item.Code; |
|
|
|
detailInput.Uom = item.BasicUom; |
|
|
|
detailInput.ItemName = item.Name; |
|
|
|
detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1:string.Empty; |
|
|
|
} |
|
|
|
if (errors.Count > 0) |
|
|
|
{ |
|
|
@ -753,6 +756,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
detailInput.ToLocationArea = tolocation.AreaCode; |
|
|
|
detailInput.ToLocationErpCode = tolocation.ErpLocationCode; |
|
|
|
detailInput.ToWarehouseCode = tolocation.WarehouseCode; |
|
|
|
detailInput.FromStatus = tolocation.DefaultInventoryStatus; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detailInput.Qty = detail.MatQty; |
|
|
|
detailInput.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; |
|
|
|
detailInput.ToPackingCode = string.Empty; |
|
|
@ -761,12 +768,15 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
detailInput.FromLocationGroup = fromlocation.LocationGroupCode; |
|
|
|
detailInput.FromLocationArea = fromlocation.AreaCode; |
|
|
|
detailInput.FromLocationErpCode = fromlocation.ErpLocationCode; |
|
|
|
detailInput.ToStatus = fromlocation.DefaultInventoryStatus; |
|
|
|
detailInput.Qty = detail.MatQty; |
|
|
|
detailInput.FromLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; |
|
|
|
detailInput.FromPackingCode = string.Empty; |
|
|
|
|
|
|
|
transfer.Details.Add(detailInput); |
|
|
|
await CreateAsync(transfer).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
await CreateAsync(transfer).ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@ -782,8 +792,8 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
ReqCode = "", |
|
|
|
Message = ex.Message |
|
|
|
}; |
|
|
|
//await unitOfWork.RollbackAsync();
|
|
|
|
return ret; |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
@ -794,6 +804,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
Message = string.Join(",", errors.ToArray()), |
|
|
|
ReqCode = "" |
|
|
|
}; |
|
|
|
await unitOfWork.RollbackAsync().ConfigureAwait(false); |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|