From cff81fe647ec476ec8a1ff81d840e6e170710e8c Mon Sep 17 00:00:00 2001
From: 18942506660 <18942506660@A18942506660>
Date: Sat, 28 Oct 2023 10:00:02 +0800
Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=8D=95=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/OutStockController.cs | 8 +--
.../Dto/OutStock/OutStockQueryInfoResponse.cs | 61 +++++++++++++++++++
.../Dto/OutStock/OutStockQueryRequest.cs | 40 ++++++++++++
.../IService/IOutStockService.cs | 9 ++-
.../Services/OutStockService.cs | 32 +++++++++-
.../OutStockRepositories.cs | 37 ++++++++++-
6 files changed, 178 insertions(+), 9 deletions(-)
diff --git a/src/WMS.Web.Api/Controllers/OutStockController.cs b/src/WMS.Web.Api/Controllers/OutStockController.cs
index c1cce1fe..36438d90 100644
--- a/src/WMS.Web.Api/Controllers/OutStockController.cs
+++ b/src/WMS.Web.Api/Controllers/OutStockController.cs
@@ -24,14 +24,14 @@ namespace WMS.Web.Api.Controllers
private readonly IMapper _mapper;
private readonly ILoginService _loginService;
private readonly IOutStockRepositories _repositories;
- private readonly IOutStockService _takeStockService;
+ private readonly IOutStockService _outStockService;
public OutStockController(IMapper mapper, ILoginService loginService,
- IOutStockRepositories repositories, IOutStockService takeStockService)
+ IOutStockRepositories repositories, IOutStockService outStockService)
{
_mapper = mapper;
_loginService = loginService;
_repositories = repositories;
- _takeStockService = takeStockService;
+ _outStockService = outStockService;
}
///
/// 列表
@@ -64,7 +64,7 @@ namespace WMS.Web.Api.Controllers
if (loginInfo == null || loginInfo.UserInfo == null)
return Result.ReFailure(ResultCodes.Token_Invalid_Error);
- return await _takeStockService.Save(dto, loginInfo);
+ return await _outStockService.Save(dto, loginInfo);
}
///
/// 同步金蝶
diff --git a/src/WMS.Web.Core/Dto/OutStock/OutStockQueryInfoResponse.cs b/src/WMS.Web.Core/Dto/OutStock/OutStockQueryInfoResponse.cs
index d7007b2e..9e185641 100644
--- a/src/WMS.Web.Core/Dto/OutStock/OutStockQueryInfoResponse.cs
+++ b/src/WMS.Web.Core/Dto/OutStock/OutStockQueryInfoResponse.cs
@@ -9,5 +9,66 @@ namespace WMS.Web.Core.Dto.OutStock
///
public class OutStockQueryInfoResponse
{
+ ///
+ /// 主键 订单编号
+ ///
+ public int Id { get; set; }
+ ///
+ /// 单据状态
+ ///
+ public string Status { get; set; }
+ ///
+ /// 单据类型
+ ///
+ public string Type { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string Creator { get; set; }
+ ///
+ /// 创建时间(出库时间)
+ ///
+ public DateTime CreateTime { get; set; } = DateTime.Now;
+ ///
+ /// 同步成功或者失败 null 就是未同步
+ ///
+ public bool? SuccessSync { 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 Qty { get; set; }
}
}
diff --git a/src/WMS.Web.Core/Dto/OutStock/OutStockQueryRequest.cs b/src/WMS.Web.Core/Dto/OutStock/OutStockQueryRequest.cs
index f9a18c1b..b5a55f4d 100644
--- a/src/WMS.Web.Core/Dto/OutStock/OutStockQueryRequest.cs
+++ b/src/WMS.Web.Core/Dto/OutStock/OutStockQueryRequest.cs
@@ -9,5 +9,45 @@ namespace WMS.Web.Core.Dto.OutStock
///
public class OutStockQueryRequest : PaginationBaseRequestDto
{
+ ///
+ /// 单据类型(出库单下拉列表)
+ ///
+ public int? Type { get; set; }
+ ///
+ /// 创建人
+ ///
+ public string Creator { get; set; }
+ ///
+ /// 创建时间(出库时间)
+ ///
+ public DateTime? CreateBeginDate { get; set; } = null;
+ ///
+ /// 创建时间(出库时间)
+ ///
+ public DateTime? CreateEndDate { get; set; } = null;
+ ///
+ /// 同步成功或者失败 null 就是未同步
+ ///
+ public bool? SuccessSync { get; set; }
+ ///
+ /// 来源单号
+ ///
+ 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/IService/IOutStockService.cs b/src/WMS.Web.Domain/IService/IOutStockService.cs
index 2daa146a..c039fb93 100644
--- a/src/WMS.Web.Domain/IService/IOutStockService.cs
+++ b/src/WMS.Web.Domain/IService/IOutStockService.cs
@@ -1,6 +1,11 @@
-using System;
+
+using System;
using System.Collections.Generic;
using System.Text;
+using System.Threading.Tasks;
+using WMS.Web.Core.Dto.Login;
+using WMS.Web.Core.Dto.OutStock;
+using WMS.Web.Core.Internal.Results;
namespace WMS.Web.Domain.IService
{
@@ -9,5 +14,7 @@ namespace WMS.Web.Domain.IService
///
public interface IOutStockService
{
+ //出库单保存
+ Task Save(List dto, LoginInDto loginInfo);
}
}
diff --git a/src/WMS.Web.Domain/Services/OutStockService.cs b/src/WMS.Web.Domain/Services/OutStockService.cs
index 444daabb..dd056cd5 100644
--- a/src/WMS.Web.Domain/Services/OutStockService.cs
+++ b/src/WMS.Web.Domain/Services/OutStockService.cs
@@ -1,14 +1,42 @@
-using System;
+using AutoMapper;
+using Microsoft.EntityFrameworkCore.Storage;
+using System;
using System.Collections.Generic;
using System.Text;
+using System.Threading.Tasks;
+using WMS.Web.Core.Dto.Login;
+using WMS.Web.Core.Dto.OutStock;
+using WMS.Web.Core.Dto.TakeStock;
+using WMS.Web.Core.Internal.Results;
+using WMS.Web.Domain.Entitys;
+using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService;
+using WMS.Web.Domain.IService.Public;
+using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Services
{
///
/// 出库服务
///
- public class OutStockService: IOutStockService
+ public class OutStockService : IOutStockService
{
+ private readonly IMapper _mapper;
+ private readonly ILoginService _loginService;
+ public readonly ITransactionRepositories _transactionRepositories;
+ private readonly IOutStockRepositories _outStockRepositories;
+ public OutStockService(IMapper mapper, ILoginService loginService,
+ ITransactionRepositories transactionRepositories,
+ IOutStockRepositories outStockRepositories)
+ {
+ _mapper = mapper;
+ _loginService = loginService;
+ _transactionRepositories = transactionRepositories;
+ _outStockRepositories = outStockRepositories;
+ }
+ public Task Save(List dto, LoginInDto loginInfo)
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/src/WMS.Web.Repositories/OutStockRepositories.cs b/src/WMS.Web.Repositories/OutStockRepositories.cs
index c329f3cb..0078b362 100644
--- a/src/WMS.Web.Repositories/OutStockRepositories.cs
+++ b/src/WMS.Web.Repositories/OutStockRepositories.cs
@@ -1,7 +1,9 @@
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.OutStock;
@@ -63,9 +65,40 @@ namespace WMS.Web.Repositories
///
///
///
- public Task<(List list, int total)> GetListAsync(OutStockQueryRequest dto)
+ public async Task<(List list, int total)> GetListAsync(OutStockQueryRequest dto)
{
- throw new NotImplementedException();
+ var query = _context.OutStock
+ .OrderByDescending(o => o.Id)
+ .Where(adv => 1 == 1);
+
+ if (dto.CreateBeginDate != null)
+ query = query.Where(w => w.CreateTime >= dto.CreateBeginDate);
+ if (dto.CreateEndDate != null)
+ query = query.Where(w => w.CreateTime <= dto.CreateEndDate);
+ //组装
+ int total = await query.CountAsync();
+ var list = await query.Select(s => new OutStockQueryInfoResponse()
+ {
+ #region dto组装
+ Id = 0,
+ Status = "",
+ Type = "",
+ Creator = "",
+ CreateTime=s.CreateTime,
+ SuccessSync = s.SuccessSync,
+ Stock = "",
+ SourceBillNo="",
+ SaleBillNo = "",
+ DeliveryOrg = "",
+ ReceiptCustomer = "",
+ MaterialName = "",
+ MaterialNumber = "",
+ Specifications = "",
+ Qty=0
+ #endregion
+
+ }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
+ return (list, total);
}
}
}