Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -6,7 +6,10 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.SingleData;
|
||||
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
|
||||
@@ -18,8 +21,12 @@ namespace WMS.Web.Api.Controllers
|
||||
[ApiController]
|
||||
public class SysConfigController : ControllerBase
|
||||
{
|
||||
public SysConfigController()
|
||||
private readonly ILoginService _loginService;
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories)
|
||||
{
|
||||
_loginService = loginService;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,5 +62,38 @@ namespace WMS.Web.Api.Controllers
|
||||
//1
|
||||
return Task.FromResult(Result<EnumStatusResponse>.ReSuccess(response));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库
|
||||
/// </summary>
|
||||
/// <param name="name">仓库模糊匹配 不必填</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetUcStock")]
|
||||
public async Task<ResultList<UcStockResponse>> GetUcStock([FromQuery] string name)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return ResultList<UcStockResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
var r = await _basicsRepositories.GetUcStockAsync(name, loginInfo.UserInfo.CompanyId);
|
||||
return ResultList<UcStockResponse>.ReSuccess(r);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据仓库获取仓位
|
||||
/// </summary>
|
||||
/// <param name="id">仓库id</param>
|
||||
/// <param name="name">仓库模糊匹配 不必填</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetSubUcStock/{id}")]
|
||||
public async Task<Result<List<UcStockResponse>>> GetSubUcStock([FromRoute] int id, [FromQuery] string name)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result<List<UcStockResponse>>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
var r = await _basicsRepositories.GetSubUcStockAsync(id, name);
|
||||
return Result<List<UcStockResponse>>.ReSuccess(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,21 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetUcStock(System.String)">
|
||||
<summary>
|
||||
获取仓库
|
||||
</summary>
|
||||
<param name="name">仓库模糊匹配 不必填</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetSubUcStock(System.Int32,System.String)">
|
||||
<summary>
|
||||
根据仓库获取仓位
|
||||
</summary>
|
||||
<param name="id">仓库id</param>
|
||||
<param name="name">仓库模糊匹配 不必填</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Api.Controllers.TakeStockController">
|
||||
<summary>
|
||||
盘点单
|
||||
|
||||
@@ -92,12 +92,12 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.ChangeBoxRecordQueryRequest.SrcBox">
|
||||
<summary>
|
||||
原箱子ID
|
||||
原箱子
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.ChangeBoxRecordQueryRequest.DestBox">
|
||||
<summary>
|
||||
目标箱子ID
|
||||
目标箱子
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.ChangeBoxRecordQueryRequest.StockId">
|
||||
@@ -1480,6 +1480,16 @@
|
||||
每页条数 不传默认每页10 条
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.SingleData.NameRequest">
|
||||
<summary>
|
||||
名称请求对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.NameRequest.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.SingleData.SingleDataRequest">
|
||||
<summary>
|
||||
单点数据-请求统一对象
|
||||
@@ -1520,6 +1530,71 @@
|
||||
是否禁用:true为禁用,false为启用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.SingleData.SubStockRequest">
|
||||
<summary>
|
||||
仓位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SubStockRequest.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.SingleData.SysStaffResponse">
|
||||
<summary>
|
||||
员工响应
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SysStaffResponse.Id">
|
||||
<summary>
|
||||
StaffID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SysStaffResponse.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SysStaffResponse.DeptId">
|
||||
<summary>
|
||||
部门ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SysStaffResponse.Telephone">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.SysStaffResponse.Disable">
|
||||
<summary>
|
||||
是否禁用:true为禁用,false为启用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.SingleData.UcStockResponse">
|
||||
<summary>
|
||||
仓库响应
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.UcStockResponse.Id">
|
||||
<summary>
|
||||
id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.UcStockResponse.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.UcStockResponse.Code">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.SingleData.UcStockResponse.Disable">
|
||||
<summary>
|
||||
是否禁用:true为禁用,false为启用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest">
|
||||
<summary>
|
||||
盘点单明细
|
||||
|
||||
@@ -980,6 +980,31 @@
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IBasicsRepositories">
|
||||
<summary>
|
||||
基础数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IBasicsRepositories.GetStaffListAsync(System.Int32)">
|
||||
<summary>
|
||||
获取所有人员-根据主体
|
||||
</summary>
|
||||
<param name="CompanyId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IBasicsRepositories.GetSubUcStockAsync(System.Int32,System.String)">
|
||||
<summary>
|
||||
根据仓库获取子仓库
|
||||
</summary>
|
||||
<param name="id">仓库id</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IBasicsRepositories.GetUcStockAsync(System.String,System.Int32)">
|
||||
<summary>
|
||||
获取仓库
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IInStockRepositories">
|
||||
<summary>
|
||||
wms入库单-仓储接口
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
||||
public class ChangeBoxRecordQueryRequest: PaginationBaseRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 原箱子ID
|
||||
/// 原箱子
|
||||
/// </summary>
|
||||
public string SrcBox { get; set; }
|
||||
/// <summary>
|
||||
/// 目标箱子ID
|
||||
/// 目标箱子
|
||||
/// </summary>
|
||||
public string DestBox { get; set; }
|
||||
/// <summary>
|
||||
|
||||
25
src/WMS.Web.Core/Dto/SingleData/NameRequest.cs
Normal file
25
src/WMS.Web.Core/Dto/SingleData/NameRequest.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.SingleData
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称请求对象
|
||||
/// </summary>
|
||||
public class NameRequest:SingleDataRequest
|
||||
{
|
||||
public NameRequest() { }
|
||||
|
||||
public NameRequest(string name,int companyId)
|
||||
{
|
||||
this.Name = name;
|
||||
this.CompanyId = companyId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
26
src/WMS.Web.Core/Dto/SingleData/SubStockRequest.cs
Normal file
26
src/WMS.Web.Core/Dto/SingleData/SubStockRequest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.SingleData
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓位
|
||||
/// </summary>
|
||||
public class SubStockRequest:NameRequest
|
||||
{
|
||||
|
||||
public SubStockRequest() { }
|
||||
public SubStockRequest(int stockId,string name,int companyId)
|
||||
{
|
||||
this.StockId = stockId;
|
||||
this.Name = name;
|
||||
this.CompanyId = companyId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
public int StockId { get; set; }
|
||||
}
|
||||
}
|
||||
37
src/WMS.Web.Core/Dto/SingleData/SysStaffResponse.cs
Normal file
37
src/WMS.Web.Core/Dto/SingleData/SysStaffResponse.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.SingleData
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工响应
|
||||
/// </summary>
|
||||
public class SysStaffResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// StaffID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门ID
|
||||
/// </summary>
|
||||
public int DeptId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
public string Telephone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用:true为禁用,false为启用
|
||||
/// </summary>
|
||||
public bool Disable { get; set; }
|
||||
}
|
||||
}
|
||||
32
src/WMS.Web.Core/Dto/SingleData/UcStockResponse.cs
Normal file
32
src/WMS.Web.Core/Dto/SingleData/UcStockResponse.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.SingleData
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库响应
|
||||
/// </summary>
|
||||
public class UcStockResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 是否禁用:true为禁用,false为启用
|
||||
/// </summary>
|
||||
public bool Disable { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 盘点日期
|
||||
/// </summary>
|
||||
[Column("Date")]
|
||||
public DateTime Date { get; set; }
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 盘点人员
|
||||
/// </summary>
|
||||
|
||||
32
src/WMS.Web.Domain/Infrastructure/IBasicsRepositories.cs
Normal file
32
src/WMS.Web.Domain/Infrastructure/IBasicsRepositories.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.SingleData;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
/// <summary>
|
||||
/// 基础数据
|
||||
/// </summary>
|
||||
public interface IBasicsRepositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取所有人员-根据主体
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SysStaffResponse>> GetStaffListAsync(int CompanyId);
|
||||
/// <summary>
|
||||
/// 根据仓库获取子仓库
|
||||
/// </summary>
|
||||
/// <param name="id">仓库id</param>
|
||||
/// <returns></returns>
|
||||
Task<List<UcStockResponse>> GetSubUcStockAsync(int id, string name);
|
||||
/// <summary>
|
||||
/// 获取仓库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<UcStockResponse>> GetUcStockAsync(string name, int companyId);
|
||||
}
|
||||
}
|
||||
73
src/WMS.Web.Repositories/BasicsRepositories.cs
Normal file
73
src/WMS.Web.Repositories/BasicsRepositories.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.SingleData;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 基础数据
|
||||
/// </summary>
|
||||
public class BasicsRepositories : IBasicsRepositories
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private RepositoryDbContext _context;
|
||||
private readonly ILoginRepositories _loginService;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
|
||||
|
||||
public BasicsRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ILoginRepositories loginService, ISingleDataService singleDataService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_loginService = loginService;
|
||||
_singleDataService = singleDataService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取所有人员
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SysStaffResponse>> GetStaffListAsync(int CompanyId)
|
||||
{
|
||||
var result = await _singleDataService.GetSysConfigData<ResultList<SysStaffResponse>, SingleDataRequest>
|
||||
(new SingleDataRequest(CompanyId),
|
||||
SysConfigAction.GetStaffByCompany);
|
||||
if (!result.Success)
|
||||
return null;
|
||||
return result.Data.ToList();
|
||||
}
|
||||
|
||||
public async Task<List<UcStockResponse>> GetSubUcStockAsync(int id, string name)
|
||||
{
|
||||
var result = await _singleDataService.GetSysConfigData<ResultList<UcStockResponse>, SubStockRequest>
|
||||
(new SubStockRequest(id, name, _loginService.CompanyId),
|
||||
SysConfigAction.GetWareouseByCustomerAndCompany);
|
||||
if (!result.Success)
|
||||
return null;
|
||||
return result.Data.ToList();
|
||||
}
|
||||
|
||||
public async Task<List<UcStockResponse>> GetUcStockAsync(string name, int companyId)
|
||||
{
|
||||
var result = await _singleDataService.GetSysConfigData<ResultList<UcStockResponse>, NameRequest>
|
||||
(new NameRequest(name, companyId),
|
||||
SysConfigAction.GetWarehouseByNameAndCompany);
|
||||
if (!result.Success)
|
||||
return null;
|
||||
return result.Data.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,16 +24,17 @@ namespace WMS.Web.Repositories
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
|
||||
public ChangeBoxRecordRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -76,6 +77,13 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<ChangeBoxRecordQueryInfoResponse> list, int total)> GetListAsync(ChangeBoxRecordQueryRequest dto)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
var query = _context.ChangeBoxRecord
|
||||
.GroupJoin(_context.Box, changeBox => changeBox.SrcBoxId, srcBox => srcBox.Id, (changeBox, srcBox) => new { changeBox, srcBox })
|
||||
.SelectMany(x => x.srcBox.DefaultIfEmpty(), (d, srcBox) => new { d.changeBox, srcBox })
|
||||
@@ -84,6 +92,18 @@ namespace WMS.Web.Repositories
|
||||
.OrderByDescending(o => o.changeBox.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.changeBox.CreatorId));
|
||||
if (!string.IsNullOrEmpty(dto.SrcBox))
|
||||
query = query.Where(w => EF.Functions.Like(w.srcBox.BoxBillNo, "%" + dto.SrcBox + "%"));
|
||||
if (!string.IsNullOrEmpty(dto.DestBox))
|
||||
query = query.Where(w => EF.Functions.Like(w.destBox.BoxBillNo, "%" + dto.DestBox + "%"));
|
||||
if (dto.StockId != null)
|
||||
query = query.Where(w => w.changeBox.StockId == dto.StockId);
|
||||
if (dto.SrcSubStockId != null)
|
||||
query = query.Where(w => w.changeBox.SrcSubStockId == dto.SrcSubStockId);
|
||||
if (dto.DestSubStockId != null)
|
||||
query = query.Where(w => w.changeBox.DestSubStockId == dto.DestSubStockId);
|
||||
if (dto.CreateBeginDate != null)
|
||||
query = query.Where(w => w.changeBox.CreateTime >= dto.CreateBeginDate);
|
||||
if (dto.CreateEndDate != null)
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddScoped<ILoginRepositories, LoginRepositories>();
|
||||
services.AddScoped<IBasicsRepositories, BasicsRepositories>();
|
||||
|
||||
services.AddTransient<ITransactionRepositories, TransactionRepositories>();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using WMS.Web.Core.Help;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -24,16 +25,17 @@ namespace WMS.Web.Repositories
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
|
||||
public MoveBoxRecordRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -76,12 +78,25 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<MoveBoxRecordQueryInfoResponse> list, int total)> GetListAsync(MoveBoxRecordQueryRequest dto)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
var query = _context.MoveBoxRecord
|
||||
.GroupJoin(_context.Box, moveBox => moveBox.BoxId, box => box.Id, (moveBox, box) => new { moveBox, box })
|
||||
.SelectMany(x => x.box.DefaultIfEmpty(), (d, box) => new { d.moveBox, box })
|
||||
.OrderByDescending(o => o.moveBox.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.moveBox.CreatorId));
|
||||
if (!string.IsNullOrEmpty(dto.Box))
|
||||
query = query.Where(w => EF.Functions.Like(w.box.BoxBillNo, "%" + dto.Box + "%"));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.moveBox.Type == (MoveBoxType)dto.Type);
|
||||
if (dto.CreateBeginDate != null)
|
||||
query = query.Where(w => w.moveBox.CreateTime >= dto.CreateBeginDate);
|
||||
if (dto.CreateEndDate != null)
|
||||
|
||||
@@ -13,6 +13,7 @@ using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Mappers;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -25,16 +26,17 @@ namespace WMS.Web.Repositories
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
|
||||
public OutStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -77,12 +79,33 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
var query = _context.OutStockDetails
|
||||
.GroupJoin(_context.OutStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
//if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.order.CreatorId));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNo, "%" + dto.SourceBillNo + "%"));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.order.Type == (OrderType)dto.Type);
|
||||
if (dto.SuccessSync != null)
|
||||
query = query.Where(w => w.order.SuccessSync == dto.SuccessSync);
|
||||
if (dto.DeliveryOrgId != null)
|
||||
query = query.Where(w => w.detail.DeliveryOrgId == dto.DeliveryOrgId);
|
||||
if (dto.StockId != null)
|
||||
query = query.Where(w => w.detail.StockId == dto.StockId);
|
||||
if (dto.CreateBeginDate != null)
|
||||
query = query.Where(w => w.order.CreateTime >= dto.CreateBeginDate);
|
||||
if (dto.CreateEndDate != null)
|
||||
|
||||
@@ -13,6 +13,7 @@ using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Mappers;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -167,6 +168,20 @@ namespace WMS.Web.Repositories
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
//if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
if (dto.Ids.Count() > 0)
|
||||
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNo, "%" + dto.SourceBillNo + "%"));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.order.Type == (OrderType)dto.Type);
|
||||
if (dto.Status != null)
|
||||
query = query.Where(w => w.order.Status == (OutStockStatus)dto.Status);
|
||||
if (dto.DeliveryOrgId != null)
|
||||
query = query.Where(w => w.detail.DeliveryOrgId == dto.DeliveryOrgId);
|
||||
if (dto.StockId != null)
|
||||
query = query.Where(w => w.detail.StockId == dto.StockId);
|
||||
if (dto.CreateBeginDate != null)
|
||||
query = query.Where(w => w.order.OperateTime >= dto.CreateBeginDate);
|
||||
if (dto.CreateEndDate != null)
|
||||
|
||||
@@ -12,6 +12,7 @@ using WMS.Web.Core.Help;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -82,6 +83,12 @@ namespace WMS.Web.Repositories
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
if (dto.ResultType != null)
|
||||
query = query.Where(w => w.detail.ResultType == (TakeStockType)dto.ResultType);
|
||||
if (!string.IsNullOrEmpty(dto.BillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.order.BillNo, "%" + dto.BillNo + "%"));
|
||||
if (dto.StockId != null)
|
||||
query = query.Where(w => w.detail.StockId == dto.StockId);
|
||||
if (dto.DateBeginDate != null)
|
||||
query = query.Where(w => w.order.Date >= dto.DateBeginDate);
|
||||
if (dto.DateEndDate != null)
|
||||
|
||||
Reference in New Issue
Block a user