diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs index a31ae087b..658d43ca0 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; +using Castle.Core.Logging; using DocumentFormat.OpenXml.Office2010.Drawing; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -31,10 +33,12 @@ public class TestService:ApplicationService { private readonly IServiceProvider _serviceProvider; private readonly IOptions _options; - public TestService(IServiceProvider serviceProvider, IOptions options) + private readonly ILogger _logger; + public TestService(IServiceProvider serviceProvider, IOptions options, ILogger logger) { _serviceProvider = serviceProvider; _options = options; + _logger = logger; } /* /// @@ -110,33 +114,13 @@ public class TestService:ApplicationService [HttpPost("pushOutTask4FW")] public async Task pushOutTask4FW(AgvRequest1 request) { - - - AgvResultObject1 reusltObject = new AgvResultObject1(); + var json=System.Text.Json.JsonSerializer.Serialize(request); + _logger.LogInformation(json); + AgvResultObject1 reusltObject = new AgvResultObject1(); reusltObject.Code = "0"; reusltObject.Message = "OK"; reusltObject.ReqCode = "T6000001970"; return reusltObject; - - - - //List result = new List(); - - //result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB1", PartCode = "TMDLYA0A071AB", Flag = 0 }); - //result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 }); - //result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 }); - - //result = result.Where(p => p.AreaID == AreaID).ToList(); - - - - //var t = new ResponCargos(); - //t.Code = 200; - //t.Msg = "Success"; - //t.Datalist = result; - - - //return t; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs index 501bcd9b8..0432f0a8e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs @@ -874,7 +874,6 @@ public class AssembleIssueJobAppService { successList.Add(jobres.Message); } - if (errors.Count > 0) { res.Code = -1; @@ -971,18 +970,14 @@ public class AssembleIssueJobAppService { errors.Add($"零件号{detail.MatCode}不存在!"); } - - var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode); if (entity == null) { errors.Add($"零件号{detail.MatCode}不在任务明细内!"); } - - - if (errors.Count > 0) { + await unitOfWork.RollbackAsync().ConfigureAwait(false); return ret = new AgvResultObject() { Code = "-1", @@ -992,7 +987,7 @@ public class AssembleIssueJobAppService } var dto = new AssembleIssueJobDetailDTO(); dto.InjectFrom(entity); - dto.HandledToLocationCode = toloc.Code; + dto.HandledToLocationCode = tolocation.Code; dto.HandledToLocationGroup = tolocation.LocationGroupCode; dto.HandledToLocationArea = tolocation.AreaCode; dto.HandledToLocationErpCode = tolocation.ErpLocationCode; @@ -1008,19 +1003,17 @@ public class AssembleIssueJobAppService dto.HandledFromLocationArea = fromlocation.AreaCode; dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; dto.HandledFromQty = detail.MatQty; - dto.HandledFromLot = string.Empty; + dto.HandledFromLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; dto.HandledFromPackingCode = string.Empty; details.Add(dto); - - - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); } if (errors.Count > 0) { + await unitOfWork.RollbackAsync().ConfigureAwait(false); ret = new AgvResultObject() { Code = "-1", @@ -1045,9 +1038,9 @@ public class AssembleIssueJobAppService { Code = "-1", ReqCode = job.AssembleRequestNumber, - Message = ex.Message, + Message = ex.Message }; - await unitOfWork.RollbackAsync(); + await unitOfWork.RollbackAsync().ConfigureAwait(false); return ret; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index e95b66e22..380f69695 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -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, 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 transferNoteDetailInputs = new List(); - 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; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs index faf18743c..fda8445bf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs @@ -49,8 +49,8 @@ public class TransferRequestEventHandler { - try - { + //try + //{ var entity = eventData.Entity; var enumTransSubType = Enum.Parse(entity.Type); @@ -85,11 +85,11 @@ public class TransferRequestEventHandler } } - } - catch (Exception e) - { - throw new UserFriendlyException($"{e.Message}"); - } + //} + //catch (Exception e) + //{ + // throw new UserFriendlyException($"{e.Message}"); + //} }