From ae3d0e0c2f97a68431da83db91cbd4a5fe82e9ec Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Sat, 28 Oct 2023 10:51:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E4=BB=BB=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/OutStockTaskController.cs | 38 ++++++++- .../OutStockTaskQueryInfoResponse.cs | 85 +++++++++++++++++++ .../OutStockTask/OutStockTaskQueryRequest.cs | 49 +++++++++++ .../IOutStockTaskRepositories.cs | 3 + .../OutStockTaskRepositories.cs | 41 +++++++++ 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryInfoResponse.cs create mode 100644 src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryRequest.cs diff --git a/src/WMS.Web.Api/Controllers/OutStockTaskController.cs b/src/WMS.Web.Api/Controllers/OutStockTaskController.cs index 43b34a51..2a97a0b2 100644 --- a/src/WMS.Web.Api/Controllers/OutStockTaskController.cs +++ b/src/WMS.Web.Api/Controllers/OutStockTaskController.cs @@ -1,9 +1,16 @@ -using Microsoft.AspNetCore.Http; +using AutoMapper; +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.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 { @@ -14,5 +21,34 @@ namespace WMS.Web.Api.Controllers [ApiController] 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; + } + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task> GetPagedList([FromBody] OutStockTaskQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + var (list, count) = await _repositories.GetListAsync(dto); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } } } diff --git a/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryInfoResponse.cs b/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryInfoResponse.cs new file mode 100644 index 00000000..724b56b7 --- /dev/null +++ b/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryInfoResponse.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.OutStockTask +{ + /// + /// 出库单任务列表 + /// + public class OutStockTaskQueryInfoResponse + { + /// + /// 单据Id + /// + public int Id { get; set; } + /// + /// 单据编号 + /// + public string BillNo { get; set; } + /// + /// 单据状态 + /// + public string Status { get; set; } + /// + /// 单据类型 + /// + public string Type { get; set; } + /// + /// 操作人(出库人) + /// + public string Operator { get; set; } + /// + /// 操作时间(出库时间) + /// + public string OperateTime { get; set; } + /// + /// 来源单号 + /// + public string SourceBillNo { get; set; } + /// + /// 销售订单号 + /// + public string SaleBillNo { get; set; } + /// + /// 发货组织 + /// + public string DeliveryOrg { get; set; } + /// + /// 收货客户 + /// + public string ReceiptCustomer { get; set; } + /// + /// 物料名称 + /// + public string MaterialName { get; set; } + /// + /// 物料编码 + /// + public string MaterialNumber { get; set; } + /// + /// 物料规格型号 + /// + public string Specifications { get; set; } + /// + /// 仓库ID + /// + public string Stock { get; set; } + /// + /// 应出库数量 + /// + public decimal AccruedQty { get; set; } + /// + /// 已出库数量 + /// + public decimal RealityQty { get; set; } + /// + /// 订单明细备注 + /// + public string Remark { get; set; } + /// + /// 创建时间(erp那边的创建时间) + /// + public string CreateTime { get; set; } + } +} diff --git a/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryRequest.cs b/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryRequest.cs new file mode 100644 index 00000000..d01954f5 --- /dev/null +++ b/src/WMS.Web.Core/Dto/OutStockTask/OutStockTaskQueryRequest.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.OutStockTask +{ + /// + /// 出库单任务 + /// + public class OutStockTaskQueryRequest : PaginationBaseRequestDto + { + /// + /// 单据类型(出库单下拉列表) + /// + public int? Type { get; set; } + /// + /// 单据状态 + /// + public int? Status { get; set; } + /// + /// 创建时间(出库时间) + /// + public DateTime? CreateBeginDate { get; set; } = null; + /// + /// 创建时间(出库时间) + /// + public DateTime? CreateEndDate { get; set; } = null; + /// + /// 来源单号 + /// + public string SourceBillNo { get; set; } + /// + /// 发货组织 + /// + public int? DeliveryOrgId { get; set; } + /// + /// 收货客户 + /// + public string ReceiptCustomer { get; set; } + /// + /// 物料编码 + /// + public string MaterialNumber { get; set; } + /// + /// 仓库ID + /// + public int? StockId { get; set; } + } +} diff --git a/src/WMS.Web.Domain/Infrastructure/IOutStockTaskRepositories.cs b/src/WMS.Web.Domain/Infrastructure/IOutStockTaskRepositories.cs index 8fdfb566..e041570a 100644 --- a/src/WMS.Web.Domain/Infrastructure/IOutStockTaskRepositories.cs +++ b/src/WMS.Web.Domain/Infrastructure/IOutStockTaskRepositories.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using System.Threading.Tasks; +using WMS.Web.Core.Dto.OutStockTask; using WMS.Web.Domain.Entitys; namespace WMS.Web.Domain.Infrastructure @@ -10,5 +11,7 @@ namespace WMS.Web.Domain.Infrastructure { // 新增 Task Add(OutStockTask entity, bool isTransaction = true); + // 获取列表 + Task<(List list, int total)> GetListAsync(OutStockTaskQueryRequest dto); } } diff --git a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs index 5a5ff771..ee9ee67d 100644 --- a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs @@ -1,9 +1,13 @@ using AutoMapper; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; using System; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Threading.Tasks; +using WMS.Web.Core.Dto.OutStockTask; +using WMS.Web.Core.Help; using WMS.Web.Domain.Entitys; using WMS.Web.Domain.Infrastructure; using WMS.Web.Repositories.Configuration; @@ -57,5 +61,42 @@ namespace WMS.Web.Repositories } } + /// + /// 列表 + /// + /// + /// + public async Task<(List 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); + } } }