箱号查询
This commit is contained in:
@@ -23,10 +23,13 @@ namespace WMS.Web.Api.Controllers
|
|||||||
{
|
{
|
||||||
private readonly ILoginService _loginService;
|
private readonly ILoginService _loginService;
|
||||||
private readonly IBasicsRepositories _basicsRepositories;
|
private readonly IBasicsRepositories _basicsRepositories;
|
||||||
public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories)
|
private readonly IBoxRepositories _boxRepositories;
|
||||||
|
public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories,
|
||||||
|
IBoxRepositories boxRepositories)
|
||||||
{
|
{
|
||||||
_loginService = loginService;
|
_loginService = loginService;
|
||||||
_basicsRepositories = basicsRepositories;
|
_basicsRepositories = basicsRepositories;
|
||||||
|
_boxRepositories = boxRepositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -95,5 +98,24 @@ namespace WMS.Web.Api.Controllers
|
|||||||
var r = await _basicsRepositories.GetSubUcStockAsync(id, name);
|
var r = await _basicsRepositories.GetSubUcStockAsync(id, name);
|
||||||
return Result<List<UcStockResponse>>.ReSuccess(r);
|
return Result<List<UcStockResponse>>.ReSuccess(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据箱号获取箱信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="billNo">必填</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("GetBoxDetails")]
|
||||||
|
public async Task<ResultList<BoxDetailResponse>> GetBoxDetails([FromQuery] string billNo)
|
||||||
|
{
|
||||||
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
|
return ResultList<BoxDetailResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
|
if(string.IsNullOrEmpty(billNo))
|
||||||
|
return ResultList<BoxDetailResponse>.ReSuccess(new List<BoxDetailResponse>());
|
||||||
|
|
||||||
|
var r = await _boxRepositories.GetDetails(billNo);
|
||||||
|
return ResultList<BoxDetailResponse>.ReSuccess(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/WMS.Web.Core/Dto/BoxDetailResponse.cs
Normal file
49
src/WMS.Web.Core/Dto/BoxDetailResponse.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据箱号获取物料信息
|
||||||
|
/// </summary>
|
||||||
|
public class BoxDetailResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据头ID
|
||||||
|
/// </summary>
|
||||||
|
public int Fid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 箱Id
|
||||||
|
/// </summary>
|
||||||
|
public int BoxId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
public int MaterialId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格型号
|
||||||
|
/// </summary>
|
||||||
|
public string Specifications { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 供应商ID
|
||||||
|
/// </summary>
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 数量(装箱数量)
|
||||||
|
/// </summary>
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号集
|
||||||
|
/// </summary>
|
||||||
|
public string SerialNumbers { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Infrastructure
|
namespace WMS.Web.Domain.Infrastructure
|
||||||
@@ -12,5 +13,7 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
public interface IBoxRepositories
|
public interface IBoxRepositories
|
||||||
{
|
{
|
||||||
Task<Box> Get(string BoxBillNo);
|
Task<Box> Get(string BoxBillNo);
|
||||||
|
//根据箱号查询物料信息
|
||||||
|
Task<List<BoxDetailResponse>> GetDetails(string BoxBillNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
using WMS.Web.Domain.Infrastructure;
|
using WMS.Web.Domain.Infrastructure;
|
||||||
using WMS.Web.Domain.IService.Public;
|
using WMS.Web.Domain.IService.Public;
|
||||||
@@ -36,8 +37,33 @@ namespace WMS.Web.Repositories
|
|||||||
}
|
}
|
||||||
public async Task<Box> Get(string BoxBillNo)
|
public async Task<Box> Get(string BoxBillNo)
|
||||||
{
|
{
|
||||||
return await _context.Box.Include(x=>x.Details)
|
return await _context.Box.Include(x => x.Details)
|
||||||
.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
|
.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据箱号查询物料信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="BoxBillNo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<BoxDetailResponse>> GetDetails(string BoxBillNo)
|
||||||
|
{
|
||||||
|
return await _context.BoxDetails
|
||||||
|
.GroupJoin(_context.Box, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||||
|
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||||
|
.Where(w => w.order.BoxBillNo.Equals(BoxBillNo))
|
||||||
|
.Select(s => new BoxDetailResponse()
|
||||||
|
{
|
||||||
|
Fid = s.detail.Fid,
|
||||||
|
BoxId = s.order.OpsBoxId,
|
||||||
|
MaterialId = s.detail.MaterialId,
|
||||||
|
MaterialName = "",
|
||||||
|
MaterialNumber = "",
|
||||||
|
Specifications = "",
|
||||||
|
SerialNumbers = s.detail.SerialNumbers,
|
||||||
|
SupplierId = s.detail.SupplierId,
|
||||||
|
Qty = s.detail.Qty
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user