From 2e0a838fa1f9048a05d90d253bd7fe1f9415de0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 4 Dec 2024 15:49:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A3=85=E9=85=8D=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueJobAppService.cs | 15 ++++----------- .../Notes/TransferNotes/TransferNoteAppService.cs | 2 -- .../Requests/TransferRequestEventHandler.cs | 14 +++++++------- 3 files changed, 11 insertions(+), 20 deletions(-) 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 0205ebd67..70246183b 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 @@ -867,7 +867,6 @@ public class AssembleIssueJobAppService { successList.Add(jobres.Message); } - if (errors.Count > 0) { res.Code = -1; @@ -964,18 +963,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", @@ -985,7 +980,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; @@ -1006,14 +1001,12 @@ public class AssembleIssueJobAppService 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", @@ -1040,7 +1033,7 @@ public class AssembleIssueJobAppService ReqCode = job.AssembleRequestNumber, 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..e653dce09 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 @@ -695,9 +695,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) 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}"); + //} } From 50fe138b698d7f920367df714fbee512635e3292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 4 Dec 2024 16:57:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notes/TransferNotes/TransferNoteAppService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 e653dce09..0da04e799 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 @@ -736,6 +736,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) { @@ -751,6 +752,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; @@ -759,12 +764,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 From 135c32e0a84eee74cfa53bc02b6c971656d1730a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 5 Dec 2024 09:14:22 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransferNotes/TransferNoteAppService.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 0da04e799..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(); @@ -752,10 +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; @@ -788,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) @@ -800,6 +804,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase Message = string.Join(",", errors.ToArray()), ReqCode = "" }; + await unitOfWork.RollbackAsync().ConfigureAwait(false); } return ret; } From 06ee55af0ea2943129c27d7b85110fa264764521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Thu, 5 Dec 2024 10:04:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/TestAppService.cs | 32 +++++-------------- .../AssembleIssueJobAppService.cs | 4 +-- 2 files changed, 10 insertions(+), 26 deletions(-) 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 70246183b..b792e6bee 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 @@ -996,7 +996,7 @@ 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); @@ -1031,7 +1031,7 @@ public class AssembleIssueJobAppService { Code = "-1", ReqCode = job.AssembleRequestNumber, - Message = ex.Message, + Message = ex.Message }; await unitOfWork.RollbackAsync().ConfigureAwait(false); return ret;