增加明细行作废
This commit is contained in:
@@ -142,7 +142,13 @@ namespace WMS.Web.Core.Dto.OutStockTask
|
||||
///</summary>
|
||||
[Column("创建时间")]
|
||||
public string CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 是否作废
|
||||
///</summary>
|
||||
[Column("是否作废")]
|
||||
public bool IsRepeal { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
/// 合并
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,20 @@ namespace WMS.Web.Repositories
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据明细id查找
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OutStockTask>> GetEntityListByDetailIds(List<int> ids)
|
||||
{
|
||||
var res = await _context.OutStockTask
|
||||
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => f.Details.Where(dw => ids.Contains(dw.Id)).Count() > 0)
|
||||
.ToListAsync();
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
@@ -311,6 +325,7 @@ namespace WMS.Web.Repositories
|
||||
AccruedQty = s.detail.AccruedQty,
|
||||
RealityQty = s.detail.RealityQty,
|
||||
CreateTime = s.order.CreateTime.DateToStringSeconds(),
|
||||
IsRepeal = s.detail.IsRepeal ?? false,
|
||||
OperateTime = s.order.OperateTime.DateToStringSeconds(),
|
||||
Operator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.OperatorId ?? 0),
|
||||
OutStockTime = s.order.OutStockTime.DateToStringSeconds(),
|
||||
@@ -353,7 +368,7 @@ namespace WMS.Web.Repositories
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
List<OutStockTask> list = new List<OutStockTask>();
|
||||
var list1 = await _context.OutStockTask.Include(x => x.Details).ThenInclude(s => s.ErpDetails)
|
||||
var list1 = await _context.OutStockTask.Include(x => x.Details.Where(w => w.IsRepeal != true)).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => EF.Functions.Like(f.BillNo, "%" + billNo + "%") &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
@@ -361,7 +376,7 @@ namespace WMS.Web.Repositories
|
||||
if (list1 != null && list1.Count() > 0)
|
||||
list.AddRange(list1);
|
||||
|
||||
var list2 = await _context.OutStockTask.Include(x => x.Details).ThenInclude(s => s.ErpDetails)
|
||||
var list2 = await _context.OutStockTask.Include(x => x.Details.Where(w => w.IsRepeal != true)).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => (f.Details.SelectMany(s => s.ErpDetails).Where(w => EF.Functions.Like(w.SourceBillNo, "%" + billNo + "%")).Any()) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
@@ -398,7 +413,7 @@ namespace WMS.Web.Repositories
|
||||
return new GetOutStockTaskByNoResponse();
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
var entity = await _context.OutStockTask.Include(x => x.Details).ThenInclude(s => s.ErpDetails)
|
||||
var entity = await _context.OutStockTask.Include(x => x.Details.Where(w => w.IsRepeal != true)).ThenInclude(s => s.ErpDetails)
|
||||
.FirstOrDefaultAsync(f => f.BillNo.Equals(billNo) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait));
|
||||
|
||||
@@ -471,14 +486,14 @@ namespace WMS.Web.Repositories
|
||||
|
||||
public async Task<List<string>> GetOutStockTaskNosByNo(string billNo)
|
||||
{
|
||||
var res = await _context.OutStockTask.Include(x => x.Details).ThenInclude(s => s.ErpDetails)
|
||||
var res = await _context.OutStockTask.Include(x => x.Details.Where(w => w.IsRepeal != true)).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => EF.Functions.Like(f.BillNo, "%" + billNo + "%") &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.Select(s => s.BillNo)
|
||||
.ToListAsync();
|
||||
|
||||
var ress = await _context.OutStockTask.Include(x => x.Details).ThenInclude(s => s.ErpDetails)
|
||||
var ress = await _context.OutStockTask.Include(x => x.Details.Where(w => w.IsRepeal != true)).ThenInclude(s => s.ErpDetails)
|
||||
.Where(f => (f.Details.SelectMany(s => s.ErpDetails).Where(w => EF.Functions.Like(w.SourceBillNo, "%" + billNo + "%")).Any()) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
@@ -514,5 +529,6 @@ namespace WMS.Web.Repositories
|
||||
|
||||
return entitys.Clone();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user