增加明细行作废

This commit is contained in:
18942506660
2024-03-22 14:11:17 +08:00
parent 4a5f2d025f
commit 0558f5d024
6 changed files with 50 additions and 13 deletions

View File

@@ -191,11 +191,17 @@ namespace WMS.Web.Domain.Entitys
/// <summary>
/// 作废
/// </summary>
public void Repeal(int creatorId)
public void Repeal(int creatorId, List<int> ids)
{
this.OperatorId = creatorId;
this.OperateTime = DateTime.Now;
this.Status = OutStockStatus.Repeal;
foreach (var d in this.Details.Where(w => ids.Contains(w.Id)))
{
d.IsRepeal = true;
}
//如果明细全部作废,则单据状态作废
if (this.Details.Where(w => w.IsRepeal == true).Count() == this.Details.Count())
this.Status = OutStockStatus.Repeal;
}
/// <summary>
/// 合并

View File

@@ -63,6 +63,11 @@ namespace WMS.Web.Domain.Entitys
[Column("OutStockEndTime")]
public DateTime? OutStockEndTime { get; set; }
/// <summary>
/// 是否作废
/// </summary>
[Column("IsRepeal")]
public bool? IsRepeal { get; set; } = false;
/// <summary>
/// 对应erp明细 同一个物料 存在于不同的来源单中(合并后出现多条)
/// </summary>
public List<OutStockTaskErpDetails> ErpDetails { get; set; } = new List<OutStockTaskErpDetails>();

View File

@@ -22,6 +22,8 @@ namespace WMS.Web.Domain.Infrastructure
Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto, int companyId = 0);
/// 查询实体集合
Task<List<OutStockTask>> GetEntityList(List<int> ids);
/// 查询实体集合(明细Id)
Task<List<OutStockTask>> GetEntityListByDetailIds(List<int> ids);
/// <summary>
/// 列表-根据明细中的来源单号精确匹配
/// </summary>

View File

@@ -54,11 +54,13 @@ namespace WMS.Web.Domain.Services
/// <returns></returns>
public async Task<Result> Repeal(OperateRequest dto, LoginInDto loginInfo)
{
var list = await _outStockTaskRepositories.GetEntityList(dto.Ids);
var list = await _outStockTaskRepositories.GetEntityListByDetailIds(dto.Ids);
foreach (var entity in list)
{
List<int> e_ids = entity.Details.Select(s => s.Id).ToList();
var j_ids = e_ids.Intersect(dto.Ids).ToList();
//作废
entity.Repeal(loginInfo.UserInfo.StaffId);
entity.Repeal(loginInfo.UserInfo.StaffId, j_ids);
}
var isSuccess = await _outStockTaskRepositories.EditEntityList(list, true);
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
@@ -373,7 +375,7 @@ namespace WMS.Web.Domain.Services
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
@@ -424,13 +426,13 @@ namespace WMS.Web.Domain.Services
if (!result.IsSuccess) isRollback = true;
}
//4.提交事务
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
_redisClientService.SetStringKey($"wms_outstock_sync", false, TimeSpan.FromMinutes(5));
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}