优化
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,5 +73,10 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否作废
|
||||
/// </summary>
|
||||
public bool? IsRepeal { get; set; } = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user