入库单-列表接口
This commit is contained in:
46
src/WMS.Web.Api/Controllers/InStockController.cs
Normal file
46
src/WMS.Web.Api/Controllers/InStockController.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
|
using WMS.Web.Core.Internal.Results;
|
||||||
|
using WMS.Web.Domain.Infrastructure;
|
||||||
|
using WMS.Web.Domain.IService.Public;
|
||||||
|
using WMS.Web.Domain.Values;
|
||||||
|
|
||||||
|
namespace WMS.Web.Api.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 入库单-接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class InStockController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ILoginService _loginService;
|
||||||
|
private readonly IInStockRepositories _inStockRepositories;
|
||||||
|
public InStockController(ILoginService loginService, IInStockRepositories inStockRepositories)
|
||||||
|
{
|
||||||
|
this._loginService = loginService;
|
||||||
|
this._inStockRepositories = inStockRepositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("GetList")]
|
||||||
|
public async Task<ResultPagedList<InStockQueryResponse>> GetPagedList([FromBody] InStockQueryRequest dto)
|
||||||
|
{
|
||||||
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
|
return ResultPagedList<InStockQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
|
var result= await _inStockRepositories.GetPagedList(dto);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,18 @@
|
|||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Api.Controllers.InStockController">
|
||||||
|
<summary>
|
||||||
|
入库单-接口
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:WMS.Web.Api.Controllers.InStockController.GetPagedList(WMS.Web.Core.Dto.InStockQueryRequest)">
|
||||||
|
<summary>
|
||||||
|
列表
|
||||||
|
</summary>
|
||||||
|
<param name="dto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Api.Controllers.LoginController">
|
<member name="T:WMS.Web.Api.Controllers.LoginController">
|
||||||
<summary>
|
<summary>
|
||||||
登录接口
|
登录接口
|
||||||
|
|||||||
@@ -340,6 +340,11 @@
|
|||||||
单据ID
|
单据ID
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStockQueryResponse.DetailsId">
|
||||||
|
<summary>
|
||||||
|
明细ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:WMS.Web.Core.Dto.InStockQueryResponse.BillNo">
|
<member name="P:WMS.Web.Core.Dto.InStockQueryResponse.BillNo">
|
||||||
<summary>
|
<summary>
|
||||||
单据编号
|
单据编号
|
||||||
|
|||||||
@@ -830,6 +830,13 @@
|
|||||||
wms入库单-仓储接口
|
wms入库单-仓储接口
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockRepositories.GetPagedList(WMS.Web.Core.Dto.InStockQueryRequest)">
|
||||||
|
<summary>
|
||||||
|
列表-分页
|
||||||
|
</summary>
|
||||||
|
<param name="dto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:WMS.Web.Domain.Infrastructure.ITransactionRepositories.GetTransaction">
|
<member name="M:WMS.Web.Domain.Infrastructure.ITransactionRepositories.GetTransaction">
|
||||||
<summary>
|
<summary>
|
||||||
获取事务 用来处理即时库存
|
获取事务 用来处理即时库存
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ namespace WMS.Web.Core.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 明细ID
|
||||||
|
/// </summary>
|
||||||
|
public int DetailsId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单据编号
|
/// 单据编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -68,6 +73,6 @@ namespace WMS.Web.Core.Dto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步成功或者失败
|
/// 同步成功或者失败
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SuccessSync { get; set; }
|
public bool? SuccessSync { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 同步成功或者失败
|
/// 同步成功或者失败
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SuccessSync { get; set; }
|
public bool? SuccessSync { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 明细
|
/// 明细
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
|
using WMS.Web.Core.Internal.Results;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Infrastructure
|
namespace WMS.Web.Domain.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -9,5 +12,11 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IInStockRepositories
|
public interface IInStockRepositories
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 列表-分页
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ResultPagedList<InStockQueryResponse>> GetPagedList(InStockQueryRequest dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core;
|
||||||
using WMS.Web.Core.Dto;
|
using WMS.Web.Core.Dto;
|
||||||
using WMS.Web.Core.Internal.Results;
|
using WMS.Web.Core.Internal.Results;
|
||||||
using WMS.Web.Domain.Infrastructure;
|
using WMS.Web.Domain.Infrastructure;
|
||||||
@@ -27,11 +30,46 @@ namespace WMS.Web.Repositories
|
|||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表-分页
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task<ResultPagedList<InStockQueryResponse>> GetPagedList(InStockQueryRequest dto)
|
public async Task<ResultPagedList<InStockQueryResponse>> GetPagedList(InStockQueryRequest dto)
|
||||||
{
|
{
|
||||||
//var query=_context.
|
var query=_context.InStockDetails
|
||||||
|
.GroupJoin(_context.Instock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||||
|
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||||
|
.Where(adv => 1 == 1);
|
||||||
|
|
||||||
return null;
|
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||||
|
query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNo, "%" + dto.SourceBillNo + "%"));
|
||||||
|
|
||||||
|
var response = new ResultPagedList<InStockQueryResponse>();
|
||||||
|
int total = await query.CountAsync();
|
||||||
|
response.TotalCount = total;
|
||||||
|
|
||||||
|
var list = await query.Select(s => new InStockQueryResponse()
|
||||||
|
{
|
||||||
|
Id=s.order.Id,
|
||||||
|
DetailsId=s.detail.Id,
|
||||||
|
BillNo=s.order.BillNo,
|
||||||
|
Type=s.order.Type.GetRemark(),
|
||||||
|
SourceBillNo=s.detail.SourceBillNo,
|
||||||
|
Supplier="",
|
||||||
|
Org="",
|
||||||
|
MaterialName="",
|
||||||
|
MaterialNumber="",
|
||||||
|
Specifications="",
|
||||||
|
Stock="",
|
||||||
|
Qty=s.detail.Qty,
|
||||||
|
Creator="",
|
||||||
|
CreateTime=s.order.CreateTime,
|
||||||
|
SuccessSync=s.order.SuccessSync
|
||||||
|
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||||
|
|
||||||
|
response.Data = list;
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user