优化修改
This commit is contained in:
@@ -5274,6 +5274,11 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SendDataDetailsDto.TaskDetailId">
|
||||
<summary>
|
||||
任务明细ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SendDataDetailsDto.MaterialName">
|
||||
<summary>
|
||||
物料名称
|
||||
|
||||
@@ -2863,6 +2863,13 @@
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetDetailsList(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
列表
|
||||
</summary>
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetListByDetailIds(System.Collections.Generic.List{System.Int32})">
|
||||
<summary>
|
||||
获取列表根据明细IDS
|
||||
@@ -2929,6 +2936,14 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.UpdateRange(System.Collections.Generic.List{WMS.Web.Domain.Entitys.InStockTaskDetails},System.Boolean)">
|
||||
<summary>
|
||||
批量修改-明细
|
||||
</summary>
|
||||
<param name="entitys"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.Update(WMS.Web.Domain.Entitys.InStockTask,System.Boolean)">
|
||||
<summary>
|
||||
修改
|
||||
|
||||
@@ -44,6 +44,12 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
public class SendDataDetailsDto
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 任务明细ID
|
||||
/// </summary>
|
||||
public int TaskDetailId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
|
||||
@@ -51,6 +51,13 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <returns></returns>
|
||||
Task<List<InStockTask>> GetList(List<int> ids);
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<InStockTaskDetails>> GetDetailsList(List<int> ids);
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表根据明细IDS
|
||||
/// </summary>
|
||||
@@ -117,7 +124,15 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> UpdateRange(List<InStockTask> entitys, bool isTransaction = true);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改-明细
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> UpdateRange(List<InStockTaskDetails> entitys, bool isTransaction = true);
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
|
||||
@@ -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<int>();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,19 @@ namespace WMS.Web.Repositories
|
||||
return entitys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTaskDetails>> GetDetailsList(List<int> ids)
|
||||
{
|
||||
var entitys = await _context.InStockTaskDetails
|
||||
.Where(f => ids.Contains(f.Id))
|
||||
.ToListAsync();
|
||||
return entitys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据明细id查找
|
||||
/// </summary>
|
||||
@@ -577,6 +590,36 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改-明细
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> UpdateRange(List<InStockTaskDetails> entitys, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
{
|
||||
try
|
||||
{
|
||||
List<int> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user