Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
69
src/WMS.Web.Api/Controllers/FileDownManagerController.cs
Normal file
69
src/WMS.Web.Api/Controllers/FileDownManagerController.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
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;
|
||||
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 FileDownManagerController : ControllerBase
|
||||
{
|
||||
private readonly ILoginService _loginService;
|
||||
private readonly IFileDownManagerRepositories _repositories;
|
||||
public FileDownManagerController(ILoginService loginService, IFileDownManagerRepositories repositories)
|
||||
{
|
||||
_loginService = loginService;
|
||||
_repositories = repositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取需要的状态列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetStatus")]
|
||||
public Task<Result<FileDownManagerStatusResponse>> GetStatus()
|
||||
{
|
||||
FileDownManagerStatusResponse response = new FileDownManagerStatusResponse();
|
||||
foreach (FileDownLoadOrderType enumv in Enum.GetValues(typeof(FileDownLoadOrderType)))
|
||||
{
|
||||
response.Type.Add((int)enumv, enumv.GetRemark());
|
||||
}
|
||||
foreach (ExportStatus enumv in Enum.GetValues(typeof(ExportStatus)))
|
||||
{
|
||||
response.Status.Add((int)enumv, enumv.GetRemark());
|
||||
}
|
||||
return Task.FromResult(Result<FileDownManagerStatusResponse>.ReSuccess(response));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("FileDownManagerQuery")]
|
||||
public async Task<Result<FileDownManagerResponse>> FileDownManagerQuery(FileDownManagerRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null)
|
||||
return Result<FileDownManagerResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
dto.SupplierId = loginInfo.UserInfo.SupplierId;
|
||||
|
||||
var result = await _repositories.GetList(dto, loginInfo.UserInfo.CompanyId);
|
||||
return Result<FileDownManagerResponse>.ReSuccess(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.OutStockTask;
|
||||
using WMS.Web.Core.Help;
|
||||
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.Options;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Api.Controllers
|
||||
@@ -27,14 +31,19 @@ namespace WMS.Web.Api.Controllers
|
||||
private readonly IOutStockTaskRepositories _repositories;
|
||||
private readonly IOutStockService _outStockService;
|
||||
private readonly IOutStockTaskService _outStockTaskService;
|
||||
private readonly QiniuOptions _option;
|
||||
private readonly IExportExcelService _exportExcelService;
|
||||
public OutStockTaskController(IMapper mapper, ILoginService loginService,
|
||||
IOutStockTaskRepositories repositories, IOutStockService outStockService, IOutStockTaskService outStockTaskService)
|
||||
IOutStockTaskRepositories repositories, IOutStockService outStockService,
|
||||
IOutStockTaskService outStockTaskService, IOptions<QiniuOptions> option, IExportExcelService exportExcelServic)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_repositories = repositories;
|
||||
_outStockService = outStockService;
|
||||
_outStockTaskService = outStockTaskService;
|
||||
_option = option?.Value;
|
||||
_exportExcelService = exportExcelServic;
|
||||
}
|
||||
/// <summary>
|
||||
/// 列表
|
||||
@@ -54,6 +63,29 @@ namespace WMS.Web.Api.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("Export")]
|
||||
public Task<Result<string>> Export([FromBody] OutStockTaskQueryRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null)
|
||||
return Task.FromResult(Result<string>.ReFailure(ResultCodes.Token_Invalid_Error));
|
||||
string fileName = FileDownLoadOrderType.OutStockTask.GetRemark() + loginInfo.UserInfo.CompanyId + DateTime.Now.DateTimeToLongTimeStamp() + ".xlsx";
|
||||
string res = _option.Url + fileName;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await _exportExcelService.ExportList<OutStockTaskQueryInfoResponse, OutStockTaskQueryRequest>(dto, fileName, loginInfo.UserInfo.StaffId, loginInfo.UserInfo.CompanyId, FileDownLoadOrderType.OutStockTask);
|
||||
});
|
||||
|
||||
return Task.FromResult(Result<string>.ReSuccess(res));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 作废
|
||||
/// </summary>
|
||||
|
||||
@@ -90,7 +90,14 @@ namespace WMS.Web.Api.Controllers
|
||||
{
|
||||
response.ShelfMethod.Add((int)enumv, enumv.GetRemark());
|
||||
}
|
||||
|
||||
foreach (FileDownLoadOrderType enumv in Enum.GetValues(typeof(OrderType)))
|
||||
{
|
||||
response.FileDownLoadOrderType.Add((int)enumv, enumv.GetRemark());
|
||||
}
|
||||
foreach (ExportStatus enumv in Enum.GetValues(typeof(ExportStatus)))
|
||||
{
|
||||
response.ExportStatus.Add((int)enumv, enumv.GetRemark());
|
||||
}
|
||||
//2
|
||||
//1
|
||||
return Task.FromResult(Result<EnumStatusResponse>.ReSuccess(response));
|
||||
|
||||
@@ -49,6 +49,24 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Api.Controllers.FileDownManagerController">
|
||||
<summary>
|
||||
上传下载中心
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.FileDownManagerController.GetStatus">
|
||||
<summary>
|
||||
获取需要的状态列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.FileDownManagerController.FileDownManagerQuery(WMS.Web.Core.Dto.FileDownManagerRequest)">
|
||||
<summary>
|
||||
列表
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Api.Controllers.InStockController">
|
||||
<summary>
|
||||
入库单-接口
|
||||
@@ -286,6 +304,13 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.OutStockTaskController.Export(WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryRequest)">
|
||||
<summary>
|
||||
导出
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.OutStockTaskController.Repeal(WMS.Web.Core.Dto.OperateRequest)">
|
||||
<summary>
|
||||
作废
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxResponse.Id">
|
||||
<summary>
|
||||
单据头ID
|
||||
箱ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxResponse.SupplierId">
|
||||
@@ -480,6 +480,16 @@
|
||||
非采购上架方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.EnumStatusResponse.FileDownLoadOrderType">
|
||||
<summary>
|
||||
下载导出订单类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.EnumStatusResponse.ExportStatus">
|
||||
<summary>
|
||||
下载导出状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.Customer.ErpCustomerDto">
|
||||
<summary>
|
||||
客户
|
||||
@@ -1045,6 +1055,111 @@
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.FileDownManagerRequest">
|
||||
<summary>
|
||||
上传下载列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.Type">
|
||||
<summary>
|
||||
单据类型(任务类型)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.Status">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.BeginDate">
|
||||
<summary>
|
||||
下单时间 开始
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.EndDate">
|
||||
<summary>
|
||||
下单时间 结束
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.User">
|
||||
<summary>
|
||||
操作人
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerRequest.SupplierId">
|
||||
<summary>
|
||||
供应商用户Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.FileDownManagerResponse">
|
||||
<summary>
|
||||
上传下载列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerResponse.List">
|
||||
<summary>
|
||||
查询列表内容
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerResponse.Total">
|
||||
<summary>
|
||||
总条数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.FileDownInfoManagerResponse">
|
||||
<summary>
|
||||
上传下载列表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.Id">
|
||||
<summary>
|
||||
主键 订单编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.Date">
|
||||
<summary>
|
||||
日期
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.Type">
|
||||
<summary>
|
||||
单据类型(任务类型)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.StatusKey">
|
||||
<summary>
|
||||
状态(Key)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.Status">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.FilePath">
|
||||
<summary>
|
||||
文件地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.UserName">
|
||||
<summary>
|
||||
操作人
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownInfoManagerResponse.Reason">
|
||||
<summary>
|
||||
失败原因
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerStatusResponse.Type">
|
||||
<summary>
|
||||
任务类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.FileDownManagerStatusResponse.Status">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsRequest">
|
||||
<summary>
|
||||
采购订单物料明细和箱物料明细-对比请求对象
|
||||
@@ -2847,12 +2962,12 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.BillNo">
|
||||
<summary>
|
||||
单据编号
|
||||
出库任务单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.Status">
|
||||
<summary>
|
||||
单据状态
|
||||
出库状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.Type">
|
||||
@@ -2907,7 +3022,7 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.Stock">
|
||||
<summary>
|
||||
仓库ID
|
||||
仓库
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse.AccruedQty">
|
||||
|
||||
@@ -311,6 +311,56 @@
|
||||
最新一次同步时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.FileDownManager">
|
||||
<summary>
|
||||
文件下载类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.Id">
|
||||
<summary>
|
||||
主键 订单编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.Date">
|
||||
<summary>
|
||||
日期
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.Type">
|
||||
<summary>
|
||||
单据类型(任务类型)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.Status">
|
||||
<summary>
|
||||
状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.CompanyId">
|
||||
<summary>
|
||||
公司Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.FilePath">
|
||||
<summary>
|
||||
文件地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.UserId">
|
||||
<summary>
|
||||
操作人
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.Reason">
|
||||
<summary>
|
||||
失败原因
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.FileDownManager.SupplierId">
|
||||
<summary>
|
||||
是否供应商用户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.InStock">
|
||||
<summary>
|
||||
wms入库单
|
||||
@@ -1339,6 +1389,13 @@
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IAllFielRepositories`1.GetListField(`0,System.Int32)">
|
||||
<summary>
|
||||
列表字段导出接口
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IBackRecordRepositories">
|
||||
<summary>
|
||||
出入库回退记录-仓储接口
|
||||
@@ -1475,6 +1532,26 @@
|
||||
定时任务最新一次时间管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IFileDownManagerRepositories.Add(WMS.Web.Domain.Entitys.FileDownManager)">
|
||||
<summary>
|
||||
保存
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IFileDownManagerRepositories.Edit(WMS.Web.Domain.Entitys.FileDownManager)">
|
||||
<summary>
|
||||
编辑
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IFileDownManagerRepositories.GetList(WMS.Web.Core.Dto.FileDownManagerRequest,System.Int32)">
|
||||
<summary>
|
||||
获取销售列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IInStockRepositories">
|
||||
<summary>
|
||||
wms入库单-仓储接口
|
||||
@@ -1756,6 +1833,50 @@
|
||||
改箱 移箱服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IExportExcelService.ExportAll``2(``1,System.String,System.Int32,System.Int32,WMS.Web.Domain.Values.FileDownLoadOrderType,Npoi.Mapper.Mapper,System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
全字段导出数据
|
||||
</summary>
|
||||
<typeparam name="Response"></typeparam>
|
||||
<typeparam name="Request"></typeparam>
|
||||
<param name="request"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="mapper"></param>
|
||||
<param name="userId"></param>
|
||||
<param name="companyId"></param>
|
||||
<param name="type"></param>
|
||||
<param name="supplierId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IExportExcelService.ExportList``2(``1,System.String,System.Int32,System.Int32,WMS.Web.Domain.Values.FileDownLoadOrderType,Npoi.Mapper.Mapper,System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
列表字段导出数据
|
||||
</summary>
|
||||
<typeparam name="Response"></typeparam>
|
||||
<typeparam name="Request"></typeparam>
|
||||
<param name="request"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="mapper"></param>
|
||||
<param name="userId"></param>
|
||||
<param name="companyId"></param>
|
||||
<param name="type"></param>
|
||||
<param name="supplierId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IExportExcelService.Export``1(System.Collections.Generic.List{``0},System.String,System.Int32,System.Int32,WMS.Web.Domain.Values.FileDownLoadOrderType,Npoi.Mapper.Mapper,System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
列表页导出数据
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="dataList"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="mapper"></param>
|
||||
<param name="userId"></param>
|
||||
<param name="type"></param>
|
||||
<param name="companyId"></param>
|
||||
<param name="supplierId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.IInStockService">
|
||||
<summary>
|
||||
入库单服务接口
|
||||
@@ -1895,6 +2016,15 @@
|
||||
出库服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IQiniuUploadService.Upload(System.String,System.IO.Stream,System.Boolean)">
|
||||
<summary>
|
||||
上传文件
|
||||
</summary>
|
||||
<param name="fileName"></param>
|
||||
<param name="stream"></param>
|
||||
<param name="isAutoDelte">是否开启自动删除 如果开启 3天后自动删除 导出的execl文件</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.ISerialNumberService">
|
||||
<summary>
|
||||
序列号服务
|
||||
@@ -2474,6 +2604,31 @@
|
||||
老ops对接
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Options.QiniuOptions">
|
||||
<summary>
|
||||
七牛云 配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QiniuOptions.AccessKey">
|
||||
<summary>
|
||||
访问key
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QiniuOptions.SecretKey">
|
||||
<summary>
|
||||
秘钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QiniuOptions.Bucket">
|
||||
<summary>
|
||||
区块文件夹
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Options.QiniuOptions.Url">
|
||||
<summary>
|
||||
访问域名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Options.QuartzJobOptions">
|
||||
<summary>
|
||||
Quartz定时任务-配置项
|
||||
@@ -2702,6 +2857,33 @@
|
||||
<param name="loginInfo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.ExportExcelService.Export``1(System.Collections.Generic.List{``0},System.String,System.Int32,System.Int32,WMS.Web.Domain.Values.FileDownLoadOrderType,Npoi.Mapper.Mapper,System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
列表页导出
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="dataList"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="userId"></param>
|
||||
<param name="companyId"></param>
|
||||
<param name="type"></param>
|
||||
<param name="mapper"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.ExportExcelService.ExportAll``2(``1,System.String,System.Int32,System.Int32,WMS.Web.Domain.Values.FileDownLoadOrderType,Npoi.Mapper.Mapper,System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
全字段导出
|
||||
</summary>
|
||||
<typeparam name="Response"></typeparam>
|
||||
<typeparam name="Request"></typeparam>
|
||||
<param name="request"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="userId"></param>
|
||||
<param name="companyId"></param>
|
||||
<param name="type"></param>
|
||||
<param name="mapper"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.InStockService">
|
||||
<summary>
|
||||
入库单服务
|
||||
@@ -3583,6 +3765,15 @@
|
||||
<param name="customerStockCode"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.QiniuUploadService.Upload(System.String,System.IO.Stream,System.Boolean)">
|
||||
<summary>
|
||||
上传文件
|
||||
</summary>
|
||||
<param name="fileName"></param>
|
||||
<param name="stream"></param>
|
||||
<param name="isAutoDelte"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.SerialNumberService">
|
||||
<summary>
|
||||
序列号服务
|
||||
@@ -3804,6 +3995,36 @@
|
||||
客户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.ExportStatus">
|
||||
<summary>
|
||||
文件导出状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.ExportStatus.Ing">
|
||||
<summary>
|
||||
正在导出
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.ExportStatus.Success">
|
||||
<summary>
|
||||
导出成功
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.ExportStatus.Fail">
|
||||
<summary>
|
||||
导出失败
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.FileDownLoadOrderType">
|
||||
<summary>
|
||||
导出单据类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Values.FileDownLoadOrderType.OutStockTask">
|
||||
<summary>
|
||||
出库任务单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Values.InstockStatus">
|
||||
<summary>
|
||||
入库状态
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace WMS.Web.Core.Dto
|
||||
public class BoxResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 单据头ID
|
||||
/// 箱ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@@ -46,8 +46,15 @@ namespace WMS.Web.Core.Dto
|
||||
/// 非采购上架方式
|
||||
/// </summary>
|
||||
public Dictionary<int, string> ShelfMethod { get; set; } = new Dictionary<int, string>();
|
||||
/// <summary>
|
||||
/// 下载导出订单类型
|
||||
/// </summary>
|
||||
public Dictionary<int, string> FileDownLoadOrderType { get; set; } = new Dictionary<int, string>();
|
||||
/// <summary>
|
||||
/// 下载导出状态
|
||||
/// </summary>
|
||||
public Dictionary<int, string> ExportStatus { get; set; } = new Dictionary<int, string>();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
37
src/WMS.Web.Core/Dto/FileDownManagerRequest.cs
Normal file
37
src/WMS.Web.Core/Dto/FileDownManagerRequest.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 上传下载列表
|
||||
/// </summary>
|
||||
public class FileDownManagerRequest: PaginationBaseRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 单据类型(任务类型)
|
||||
/// </summary>
|
||||
public int? Type { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
/// <summary>
|
||||
/// 下单时间 开始
|
||||
/// </summary>
|
||||
public DateTime? BeginDate { get; set; }
|
||||
/// <summary>
|
||||
/// 下单时间 结束
|
||||
/// </summary>
|
||||
public DateTime? EndDate { get; set; }
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
public string User { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商用户Id
|
||||
/// </summary>
|
||||
public int? SupplierId { get; set; } = null;
|
||||
}
|
||||
}
|
||||
73
src/WMS.Web.Core/Dto/FileDownManagerResponse.cs
Normal file
73
src/WMS.Web.Core/Dto/FileDownManagerResponse.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Help;
|
||||
|
||||
namespace WMS.Web.Core.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 上传下载列表
|
||||
/// </summary>
|
||||
public class FileDownManagerResponse
|
||||
{
|
||||
public FileDownManagerResponse(List<FileDownInfoManagerResponse> list, int? total)
|
||||
{
|
||||
this.List = list;
|
||||
this.Total = total;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询列表内容
|
||||
/// </summary>
|
||||
public List<FileDownInfoManagerResponse> List { get; set; } = new List<FileDownInfoManagerResponse>();
|
||||
/// <summary>
|
||||
/// 总条数
|
||||
/// </summary>
|
||||
public int? Total { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传下载列表
|
||||
/// </summary>
|
||||
public class FileDownInfoManagerResponse
|
||||
{
|
||||
public FileDownInfoManagerResponse() { }
|
||||
public FileDownInfoManagerResponse(FileDownInfoManagerResponse response)
|
||||
{
|
||||
response.CopyPropertiesToD(this);
|
||||
}
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 日期
|
||||
/// </summary>
|
||||
public string Date { get; set; }
|
||||
/// <summary>
|
||||
/// 单据类型(任务类型)
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// 状态(Key)
|
||||
/// </summary>
|
||||
public int StatusKey { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 文件地址
|
||||
/// </summary>
|
||||
public string FilePath { get; set; }
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
/// <summary>
|
||||
/// 失败原因
|
||||
/// </summary>
|
||||
public string Reason { get; set; }
|
||||
}
|
||||
}
|
||||
19
src/WMS.Web.Core/Dto/FileDownManagerStatusResponse.cs
Normal file
19
src/WMS.Web.Core/Dto/FileDownManagerStatusResponse.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto
|
||||
{
|
||||
public class FileDownManagerStatusResponse
|
||||
{
|
||||
public FileDownManagerStatusResponse() { }
|
||||
/// <summary>
|
||||
/// 任务类型
|
||||
/// </summary>
|
||||
public Dictionary<int, string> Type { get; set; } = new Dictionary<int, string>();
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public Dictionary<int, string> Status { get; set; } = new Dictionary<int, string>();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Npoi.Mapper.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -12,90 +13,112 @@ namespace WMS.Web.Core.Dto.OutStockTask
|
||||
/// <summary>
|
||||
/// 单据Id
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 明细Id
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public int DetailId { get; set; }
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// 出库任务单号
|
||||
/// </summary>
|
||||
[Column("出库任务单号")]
|
||||
public string BillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 单据状态
|
||||
/// 出库状态
|
||||
/// </summary>
|
||||
[Column("出库状态")]
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
[Column("出库类型")]
|
||||
public string Type { get; set; }
|
||||
/// <summary>
|
||||
/// 操作人(出库人)
|
||||
/// </summary>
|
||||
[Column("出库人")]
|
||||
public string Operator { get; set; }
|
||||
/// <summary>
|
||||
/// 操作时间(出库时间)
|
||||
/// </summary>
|
||||
[Column("出库时间")]
|
||||
public string OperateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 来源单号
|
||||
///</summary>
|
||||
[Column("来源单号")]
|
||||
public string SourceBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 销售订单号
|
||||
///</summary>
|
||||
[Column("销售订单号")]
|
||||
public string SaleBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 发货组织
|
||||
///</summary>
|
||||
[Column("发货组织")]
|
||||
public string DeliveryOrg { get; set; }
|
||||
/// <summary>
|
||||
/// 收货客户
|
||||
///</summary>
|
||||
[Column("收货客户")]
|
||||
public string ReceiptCustomer { get; set; }
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
[Column("物料名称")]
|
||||
public string MaterialName { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
[Column("物料编码")]
|
||||
public string MaterialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
[Column("规格型号")]
|
||||
public string Specifications { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// 仓库
|
||||
///</summary>
|
||||
[Column("发货仓库")]
|
||||
public string Stock { get; set; }
|
||||
/// <summary>
|
||||
/// 应出库数量
|
||||
///</summary>
|
||||
[Column("应出库数量")]
|
||||
public decimal AccruedQty { get; set; }
|
||||
/// <summary>
|
||||
/// 已出库数量
|
||||
///</summary>
|
||||
[Column("已出库数量")]
|
||||
public decimal RealityQty { get; set; }
|
||||
/// <summary>
|
||||
/// 订单明细备注
|
||||
///</summary>
|
||||
[Column("订单明细备注")]
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间(erp那边的创建时间)
|
||||
///</summary>
|
||||
[Column("创建时间")]
|
||||
public string CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
[Column("单位")]
|
||||
public string Unit { get; set; }
|
||||
/// <summary>
|
||||
/// 出库开始时间
|
||||
///</summary>
|
||||
[Column("出库开始时间")]
|
||||
public string OutStockBeginTime { get; set; }
|
||||
/// <summary>
|
||||
/// 出库结束时间
|
||||
///</summary>
|
||||
[Column("出库结束时间")]
|
||||
public string OutStockEndTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
84
src/WMS.Web.Domain/Entitys/FileDownManager.cs
Normal file
84
src/WMS.Web.Domain/Entitys/FileDownManager.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件下载类型
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_wms_file_down_manager")]
|
||||
public class FileDownManager : EntityBase
|
||||
{
|
||||
public FileDownManager() { }
|
||||
public FileDownManager(int userId, int companyId, FileDownLoadOrderType type, string path, int? supplierId = null)
|
||||
{
|
||||
this.UserId = userId;
|
||||
this.CompanyId = companyId;
|
||||
this.Type = type;
|
||||
this.FilePath = path;
|
||||
this.SupplierId = supplierId;
|
||||
}
|
||||
/// <summary>
|
||||
/// 主键 订单编号
|
||||
/// </summary>
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 日期
|
||||
/// </summary>
|
||||
[Column("Date")]
|
||||
public DateTime? Date { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 单据类型(任务类型)
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
public FileDownLoadOrderType Type { get; set; } = FileDownLoadOrderType.OutStockTask;
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[Column("Status")]
|
||||
public ExportStatus Status { get; set; } = ExportStatus.Ing;
|
||||
/// <summary>
|
||||
/// 公司Id
|
||||
/// </summary>
|
||||
[Column("CompanyId")]
|
||||
public int CompanyId { get; set; }
|
||||
/// <summary>
|
||||
/// 文件地址
|
||||
/// </summary>
|
||||
[Column("FilePath")]
|
||||
public string FilePath { get; set; }
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
[Column("UserId")]
|
||||
public int UserId { get; set; }
|
||||
/// <summary>
|
||||
/// 失败原因
|
||||
/// </summary>
|
||||
[Column("Reason")]
|
||||
public string Reason { get; set; }
|
||||
/// <summary>
|
||||
/// 是否供应商用户
|
||||
/// </summary>
|
||||
[Column("SupplierId")]
|
||||
public int? SupplierId { get; set; }
|
||||
|
||||
public void Finish(bool IsSuccess, string reson)
|
||||
{
|
||||
if (IsSuccess)
|
||||
this.Status = ExportStatus.Success;
|
||||
else
|
||||
{
|
||||
this.Status = ExportStatus.Fail;
|
||||
this.Reason = reson;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/WMS.Web.Domain/IService/IExportExcelService.cs
Normal file
55
src/WMS.Web.Domain/IService/IExportExcelService.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Npoi.Mapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
public interface IExportExcelService
|
||||
{
|
||||
/// <summary>
|
||||
/// 全字段导出数据
|
||||
/// </summary>
|
||||
/// <typeparam name="Response"></typeparam>
|
||||
/// <typeparam name="Request"></typeparam>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="supplierId"></param>
|
||||
/// <returns></returns>
|
||||
Task ExportAll<Response, Request>(Request request, string fileName, int userId,int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto;
|
||||
/// <summary>
|
||||
/// 列表字段导出数据
|
||||
/// </summary>
|
||||
/// <typeparam name="Response"></typeparam>
|
||||
/// <typeparam name="Request"></typeparam>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="supplierId"></param>
|
||||
/// <returns></returns>
|
||||
Task ExportList<Response, Request>(Request request, string fileName, int userId, int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto;
|
||||
/// <summary>
|
||||
/// 列表页导出数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="dataList"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <param name="supplierId"></param>
|
||||
/// <returns></returns>
|
||||
Task Export<T>(List<T> dataList, string fileName,int userId,int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null);
|
||||
}
|
||||
}
|
||||
22
src/WMS.Web.Domain/IService/IQiniuUploadService.cs
Normal file
22
src/WMS.Web.Domain/IService/IQiniuUploadService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
public interface IQiniuUploadService
|
||||
{
|
||||
/// <summary>
|
||||
/// 上传文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="isAutoDelte">是否开启自动删除 如果开启 3天后自动删除 导出的execl文件</param>
|
||||
/// <returns></returns>
|
||||
Task<Result<string>> Upload(string fileName, Stream stream,bool isAutoDelte= false);
|
||||
}
|
||||
}
|
||||
26
src/WMS.Web.Domain/Infrastructure/IAllFielRepositories.cs
Normal file
26
src/WMS.Web.Domain/Infrastructure/IAllFielRepositories.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IAllFielRepositories<Request>
|
||||
{
|
||||
/// <summary>
|
||||
/// 全字段导出接口
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
//Task<(object obj, int total)> GetListAllField(Request dto, int companyId);
|
||||
|
||||
/// <summary>
|
||||
/// 列表字段导出接口
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
Task<(object obj, int total)> GetListField(Request dto, int companyId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface IFileDownManagerRepositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<FileDownManager> Add(FileDownManager entity);
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<FileDownManager> Edit(FileDownManager entity);
|
||||
/// <summary>
|
||||
/// 获取销售列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<FileDownManagerResponse> GetList(FileDownManagerRequest dto,int companyId);
|
||||
}
|
||||
}
|
||||
31
src/WMS.Web.Domain/Options/QiniuOptions.cs
Normal file
31
src/WMS.Web.Domain/Options/QiniuOptions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Domain.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// 七牛云 配置
|
||||
/// </summary>
|
||||
public class QiniuOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问key
|
||||
/// </summary>
|
||||
public string AccessKey { get; set; }
|
||||
/// <summary>
|
||||
/// 秘钥
|
||||
/// </summary>
|
||||
public string SecretKey { get; set; }
|
||||
/// <summary>
|
||||
/// 区块文件夹
|
||||
/// </summary>
|
||||
public string Bucket { get; set; }
|
||||
/// <summary>
|
||||
/// 访问域名
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
//导出数据一页条数
|
||||
public int PageSize { get; set; } = 50000;
|
||||
}
|
||||
}
|
||||
228
src/WMS.Web.Domain/Services/ExportExcelService.cs
Normal file
228
src/WMS.Web.Domain/Services/ExportExcelService.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Npoi.Mapper;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.Options;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Values;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Core.Dto;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
public class ExportExcelService : IExportExcelService
|
||||
{
|
||||
private readonly IQiniuUploadService _qiniuUploadService;
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
private readonly ILogger<ExportExcelService> _logger;
|
||||
private readonly QiniuOptions _option;
|
||||
public ExportExcelService(IQiniuUploadService qiniuUploadService, IServiceScopeFactory serviceScopeFactory,
|
||||
ILogger<ExportExcelService> logger, IOptions<QiniuOptions> option)
|
||||
{
|
||||
_qiniuUploadService = qiniuUploadService;
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
_logger = logger;
|
||||
_option = option?.Value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 列表页导出
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="dataList"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Export<T>(List<T> dataList, string fileName, int userId, int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null)
|
||||
{
|
||||
FileDownManager entity = new FileDownManager(userId, companyId, type, _option.Url + fileName, supplierId);
|
||||
using (var scope = _serviceScopeFactory.CreateScope())
|
||||
{
|
||||
var _fileDownManagerService = scope.ServiceProvider.GetRequiredService<IFileDownManagerRepositories>();
|
||||
entity = await _fileDownManagerService.Add(entity);
|
||||
List<List<T>> listz = new List<List<T>>();
|
||||
listz.Add(dataList);
|
||||
|
||||
string msg = await Upload(listz, fileName, userId, type);
|
||||
|
||||
entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg);
|
||||
await _fileDownManagerService.Edit(entity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 全字段导出
|
||||
/// </summary>
|
||||
/// <typeparam name="Response"></typeparam>
|
||||
/// <typeparam name="Request"></typeparam>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="mapper"></param>
|
||||
/// <returns></returns>
|
||||
public Task ExportAll<Response, Request>(Request request, string fileName, int userId, int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
//FileDownManager entity = new FileDownManager(userId, companyId, type, _option.Url + fileName, supplierId);
|
||||
|
||||
//request.PageNo = 1;
|
||||
//request.PageSize = _option.PageSize;
|
||||
//List<List<Response>> listz = new List<List<Response>>();
|
||||
//string msg = "";
|
||||
//using (var scope = _serviceScopeFactory.CreateScope())
|
||||
//{
|
||||
// var _fileDownManagerService = scope.ServiceProvider.GetRequiredService<IFileDownManagerRepositories>();
|
||||
// entity = await _fileDownManagerService.Add(entity);
|
||||
// try
|
||||
// {
|
||||
// var _service = scope.ServiceProvider.GetRequiredService<IAllFielRepositories<Request>>();
|
||||
// _logger.LogInformation($"{DateTime.Now}--开始访问数据");
|
||||
// var (obj, total) = await _service.GetListAllField(request, companyId);
|
||||
// var list = (List<Response>)obj;
|
||||
// var page = Math.Ceiling(Convert.ToDecimal(total) / _option.PageSize);
|
||||
|
||||
// listz.Add(list);
|
||||
// for (int i = 1; i < page; i++)
|
||||
// {
|
||||
// request.PageNo++;
|
||||
// var (obj_f, total_f) = await _service.GetListAllField(request, companyId);
|
||||
// var list_f = (List<Response>)obj_f;
|
||||
// listz.Add(list_f);
|
||||
// }
|
||||
// _logger.LogInformation($"{DateTime.Now}--访问数据成功 总数:{total}");
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// msg = $"未找到数据 {ex.ToString()}";
|
||||
// _logger.LogError($"导出异常:{ex.ToString()}");
|
||||
// }
|
||||
|
||||
// if (!string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// entity.Finish(false, msg);
|
||||
// await _fileDownManagerService.Edit(entity);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// msg = await Upload(listz, fileName, userId, type);
|
||||
|
||||
// entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg);
|
||||
// await _fileDownManagerService.Edit(entity);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
|
||||
public async Task ExportList<Response, Request>(Request request, string fileName, int userId, int companyId, FileDownLoadOrderType type, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto
|
||||
{
|
||||
FileDownManager entity = new FileDownManager(userId, companyId, type, _option.Url + fileName, supplierId);
|
||||
|
||||
request.PageNo = 1;
|
||||
request.PageSize = _option.PageSize;
|
||||
List<List<Response>> listz = new List<List<Response>>();
|
||||
string msg = "";
|
||||
using (var scope = _serviceScopeFactory.CreateScope())
|
||||
{
|
||||
var _fileDownManagerService = scope.ServiceProvider.GetRequiredService<IFileDownManagerRepositories>();
|
||||
entity = await _fileDownManagerService.Add(entity);
|
||||
try
|
||||
{
|
||||
var _service = scope.ServiceProvider.GetRequiredService<IAllFielRepositories<Request>>();
|
||||
_logger.LogInformation($"{DateTime.Now}--开始访问数据");
|
||||
var (obj, total) = await _service.GetListField(request, companyId);
|
||||
var list = (List<Response>)obj;
|
||||
var page = Math.Ceiling(Convert.ToDecimal(total) / _option.PageSize);
|
||||
|
||||
listz.Add(list);
|
||||
for (int i = 1; i < page; i++)
|
||||
{
|
||||
request.PageNo++;
|
||||
var (obj_f, total_f) = await _service.GetListField(request, companyId);
|
||||
var list_f = (List<Response>)obj_f;
|
||||
listz.Add(list_f);
|
||||
}
|
||||
_logger.LogInformation($"{DateTime.Now}--访问数据成功 总数:{total}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
msg = "未找到数据";
|
||||
_logger.LogError($"导出数据查询异常 {ex.ToString()}");
|
||||
}
|
||||
|
||||
if (listz.Count <= 0)
|
||||
{
|
||||
entity.Finish(false, msg);
|
||||
await _fileDownManagerService.Edit(entity);
|
||||
return;
|
||||
}
|
||||
|
||||
msg = await Upload(listz, fileName, userId, type);
|
||||
|
||||
entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg);
|
||||
await _fileDownManagerService.Edit(entity);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> Upload<T>(List<List<T>> dataList, string fileName, int userId, FileDownLoadOrderType type, Mapper mapper = null)
|
||||
{
|
||||
if (mapper == null)
|
||||
mapper = new Mapper();
|
||||
|
||||
//第一个参数为导出Excel名称
|
||||
//第二个参数为Excel数据来源
|
||||
//第三个参数为导出的Sheet名称
|
||||
//overwrite参数如果是要覆盖已存在的Excel或者新建Excel则为true,如果在原有Excel上追加数据则为false
|
||||
//xlsx参数是用于区分导出的数据格式为xlsx还是xls
|
||||
MemoryStream stream = new MemoryStream();
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < dataList.Count; i++)
|
||||
{
|
||||
mapper.Put<T>(dataList[i], "sheet" + (i + 1), true);
|
||||
}
|
||||
mapper.Save(stream);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "数据导入Execl异常";
|
||||
}
|
||||
|
||||
|
||||
//mapper.Save(stream, dataList, "sheet1", overwrite: true, xlsx: true);
|
||||
//,但是这里也踩到了一个坑,不过这个是 Npoi 的坑并不是 Npoi.Mapper 的坑,
|
||||
// 那就是 Workbook.Write(stream)的时候会将 stream 关闭,如果继续操作这个 Stream 会报流已关闭的错误
|
||||
//所以这里 是把流先转成byte[] 再转回使用的流
|
||||
try
|
||||
{
|
||||
var middleByte = stream.ToArray();
|
||||
using (MemoryStream streamUpload = new MemoryStream(middleByte))
|
||||
{
|
||||
var res = await _qiniuUploadService.Upload(fileName, streamUpload, true);
|
||||
if (!res.Success)
|
||||
{
|
||||
_logger.LogError($"{DateTime.Now}--上传千牛云失败 原因:{res.Message}");
|
||||
return res.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "数据上传云端异常";
|
||||
}
|
||||
|
||||
_logger.LogInformation($"{DateTime.Now}--导出成功");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
73
src/WMS.Web.Domain/Services/QiniuUploadService.cs
Normal file
73
src/WMS.Web.Domain/Services/QiniuUploadService.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Qiniu.Http;
|
||||
using Qiniu.Storage;
|
||||
using Qiniu.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.Options;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
public class QiniuUploadService : IQiniuUploadService
|
||||
{
|
||||
private readonly QiniuOptions _option;
|
||||
public QiniuUploadService(IOptions<QiniuOptions> option)
|
||||
{
|
||||
_option = option?.Value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 上传文件
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="isAutoDelte"></param>
|
||||
/// <returns></returns>
|
||||
public Task<Result<string>> Upload(string fileName, Stream stream, bool isAutoDelte = false)
|
||||
{
|
||||
// 生成(上传)凭证时需要使用此Mac
|
||||
// 这个示例单独使用了一个Settings类,其中包含AccessKey和SecretKey
|
||||
// 实际应用中,请自行设置您的AccessKey和SecretKey
|
||||
Mac mac = new Mac(_option.AccessKey, _option.SecretKey);
|
||||
|
||||
PutPolicy putPolicy = new PutPolicy();
|
||||
// 如果需要设置为"覆盖"上传(如果云端已有同名文件则覆盖),请使用 SCOPE = "BUCKET:KEY"
|
||||
putPolicy.Scope = _option.Bucket + ":" + fileName;
|
||||
// putPolicy.Scope = bucket;
|
||||
// 上传策略有效期(对应于生成的凭证的有效期)
|
||||
putPolicy.SetExpires(3600);
|
||||
// 上传到云端多少天后自动删除该文件,如果不设置(即保持默认默认)则不删除
|
||||
if (isAutoDelte)
|
||||
putPolicy.DeleteAfterDays = 7;
|
||||
string jstr = putPolicy.ToJsonString();
|
||||
string token = Auth.CreateUploadToken(mac, jstr);
|
||||
|
||||
Config config = new Config();
|
||||
// 空间对应的机房 华 东 ZONE_CN_East 华 北 ZONE_CN_North 华 南 ZONE_CN_Sout 北 美 ZONE_US_North 东南亚 ZONE_AS_Singapore
|
||||
config.Zone = Zone.ZONE_CN_South;
|
||||
// 是否使用https域名
|
||||
config.UseHttps = true;
|
||||
// 上传是否使用cdn加速
|
||||
config.UseCdnDomains = true;
|
||||
HttpResult result = null;
|
||||
try
|
||||
{
|
||||
FormUploader fu = new FormUploader(config);
|
||||
result = fu.UploadStream(stream, fileName, token, null);
|
||||
if (result.Code == 200)
|
||||
return Task.FromResult(Result<string>.ReSuccess(_option.Url + fileName));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
return Task.FromResult(Result<string>.ReFailure("上传文件失败" + ex.ToString(), 0));
|
||||
}
|
||||
return Task.FromResult(Result<string>.ReFailure("上传文件失败" + JsonConvert.SerializeObject(result), 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/WMS.Web.Domain/Values/ExportStatus.cs
Normal file
30
src/WMS.Web.Domain/Values/ExportStatus.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
|
||||
namespace WMS.Web.Domain.Values
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件导出状态
|
||||
/// </summary>
|
||||
public enum ExportStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 正在导出
|
||||
/// </summary>
|
||||
[EnumRemark("正在导出")]
|
||||
Ing = 0,
|
||||
/// <summary>
|
||||
/// 导出成功
|
||||
/// </summary>
|
||||
[EnumRemark("导出成功")]
|
||||
Success = 1,
|
||||
/// <summary>
|
||||
/// 导出失败
|
||||
/// </summary>
|
||||
[EnumRemark("导出失败")]
|
||||
Fail = 2
|
||||
}
|
||||
}
|
||||
19
src/WMS.Web.Domain/Values/FileDownLoadOrderType.cs
Normal file
19
src/WMS.Web.Domain/Values/FileDownLoadOrderType.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
|
||||
namespace WMS.Web.Domain.Values
|
||||
{
|
||||
/// <summary>
|
||||
/// 导出单据类型
|
||||
/// </summary>
|
||||
public enum FileDownLoadOrderType
|
||||
{
|
||||
/// <summary>
|
||||
/// 出库任务单
|
||||
/// </summary>
|
||||
[EnumRemark("出库任务单")]
|
||||
OutStockTask = 1,
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,11 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.ToTable("t_wms_sync_date");
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
builder.Entity<FileDownManager>(ent =>
|
||||
{
|
||||
ent.ToTable("t_wms_file_down_manager");
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
|
||||
|
||||
#region 出库单
|
||||
@@ -253,6 +258,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
base.OnModelCreating(builder);
|
||||
}
|
||||
|
||||
public DbSet<FileDownManager> FileDownManager { get; set; }
|
||||
public DbSet<SerialNumbers> SerialNumbers { get; set; }
|
||||
public DbSet<ErpOpsSyncDate> ErpOpsSyncDate { get; set; }
|
||||
public DbSet<SerialNumberOperate> SerialNumberOperate { get; set; }
|
||||
|
||||
@@ -177,6 +177,8 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
Services.Configure<ErpOptions>(Configuration.GetSection("ErpOptions"));
|
||||
Services.AddOptions<OpsOptions>();
|
||||
Services.Configure<OpsOptions>(Configuration.GetSection("OpsOptions"));
|
||||
Services.AddOptions<QiniuOptions>();
|
||||
Services.Configure<QiniuOptions>(Configuration.GetSection("Qiniu"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -252,7 +254,8 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
Services.AddTransient<IOpsService, OpsService>();
|
||||
|
||||
Services.AddTransient<IErpBasicDataExtendService, ErpBasicDataExtendService>();
|
||||
|
||||
Services.AddTransient<IExportExcelService, ExportExcelService>();
|
||||
Services.AddTransient<IQiniuUploadService, QiniuUploadService>();
|
||||
|
||||
|
||||
Services.AddTransient<IBoxService, BoxService>();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.OutStockTask;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
@@ -36,7 +37,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddTransient<IBoxRepositories, BoxRepositories>();
|
||||
services.AddTransient<IBasicsRepositories, BasicsRepositories>();
|
||||
services.AddTransient<ITransactionRepositories, TransactionRepositories>();
|
||||
|
||||
|
||||
#region 导出
|
||||
services.AddTransient<IAllFielRepositories<OutStockTaskQueryRequest>, OutStockTaskRepositories>();
|
||||
#endregion
|
||||
|
||||
|
||||
services.AddTransient<IInStockRepositories, InStockRepositories>();
|
||||
services.AddTransient<IInStockTaskRepositories, InStockTaskRepositories>();
|
||||
@@ -44,7 +49,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddTransient<IInventoryDetailsRepositories, InventoryDetailsRepositories>();
|
||||
services.AddTransient<IInventoryInOutDetailsRepositories, InventoryInOutDetailsRepositories>();
|
||||
services.AddTransient<IBoxInventoryRepositories, BoxInventoryRepositories>();
|
||||
|
||||
services.AddTransient<IFileDownManagerRepositories, FileDownManagerRepositories>();
|
||||
|
||||
services.AddTransient<ISerialNumbersRepositories, SerialNumbersRepositories>();
|
||||
services.AddTransient<ISerialNumberOperateRepositories, SerialNumberOperateRepositories>();
|
||||
|
||||
103
src/WMS.Web.Repositories/FileDownManagerRepositories.cs
Normal file
103
src/WMS.Web.Repositories/FileDownManagerRepositories.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
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;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
public class FileDownManagerRepositories : IFileDownManagerRepositories
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
public FileDownManagerRepositories(RepositoryDbContext context, IMapper mapper, ISingleDataService singleDataService)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_context = context;
|
||||
_singleDataService = singleDataService;
|
||||
}
|
||||
|
||||
public async Task<FileDownManager> Add(FileDownManager entity)
|
||||
{
|
||||
await _context.FileDownManager.AddAsync(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<FileDownManager> Edit(FileDownManager entity)
|
||||
{
|
||||
var res = await _context.FileDownManager
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (res == null) return null;
|
||||
|
||||
_mapper.Map(entity, res);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<FileDownManagerResponse> GetList(FileDownManagerRequest dto, int companyId)
|
||||
{
|
||||
List<int> userIds = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.User))
|
||||
userIds = _singleDataService.GetIdsBySingleName(SingleAction.Staffs, companyId, dto.User);
|
||||
|
||||
var res = _context.FileDownManager
|
||||
//.GroupJoin(_context.UcStaff, manager => manager.UserId, user => user.Id, (manager, user) => new { manager, user })
|
||||
// .SelectMany(x => x.user.DefaultIfEmpty(), (d, user) => new { d.manager, user })
|
||||
.OrderByDescending(o => o.Date)
|
||||
.Where(w => w.CompanyId == companyId);
|
||||
|
||||
|
||||
#region 条件
|
||||
if (!string.IsNullOrEmpty(dto.User))
|
||||
res = res.Where(w => userIds.Contains(w.UserId));
|
||||
if (dto.BeginDate != null)
|
||||
res = res.Where(w => w.Date >= dto.BeginDate);
|
||||
if (dto.EndDate != null)
|
||||
res = res.Where(w => w.Date <= (dto.EndDate ?? DateTime.Now).AddHours(23).AddMinutes(59).AddSeconds(59));
|
||||
if (dto.Type != null)
|
||||
res = res.Where(w => w.Type == (FileDownLoadOrderType)dto.Type);
|
||||
|
||||
if (dto.SupplierId != null)
|
||||
res = res.Where(w => w.SupplierId == dto.SupplierId);
|
||||
|
||||
if (dto.Status != null)
|
||||
{
|
||||
if ((ExportStatus)dto.Status == ExportStatus.Ing)
|
||||
res = res.Where(w => w.Status == ExportStatus.Ing && w.Date >= DateTime.Now.AddHours(-1));
|
||||
else if ((ExportStatus)dto.Status == ExportStatus.Fail)
|
||||
res = res.Where(w => (w.Status == ExportStatus.Fail) || (w.Status == ExportStatus.Ing && w.Date < DateTime.Now.AddHours(-1)));
|
||||
else
|
||||
res = res.Where(w => w.Status == (ExportStatus)dto.Status);
|
||||
}
|
||||
#endregion
|
||||
|
||||
int total = await res.CountAsync();
|
||||
var list = await res.Select(s => new FileDownInfoManagerResponse(_mapper.Map<FileDownInfoManagerResponse>(s))
|
||||
{
|
||||
StatusKey = (s.Status == ExportStatus.Ing && s.Date < DateTime.Now.AddHours(-1)) ? (int)ExportStatus.Fail : (int)s.Status,
|
||||
Status = (s.Status == ExportStatus.Ing && s.Date < DateTime.Now.AddHours(-1)) ? ExportStatus.Fail.GetRemark() : s.Status.GetRemark(),
|
||||
UserName = dto.SupplierId != null
|
||||
? _singleDataService.GetSingleData(SingleAction.Users, companyId, s.UserId)
|
||||
: _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.UserId),//s.StaffName
|
||||
})
|
||||
.Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return new FileDownManagerResponse(list, total);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
public class OutStockTaskRepositories : IOutStockTaskRepositories
|
||||
public class OutStockTaskRepositories : IAllFielRepositories<OutStockTaskQueryRequest>, IOutStockTaskRepositories
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
@@ -425,5 +425,16 @@ namespace WMS.Web.Repositories
|
||||
.Select(s => s.BillNo)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出列表
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<(object obj, int total)> GetListField(OutStockTaskQueryRequest dto, int companyId)
|
||||
{
|
||||
return await GetListAsync(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user