出库任务列表
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using AutoMapper;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto.OutStockTask;
|
||||||
|
using WMS.Web.Core.Internal.Results;
|
||||||
|
using WMS.Web.Domain.Infrastructure;
|
||||||
|
using WMS.Web.Domain.IService;
|
||||||
|
using WMS.Web.Domain.IService.Public;
|
||||||
|
using WMS.Web.Domain.Values;
|
||||||
|
|
||||||
namespace WMS.Web.Api.Controllers
|
namespace WMS.Web.Api.Controllers
|
||||||
{
|
{
|
||||||
@@ -14,5 +21,34 @@ namespace WMS.Web.Api.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class OutStockTaskController : ControllerBase
|
public class OutStockTaskController : ControllerBase
|
||||||
{
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly ILoginService _loginService;
|
||||||
|
private readonly IOutStockTaskRepositories _repositories;
|
||||||
|
private readonly IOutStockService _outStockService;
|
||||||
|
public OutStockTaskController(IMapper mapper, ILoginService loginService,
|
||||||
|
IOutStockTaskRepositories repositories, IOutStockService outStockService)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_loginService = loginService;
|
||||||
|
_repositories = repositories;
|
||||||
|
_outStockService = outStockService;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("GetList")]
|
||||||
|
public async Task<ResultPagedList<OutStockTaskQueryInfoResponse>> GetPagedList([FromBody] OutStockTaskQueryRequest dto)
|
||||||
|
{
|
||||||
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
|
return ResultPagedList<OutStockTaskQueryInfoResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
|
|
||||||
|
var (list, count) = await _repositories.GetListAsync(dto);
|
||||||
|
var result = ResultPagedList<OutStockTaskQueryInfoResponse>.ReSuccess(list, count);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto.OutStockTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单任务列表
|
||||||
|
/// </summary>
|
||||||
|
public class OutStockTaskQueryInfoResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据Id
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string BillNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据状态
|
||||||
|
/// </summary>
|
||||||
|
public string Status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据类型
|
||||||
|
/// </summary>
|
||||||
|
public string Type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 操作人(出库人)
|
||||||
|
/// </summary>
|
||||||
|
public string Operator { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 操作时间(出库时间)
|
||||||
|
/// </summary>
|
||||||
|
public string OperateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 来源单号
|
||||||
|
///</summary>
|
||||||
|
public string SourceBillNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 销售订单号
|
||||||
|
///</summary>
|
||||||
|
public string SaleBillNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 发货组织
|
||||||
|
///</summary>
|
||||||
|
public string DeliveryOrg { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 收货客户
|
||||||
|
///</summary>
|
||||||
|
public string ReceiptCustomer { 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 string Stock { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 应出库数量
|
||||||
|
///</summary>
|
||||||
|
public decimal AccruedQty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 已出库数量
|
||||||
|
///</summary>
|
||||||
|
public decimal RealityQty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 订单明细备注
|
||||||
|
///</summary>
|
||||||
|
public string Remark { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间(erp那边的创建时间)
|
||||||
|
///</summary>
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto.OutStockTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 出库单任务
|
||||||
|
/// </summary>
|
||||||
|
public class OutStockTaskQueryRequest : PaginationBaseRequestDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据类型(出库单下拉列表)
|
||||||
|
/// </summary>
|
||||||
|
public int? Type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据状态
|
||||||
|
/// </summary>
|
||||||
|
public int? Status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间(出库时间)
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateBeginDate { get; set; } = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间(出库时间)
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateEndDate { get; set; } = null;
|
||||||
|
/// <summary>
|
||||||
|
/// 来源单号
|
||||||
|
///</summary>
|
||||||
|
public string SourceBillNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 发货组织
|
||||||
|
///</summary>
|
||||||
|
public int? DeliveryOrgId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 收货客户
|
||||||
|
///</summary>
|
||||||
|
public string ReceiptCustomer { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
///</summary>
|
||||||
|
public string MaterialNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库ID
|
||||||
|
///</summary>
|
||||||
|
public int? StockId { 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.OutStockTask;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Infrastructure
|
namespace WMS.Web.Domain.Infrastructure
|
||||||
@@ -10,5 +11,7 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
{
|
{
|
||||||
// 新增
|
// 新增
|
||||||
Task<OutStockTask> Add(OutStockTask entity, bool isTransaction = true);
|
Task<OutStockTask> Add(OutStockTask entity, bool isTransaction = true);
|
||||||
|
// 获取列表
|
||||||
|
Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Storage;
|
using Microsoft.EntityFrameworkCore.Storage;
|
||||||
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.Dto.OutStockTask;
|
||||||
|
using WMS.Web.Core.Help;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
using WMS.Web.Domain.Infrastructure;
|
using WMS.Web.Domain.Infrastructure;
|
||||||
using WMS.Web.Repositories.Configuration;
|
using WMS.Web.Repositories.Configuration;
|
||||||
@@ -57,5 +61,42 @@ namespace WMS.Web.Repositories
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||||
|
{
|
||||||
|
var query = _context.OutStockTask
|
||||||
|
.OrderByDescending(o => o.Id)
|
||||||
|
.Where(adv => 1 == 1);
|
||||||
|
|
||||||
|
if (dto.CreateBeginDate != null)
|
||||||
|
query = query.Where(w => w.OperateTime >= dto.CreateBeginDate);
|
||||||
|
if (dto.CreateEndDate != null)
|
||||||
|
query = query.Where(w => w.OperateTime <= dto.CreateEndDate);
|
||||||
|
//组装
|
||||||
|
int total = await query.CountAsync();
|
||||||
|
var list = await query.Select(s => new OutStockTaskQueryInfoResponse()
|
||||||
|
{
|
||||||
|
#region dto组装
|
||||||
|
Id = 0,
|
||||||
|
Status = "",
|
||||||
|
Type = "",
|
||||||
|
CreateTime = s.OperateTime.DateToStringSeconds(),
|
||||||
|
Stock = "",
|
||||||
|
SourceBillNo = "",
|
||||||
|
SaleBillNo = "",
|
||||||
|
DeliveryOrg = "",
|
||||||
|
ReceiptCustomer = "",
|
||||||
|
MaterialName = "",
|
||||||
|
MaterialNumber = "",
|
||||||
|
Specifications = ""
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||||
|
return (list, total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user