增加明细行作废
This commit is contained in:
@@ -142,6 +142,12 @@ namespace WMS.Web.Core.Dto.OutStockTask
|
|||||||
///</summary>
|
///</summary>
|
||||||
[Column("创建时间")]
|
[Column("创建时间")]
|
||||||
public string CreateTime { get; set; }
|
public string CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否作废
|
||||||
|
///</summary>
|
||||||
|
[Column("是否作废")]
|
||||||
|
public bool IsRepeal { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,10 +191,16 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 作废
|
/// 作废
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Repeal(int creatorId)
|
public void Repeal(int creatorId, List<int> ids)
|
||||||
{
|
{
|
||||||
this.OperatorId = creatorId;
|
this.OperatorId = creatorId;
|
||||||
this.OperateTime = DateTime.Now;
|
this.OperateTime = DateTime.Now;
|
||||||
|
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;
|
this.Status = OutStockStatus.Repeal;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
[Column("OutStockEndTime")]
|
[Column("OutStockEndTime")]
|
||||||
public DateTime? OutStockEndTime { get; set; }
|
public DateTime? OutStockEndTime { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 是否作废
|
||||||
|
/// </summary>
|
||||||
|
[Column("IsRepeal")]
|
||||||
|
public bool? IsRepeal { get; set; } = false;
|
||||||
|
/// <summary>
|
||||||
/// 对应erp明细 同一个物料 存在于不同的来源单中(合并后出现多条)
|
/// 对应erp明细 同一个物料 存在于不同的来源单中(合并后出现多条)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<OutStockTaskErpDetails> ErpDetails { get; set; } = new List<OutStockTaskErpDetails>();
|
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<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto, int companyId = 0);
|
||||||
/// 查询实体集合
|
/// 查询实体集合
|
||||||
Task<List<OutStockTask>> GetEntityList(List<int> ids);
|
Task<List<OutStockTask>> GetEntityList(List<int> ids);
|
||||||
|
/// 查询实体集合(明细Id)
|
||||||
|
Task<List<OutStockTask>> GetEntityListByDetailIds(List<int> ids);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 列表-根据明细中的来源单号精确匹配
|
/// 列表-根据明细中的来源单号精确匹配
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -54,11 +54,13 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<Result> Repeal(OperateRequest dto, LoginInDto loginInfo)
|
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)
|
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);
|
var isSuccess = await _outStockTaskRepositories.EditEntityList(list, true);
|
||||||
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|||||||
@@ -178,6 +178,20 @@ namespace WMS.Web.Repositories
|
|||||||
|
|
||||||
return res.Clone();
|
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>
|
/// <summary>
|
||||||
/// 编辑
|
/// 编辑
|
||||||
@@ -311,6 +325,7 @@ namespace WMS.Web.Repositories
|
|||||||
AccruedQty = s.detail.AccruedQty,
|
AccruedQty = s.detail.AccruedQty,
|
||||||
RealityQty = s.detail.RealityQty,
|
RealityQty = s.detail.RealityQty,
|
||||||
CreateTime = s.order.CreateTime.DateToStringSeconds(),
|
CreateTime = s.order.CreateTime.DateToStringSeconds(),
|
||||||
|
IsRepeal = s.detail.IsRepeal ?? false,
|
||||||
OperateTime = s.order.OperateTime.DateToStringSeconds(),
|
OperateTime = s.order.OperateTime.DateToStringSeconds(),
|
||||||
Operator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.OperatorId ?? 0),
|
Operator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.OperatorId ?? 0),
|
||||||
OutStockTime = s.order.OutStockTime.DateToStringSeconds(),
|
OutStockTime = s.order.OutStockTime.DateToStringSeconds(),
|
||||||
@@ -353,7 +368,7 @@ namespace WMS.Web.Repositories
|
|||||||
List<int> ids = new List<int>();
|
List<int> ids = new List<int>();
|
||||||
|
|
||||||
List<OutStockTask> list = new List<OutStockTask>();
|
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 + "%") &&
|
.Where(f => EF.Functions.Like(f.BillNo, "%" + billNo + "%") &&
|
||||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||||
.OrderByDescending(o => o.Id)
|
.OrderByDescending(o => o.Id)
|
||||||
@@ -361,7 +376,7 @@ namespace WMS.Web.Repositories
|
|||||||
if (list1 != null && list1.Count() > 0)
|
if (list1 != null && list1.Count() > 0)
|
||||||
list.AddRange(list1);
|
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()) &&
|
.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))
|
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||||
.OrderByDescending(o => o.Id)
|
.OrderByDescending(o => o.Id)
|
||||||
@@ -398,7 +413,7 @@ namespace WMS.Web.Repositories
|
|||||||
return new GetOutStockTaskByNoResponse();
|
return new GetOutStockTaskByNoResponse();
|
||||||
var materials = materials_result.Data.ToList();
|
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) &&
|
.FirstOrDefaultAsync(f => f.BillNo.Equals(billNo) &&
|
||||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait));
|
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait));
|
||||||
|
|
||||||
@@ -471,14 +486,14 @@ namespace WMS.Web.Repositories
|
|||||||
|
|
||||||
public async Task<List<string>> GetOutStockTaskNosByNo(string billNo)
|
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 + "%") &&
|
.Where(f => EF.Functions.Like(f.BillNo, "%" + billNo + "%") &&
|
||||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||||
.OrderByDescending(o => o.Id)
|
.OrderByDescending(o => o.Id)
|
||||||
.Select(s => s.BillNo)
|
.Select(s => s.BillNo)
|
||||||
.ToListAsync();
|
.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()) &&
|
.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))
|
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||||
.OrderByDescending(o => o.Id)
|
.OrderByDescending(o => o.Id)
|
||||||
@@ -514,5 +529,6 @@ namespace WMS.Web.Repositories
|
|||||||
|
|
||||||
return entitys.Clone();
|
return entitys.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user