获取箱库存明细-根据箱号-pad

This commit is contained in:
tongfei
2023-11-13 17:19:14 +08:00
parent 1deb28b28d
commit aee5ba78a2
9 changed files with 156 additions and 1 deletions

View File

@@ -82,5 +82,21 @@ namespace WMS.Web.Api.Controllers
var result = await _boxInventoryRepositories.GetPagedList(dto);
return result;
}
/// <summary>
/// 获取箱库存明细-根据箱号-pad
/// </summary>
/// <param name="boxBillNo"></param>
/// <returns></returns>
[HttpPost]
[Route("GetBoxInventoryDetails/{boxBillNo}")]
public async Task<ResultList<BoxInventoryDetailsDto>> GetBoxInventoryDetails([FromRoute] string boxBillNo)
{
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultPagedList<BoxInventoryDetailsDto>.ReFailure(ResultCodes.Token_Invalid_Error);
var result = await _boxInventoryRepositories.GetListDetailsBy(boxBillNo);
return ResultList < BoxInventoryDetailsDto >.ReSuccess(result);
}
}
}

View File

@@ -176,6 +176,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Api.Controllers.InventoryController.GetBoxInventoryDetails(System.String)">
<summary>
获取箱库存明细-根据箱号-pad
</summary>
<param name="boxBillNo"></param>
<returns></returns>
</member>
<member name="T:WMS.Web.Api.Controllers.LoginController">
<summary>
登录接口

View File

@@ -1830,6 +1830,46 @@
保存入库单-请求对象
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.Inventory.BoxInventoryDto">
<summary>
箱库存
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto">
<summary>
箱库存明细
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.DetailsId">
<summary>
明细ID
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.BoxId">
<summary>
箱ID
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.BoxInventoryId">
<summary>
箱库存ID
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.MaterialId">
<summary>
物料ID
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.SerialNumbers">
<summary>
序列号集
</summary>
</member>
<member name="P:WMS.Web.Core.Dto.Inventory.BoxInventoryDetailsDto.Qty">
<summary>
物料库存数量
</summary>
</member>
<member name="T:WMS.Web.Core.Dto.Inventory.BoxInventoryQueryRequest">
<summary>
箱库存-查询请求对象

View File

@@ -1412,6 +1412,13 @@
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IBoxInventoryRepositories.GetListDetailsBy(System.String)">
<summary>
明细集合-根据箱号
</summary>
<param name="boxBillNo"></param>
<returns></returns>
</member>
<member name="M:WMS.Web.Domain.Infrastructure.IBoxInventoryRepositories.AddRange(System.Collections.Generic.List{WMS.Web.Domain.Entitys.BoxInventory},System.Boolean)">
<summary>
批量添加

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WMS.Web.Core.Dto.Inventory
{
/// <summary>
/// 箱库存
/// </summary>
public class BoxInventoryDto
{
}
/// <summary>
/// 箱库存明细
/// </summary>
public class BoxInventoryDetailsDto
{
/// <summary>
/// 明细ID
/// </summary>
public int DetailsId { get; set; }
/// <summary>
/// 箱ID
/// </summary>
public int BoxId { get; set; }
/// <summary>
/// 箱库存ID
/// </summary>
public int BoxInventoryId { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public int MaterialId { get; set; }
/// <summary>
/// 序列号集
/// </summary>
public List<string> SerialNumbers { get; set; } = new List<string>();
/// <summary>
/// 物料库存数量
/// </summary>
public decimal Qty { get; set; }
}
}

View File

@@ -29,7 +29,7 @@ namespace WMS.Web.Domain.Entitys
/// <summary>
/// 序列号集
/// </summary>
public string SerialNumbers { get; set; }
public List<string> SerialNumbers { get; set; } = new List<string>();
/// <summary>
/// 物料库存数量
/// </summary>

View File

@@ -19,6 +19,13 @@ namespace WMS.Web.Domain.Infrastructure
/// <param name="dto"></param>
/// <returns></returns>
Task<ResultPagedList<BoxInventoryQueryResponse>> GetPagedList(BoxInventoryQueryRequest dto);
/// <summary>
/// 明细集合-根据箱号
/// </summary>
/// <param name="boxBillNo"></param>
/// <returns></returns>
Task<List<BoxInventoryDetailsDto>> GetListDetailsBy(string boxBillNo);
/// <summary>
/// 批量添加
/// </summary>

View File

@@ -101,6 +101,33 @@ namespace WMS.Web.Repositories
return response;
}
/// <summary>
/// 明细集合-根据箱号
/// </summary>
/// <param name="boxBillNo"></param>
/// <returns></returns>
public async Task<List<BoxInventoryDetailsDto>> GetListDetailsBy(string boxBillNo)
{
var query=_context.BoxInventoryDetails
.GroupJoin(_context.BoxInventory, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.GroupJoin(_context.Box, p => p.order.BoxId, t => t.Id, (p, ts) => new { p.detail, p.order, ts })
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, p.order, box })
.Where(x => 1 == 1 && x.box.BoxBillNo==boxBillNo);
var list = await query.Select(x => new BoxInventoryDetailsDto()
{
DetailsId=x.detail.Id,
BoxId=x.box.Id,
BoxInventoryId=x.order.Id,
MaterialId=x.detail.MaterialId,
Qty=x.detail.Qty,
SerialNumbers=x.detail.SerialNumbers
}).ToListAsync();
return list;
}
/// <summary>
/// 批量添加
/// </summary>

View File

@@ -211,6 +211,9 @@ namespace WMS.Web.Repositories.Configuration
{
ent.ToTable("t_wms_box_inventory_details");
ent.HasKey(x => x.Id);
ent.Property(f => f.SerialNumbers).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
});
# endregion