diff --git a/src/WMS.Web.Api/Controllers/FileDownManagerController.cs b/src/WMS.Web.Api/Controllers/FileDownManagerController.cs
new file mode 100644
index 00000000..b9ac525b
--- /dev/null
+++ b/src/WMS.Web.Api/Controllers/FileDownManagerController.cs
@@ -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
+{
+ ///
+ /// 上传下载中心
+ ///
+ [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;
+ }
+
+ ///
+ /// 获取需要的状态列表
+ ///
+ ///
+ [HttpGet]
+ [Route("GetStatus")]
+ public Task> 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.ReSuccess(response));
+ }
+
+ ///
+ /// 列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("FileDownManagerQuery")]
+ public async Task> FileDownManagerQuery(FileDownManagerRequest dto)
+ {
+ var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
+ if (loginInfo == null)
+ return Result.ReFailure(ResultCodes.Token_Invalid_Error);
+ dto.SupplierId = loginInfo.UserInfo.SupplierId;
+
+ var result = await _repositories.GetList(dto, loginInfo.UserInfo.CompanyId);
+ return Result.ReSuccess(result);
+ }
+ }
+}
diff --git a/src/WMS.Web.Api/Controllers/SysConfigController.cs b/src/WMS.Web.Api/Controllers/SysConfigController.cs
index 918dca8b..a21d58e3 100644
--- a/src/WMS.Web.Api/Controllers/SysConfigController.cs
+++ b/src/WMS.Web.Api/Controllers/SysConfigController.cs
@@ -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.ReSuccess(response));
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
index 682db163..1b53c4f3 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
@@ -49,6 +49,24 @@
+
+
+ 上传下载中心
+
+
+
+
+ 获取需要的状态列表
+
+
+
+
+
+ 列表
+
+
+
+
入库单-接口
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
index 4c0bfac7..7bf04f66 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
@@ -272,7 +272,7 @@
- 单据头ID
+ 箱ID
@@ -480,6 +480,16 @@
非采购上架方式
+
+
+ 下载导出订单类型
+
+
+
+
+ 下载导出状态
+
+
客户
@@ -1045,6 +1055,111 @@
备注
+
+
+ 上传下载列表
+
+
+
+
+ 单据类型(任务类型)
+
+
+
+
+ 状态
+
+
+
+
+ 下单时间 开始
+
+
+
+
+ 下单时间 结束
+
+
+
+
+ 操作人
+
+
+
+
+ 供应商用户Id
+
+
+
+
+ 上传下载列表
+
+
+
+
+ 查询列表内容
+
+
+
+
+ 总条数
+
+
+
+
+ 上传下载列表
+
+
+
+
+ 主键 订单编号
+
+
+
+
+ 日期
+
+
+
+
+ 单据类型(任务类型)
+
+
+
+
+ 状态(Key)
+
+
+
+
+ 状态
+
+
+
+
+ 文件地址
+
+
+
+
+ 操作人
+
+
+
+
+ 失败原因
+
+
+
+
+ 任务类型
+
+
+
+
+ 状态
+
+
采购订单物料明细和箱物料明细-对比请求对象
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
index 2b450c57..d128f028 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml
@@ -311,6 +311,56 @@
最新一次同步时间
+
+
+ 文件下载类型
+
+
+
+
+ 主键 订单编号
+
+
+
+
+ 日期
+
+
+
+
+ 单据类型(任务类型)
+
+
+
+
+ 状态
+
+
+
+
+ 公司Id
+
+
+
+
+ 文件地址
+
+
+
+
+ 操作人
+
+
+
+
+ 失败原因
+
+
+
+
+ 是否供应商用户
+
+
wms入库单
@@ -1461,6 +1511,26 @@
定时任务最新一次时间管理
+
+
+ 保存
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+ 获取销售列表
+
+
+
wms入库单-仓储接口
@@ -3777,6 +3847,36 @@
客户
+
+
+ 文件导出状态
+
+
+
+
+ 正在导出
+
+
+
+
+ 导出成功
+
+
+
+
+ 导出失败
+
+
+
+
+ 导出单据类型
+
+
+
+
+ 出库任务单
+
+
入库状态
diff --git a/src/WMS.Web.Core/Dto/BoxResponse.cs b/src/WMS.Web.Core/Dto/BoxResponse.cs
index 7547db7d..6b5e66fd 100644
--- a/src/WMS.Web.Core/Dto/BoxResponse.cs
+++ b/src/WMS.Web.Core/Dto/BoxResponse.cs
@@ -10,7 +10,7 @@ namespace WMS.Web.Core.Dto
public class BoxResponse
{
///
- /// 单据头ID
+ /// 箱ID
///
public int Id { get; set; }
///
diff --git a/src/WMS.Web.Core/Dto/EnumStatusResponse.cs b/src/WMS.Web.Core/Dto/EnumStatusResponse.cs
index 0326b5f3..d24b3bc9 100644
--- a/src/WMS.Web.Core/Dto/EnumStatusResponse.cs
+++ b/src/WMS.Web.Core/Dto/EnumStatusResponse.cs
@@ -46,8 +46,15 @@ namespace WMS.Web.Core.Dto
/// 非采购上架方式
///
public Dictionary ShelfMethod { get; set; } = new Dictionary();
+ ///
+ /// 下载导出订单类型
+ ///
+ public Dictionary FileDownLoadOrderType { get; set; } = new Dictionary();
+ ///
+ /// 下载导出状态
+ ///
+ public Dictionary ExportStatus { get; set; } = new Dictionary();
-
-
+
}
}
diff --git a/src/WMS.Web.Core/Dto/FileDownManagerRequest.cs b/src/WMS.Web.Core/Dto/FileDownManagerRequest.cs
new file mode 100644
index 00000000..ddb5a4ca
--- /dev/null
+++ b/src/WMS.Web.Core/Dto/FileDownManagerRequest.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WMS.Web.Core.Dto
+{
+ ///
+ /// 上传下载列表
+ ///
+ public class FileDownManagerRequest: PaginationBaseRequestDto
+ {
+ ///
+ /// 单据类型(任务类型)
+ ///
+ public int? Type { get; set; }
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+ ///
+ /// 下单时间 开始
+ ///
+ public DateTime? BeginDate { get; set; }
+ ///
+ /// 下单时间 结束
+ ///
+ public DateTime? EndDate { get; set; }
+ ///
+ /// 操作人
+ ///
+ public string User { get; set; }
+ ///
+ /// 供应商用户Id
+ ///
+ public int? SupplierId { get; set; } = null;
+ }
+}
diff --git a/src/WMS.Web.Core/Dto/FileDownManagerResponse.cs b/src/WMS.Web.Core/Dto/FileDownManagerResponse.cs
new file mode 100644
index 00000000..09b02aa7
--- /dev/null
+++ b/src/WMS.Web.Core/Dto/FileDownManagerResponse.cs
@@ -0,0 +1,73 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using WMS.Web.Core.Help;
+
+namespace WMS.Web.Core.Dto
+{
+ ///
+ /// 上传下载列表
+ ///
+ public class FileDownManagerResponse
+ {
+ public FileDownManagerResponse(List list, int? total)
+ {
+ this.List = list;
+ this.Total = total;
+ }
+
+ ///
+ /// 查询列表内容
+ ///
+ public List List { get; set; } = new List();
+ ///
+ /// 总条数
+ ///
+ public int? Total { get; set; }
+ }
+
+ ///
+ /// 上传下载列表
+ ///
+ public class FileDownInfoManagerResponse
+ {
+ public FileDownInfoManagerResponse() { }
+ public FileDownInfoManagerResponse(FileDownInfoManagerResponse response)
+ {
+ response.CopyPropertiesToD(this);
+ }
+ ///
+ /// 主键 订单编号
+ ///
+ public int Id { get; set; }
+ ///
+ /// 日期
+ ///
+ public string Date { get; set; }
+ ///
+ /// 单据类型(任务类型)
+ ///
+ public int Type { get; set; }
+ ///
+ /// 状态(Key)
+ ///
+ public int StatusKey { get; set; }
+ ///
+ /// 状态
+ ///
+ public string Status { get; set; }
+ ///
+ /// 文件地址
+ ///
+ public string FilePath { get; set; }
+ ///
+ /// 操作人
+ ///
+ public string UserName { get; set; }
+ ///
+ /// 失败原因
+ ///
+ public string Reason { get; set; }
+ }
+}
diff --git a/src/WMS.Web.Core/Dto/FileDownManagerStatusResponse.cs b/src/WMS.Web.Core/Dto/FileDownManagerStatusResponse.cs
new file mode 100644
index 00000000..3da3cd8a
--- /dev/null
+++ b/src/WMS.Web.Core/Dto/FileDownManagerStatusResponse.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WMS.Web.Core.Dto
+{
+ public class FileDownManagerStatusResponse
+ {
+ public FileDownManagerStatusResponse() { }
+ ///
+ /// 任务类型
+ ///
+ public Dictionary Type { get; set; } = new Dictionary();
+ ///
+ /// 状态
+ ///
+ public Dictionary Status { get; set; } = new Dictionary();
+ }
+}
diff --git a/src/WMS.Web.Domain/Entitys/FileDownManager.cs b/src/WMS.Web.Domain/Entitys/FileDownManager.cs
new file mode 100644
index 00000000..27819d83
--- /dev/null
+++ b/src/WMS.Web.Domain/Entitys/FileDownManager.cs
@@ -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
+{
+ ///
+ /// 文件下载类型
+ ///
+ [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;
+ }
+ ///
+ /// 主键 订单编号
+ ///
+ [Column("Id")]
+ public override int Id { get; set; }
+ ///
+ /// 日期
+ ///
+ [Column("Date")]
+ public DateTime? Date { get; set; } = DateTime.Now;
+ ///
+ /// 单据类型(任务类型)
+ ///
+ [Column("Type")]
+ public FileDownLoadOrderType Type { get; set; } = FileDownLoadOrderType.OutStockTask;
+ ///
+ /// 状态
+ ///
+ [Column("Status")]
+ public ExportStatus Status { get; set; } = ExportStatus.Ing;
+ ///
+ /// 公司Id
+ ///
+ [Column("CompanyId")]
+ public int CompanyId { get; set; }
+ ///
+ /// 文件地址
+ ///
+ [Column("FilePath")]
+ public string FilePath { get; set; }
+ ///
+ /// 操作人
+ ///
+ [Column("UserId")]
+ public int UserId { get; set; }
+ ///
+ /// 失败原因
+ ///
+ [Column("Reason")]
+ public string Reason { get; set; }
+ ///
+ /// 是否供应商用户
+ ///
+ [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;
+ }
+ }
+ }
+}
diff --git a/src/WMS.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs b/src/WMS.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs
new file mode 100644
index 00000000..1f1bb96b
--- /dev/null
+++ b/src/WMS.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs
@@ -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
+ {
+ ///
+ /// 保存
+ ///
+ ///
+ ///
+ Task Add(FileDownManager entity);
+ ///
+ /// 编辑
+ ///
+ ///
+ ///
+ Task Edit(FileDownManager entity);
+ ///
+ /// 获取销售列表
+ ///
+ ///
+ Task GetList(FileDownManagerRequest dto,int companyId);
+ }
+}
diff --git a/src/WMS.Web.Domain/Values/ExportStatus.cs b/src/WMS.Web.Domain/Values/ExportStatus.cs
new file mode 100644
index 00000000..33f1ede4
--- /dev/null
+++ b/src/WMS.Web.Domain/Values/ExportStatus.cs
@@ -0,0 +1,30 @@
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using WMS.Web.Core;
+
+namespace WMS.Web.Domain.Values
+{
+ ///
+ /// 文件导出状态
+ ///
+ public enum ExportStatus
+ {
+ ///
+ /// 正在导出
+ ///
+ [EnumRemark("正在导出")]
+ Ing = 0,
+ ///
+ /// 导出成功
+ ///
+ [EnumRemark("导出成功")]
+ Success = 1,
+ ///
+ /// 导出失败
+ ///
+ [EnumRemark("导出失败")]
+ Fail = 2
+ }
+}
diff --git a/src/WMS.Web.Domain/Values/FileDownLoadOrderType.cs b/src/WMS.Web.Domain/Values/FileDownLoadOrderType.cs
new file mode 100644
index 00000000..f18e4da8
--- /dev/null
+++ b/src/WMS.Web.Domain/Values/FileDownLoadOrderType.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using WMS.Web.Core;
+
+namespace WMS.Web.Domain.Values
+{
+ ///
+ /// 导出单据类型
+ ///
+ public enum FileDownLoadOrderType
+ {
+ ///
+ /// 出库任务单
+ ///
+ [EnumRemark("出库任务单")]
+ OutStockTask = 1,
+ }
+}
diff --git a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
index 729c827a..952dad35 100644
--- a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
+++ b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
@@ -68,6 +68,11 @@ namespace WMS.Web.Repositories.Configuration
ent.ToTable("t_wms_sync_date");
ent.HasKey(x => x.Id);
});
+ builder.Entity(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 { get; set; }
public DbSet SerialNumbers { get; set; }
public DbSet ErpOpsSyncDate { get; set; }
public DbSet SerialNumberOperate { get; set; }
diff --git a/src/WMS.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs b/src/WMS.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs
index 4ed35dbb..9c8d210d 100644
--- a/src/WMS.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs
+++ b/src/WMS.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs
@@ -44,7 +44,7 @@ namespace Microsoft.Extensions.DependencyInjection
services.AddTransient();
services.AddTransient();
services.AddTransient();
-
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/src/WMS.Web.Repositories/FileDownManagerRepositories.cs b/src/WMS.Web.Repositories/FileDownManagerRepositories.cs
new file mode 100644
index 00000000..1be5e576
--- /dev/null
+++ b/src/WMS.Web.Repositories/FileDownManagerRepositories.cs
@@ -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 Add(FileDownManager entity)
+ {
+ await _context.FileDownManager.AddAsync(entity);
+ await _context.SaveChangesAsync();
+
+ return entity;
+ }
+
+ public async Task 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 GetList(FileDownManagerRequest dto, int companyId)
+ {
+ List userIds = new List();
+ 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(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);
+ }
+ }
+}