优化接口
This commit is contained in:
@@ -830,6 +830,11 @@
|
|||||||
箱号
|
箱号
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.CreateTime">
|
||||||
|
<summary>
|
||||||
|
收货时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.Details">
|
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.Details">
|
||||||
<summary>
|
<summary>
|
||||||
明细
|
明细
|
||||||
@@ -2196,6 +2201,13 @@
|
|||||||
<param name="taskId"></param>
|
<param name="taskId"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Collections.Generic.List{System.Int32})">
|
||||||
|
<summary>
|
||||||
|
集合:根据boxIDS
|
||||||
|
</summary>
|
||||||
|
<param name="boxIds"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Collections.Generic.List{System.String})">
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Collections.Generic.List{System.String})">
|
||||||
<summary>
|
<summary>
|
||||||
集合:根据箱号集合
|
集合:根据箱号集合
|
||||||
@@ -2218,6 +2230,14 @@
|
|||||||
<param name="isTransaction"></param>
|
<param name="isTransaction"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.DeleteRange(System.Collections.Generic.List{System.Int32},System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
批量删除
|
||||||
|
</summary>
|
||||||
|
<param name="ids"></param>
|
||||||
|
<param name="isTransaction"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories">
|
<member name="T:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories">
|
||||||
<summary>
|
<summary>
|
||||||
入库任务-仓储接口
|
入库任务-仓储接口
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string BoxBillNo { get; set; }
|
public string BoxBillNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 收货时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 明细
|
/// 明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<InStockTaskBox>> GetListBy(int taskId);
|
Task<List<InStockTaskBox>> GetListBy(int taskId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 集合:根据boxIDS
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="boxIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<InStockTaskBox>> GetListBy(List<int> boxIds);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集合:根据箱号集合
|
/// 集合:根据箱号集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -39,5 +46,13 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// <param name="isTransaction"></param>
|
/// <param name="isTransaction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> AddRange(List<InStockTaskBox> entitys, bool isTransaction = true);
|
Task<bool> AddRange(List<InStockTaskBox> entitys, bool isTransaction = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ids"></param>
|
||||||
|
/// <param name="isTransaction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> DeleteRange(List<int> ids, bool isTransaction = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -597,10 +597,9 @@ namespace WMS.Web.Domain.Services
|
|||||||
});
|
});
|
||||||
|
|
||||||
//2.修改箱和任务单的绑定关系,先判断箱没有被收货过
|
//2.修改箱和任务单的绑定关系,先判断箱没有被收货过
|
||||||
var taskBoxList = await _inStockTaskBoxRepositories.GetListBy(entity.Id);
|
|
||||||
var dto_boxIds = dto.Boxs.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
var dto_boxIds = dto.Boxs.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||||
var isHaveBox = taskBoxList.Where(x => dto_boxIds.Contains(x.BoxId)).Any();
|
var taskBoxList = await _inStockTaskBoxRepositories.GetListBy(dto_boxIds);
|
||||||
if (isHaveBox)
|
if (taskBoxList != null && taskBoxList.Count != 0)
|
||||||
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
|
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
|
||||||
|
|
||||||
//3.组装绑定关系表,要添加的集合
|
//3.组装绑定关系表,要添加的集合
|
||||||
|
|||||||
@@ -59,6 +59,18 @@ namespace WMS.Web.Repositories
|
|||||||
return entitys;
|
return entitys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 集合:根据boxIDS
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="boxIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<InStockTaskBox>> GetListBy(List<int> boxIds)
|
||||||
|
{
|
||||||
|
var entitys = await _context.InstockTaskBox
|
||||||
|
.Include(s => s.Details).Where(x => boxIds.Contains(x.BoxId)).ToListAsync();
|
||||||
|
return entitys;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集合:根据箱号集合
|
/// 集合:根据箱号集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -112,5 +124,34 @@ namespace WMS.Web.Repositories
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<bool> DeleteRange(List<int> ids, bool isTransaction = false)
|
||||||
|
{
|
||||||
|
IDbContextTransaction _transaction = null;
|
||||||
|
if (isTransaction)
|
||||||
|
_transaction = _context.Database.BeginTransaction();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = await _context.InstockTaskBox.Include(x => x.Details)
|
||||||
|
.Where(f => ids.Contains(f.Id)).ToListAsync();
|
||||||
|
_context.InstockTaskBox.RemoveRange(list);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (_transaction != null)
|
||||||
|
_transaction.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_transaction != null)
|
||||||
|
_transaction.Rollback();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user