diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index c8859122..db218c02 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -5274,6 +5274,11 @@ 明细 + + + 任务明细ID + + 物料名称 diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index 4f887ee7..7a2e320a 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -2863,6 +2863,13 @@ + + + 列表 + + + + 获取列表根据明细IDS @@ -2929,6 +2936,14 @@ + + + 批量修改-明细 + + + + + 修改 diff --git a/src/WMS.Web.Core/Dto/SendDataDto.cs b/src/WMS.Web.Core/Dto/SendDataDto.cs index ed2d034a..375e268b 100644 --- a/src/WMS.Web.Core/Dto/SendDataDto.cs +++ b/src/WMS.Web.Core/Dto/SendDataDto.cs @@ -44,6 +44,12 @@ namespace WMS.Web.Core.Dto /// public class SendDataDetailsDto { + + /// + /// 任务明细ID + /// + public int TaskDetailId { get; set; } + /// /// 物料名称 /// diff --git a/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs b/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs index 922578a7..be33934b 100644 --- a/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs +++ b/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs @@ -51,6 +51,13 @@ namespace WMS.Web.Domain.Infrastructure /// Task> GetList(List ids); + /// + /// 列表 + /// + /// + /// + Task> GetDetailsList(List ids); + /// /// 获取列表根据明细IDS /// @@ -117,7 +124,15 @@ namespace WMS.Web.Domain.Infrastructure /// /// Task UpdateRange(List entitys, bool isTransaction = true); - + + /// + /// 批量修改-明细 + /// + /// + /// + /// + Task UpdateRange(List entitys, bool isTransaction = true); + /// /// 修改 /// diff --git a/src/WMS.Web.Domain/Services/Public/SendMessageService.cs b/src/WMS.Web.Domain/Services/Public/SendMessageService.cs index 9eef94f8..3f970834 100644 --- a/src/WMS.Web.Domain/Services/Public/SendMessageService.cs +++ b/src/WMS.Web.Domain/Services/Public/SendMessageService.cs @@ -20,6 +20,7 @@ using WMS.Web.Core.Dto; using System.Linq; using WMS.Web.Domain.IService.Public; using WMS.Web.Core.Dto.Erp; +using WMS.Web.Domain.Entitys; namespace WMS.Web.Domain.Services { @@ -183,6 +184,7 @@ namespace WMS.Web.Domain.Services foreach (var current_det in current_notSendDetails) { var det = new SendDataDetailsDto(); + det.TaskDetailId = current_det.Id; det.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, current_det.MaterialNumber); det.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, current_det.MaterialNumber); det.MaterialNumber = current_det.MaterialNumber; @@ -210,6 +212,8 @@ namespace WMS.Web.Domain.Services { try { + var update_taskDetailsIds = new List(); + var sendContentList_result = await this.GetSendContent(); if (sendContentList_result.IsSuccess) { @@ -225,6 +229,7 @@ namespace WMS.Web.Domain.Services int i = 1; foreach (var det in item.Details) { + update_taskDetailsIds.Add(det.TaskDetailId); if (i == item.Details.Count) content = det.Specifications + " X 数量" +Convert.ToInt32(det.Qty); else @@ -237,6 +242,18 @@ namespace WMS.Web.Domain.Services //短信 this.SendSms(item.PhoneNumbers, content); } + //任务明细:修改的 + var tasksDetails = await _inStockTaskRepositories.GetDetailsList(update_taskDetailsIds); + if(tasksDetails!=null && tasksDetails.Count != 0) + { + tasksDetails.ForEach(x => { x.IsHasSend = true; }); + + var update_Result= await _inStockTaskRepositories.UpdateRange(tasksDetails); + if (!update_Result) + { + _logger.LogInformation("发送消息:失败-修改任务明细->:" + JsonConvert.SerializeObject(tasksDetails)); + } + } } } diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs index bfb50e46..fc8dba10 100644 --- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs @@ -100,6 +100,19 @@ namespace WMS.Web.Repositories return entitys; } + /// + /// 列表 + /// + /// + /// + public async Task> GetDetailsList(List ids) + { + var entitys = await _context.InStockTaskDetails + .Where(f => ids.Contains(f.Id)) + .ToListAsync(); + return entitys; + } + /// /// 根据明细id查找 /// @@ -577,6 +590,36 @@ namespace WMS.Web.Repositories } } + /// + /// 批量修改-明细 + /// + /// + /// + public async Task UpdateRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + { + try + { + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.InStockTaskDetails.AsNoTracking().Where(f => list.Contains(f.Id)).ToListAsync(); + _mapper.ToMapList(entitys, res); + await _context.SaveChangesAsync(); + if (_transaction != null) + _transaction.Commit(); + } + catch (Exception ex) + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + return true; + } + } + /// /// 修改 ///