Browse Source

提交说明

master
学 赵 1 year ago
parent
commit
151b2ae986
  1. 29
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/scripts/README.md
  2. 79
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErpShipping/ErpShippingAppService.cs

29
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/scripts/README.md

@ -1,5 +1,34 @@
# 数据库存储过程和自定义函数说明 # 数据库存储过程和自定义函数说明
# 创建数据库
USE [BQ_SA]
CREATE DATABASE [BQ_SA]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'BQ_SA1', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\BQ_SA1.mdf' , SIZE = 3022848KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2022]
( NAME = N'2022', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2022.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2023]
( NAME = N'2023', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2023.ndf' , SIZE = 2629632KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2024]
( NAME = N'2024', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2024.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2025]
( NAME = N'2025', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2025.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2026]
( NAME = N'2026', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2026.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2027]
( NAME = N'2027', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2027.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB ),
FILEGROUP [2028]
( NAME = N'2028', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\2028.ndf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'BQ_SA1_log', FILENAME = N'D:\SqlServer2019\MSSQL15.JS\MSSQL\DATA\BQ_SA1_log.ldf' , SIZE = 4530176KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT
GO
ALTER DATABASE [BQ_SA] SET COMPATIBILITY_LEVEL = 130
# 分区脚本,需要先在SQL SERVER清空数据,手工创建多个NDF物理文件,2022,、2023、2024等 # 分区脚本,需要先在SQL SERVER清空数据,手工创建多个NDF物理文件,2022,、2023、2024等
USE [BQ_SA] USE [BQ_SA]
GO GO

79
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErpShipping/ErpShippingAppService.cs

@ -31,7 +31,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
{ {
/// <summary> /// <summary>
/// 区域相关应用服务 /// 区域相关应用服务
/// </summary> /// </summary>
[Authorize(SettleAccountPermissions.Boms.Default)] [Authorize(SettleAccountPermissions.Boms.Default)]
//[AllowAnonymous] //[AllowAnonymous]
@ -53,12 +53,12 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
private readonly ISettleAccountBranchEfCoreRepository<ERPShippingVersion, Guid> _versionRepository; private readonly ISettleAccountBranchEfCoreRepository<ERPShippingVersion, Guid> _versionRepository;
/// <summary> /// <summary>
/// 构建方法 /// 构建方法
/// </summary> /// </summary>
/// <param name="guidGenerator">构建UID</param> /// <param name="guidGenerator">构建UID</param>
/// <param name="objectMapper">自动map</param> /// <param name="objectMapper">自动map</param>
/// <param name="repository">仓储接口</param> /// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param> /// <param name="cache">缓存</param>
public ErpShippingAppService(IGuidGenerator guidGenerator, public ErpShippingAppService(IGuidGenerator guidGenerator,
IObjectMapper objectMapper, IObjectMapper objectMapper,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
@ -80,12 +80,12 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
_importColumnMapRepository = importColumnMapRepository; _importColumnMapRepository = importColumnMapRepository;
} }
#region 导入导出功能 #region 导入导出功能
/// <summary> /// <summary>
/// 导入功能 /// 导入功能
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
//[HttpPost] //[HttpPost]
//[Route("ExcelImport-Map")] //[Route("ExcelImport-Map")]
@ -95,7 +95,6 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
//public async Task<string> ERPShippingDetailUploadExcelImportMap([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory) //public async Task<string> ERPShippingDetailUploadExcelImportMap([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory)
//{ //{
// var _mapList=_importColumnMapRepository.Where(p => p.ProjectName ==SettleAccountModuleName.ERPShippingDetail ).ToList(); // var _mapList=_importColumnMapRepository.Where(p => p.ProjectName ==SettleAccountModuleName.ERPShippingDetail ).ToList();
// ExportImporter _exportImporter = new ExportImporter(); // ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.ExtendExcelImport<ImportERPShippingDetailDto>(files, _excelImportService,_mapList); // var result = await _exportImporter.ExtendExcelImport<ImportERPShippingDetailDto>(files, _excelImportService,_mapList);
// var entityList = ObjectMapper.Map<List<ImportERPShippingDetailDto>, List<ERPShippingDetail>>(result); // var entityList = ObjectMapper.Map<List<ImportERPShippingDetailDto>, List<ERPShippingDetail>>(result);
@ -110,7 +109,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
// { // {
// if (itm.Count > 1) // if (itm.Count > 1)
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
// } // }
// } // }
// var _id = GuidGenerator.Create(); // var _id = GuidGenerator.Create();
@ -120,7 +119,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
// { // {
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode)) // if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
// continue; // continue;
// } // }
// itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory); // itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory);
@ -136,9 +135,9 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
//} //}
/// <summary> /// <summary>
/// 导入功能 /// 导入功能
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("ExcelImport")] [Route("ExcelImport")]
@ -161,7 +160,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
//{ //{
// if (itm.Count > 1) // if (itm.Count > 1)
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
// } // }
//} //}
//var _id = GuidGenerator.Create(); //var _id = GuidGenerator.Create();
@ -171,7 +170,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
//{ //{
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode)) // if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty));
// continue; // continue;
// } // }
// itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory); // itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory);
@ -188,7 +187,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
/// <summary> /// <summary>
/// 导出文件 /// 导出文件
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
@ -199,7 +198,7 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
{ {
IExporter _csv = new CsvExporter(); IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter(); IExporter _excel = new ExcelExporter();
//导出加上版本过滤条件,不能全导出 //导出加上版本过滤条件,不能全导出
if (!string.IsNullOrEmpty(input.Version)) if (!string.IsNullOrEmpty(input.Version))
{ {
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version.ToString() }); input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version.ToString() });
@ -211,14 +210,11 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true).ConfigureAwait(false); 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<ERPShippingDetail>, List<ERPShippingDetailExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<ERPShippingDetail>, List<ERPShippingDetailExportDto>>(entities);
var _fileName = string.Format("ERP调拨_{0}.xlsx", Guid.NewGuid().ToString("N")); var _fileName = string.Format("ERP调拨_{0}.xlsx", Guid.NewGuid().ToString("N"));
//声明导出容器 //声明导出容器
var result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false); var result = await _excel.ExportAsByteArray(dtoDetails).ConfigureAwait(false);
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync( await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto new SaveExcelImportInputDto
{ {
@ -231,13 +227,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
#endregion #endregion
/// <summary> /// <summary>
/// 按ID获取唯一实体 /// 按ID获取唯一实体
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 返回实体全部属性 /// 返回实体全部属性
/// </remarks> /// </remarks>
/// <param name="id">ID</param> /// <param name="id">ID</param>
/// <returns>实体DTO</returns> /// <returns>实体DTO</returns>
[HttpGet] [HttpGet]
[Route("{id}")] [Route("{id}")]
@ -259,9 +255,9 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
} }
/// <summary> /// <summary>
/// 获取实体总数 /// 获取实体总数
/// </summary> /// </summary>
/// <returns>实体总数</returns> /// <returns>实体总数</returns>
[HttpGet] [HttpGet]
[Route("count")] [Route("count")]
@ -271,10 +267,10 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
} }
/// <summary> /// <summary>
/// 删除实体 /// 删除实体
/// </summary> /// </summary>
/// <param name="id">ID</param> /// <param name="id">ID</param>
/// <returns>无</returns> /// <returns>无</returns>
[HttpDelete] [HttpDelete]
[Route("{id}")] [Route("{id}")]
@ -286,10 +282,10 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
} }
/// <summary> /// <summary>
/// 按IDs删除实体列表 /// 按IDs删除实体列表
/// </summary> /// </summary>
/// <param name="ids">IDs</param> /// <param name="ids">IDs</param>
/// <returns>是否执行成功</returns> /// <returns>是否执行成功</returns>
[HttpPost] [HttpPost]
[Route("delete")] [Route("delete")]
@ -307,13 +303,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
///// <summary> ///// <summary>
/// <summary> /// <summary>
/// 根据筛选条件获取实体列表 /// 根据筛选条件获取实体列表
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks> /// </remarks>
/// <param name="input">请求条件</param> /// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns> /// <returns>实体DTO列表</returns>
[HttpPost] [HttpPost]
[Route("list")] [Route("list")]
@ -337,13 +333,13 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
///// <summary> ///// <summary>
/// <summary> /// <summary>
/// 根据筛选条件获取实体列表 /// 根据筛选条件获取实体列表
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks> /// </remarks>
/// <param name="input">请求条件</param> /// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns> /// <returns>实体DTO列表</returns>
[HttpPost] [HttpPost]
[Route("listVersion")] [Route("listVersion")]
@ -351,7 +347,6 @@ namespace Win.Sfs.SettleAccount.ERPShippingDetails
{ {
var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
input.SkipCount, true).ConfigureAwait(false); input.SkipCount, true).ConfigureAwait(false);
var totalCount = await GetCountAsync(input).ConfigureAwait(false); var totalCount = await GetCountAsync(input).ConfigureAwait(false);
var dtos = _objectMapper.Map<List<ERPShippingVersion>, List<ERPShippingVersionDto>>(entities); var dtos = _objectMapper.Map<List<ERPShippingVersion>, List<ERPShippingVersionDto>>(entities);
//foreach (var itm in dtos) //foreach (var itm in dtos)

Loading…
Cancel
Save