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

@@ -2377,6 +2377,11 @@
创建时间erp那边的创建时间
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.InStockTaskQueryResponse.IsRepeal">
<summary>
是否作废
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.InStock.BoxInStockTaskRequest">
<summary>
箱号-获取来源单信息-请求对象
@@ -4638,6 +4643,11 @@
创建时间erp那边的创建时间
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.IsRepeal">
<summary>
是否作废
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryRequest">
<summary>
出库单任务

View File

@@ -971,7 +971,7 @@
<param name="sourceBillNo"></param>
<param name="createTime"></param>
</member>
<member name="M:WMS.Web.Domain.Entitys.InStockTask.Repeal(System.Int32)">
<member name="M:WMS.Web.Domain.Entitys.InStockTask.Repeal(System.Int32,System.Collections.Generic.List{System.Int32})">
<summary>
作废
</summary>
@@ -1141,6 +1141,11 @@
明细备注
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.InStockTaskDetails.IsRepeal">
<summary>
是否作废
</summary>
</member>
<member name="T:WMS.Web.Domain.Entitys.InStockTotalDetails">
<summary>
wms入库单-汇总明细
@@ -1793,7 +1798,7 @@
生成单据号
</summary>
</member>
<member name="M:WMS.Web.Domain.Entitys.OutStockTask.Repeal(System.Int32)">
<member name="M:WMS.Web.Domain.Entitys.OutStockTask.Repeal(System.Int32,System.Collections.Generic.List{System.Int32})">
<summary>
作废
</summary>
@@ -1851,6 +1856,11 @@
出库结束时间
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.IsRepeal">
<summary>
是否作废
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.ErpDetails">
<summary>
对应erp明细 同一个物料 存在于不同的来源单中(合并后出现多条)
@@ -2604,6 +2614,13 @@
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetListByDetailIds(System.Collections.Generic.List{System.Int32})">
<summary>
获取列表根据明细IDS
</summary>
<param name="ids"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories.GetListBy(System.Collections.Generic.List{System.String})">
<summary>
列表-根据明细中的来源单号
@@ -2797,6 +2814,9 @@
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityList(System.Collections.Generic.List{System.Int32})">
查询实体集合
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetEntityListByDetailIds(System.Collections.Generic.List{System.Int32})">
查询实体集合(明细Id)
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IOutStockTaskRepositories.GetListBySourceBillNo(System.Collections.Generic.List{System.String})">
<summary>
列表-根据明细中的来源单号精确匹配

View File

@@ -132,5 +132,11 @@ namespace WMS.Web.Core.Dto
/// </summary>
[Column("创建时间")]
public string CreateTime { get; set; }
/// <summary>
/// 是否作废
/// </summary>
[Column("是否作废")]
public bool IsRepeal { get; set; }
}
}

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);

View File

@@ -100,6 +100,22 @@ namespace WMS.Web.Repositories
return entitys;
}
/// <summary>
/// 根据明细id查找
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<List<InStockTask>> GetListByDetailIds(List<int> ids)
{
var res = await _context.InStockTask
.Include(s => s.Details)
.Where(f => f.Details.Where(dw => ids.Contains(dw.Id)).Count() > 0)
.ToListAsync();
return res.Clone();
}
/// <summary>
/// 列表-根据明细中的来源单号
/// </summary>
@@ -147,7 +163,11 @@ namespace WMS.Web.Repositories
var query = _context.InStockTaskDetails
.GroupJoin(_context.InStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && w.order.Type == InstockType.Purchase && (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status== InstockStatus.WaitInStock) && w.detail.AccruedQty>0);
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%")
&& w.order.Type == InstockType.Purchase
&& (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status== InstockStatus.WaitInStock)
&& w.detail.AccruedQty>0
&& w.detail.IsRepeal!=true);
//仓库
if (!string.IsNullOrEmpty(dto.StockCode))
@@ -223,7 +243,7 @@ namespace WMS.Web.Repositories
{
var ids = taskList.Select(x => x.Id).ToList();
//找明细
var query = _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid) && x.AccruedQty>0);
var query = _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid) && x.AccruedQty>0 && x.IsRepeal!=true);
//仓库
if (!string.IsNullOrEmpty(dto.StockCode))
@@ -552,6 +572,7 @@ namespace WMS.Web.Repositories
ShelfTime = s.order.ShelfTime.HasValue ? s.order.ShelfTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
Remark = s.detail.Remark,
IsRepeal = s.detail.IsRepeal ?? false,
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
return (list, total);