From 59cb8985ecc53e05078003dccd8c5114e681a9e9 Mon Sep 17 00:00:00 2001 From: zhaoxinyu <89237069@qq.com> Date: Tue, 11 Jun 2024 16:51:15 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E9=87=87?= =?UTF-8?q?=E9=9B=86=E6=8E=A5=E5=8F=A3POST=E6=94=B9=E6=88=90GET=E8=AF=B7?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/WebApi.cs | 37 +++++++++---------- .../Incoming/InjectionMoldingRequestReader.cs | 6 +-- .../test/TestAppService.cs | 24 ++++++------ .../AssembleIssueJobAppService.cs | 1 - 4 files changed, 32 insertions(+), 36 deletions(-) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs index d466900cd..a4498b3d5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs @@ -1,3 +1,5 @@ + + //---------------------- // // Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) @@ -212,15 +214,15 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming /// Success /// A server side error occurred. - public virtual System.Threading.Tasks.Task> GetCargoStaticAsync(string p_AreaID) + public virtual System.Threading.Tasks.Task> GetCargoStaticAsync(string areaID) { - return GetCargoStaticAsync(p_AreaID, System.Threading.CancellationToken.None); + return GetCargoStaticAsync(areaID, System.Threading.CancellationToken.None); } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Success /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> GetCargoStaticAsync(string p_AreaID, System.Threading.CancellationToken cancellationToken) + public virtual async System.Threading.Tasks.Task> GetCargoStaticAsync(string areaID, System.Threading.CancellationToken cancellationToken) { var client_ = _httpClient; var disposeClient_ = false; @@ -228,8 +230,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); - request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); var urlBuilder_ = new System.Text.StringBuilder(); @@ -237,9 +238,9 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming // Operation Path: "CargoState/GetCargoStatic" urlBuilder_.Append("CargoState/GetCargoStatic"); urlBuilder_.Append('?'); - if (p_AreaID != null) + if (areaID != null) { - urlBuilder_.Append(System.Uri.EscapeDataString("p_AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(p_AreaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); + urlBuilder_.Append(System.Uri.EscapeDataString("AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(areaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&'); } urlBuilder_.Length--; @@ -535,16 +536,8 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ResponCargoItem1 { - - /// - /// 读取次数 - /// - [Newtonsoft.Json.JsonProperty("number", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Number { get; set; } - /// /// 区域ID /// @@ -569,8 +562,12 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming [Newtonsoft.Json.JsonProperty("flag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int Flag { get; set; } - } + [Newtonsoft.Json.JsonProperty("number", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Number { get; set; } + + + } @@ -612,10 +609,10 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming } -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 #pragma warning restore 1573 #pragma warning restore 1591 #pragma warning restore 8073 diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs index fde6ad445..865ce68a2 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs @@ -50,7 +50,6 @@ public class InjectionMoldingRequestReader : IReader ) { _injectionRequest = injectionRequest; - _logger = logger; _options = options; _httpClientFactory = httpClientFactory; @@ -102,8 +101,7 @@ public class InjectionMoldingRequestReader : IReader { var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false); - - Thread.Sleep(1000);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息 + Thread.Sleep(500);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息 //flag 1-有货 0-空闲 foreach (var respon in idsList.Where(r => r.Flag == 0)) { @@ -167,6 +165,8 @@ public class InjectionMoldingRequestReader : IReader _logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList)); + //_logger.LogInformation($"标识{guid}同步WMS开始"); + foreach (var inject in injectionList) 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 194c19364..e5fea514f 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 @@ -47,11 +47,11 @@ public class TestService:ApplicationService - [HttpPost("GetCargoStatic")] + [HttpGet("GetCargoStatic")] /// /// 异步开始生命周期操作不能堵塞 /// - public async Task> GetCargoStatic(string p_AreaID) + public async Task> GetCargoStatic(string AreaID) { List result = new List(); @@ -60,28 +60,28 @@ public class TestService:ApplicationService 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 == p_AreaID).ToList(); + result = result.Where(p => p.AreaID == AreaID).ToList(); return result; } - [HttpPost("SyncIssueJobStereo")] + //[HttpPost("SyncIssueJobStereo")] - public virtual async Task SyncIssueJobStereoAsync(IssueJobToRestoDTO input) - { + //public virtual async Task SyncIssueJobStereoAsync(IssueJobToRestoDTO input) + //{ - ReusltObject reuslt=new ReusltObject(); - reuslt.Code = "1"; - reuslt.Message = "操作成功"; - reuslt.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + // ReusltObject reuslt=new ReusltObject(); + // reuslt.Code = "1"; + // reuslt.Message = "操作成功"; + // reuslt.OperateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - return reuslt; + // return reuslt; - } + //} 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 541fbf282..b6d1770b6 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 @@ -591,7 +591,6 @@ public class AssembleIssueJobAppService { var jobDetailInputdetail = assembleIssueJobDto.Details.FirstOrDefault(); - var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) .ConfigureAwait(false); From c67ace76d4a37e554452491efe5b01235379bb69 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 11 Jun 2024 17:01:52 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=A4=87=E5=93=81=E3=80=81=E6=B3=A8?= =?UTF-8?q?=E5=A1=91=E3=80=81=E8=A3=85=E9=85=8D=E3=80=81=E5=96=B7=E6=B6=82?= =?UTF-8?q?TYRP=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueNoteEventHandler.cs | 0 .../CoatingIssueNoteEventHandler.cs | 65 +++++------ .../InjectionIssueNoteEventHandler.cs | 65 +++++------ .../KittingIssueNoteEventHandler.cs | 0 .../Issue/SparePartIssueNoteEventHandler.cs | 107 ++++++++++++++++++ 5 files changed, 173 insertions(+), 64 deletions(-) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/{ => Issue}/AssembleIssueNoteEventHandler.cs (100%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/{ => Issue}/CoatingIssueNoteEventHandler.cs (58%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/{ => Issue}/InjectionIssueNoteEventHandler.cs (59%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/{ => Issue}/KittingIssueNoteEventHandler.cs (100%) create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs similarity index 100% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs similarity index 58% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs index ad795164a..698184507 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs @@ -37,44 +37,45 @@ public class CoatingIssueNoteEventHandler protected override async Task AddExchangeDataAsync(List entities) { - var dtos = ObjectMapper.Map, List>(entities); + var dtos = ObjectMapper.Map, List>(entities); foreach (var detail in dtos.SelectMany(dto => dto.Details)) { - if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledFromLocationErpCode = location.ErpLocationCode; - detail.HandledFromLocationGroup = location.LocationGroupCode; - detail.HandledFromLocationArea = location.AreaCode; + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + //if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledFromLocationErpCode = location.ErpLocationCode; + // detail.HandledFromLocationGroup = location.LocationGroupCode; + // detail.HandledFromLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) - { - detail.HandledFromWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + // { + // detail.HandledFromWarehouseCode = location.WarehouseCode; + // } + // } + //} - if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledToLocationErpCode = location.ErpLocationCode; - detail.HandledToLocationGroup = location.LocationGroupCode; - detail.HandledToLocationArea = location.AreaCode; + //if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledToLocationErpCode = location.ErpLocationCode; + // detail.HandledToLocationGroup = location.LocationGroupCode; + // detail.HandledToLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) - { - detail.HandledToWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + // { + // detail.HandledToWarehouseCode = location.WarehouseCode; + // } + // } + //} } - var toErpDto = new List(); + var toErpDto = new List(); foreach (var item in dtos) { if (item.Details != null && item.Details.Count != 0) @@ -84,10 +85,10 @@ public class CoatingIssueNoteEventHandler } //2023-12-6要求同储位不传入接口 按历史规则 - var result = new List(); + var result = new List(); foreach (var coatingIssueNoteDto in toErpDto) { - coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode); if (coatingIssueNoteDto.Details.Count > 0) { result.Add(coatingIssueNoteDto); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs similarity index 59% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs index 34d324950..022d1d360 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs @@ -37,44 +37,45 @@ public class InjectionIssueNoteEventHandler protected override async Task AddExchangeDataAsync(List entities) { - var dtos = ObjectMapper.Map, List>(entities); + var dtos = ObjectMapper.Map, List>(entities); foreach (var detail in dtos.SelectMany(dto => dto.Details)) { - if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledFromLocationErpCode = location.ErpLocationCode; - detail.HandledFromLocationGroup = location.LocationGroupCode; - detail.HandledFromLocationArea = location.AreaCode; + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + //if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledFromLocationErpCode = location.ErpLocationCode; + // detail.HandledFromLocationGroup = location.LocationGroupCode; + // detail.HandledFromLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) - { - detail.HandledFromWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + // { + // detail.HandledFromWarehouseCode = location.WarehouseCode; + // } + // } + //} - if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledToLocationErpCode = location.ErpLocationCode; - detail.HandledToLocationGroup = location.LocationGroupCode; - detail.HandledToLocationArea = location.AreaCode; + //if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledToLocationErpCode = location.ErpLocationCode; + // detail.HandledToLocationGroup = location.LocationGroupCode; + // detail.HandledToLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) - { - detail.HandledToWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + // { + // detail.HandledToWarehouseCode = location.WarehouseCode; + // } + // } + //} } - var toErpDto = new List(); + var toErpDto = new List(); foreach (var item in dtos) { if (item.Details != null && item.Details.Count != 0) @@ -84,10 +85,10 @@ public class InjectionIssueNoteEventHandler } //2023-12-6要求同储位不传入接口 按历史规则 - var result = new List(); + var result = new List(); foreach (var injectionIssueNoteDto in toErpDto) { - injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode); if (injectionIssueNoteDto.Details.Count > 0) { result.Add(injectionIssueNoteDto); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs similarity index 100% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs new file mode 100644 index 000000000..bc03a1ed9 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; + +/// +/// 备品发料记录传给TYRP(线边仓领料单) +/// +public class SparePartIssueNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + //线边仓领料单 + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + //if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledFromLocationErpCode = location.ErpLocationCode; + // detail.HandledFromLocationGroup = location.LocationGroupCode; + // detail.HandledFromLocationArea = location.AreaCode; + + // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + // { + // detail.HandledFromWarehouseCode = location.WarehouseCode; + // } + // } + //} + + //if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledToLocationErpCode = location.ErpLocationCode; + // detail.HandledToLocationGroup = location.LocationGroupCode; + // detail.HandledToLocationArea = location.AreaCode; + + // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + // { + // detail.HandledToWarehouseCode = location.WarehouseCode; + // } + // } + //} + + } + + var toErpDto = new List(); + foreach (var item in dtos) + { + if (item.Details != null && item.Details.Count != 0) + { + toErpDto.Add(item); + } + } + + //2023-12-6要求同储位不传入接口 按历史规则 + var result = new List(); + foreach (var sparePartIssueNoteDto in toErpDto) + { + sparePartIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode); + if (sparePartIssueNoteDto.Details.Count > 0) + { + result.Add(sparePartIssueNoteDto); + } + } + + if (result.Count > 0) + { + var exchangeDataerp = + await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) + .ConfigureAwait(false); + await AddManyAsync(exchangeDataerp).ConfigureAwait(false); + } + } + +} From a7593e4f547ca782c951d4bb4dd3ff903198f237 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Wed, 12 Jun 2024 14:23:34 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Jobs/ThirdLocationJobController.cs | 2 +- .../Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs | 6 ++++++ .../Jobs/ThirdLocationJobEventHandler.cs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs index 2c1ed7bb4..3d3f29459 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ThirdLocationJobController.cs @@ -182,7 +182,7 @@ public class ThirdLocationJobController : AbpController } /// - /// 关闭任务 + /// 终止关闭任务 /// /// /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 647260243..1c505db17 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -89,6 +89,12 @@ public class ThirdLocationJobAppService return handleDto; } + /// + /// 终止关闭任务 + /// + /// + /// + /// [HttpPost("close-job/{id}")] public virtual async Task CloseJobAsync(Guid id) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index bcc80e5c4..af8b6ad51 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -104,7 +104,7 @@ public class ThirdLocationJobEventHandler : } /// - /// 关闭任务后 + /// 终止关闭任务后 /// /// /// From 1c05d14f10c4a26f6ddd6204067c3c465a0216b1 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Wed, 12 Jun 2024 14:34:57 +0800 Subject: [PATCH 04/11] tijiao --- .../SplitPackings/ISplitPackingRecAppService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs index 98fa3b255..4ba841877 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/ISplitPackingRecAppService.cs @@ -30,6 +30,13 @@ public interface ISplitPackingRecAppService Task GetSplitPackingCode(string toPackingCode); Task> GetFirstOrDefaultPackingCode(List toPackingCodeList); + /// + /// 根据to箱码取所有具有相同箱码的拆箱记录 + /// + /// + /// + Task> GetSamePoNumberListByToPackingCode(string toPackingCode); + /// /// /// From cfe5f8edd5b03a2c7db1549791734ccf97a25343 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 12 Jun 2024 14:59:26 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E9=9D=9E=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E9=80=80=E6=96=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Balances/BalanceManager.cs | 7 +++---- .../Transactions/NoOkConvertOKNoteEventHandler.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs index db0162c61..69f37b12d 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs @@ -560,16 +560,15 @@ public class BalanceManager : DomainService, IBalanceManager .GroupBy(p => p.ContainerCode) .Select(d => d.Key) .ToListAsync().ConfigureAwait(false); - - usableBalances + usableBalances= usableBalances //扣减已占用库存 .DecreaseExpectOutQty(expectOuts, locations) //去除不可拆箱 拆托的且有预占用的库存余额 .IgnoreExpectOutOfSameContainer(expectOutContainerCodes, itemStoreRelationDict, locations) //过滤掉不允许拣料的库位 .FilterLocationEnablePickAsync(locations) - //排序库存余额 最终可用的余额集合 - .SortByFifo(); + //排序库存余额 最终可用的余额集合 + .SortByFifo(); LogDebug(traceId, usableBalances, "AvailableBalances"); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs index 1c2b416a6..9b8e278c3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/NoOkConvertOKNoteEventHandler.cs @@ -58,7 +58,7 @@ public class NoOkConvertOkNoteEventHandler transferLog.TransType = TransType; transferLog.ToLocationCode = locationInfo.Code; - transferLog.FromLocationArea = locationInfo.AreaCode; + transferLog.ToLocationArea = locationInfo.AreaCode; transferLog.ToLocationErpCode = locationInfo.ErpLocationCode; transferLog.ToLocationGroup = locationInfo.LocationGroupCode; transferLog.ToStatus = EnumInventoryStatus.OK; From d6b802e891a2f7f1e71048c6d689d5b68d5e9e4f Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Wed, 12 Jun 2024 15:07:25 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8F=96=E6=B6=88=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationRequestAppService.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index 7a6e2fd67..deeaa16ae 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs @@ -212,10 +212,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase(request), false).ConfigureAwait(false); await _repository.UpdateAsync(request).ConfigureAwait(false); - } else From 7ff54321f3d163bd15416dbf79bd29874d97825f Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Wed, 12 Jun 2024 15:34:40 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=8F=AA=E6=9C=89=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=BA=E9=83=A8=E5=88=86=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E7=BB=88=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobs/ThirdLocationJobAppService.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 1c505db17..83121b505 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -103,8 +103,19 @@ public class ThirdLocationJobAppService { throw new UserFriendlyException($"未找到ID为 {id} 的任务"); } + else + { + if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) + { + await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + } + else + { + throw new UserFriendlyException($"【{thirdLocationJob.JobStatus.GetDisplayName()}】状态不允许终止"); + } + } - await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + } /// From 1fbc552c65a286a148c31a3eb62b95a8d0e348e1 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 12 Jun 2024 15:55:11 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IncomingToWmsExtensions.cs | 6 +++--- .../Balances/IBalanceAppService.cs | 1 + .../Balances/BalanceAppService.cs | 18 ++++++++++++++++++ .../Transactions/Transaction.cs | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs index 6c7ca0d7a..5f5c36cc9 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs @@ -85,9 +85,9 @@ public static class IncomingToWmsExtensions } public static async Task HandleErpLocationItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) { - //var erpLocationItem = JsonSerializer.Deserialize(incomingConverted.DataContent); - //var erpLocationItemAppService = workerContext.ServiceProvider.GetRequiredService(); - //await erpLocationItemAppService.UpsertAsync(erpLocationItem).ConfigureAwait(false); + var erpLocationItem = JsonSerializer.Deserialize(incomingConverted.DataContent); + var erpLocationItemAppService = workerContext.ServiceProvider.GetRequiredService(); + await erpLocationItemAppService.UpsertAsync(erpLocationItem).ConfigureAwait(false); } public static async Task HandleErpLocationsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext) { diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs index 4fc6aa103..e1df84285 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs @@ -177,4 +177,5 @@ public interface IBalanceAppService string itemCode, string locationCode, EnumInventoryStatus status,string lot); Task> GetRecommendBalancesByLocationsExpectOldBalancesAsync(RecommendBalanceRequestInput input); Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status, DateTime datetime, string countPlanNumber); + Task> GetUsableListByTypeAsync(RecommendBalanceRequestInput input); } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs index ff20cc1b6..597e5b0c4 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs @@ -687,7 +687,25 @@ public class BalanceAppService return dtos; } + /// + /// 获取可用库存列表 + /// + /// + /// + /// + [HttpGet("usable-list-by-type")] + public virtual async Task> GetUsableListByTypeAsync(RecommendBalanceRequestInput input) + { + List locationCodes = new List(); + var locations=await _locationAclService.GetListByTypesAsync(input.LocationTypes).ConfigureAwait(false); + locationCodes= locations.Select(location=>location.Code).ToList(); + var inventoryBalances = await _balanceManager + .GetUsableListAsync(input.ItemCode, locationCodes, input.Statuses, input.IsPackingCode).ConfigureAwait(false); + + var dtos = ObjectMapper.Map, List>(inventoryBalances); + return dtos; + } /// /// pda发料执行查询使用 /// diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs index c77e039f6..2996f4c6d 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs @@ -238,6 +238,7 @@ public class Transaction : SfsInventoryAggregateRootBase ItemName = item.Name; ItemDesc1 = item.Desc1; ItemDesc2 = item.Desc2; + StdPackQty = item.StdPackQty; } if (string.IsNullOrEmpty(WarehouseCode)) { From b96ce0a45451c34d7c108c577ae3cf70aef84826 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 13 Jun 2024 08:57:15 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E7=BB=88?= =?UTF-8?q?=E6=AD=A2=E5=8A=9F=E8=83=BD=E6=94=B9=E6=88=90=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobs/ThirdLocationJobAppService.cs | 11 ++++++++++- .../Jobs/ThirdLocationJobEventHandler.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 83121b505..9707f05ec 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -6,13 +6,16 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -107,7 +110,13 @@ public class ThirdLocationJobAppService { if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) { - await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + thirdLocationJob.JobStatus = EnumJobStatus.Done; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await Repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + + //await _thirdLocationJobManager.CloseAsync(thirdLocationJob).ConfigureAwait(false); + } else { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index af8b6ad51..aa86d7425 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -123,7 +123,7 @@ public class ThirdLocationJobEventHandler : await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); - thirdLocationRequest.RequestStatus = EnumRequestStatus.Abort; + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); } From 58d849ff79e046905ccfdc4ddf0e9aa4b50164c3 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Thu, 13 Jun 2024 10:31:19 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9kitting=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Jobs/TransferLibJobController.cs | 2 +- .../KittingPackagingNoteChassisDetail.cs | 9 ++++++++- ...ttingPackagingNoteDbContextModelCreatingExtensions.cs | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs index 5c6aed4cb..d1e770fac 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/TransferLibJobController.cs @@ -15,7 +15,7 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; /// /// [ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] +[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")] //??store应该改成job public class TransferLibJobController : AbpController { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs index e1349a47e..8615428c9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/KittingPackagingNotes/KittingPackagingNoteChassisDetail.cs @@ -9,11 +9,18 @@ public class KittingPackagingNoteChassisDetail : SfsStoreDetailEntityBase /// 底盘号 /// [Display(Name = "底盘号")] - public long ChassisNumber { get; set; } + //public long ChassisNumber { get; set; } + public string ChassisNumber { get; set; } //lyf at 20240613 /// /// Kitting代码 /// [Display(Name = "Kitting代码")] public string KittingCode { get; set; } + + /// + /// 底盘号排序序列 + /// + [Display(Name = "底盘号排序序列")] + public long ChassisSortNumber { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs index 2ee0c6e2e..09c22253e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/KittingPackagingNotes/KittingPackagingNoteDbContextModelCreatingExtensions.cs @@ -53,6 +53,7 @@ public static class KittingPackagingNoteDbContextModelCreatingExtensions b.ConfigureSfsBase(); //Properties b.Property(q => q.KittingCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.ChassisNumber).HasMaxLength(SfsPropertyConst.CodeLength); //Indexes }); } From 8cee51fdc6776954242b4e4195d84b6aceb40178 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Thu, 13 Jun 2024 14:01:23 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=B7=E6=B1=82=E5=AE=8C=E6=88=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Stores/ThirdLocationRequestController.cs | 13 +++++ .../ThirdLocationJobAppService.cs | 30 +++++----- .../ThirdLocationRequestAppService.cs | 55 +++++++++++++++++++ .../Jobs/ThirdLocationJobEventHandler.cs | 33 +++++++++-- .../ThirdLocationRequestEventHandler.cs | 17 ++++-- 5 files changed, 123 insertions(+), 25 deletions(-) diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs index 9c5a29854..529776dbb 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/ThirdLocationRequestController.cs @@ -109,4 +109,17 @@ public class ThirdLocationRequestController : AbpController return Ok(result); } + /// + /// 完成三方库请求 + /// + /// + /// + [HttpPost("complete/{id}")] + public virtual async Task> CompleteAsync(Guid id) + { + var result = await _thirdLocationRequestAppService.CompleteAsync(id).ConfigureAwait(false); + return Ok(result); + } + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 9707f05ec..23af60ffa 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -59,25 +59,29 @@ public class ThirdLocationJobAppService } else { - var jobDetail= job.Details.FirstOrDefault(p => p.ItemCode == dto.Details[0].ItemCode); - - if(jobDetail==null) - { - throw new UserFriendlyException($"任务错误:未找到物品【{dto.Details[0].ItemCode} 的明细信息"); - } - else + foreach(var item in dto.Details) { - if (dto.Details[0].HandledQty > jobDetail.RecommendQty) + var jobDetail = job.Details.FirstOrDefault(p => p.ItemCode == item.ItemCode); + + if (jobDetail == null) { - throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于推荐数量【{dto.Details[0].RecommendQty}】"); + throw new UserFriendlyException($"任务错误:未找到物品【{item.ItemCode} 的明细信息"); } - if (jobDetail.ToLocationCode != dto.Details[0].ToLocationCode) + else { - throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致"); + if (item.HandledQty > jobDetail.RecommendQty) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{item.HandledQty}】不能大于推荐数量【{item.RecommendQty}】"); + } + if (jobDetail.ToLocationCode != item.ToLocationCode) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{item.ToLocationCode}】与申请目标库位【{jobDetail.ToLocationCode}】不一致"); + } } - } - + } + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index deeaa16ae..b3075b3ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs @@ -49,10 +49,12 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase(request); } + /// + /// 用来重写 完成请求 + /// + /// + /// + public override async Task CompleteAsync(Guid id) + { + var request = await _repository.GetAsync(id).ConfigureAwait(false); + + if (request.RequestStatus == EnumRequestStatus.Partial) + { + request.RequestStatus = EnumRequestStatus.Completed; + await Task.CompletedTask.ConfigureAwait(false); + //await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData(request), false).ConfigureAwait(false); + await _repository.UpdateAsync(request).ConfigureAwait(false); + + } + else + { + throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消"); + } + var entitys = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == request.Number, "", true).ConfigureAwait(false); + + if (entitys.Any()) + { + foreach (var thirdLocationJob in entitys) + { + if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) + { + thirdLocationJob.JobStatus = EnumJobStatus.Done; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } + else if (thirdLocationJob.JobStatus == EnumJobStatus.Open) + { + thirdLocationJob.JobStatus = EnumJobStatus.Closed; + await Task.CompletedTask.ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsClosedEntityEventData(thirdLocationJob), false).ConfigureAwait(false); + await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } + else + { + + } + } + } + + return ObjectMapper.Map(request); + } + + /// /// 赋值Request业务属性 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index aa86d7425..1556e7251 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Routing.Matching; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -24,13 +25,15 @@ public class ThirdLocationJobEventHandler : private readonly ILocationAppService _locationAppService; private readonly IThirdLocationRequestManager _thirdLocationRequestManager; private readonly ITransferLogAppService _transferLogAppService; + private readonly IThirdLocationJobRepository _thirdLocationJobRepository; - public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService) + public ThirdLocationJobEventHandler(IThirdLocationNoteAppService thirdLocationNoteAppService, IThirdLocationJobRepository thirdLocationJobRepository, ITransferLogAppService transferLogAppService, IThirdLocationRequestManager thirdLocationRequestManager, ILocationAppService locationAppService) { _thirdLocationNoteAppService = thirdLocationNoteAppService; _locationAppService = locationAppService; _thirdLocationRequestManager = thirdLocationRequestManager; _transferLogAppService = transferLogAppService; + _thirdLocationJobRepository = thirdLocationJobRepository; } /// @@ -119,21 +122,39 @@ public class ThirdLocationJobEventHandler : var transferLogs = new List(); - transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest).ConfigureAwait(false)); + transferLogs.AddRange(await BuildCancelTransferLogsAsync(thirdLocationRequest, entity.Details[0].ItemCode).ConfigureAwait(false)); await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); - thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; - await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + var jobEntities = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == entity.RequestNumber, "Number", true).ConfigureAwait(false); + bool isDone = false; + foreach (var job in jobEntities.Where(p=>p.Number!= entity.Number)) + { + if(job.JobStatus == EnumJobStatus.Done) + { + isDone = true; + } + else + { + isDone = false; + } + + } + if(isDone) + { + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; + await _thirdLocationRequestManager.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + } + } } - private async Task> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest) + private async Task> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest,string itemCode) { var transferLogs = new List(); - foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0)) + foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.IssuedQty-detail.ReceivedQty != 0 && detail.ItemCode== itemCode)) { var transferLog = ObjectMapper.Map(detail); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs index 783808a45..0eab56632 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs @@ -306,13 +306,18 @@ public class ThirdLocationRequestEventHandler } var fromLocation = await _locationAppService.GetByCodeAsync(thirdLocationRequestDetail.FromLocationCode).ConfigureAwait(false); - var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); - if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode)) - { - job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); - jobs.Add(job); - } + + var job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); job.Details.AddRange(jobDetails); + jobs.Add(job); + + //var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); + //if (job == null || job.Details.Any(p => p.ToLocationCode != thirdLocationRequestDetail.ToLocationCode)) + //{ + // job = BuildThirdLocationJobCreateInput(thirdLocationRequest, fromLocation); + // jobs.Add(job); + //} + //job.Details.AddRange(jobDetails); }