diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
index e5fcae2b..0ffb0d2e 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
@@ -2377,6 +2377,11 @@
创建时间(erp那边的创建时间)
+
+
+ 是否作废
+
+
箱号-获取来源单信息-请求对象
@@ -4638,6 +4643,11 @@
创建时间(erp那边的创建时间)
+
+
+ 是否作废
+
+
出库单任务
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
index 935b876d..38c56b1a 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
@@ -971,7 +971,7 @@
-
+
作废
@@ -1141,6 +1141,11 @@
明细备注
+
+
+ 是否作废
+
+
wms入库单-汇总明细
@@ -1793,7 +1798,7 @@
生成单据号
-
+
作废
@@ -1851,6 +1856,11 @@
出库结束时间
+
+
+ 是否作废
+
+
对应erp明细 同一个物料 存在于不同的来源单中(合并后出现多条)
@@ -2604,6 +2614,13 @@
+
+
+ 获取列表根据明细IDS
+
+
+
+
列表-根据明细中的来源单号
@@ -2797,6 +2814,9 @@
查询实体集合
+
+ 查询实体集合(明细Id)
+
列表-根据明细中的来源单号精确匹配
diff --git a/src/WMS.Web.Core/Dto/InStockTask/InStockTaskQueryResponse.cs b/src/WMS.Web.Core/Dto/InStockTask/InStockTaskQueryResponse.cs
index 68cf5be5..3da119e5 100644
--- a/src/WMS.Web.Core/Dto/InStockTask/InStockTaskQueryResponse.cs
+++ b/src/WMS.Web.Core/Dto/InStockTask/InStockTaskQueryResponse.cs
@@ -132,5 +132,11 @@ namespace WMS.Web.Core.Dto
///
[Column("创建时间")]
public string CreateTime { get; set; }
+
+ ///
+ /// 是否作废
+ ///
+ [Column("是否作废")]
+ public bool IsRepeal { get; set; }
}
}
diff --git a/src/WMS.Web.Domain/Entitys/InstockTask.cs b/src/WMS.Web.Domain/Entitys/InstockTask.cs
index 11372b08..2cf3bcfe 100644
--- a/src/WMS.Web.Domain/Entitys/InstockTask.cs
+++ b/src/WMS.Web.Domain/Entitys/InstockTask.cs
@@ -93,11 +93,17 @@ namespace WMS.Web.Domain.Entitys
///
/// 作废
///
- public void Repeal(int repealerId)
+ public void Repeal(int repealerId,List 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;
+
}
diff --git a/src/WMS.Web.Domain/Entitys/InstockTaskDetails.cs b/src/WMS.Web.Domain/Entitys/InstockTaskDetails.cs
index 9d7b6ef7..5bb988b8 100644
--- a/src/WMS.Web.Domain/Entitys/InstockTaskDetails.cs
+++ b/src/WMS.Web.Domain/Entitys/InstockTaskDetails.cs
@@ -73,5 +73,10 @@ namespace WMS.Web.Domain.Entitys
///
public string Remark { get; set; }
+ ///
+ /// 是否作废
+ ///
+ public bool? IsRepeal { get; set; } = false;
+
}
}
diff --git a/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs b/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs
index 6503e3b5..2bbda600 100644
--- a/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs
+++ b/src/WMS.Web.Domain/Infrastructure/IInStockTaskRepositories.cs
@@ -43,6 +43,13 @@ namespace WMS.Web.Domain.Infrastructure
///
Task> GetList(List ids);
+ ///
+ /// 获取列表根据明细IDS
+ ///
+ ///
+ ///
+ Task> GetListByDetailIds(List ids);
+
///
/// 列表-根据明细中的来源单号
///
diff --git a/src/WMS.Web.Domain/Services/InStockTaskService.cs b/src/WMS.Web.Domain/Services/InStockTaskService.cs
index 7b4fa845..d7c063c5 100644
--- a/src/WMS.Web.Domain/Services/InStockTaskService.cs
+++ b/src/WMS.Web.Domain/Services/InStockTaskService.cs
@@ -636,11 +636,12 @@ namespace WMS.Web.Domain.Services
///
public async Task 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);
diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs
index 31891369..3841b650 100644
--- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs
+++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs
@@ -100,6 +100,22 @@ namespace WMS.Web.Repositories
return entitys;
}
+ ///
+ /// 根据明细id查找
+ ///
+ ///
+ ///
+ public async Task> GetListByDetailIds(List 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();
+ }
+
+
///
/// 列表-根据明细中的来源单号
///
@@ -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);