This commit is contained in:
tongfei
2024-03-22 14:29:37 +08:00
parent 0558f5d024
commit 31af75a15e
8 changed files with 84 additions and 8 deletions

View File

@@ -93,11 +93,17 @@ namespace WMS.Web.Domain.Entitys
/// <summary>
/// 作废
/// </summary>
public void Repeal(int repealerId)
public void Repeal(int repealerId,List<int> detailsIds)
{
this.Status = InstockStatus.Repeal;
this.RepealerId = repealerId;
this.RepealTime= DateTime.Now;
//明细行作废
this.Details.Where(x => detailsIds.Contains(x.Id)).ToList().ForEach(x => { x.IsRepeal = true; });
//如果明细全部作废,则单据状态作废
if (this.Details.All(x => x.IsRepeal == true))
this.Status = InstockStatus.Repeal;
}

View File

@@ -73,5 +73,10 @@ namespace WMS.Web.Domain.Entitys
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 是否作废
/// </summary>
public bool? IsRepeal { get; set; } = false;
}
}

View File

@@ -43,6 +43,13 @@ namespace WMS.Web.Domain.Infrastructure
/// <returns></returns>
Task<List<InStockTask>> GetList(List<int> ids);
/// <summary>
/// 获取列表根据明细IDS
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<List<InStockTask>> GetListByDetailIds(List<int> ids);
/// <summary>
/// 列表-根据明细中的来源单号
/// </summary>

View File

@@ -636,11 +636,12 @@ namespace WMS.Web.Domain.Services
/// <returns></returns>
public async Task<Result> Repeal(OperateRequest dto, LoginInDto loginInfo)
{
var list = await _inStockTaskRepositories.GetList(dto.Ids);
var list = await _inStockTaskRepositories.GetListByDetailIds(dto.Ids);
foreach (var entity in list)
{
var det_ids = entity.Details.Select(s => s.Id).ToList();
//作废
entity.Repeal(loginInfo.UserInfo.StaffId);
entity.Repeal(loginInfo.UserInfo.StaffId, det_ids);
}
var isSuccess = await _inStockTaskRepositories.UpdateRange(list, true);
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);