diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Properties/launchSettings.json b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Properties/launchSettings.json index 73c14915..8341e6cc 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Properties/launchSettings.json +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Properties/launchSettings.json @@ -1,28 +1,12 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "https://localhost:44378", - "sslPort": 44378 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "SettleAccount.DemoApp": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "dotnetRunMessages": "true", - "applicationUrl": "http://localhost:44378" + "applicationUrl": "http://localhost:44379" }, "Docker": { "commandName": "Docker", diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomExportDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomExportDto.cs index b3f96eab..7d57aa68 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomExportDto.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomExportDto.cs @@ -1,16 +1,7 @@ using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Core.Filters; -using Magicodes.ExporterAndImporter.Core.Models; -using Magicodes.ExporterAndImporter.Excel; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Win.Sfs.SettleAccount.Entities.Boms { - public class BomExportDto { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomRequestDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomRequestDto.cs index 42e51bfe..588bf3d5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomRequestDto.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Boms/BomRequestDto.cs @@ -1,23 +1,9 @@ -// 闻荫智慧工厂管理套件 -// Copyright (c) 闻荫科技 www.ccwin-in.com - -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using Win.Sfs.Shared; -using Win.Sfs.Shared.DtoBase; +using Win.Sfs.Shared.DtoBase; namespace Win.Sfs.SettleAccount.Boms { - public class BomRequestDto : RequestDtoBase,IBranch + public class BomRequestDto : RequestDtoBase { - public Guid ParentId { set; get; } - public Guid BranchId { get; set; } - - public virtual Guid UserId { get; set; } - - public virtual int FileType { get; set; } - } } \ No newline at end of file diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs index 1d76e03f..2cb1abf7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Controls/CentralizedControlDtoBase.cs @@ -44,29 +44,12 @@ namespace Win.Sfs.SettleAccount.Entities.Controls public virtual string Remark { set; get; } } - public class CentralizedControlRequestDto : RequestDtoBase, IBranch - { - ///年度 - /// - public string Year { get; set; } - - /// - /// 期间 - /// - public string Period { set; get; } - - /// - /// 版本 - /// - public string Version { set; get; } + public class CentralizedControlRequestDto : RequestDtoBase + { - /// - /// 是否开放状态 - /// - public int State { set; get; } - public Guid BranchId { get; set ; } } + public class CentralizedControlDto : AuditedEntityDtoBase, IBranch { /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs index 73734c34..b8e7bd3d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs @@ -270,39 +270,12 @@ namespace Win.Sfs.SettleAccount.Entities.Materials { } - public class MaterialRequestDto : RequestDtoBase, IBranch - { - /// - ///工厂 - /// - public virtual string Factory { set; get; } - /// - /// 物料编码 - /// - public virtual string MaterialCode { set; get; } - /// - ///物料描述 - /// - public virtual string MaterialDesc - { - set; get; - } - /// - /// 基础单位 - /// - public virtual string Unit { set; get; } - /// - /// 估价类 - /// - public virtual string EstimateType { set; get; } - /// - /// 估价类描述 - /// - public virtual string EstimateTypeDesc { set; get; } - public Guid BranchId { get ; set ; } - public Guid UserId { get; set; } + public class MaterialRequestDto : RequestDtoBase + { + } + public class MaterialDto : AuditedEntityDtoBase, IBranch { /// @@ -387,55 +360,38 @@ namespace Win.Sfs.SettleAccount.Entities.Materials public virtual string EstimateTypeDesc { set; get; } } + public class MaterialExportDto { - - - - - ///// - /////工厂 - ///// - //[ExporterHeader(DisplayName = "工厂")] - - //public virtual string Factory { set; get; } /// - /// 物料编码(物料号) + /// 客户物料号 /// - [ExporterHeader(DisplayName = "ERP物料号")] - - + [ExporterHeader(DisplayName = "客户物料号")] + public string CustomerPartCode { set; get; } + + /// + /// 厂内物料号 + /// + [ExporterHeader(DisplayName = "厂内物料号")] + public string MaterialCode { set; get; } - public virtual string MaterialCode { set; get; } /// - ///物料描述 + /// 物料描述 /// - [ExporterHeader(DisplayName = "ERP物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } - public virtual string MaterialDesc - { - set; get; - } /// /// 基础计量单位 /// [ExporterHeader(DisplayName = "基本计量单位")] - + public string Unit { set; get; } - public virtual string Unit { set; get; } /// - /// 估价类 + /// 产品类型 /// [ExporterHeader(DisplayName = "产品类型")] - - public virtual string EstimateType { set; get; } - ///// - ///// 估价类描述 - ///// - //[ExporterHeader(DisplayName = "估价类描述")] + public string EstimateType { set; get; } - - //public virtual string EstimateTypeDesc { set; get; } - ////public Guid BranchId { get; set; } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs index 32881e7f..a60609ab 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CurdBaseAppService.cs @@ -1,5 +1,4 @@ -using Castle.Core.Internal; -using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Csv; using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Http; @@ -8,7 +7,6 @@ using Shouldly; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; using System.Reflection; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; @@ -16,8 +14,6 @@ using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Constant; -using Win.Sfs.SettleAccount.Entities.Prices; -using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Bases @@ -109,7 +105,7 @@ namespace Win.Sfs.SettleAccount.Bases { var entity = ObjectMapper.Map(input); await _repository.InsertAsync(entity, autoSave: true).ConfigureAwait(continueOnCapturedContext: false); - return ObjectMapper.Map (entity); + return ObjectMapper.Map(entity); } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs index ffabef3c..2901dbd5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs @@ -1,6 +1,3 @@ - - - using System; using System.Collections.Generic; using System.Diagnostics; @@ -29,216 +26,89 @@ using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.Boms; +using Win.Sfs.SettleAccount.Entities.Controls; using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.Filter; +using Win.Sfs.Shared.RepositoryBase; using Win.Utils; namespace Win.Sfs.SettleAccount.Boms { /// - /// Ӧ÷ + /// BOM /// - [Authorize(SettleAccountPermissions.Boms.Default)] - //[AllowAnonymous] + //[Authorize(SettleAccountPermissions.Boms.Default)] + [AllowAnonymous] [Route("api/settleaccount/bom")] - public class BomAppService : SettleAccountApplicationBase, IBomAppService + public class BomAppService : SettleAccountApplicationBase { + /// + /// BOMִ + /// + private readonly INormalEfCoreRepository _repository; + private readonly IGuidGenerator _guidGenerator; private readonly IObjectMapper _objectMapper; private readonly IExcelImportAppService _excelImportService; - - private readonly ISettleAccountBranchEfCoreRepository _repository; - - private readonly ISettleAccountBranchEfCoreRepository _materialRepository; private readonly ISettleAccountBranchEfCoreRepository _importColumnMapRepository; private readonly ISettleAccountBranchEfCoreRepository _versionRepository; + /// - /// + /// 췽 /// - /// UID - /// Զmap - /// ִӿ - /// - public BomAppService(IGuidGenerator guidGenerator, + public BomAppService( + INormalEfCoreRepository repository, + IGuidGenerator guidGenerator, IObjectMapper objectMapper, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, - ISettleAccountBranchEfCoreRepository repository, ISettleAccountBranchEfCoreRepository versionRepository, ISettleAccountBranchEfCoreRepository materialRepository, ISettleAccountBranchEfCoreRepository importColumnMapRepository, IDistributedCache cache ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) { + _repository = repository; + _guidGenerator = guidGenerator; _objectMapper = objectMapper; - _repository = repository; + _excelImportService = excelImportService; _versionRepository = versionRepository; _materialRepository = materialRepository; _importColumnMapRepository = importColumnMapRepository; } - #region 뵼 - + #region 롢 /// - /// 빦 + /// /// - /// ϴļ(ǰѾֻϴһ) - /// - [HttpPost] - [Route("ExcelImport-Map")] - [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.Boms.Create)] - - public async Task BomUploadExcelImportMap([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory) - { - var _mapList=_importColumnMapRepository.Where(p => p.ProjectName ==SettleAccountModuleName.Bom ).ToList(); - - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.ExtendExcelImport(files, _excelImportService,_mapList); - var entityList = ObjectMapper.Map, List>(result); - var _versionQuery = _versionRepository.Where(p => p.Version == version && p.Factory == factory); - await _versionQuery.BatchDeleteAsync(); - var _query = _repository.Where(p => p.Version == version && p.Factory == factory); - await _query.BatchDeleteAsync(); - var checkList = new List(); - var _matList = await _materialRepository.GetAllAsync(GuidGenerator.Create()); - var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(), ParentItmeCode = p.Key.ParentItemCode, ChildItemCode = p.Key.ChildItemCode }); - foreach (var itm in _group) - { - 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)); - } - } - var _id = GuidGenerator.Create(); - var _bomList = new List(); - _bomList.Add(new BomVersion(_id, branchId, year, period, version, customerCode, factory)); - foreach (var itm in entityList) - { - 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)); - continue; - } - itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory); - } - if (checkList.Count > 0) - { - return await ExportErrorReportAsync(checkList); - } - await _repository.GetDbContext().BulkInsertAsync(entityList); - await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); - //st.Stop(); - return ApplicationConsts.SuccessStr; - } - - - - - /// - /// 빦 - /// - /// ϴļ(ǰѾֻϴһ) - /// - [HttpPost] - [Route("ExcelImport")] - [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.Boms.Create)] - - public async Task BomUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode,string factory) - { - - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.UploadExcelImport(files, _excelImportService); - var entityList = ObjectMapper.Map, List>(result); - var _versionQuery = _versionRepository.Where(p => p.Version == version && p.Factory==factory ); - await _versionQuery.BatchDeleteAsync(); - var _query = _repository.Where(p => p.Version == version && p.Factory == factory); - await _query.BatchDeleteAsync(); - var checkList = new List(); - var _matList =await _materialRepository.GetAllAsync(GuidGenerator.Create()); - var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(),ParentItmeCode=p.Key.ParentItemCode, ChildItemCode=p.Key.ChildItemCode }); - foreach (var itm in _group) - { - 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)); - } - } - var _id = GuidGenerator.Create(); - var _bomList = new List(); - _bomList.Add(new BomVersion(_id, branchId, year, period, version, customerCode,factory)); - foreach (var itm in entityList) - { - 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)); - continue; - } - itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory); - } - if (checkList.Count > 0) - { - return await ExportErrorReportAsync(checkList); - } - await _repository.GetDbContext().BulkInsertAsync(entityList); - await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); - //st.Stop(); - return ApplicationConsts.SuccessStr; - } - /// - /// ļ - /// - /// - /// [HttpPost] [Route("Export")] - [Authorize(SettleAccountPermissions.Boms.Default)] - virtual public async Task ExportAsync(BomRequestDto input) + public virtual async Task ExportAsync(BomRequestDto input) { - IExporter _csv = new CsvExporter(); - IExporter _excel = new ExcelExporter(); - //ϰ汾ȫ - if (input.ParentId != Guid.Empty) - { - input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); - } - //else - //{ - // return new PagedResultDto(0, new List()); - //} - var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + string _fileName = string.Format("BOM_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); - var dtoDetails = ObjectMapper.Map, List>(entities); - string _fileName = string.Empty; + var dtoDetails = ObjectMapper.Map, List >(entities); + // + ExportImporter _exportImporter = new ExportImporter(); + + var result = await _exportImporter.ExcelExporter(dtoDetails); - byte[] result = null; - switch (input.FileType) - { - case 0: - _fileName = string.Format("Ʒṹ_{0}.csv", input.UserId.ToString()); - result = await _csv.ExportAsByteArray(dtoDetails); - break; - case 1: - _fileName = string.Format("Ʒṹ_{0}.xlsx", input.UserId.ToString()); - result = await _excel.ExportAsByteArray(dtoDetails); - break; - } result.ShouldNotBeNull(); //浼ļɶ @@ -253,147 +123,327 @@ namespace Win.Sfs.SettleAccount.Boms } #endregion + #region CURD /// - /// IDȡΨһʵ - /// - /// - /// ʵȫ - /// - /// ID - /// ʵDTO - [HttpGet] - [Route("{id}")] - [Authorize(SettleAccountPermissions.Boms.Default)] - virtual public async Task GetAsync(Guid id) - { - var result = await _repository.GetAsync(id); - var dto = _objectMapper.Map(result); - return dto; - } - - - private async Task GetFromCacheAsync(Guid id) - { - var result = await _repository.GetAsync(id); - return result; - } - - - private async Task GetCountAsync(BomRequestDto input) - { - return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); - } - - - private async Task GetCountAsync(BomVersionRequestDto input) - { - return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); - } - - /// - /// ȡʵ - /// - /// ʵ - [HttpGet] - [Route("count")] - [Authorize(SettleAccountPermissions.Boms.Default)] - virtual public async Task GetTotalCountAsync(Guid branchId) - { - return await _repository.GetCountAsync(branchId); - } - - - - /// - /// ɾʵ + /// ȡб /// - /// ID - /// - [HttpDelete] - [Route("{id}")] - [Authorize(SettleAccountPermissions.Boms.Delete)] - virtual public async Task DeleteAsync(Guid id) - { - //var entity = await GetFromCacheAsync(id); - //await Cache.DeleteAsync(id.ToString()); - await _repository.DeleteAsync(id); - } - - /// - /// IDsɾʵб - /// - /// IDs - /// Ƿִгɹ - [HttpPost] - [Route("delete")] - [Authorize(SettleAccountPermissions.Boms.Delete)] - virtual public async Task DeleteListAsync(List ids) - { - //foreach (var id in ids) - //{ - // var entity = await GetFromCacheAsync(id); - - //} - - return await _repository.DeleteListAsync(ids); - } - - - ///// - - /// - /// ɸѡȡʵб - /// - /// - /// :ɸѡб,,,ҳ - /// - /// - /// ʵDTOб [HttpPost] [Route("list")] - [Authorize(SettleAccountPermissions.Boms.Default)] - public async Task> GetListAsync(Guid parentId, BomRequestDto input) + public async Task> GetListAsync(BomRequestDto input) { - if (input.ParentId != Guid.Empty) - { - input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); - } - else - { - return new PagedResultDto(0,new List()); - } - var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, - input.SkipCount, true); - var totalCount = await GetCountAsync(input); - var dtos = _objectMapper.Map, List>(entities); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters); + var dtos = ObjectMapper.Map, List>(entities); return new PagedResultDto(totalCount, dtos); } + #endregion - ///// + #region ԭ + // #region 뵼 + + // /// + // /// 빦 + // /// + // /// ϴļ(ǰѾֻϴһ) + // /// + // [HttpPost] + // [Route("ExcelImport-Map")] + // [DisableRequestSizeLimit] + // [Authorize(SettleAccountPermissions.Boms.Create)] + + // public async Task BomUploadExcelImportMap([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory) + // { + // var _mapList=_importColumnMapRepository.Where(p => p.ProjectName ==SettleAccountModuleName.Bom ).ToList(); + + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.ExtendExcelImport(files, _excelImportService,_mapList); + // var entityList = ObjectMapper.Map, List>(result); + // var _versionQuery = _versionRepository.Where(p => p.Version == version && p.Factory == factory); + // await _versionQuery.BatchDeleteAsync(); + // var _query = _repository.Where(p => p.Version == version && p.Factory == factory); + // await _query.BatchDeleteAsync(); + // var checkList = new List(); + // var _matList = await _materialRepository.GetAllAsync(GuidGenerator.Create()); + // var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(), ParentItmeCode = p.Key.ParentItemCode, ChildItemCode = p.Key.ChildItemCode }); + // foreach (var itm in _group) + // { + // 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)); + // } + // } + // var _id = GuidGenerator.Create(); + // var _bomList = new List(); + // _bomList.Add(new BomVersion(_id, branchId, year, period, version, customerCode, factory)); + // foreach (var itm in entityList) + // { + // 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)); + // continue; + // } + // itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory); + // } + // if (checkList.Count > 0) + // { + // return await ExportErrorReportAsync(checkList); + // } + // await _repository.GetDbContext().BulkInsertAsync(entityList); + // await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + // //st.Stop(); + // return ApplicationConsts.SuccessStr; + // } + + + + + // /// + // /// 빦 + // /// + // /// ϴļ(ǰѾֻϴһ) + // /// + // [HttpPost] + // [Route("ExcelImport")] + // [DisableRequestSizeLimit] + // [Authorize(SettleAccountPermissions.Boms.Create)] + + // public async Task BomUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode,string factory) + // { + + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + // var entityList = ObjectMapper.Map, List>(result); + // var _versionQuery = _versionRepository.Where(p => p.Version == version && p.Factory==factory ); + // await _versionQuery.BatchDeleteAsync(); + // var _query = _repository.Where(p => p.Version == version && p.Factory == factory); + // await _query.BatchDeleteAsync(); + // var checkList = new List(); + // var _matList =await _materialRepository.GetAllAsync(GuidGenerator.Create()); + // var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(),ParentItmeCode=p.Key.ParentItemCode, ChildItemCode=p.Key.ChildItemCode }); + // foreach (var itm in _group) + // { + // 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)); + // } + // } + // var _id = GuidGenerator.Create(); + // var _bomList = new List(); + // _bomList.Add(new BomVersion(_id, branchId, year, period, version, customerCode,factory)); + // foreach (var itm in entityList) + // { + // 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)); + // continue; + // } + // itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory); + // } + // if (checkList.Count > 0) + // { + // return await ExportErrorReportAsync(checkList); + // } + // await _repository.GetDbContext().BulkInsertAsync(entityList); + // await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + // //st.Stop(); + // return ApplicationConsts.SuccessStr; + // } + // /// + // /// ļ + // /// + // /// + // /// + // [HttpPost] + // [Route("Export")] + // [Authorize(SettleAccountPermissions.Boms.Default)] + // virtual public async Task ExportAsync(BomRequestDto input) + // { + // IExporter _csv = new CsvExporter(); + // IExporter _excel = new ExcelExporter(); + // //ϰ汾ȫ + // if (input.ParentId != Guid.Empty) + // { + // input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); + // } + // //else + // //{ + // // return new PagedResultDto(0, new List()); + // //} + // var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + // 0, true); + // var dtoDetails = ObjectMapper.Map, List>(entities); + // string _fileName = string.Empty; + // // + + // byte[] result = null; + // switch (input.FileType) + // { + // case 0: + // _fileName = string.Format("Ʒṹ_{0}.csv", input.UserId.ToString()); + // result = await _csv.ExportAsByteArray(dtoDetails); + // break; + // case 1: + // _fileName = string.Format("Ʒṹ_{0}.xlsx", input.UserId.ToString()); + // result = await _excel.ExportAsByteArray(dtoDetails); + // break; + // } + // result.ShouldNotBeNull(); + + // //浼ļɶ + // await _excelImportService.SaveBlobAsync( + // new SaveExcelImportInputDto + // { + // Name = _fileName, + // Content = result + // } + // ); + // return _fileName; + // } + // #endregion + + // /// + // /// IDȡΨһʵ + // /// + // /// + // /// ʵȫ + // /// + // /// ID + // /// ʵDTO + // [HttpGet] + // [Route("{id}")] + //[Authorize(SettleAccountPermissions.Boms.Default)] + // virtual public async Task GetAsync(Guid id) + // { + // var result = await _repository.GetAsync(id); + // var dto = _objectMapper.Map(result); + // return dto; + // } + + + // private async Task GetFromCacheAsync(Guid id) + // { + // var result = await _repository.GetAsync(id); + // return result; + // } + + + // private async Task GetCountAsync(BomRequestDto input) + // { + // return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + // } + + + // private async Task GetCountAsync(BomVersionRequestDto input) + // { + // return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); + // } + + // /// + // /// ȡʵ + // /// + // /// ʵ + // [HttpGet] + // [Route("count")] + //[Authorize(SettleAccountPermissions.Boms.Default)] + // virtual public async Task GetTotalCountAsync(Guid branchId) + // { + // return await _repository.GetCountAsync(branchId); + // } + + + + // /// + // /// ɾʵ + // /// + // /// ID + // /// + // [HttpDelete] + // [Route("{id}")] + //[Authorize(SettleAccountPermissions.Boms.Delete)] + // virtual public async Task DeleteAsync(Guid id) + // { + // //var entity = await GetFromCacheAsync(id); + // //await Cache.DeleteAsync(id.ToString()); + // await _repository.DeleteAsync(id); + // } + + // /// + // /// IDsɾʵб + // /// + // /// IDs + // /// Ƿִгɹ + // [HttpPost] + // [Route("delete")] + //[Authorize(SettleAccountPermissions.Boms.Delete)] + // virtual public async Task DeleteListAsync(List ids) + // { + // //foreach (var id in ids) + // //{ + // // var entity = await GetFromCacheAsync(id); + + // //} + + // return await _repository.DeleteListAsync(ids); + // } + + + // ///// + + // /// + // /// ɸѡȡʵб + // /// + // /// + // /// :ɸѡб,,,ҳ + // /// + // /// + // /// ʵDTOб + // [HttpPost] + // [Route("list")] + // [Authorize(SettleAccountPermissions.Boms.Default)] + // public async Task> GetListAsync(Guid parentId, BomRequestDto input) + // { + // if (input.ParentId != Guid.Empty) + // { + // input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); + // } + // else + // { + // return new PagedResultDto(0,new List()); + // } + // var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, + // input.SkipCount, true); + // var totalCount = await GetCountAsync(input); + // var dtos = _objectMapper.Map, List>(entities); + // return new PagedResultDto(totalCount, dtos); + // } + + // ///// + + // /// + // /// ɸѡȡʵб + // /// + // /// + // /// :ɸѡб,,,ҳ + // /// + // /// + // /// ʵDTOб + // [HttpPost] + // [Route("listVersion")] + // [Authorize(SettleAccountPermissions.Boms.Default)] + // public async Task> GetVersionListAsync(BomVersionRequestDto input) + // { + // var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + // input.SkipCount, true); + + // var totalCount = await GetCountAsync(input); + // var dtos = _objectMapper.Map, List>(entities); + // //foreach (var itm in dtos) + // //{ + // // itm.Version = itm.Version + string.Format("({0})", itm.Factory); + // //} + // return new PagedResultDto(totalCount, dtos); + // } + #endregion - /// - /// ɸѡȡʵб - /// - /// - /// :ɸѡб,,,ҳ - /// - /// - /// ʵDTOб - [HttpPost] - [Route("listVersion")] - [Authorize(SettleAccountPermissions.Boms.Default)] - public async Task> GetVersionListAsync(BomVersionRequestDto input) - { - var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, - input.SkipCount, true); - - var totalCount = await GetCountAsync(input); - var dtos = _objectMapper.Map, List>(entities); - //foreach (var itm in dtos) - //{ - // itm.Version = itm.Version + string.Format("({0})", itm.Factory); - //} - return new PagedResultDto(totalCount, dtos); - } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs index fef483ae..da1c845d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs @@ -24,306 +24,351 @@ using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.CodeSettings; using Win.Sfs.SettleAccount.Entities.ImportMap; +using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.CacheBase; +using Win.Sfs.Shared.RepositoryBase; using Win.Utils; namespace Win.Sfs.SettleAccount.Entities.Controls { - - - /// /// 期间设置 /// - [Authorize(SettleAccountPermissions.CentralizedControls.Default)] - //[AllowAnonymous] + //[Authorize(SettleAccountPermissions.CentralizedControls.Default)] + [AllowAnonymous] [Route("api/settleaccount/CentralizedControl")] - public class CentralizedControlAppService : SettleAccountApplicationBase, ICentralizedControlAppService + public class CentralizedControlAppService : SettleAccountApplicationBase { + /// + /// 期间设置仓储 + /// + private readonly INormalEfCoreRepository _repository; + private readonly ISettleAccountBranchEfCoreRepository _mapRepository; private readonly IExcelImportAppService _excelImportService; - private readonly ISettleAccountBranchEfCoreRepository _repository; /// /// 构建方法 /// - /// 构建UID - /// 自动map - /// 仓储接口 - /// 缓存 - public CentralizedControlAppService(IGuidGenerator guidGenerator, + public CentralizedControlAppService( + INormalEfCoreRepository repository, + IGuidGenerator guidGenerator, IObjectMapper objectMapper, - ISettleAccountBranchEfCoreRepository repository, IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager - ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { - _repository = repository; _excelImportService = excelImportService; } + #region CURD /// - /// 导入功能 + /// 获取列表 /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("ExcelImport")] - [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.CentralizedControls.Create)] - public async Task CentralizedControlUploadExcelImport([FromForm] IFormFileCollection files,Guid branchId) - { - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.UploadExcelImport(files, _excelImportService); - var _ls = ObjectMapper.Map, List>(result); - foreach (var itm in _ls) - { - itm.SetValue(GuidGenerator.Create(), branchId); - } - var bulkConfig = new BulkConfig { SetOutputIdentity = true, BatchSize = 10000 }; - _repository.GetDbContext().BulkInsert(_ls, bulkConfig); - return ApplicationConsts.SuccessStr; - } - - - - /// - /// 按ID获取唯一实体 - /// - /// - /// 返回实体全部属性 - /// - /// ID - /// 实体DTO - [HttpGet] - [Route("{id}")] - virtual public async Task GetAsync(Guid id) - { - var result = await GetFromCacheAsync(id); - var dto = ObjectMapper.Map(result); - return dto; - } - - - private async Task GetFromCacheAsync(Guid id) - { - var result = - await _repository.GetAsync(id); - - - return result; - } - - - private async Task GetCountAsync(CentralizedControlRequestDto input) - { - return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); - } - - - - - ///// - - /// - /// 根据筛选条件获取实体列表 - /// - /// - /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 - /// - /// 请求条件 - /// 实体DTO列表 [HttpPost] [Route("list")] - virtual public async Task> GetListAsync(CentralizedControlRequestDto input) + public async Task> GetListAsync(CentralizedControlRequestDto input) { - var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, - input.SkipCount, true); - - var totalCount = await GetCountAsync(input); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters); var dtos = ObjectMapper.Map, List>(entities); - return new PagedResultDto(totalCount, dtos); } + #endregion - - /// - /// 获取实体总数 - /// - /// 实体总数 - [HttpGet] - [Route("count")] - virtual public async Task GetTotalCountAsync(Guid branchId) - { - return await _repository.GetCountAsync(branchId); - } - - /// - /// 获取全部实体列表 - /// - /// 实体DTO列表 - [HttpGet] - [Route("all")] - virtual public async Task> GetAllAsync(Guid branchId) - { - var entities = await _repository.GetAllAsync(branchId, true); - - - var dtos = ObjectMapper.Map, List>(entities); - - - return new ListResultDto(dtos); - } - - - - - /// - /// 新增实体 - /// - /// 新增实体DTO - /// 实体DTO - - [HttpPost] - [Route("")] - [Authorize(SettleAccountPermissions.CentralizedControls.Create)] - virtual public async Task CreateAsync(CentralizedControlCreateDto input) - { - var _first= _repository.Where(p => p.Version == input.Version).FirstOrDefault(); - - if (_first != null) - { - throw new BusinessException("001", "已经存在该期间,不能重复添加!"); - } - - var entity = new CentralizedControl( - GuidGenerator.Create(), - input.BranchId, - input.Year, - input.Period, - input.Year+input.Period, - input.State - - - ); - - await _repository.InsertAsync(entity); - - //create cache - //await Cache.SetAsync(entity.Id.ToString(), entity,CacheStrategyConst.FIVE_MINUTES); - - var dto = ObjectMapper.Map(entity); - return dto; - - } - - /// - /// 修改实体 - /// - /// ID - /// 修改实体DTO - /// 实体DTO - [HttpPut] - [Route("{id}")] - [Authorize(SettleAccountPermissions.CentralizedControls.Update)] - virtual public async Task UpdateAsync(Guid id, CentralizedControlUpdateDto input) - { - var entity = await _repository.GetAsync(id); - entity.Update(input.Remark); - await _repository.UpdateAsync(entity); - //update cache - //await Cache.SetAsync(id.ToString(), entity, CacheStrategyConst.FIVE_MINUTES); - var dto = ObjectMapper.Map(entity); - return dto; - - - - } - - /// - /// 删除实体 - /// - /// ID - /// - [HttpDelete] - [Route("{id}")] - [Authorize(SettleAccountPermissions.CentralizedControls.Delete)] - virtual public async Task DeleteAsync(Guid id) - { - var entity = await GetFromCacheAsync(id); - await Cache.DeleteAsync(id.ToString()); - await _repository.DeleteAsync(id); - } - - /// - /// 按IDs删除实体列表 - /// - /// IDs - /// 是否执行成功 - [HttpPost] - [Route("delete")] - [Authorize(SettleAccountPermissions.CentralizedControls.Delete)] - virtual public async Task DeleteListAsync(List ids) - { - var _query = _repository.Where(p => ids.Contains(p.Id)); - int i = await _query.BatchDeleteAsync(); - - if (i == 0) - { - return false; - } - return true; - } + #region 开启、关闭 [HttpPost] [Route("open")] - [Authorize(SettleAccountPermissions.CentralizedControls.Create)] public async Task OpenVersion(List ids) { - foreach (var id in ids) + var entitys = await _repository.GetListAsync(p => ids.Contains(p.Id)); + foreach (var entity in entitys) { - var _entity = await _repository.GetAsync(id); - _entity.OpenVersion(); - + entity.OpenVersion(); } return true; } + [HttpPost] [Route("close")] - [Authorize(SettleAccountPermissions.CentralizedControls.Create)] /// /// 关闭版本 /// - /// 选择要关闭的ID - /// - public async Task ClosedVersion(List ids) + public async Task ClosedVersion(List ids) { - foreach (var id in ids) + var entitys = await _repository.GetListAsync(p => ids.Contains(p.Id)); + foreach (var entity in entitys) { - var _entity = await _repository.GetAsync(id); - _entity.ClosedVersion(); + entity.ClosedVersion(); } return true; } - [HttpPost] - [Route("openlist")] - /// - /// 获得开放的版本列表 - /// - /// - public async Task> GetOpenVersionList() - { - var _list = await _repository.Where(p => p.State == 0).ToListAsync(); - - var dtos = ObjectMapper.Map, List>(_list); + #endregion + + #region 原方法(废弃) + // /// + // /// 导入功能 + // /// + // /// 上传的文件(前端已经限制只能上传一个附件) + // /// + // [HttpPost] + // [Route("ExcelImport")] + // [DisableRequestSizeLimit] + // [Authorize(SettleAccountPermissions.CentralizedControls.Create)] + // public async Task CentralizedControlUploadExcelImport([FromForm] IFormFileCollection files,Guid branchId) + // { + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + // var _ls = ObjectMapper.Map, List>(result); + // foreach (var itm in _ls) + // { + // itm.SetValue(GuidGenerator.Create(), branchId); + // } + // var bulkConfig = new BulkConfig { SetOutputIdentity = true, BatchSize = 10000 }; + // _repository.GetDbContext().BulkInsert(_ls, bulkConfig); + // return ApplicationConsts.SuccessStr; + // } + + + + // /// + // /// 按ID获取唯一实体 + // /// + // /// + // /// 返回实体全部属性 + // /// + // /// ID + // /// 实体DTO + // [HttpGet] + // [Route("{id}")] + // virtual public async Task GetAsync(Guid id) + // { + // var result = await GetFromCacheAsync(id); + // var dto = ObjectMapper.Map(result); + // return dto; + // } + + + // private async Task GetFromCacheAsync(Guid id) + // { + // var result = + // await _repository.GetAsync(id); + + + // return result; + // } + + + // private async Task GetCountAsync(CentralizedControlRequestDto input) + // { + // return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + // } + + + + + // ///// + + // /// + // /// 根据筛选条件获取实体列表 + // /// + // /// + // /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + // /// + // /// 请求条件 + // /// 实体DTO列表 + // [HttpPost] + // [Route("list")] + // virtual public async Task> GetListAsync(CentralizedControlRequestDto input) + // { + // var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, + // input.SkipCount, true); + + // var totalCount = await GetCountAsync(input); + // var dtos = ObjectMapper.Map, List>(entities); + + // return new PagedResultDto(totalCount, dtos); + // } + + + // /// + // /// 获取实体总数 + // /// + // /// 实体总数 + // [HttpGet] + // [Route("count")] + // virtual public async Task GetTotalCountAsync(Guid branchId) + // { + // return await _repository.GetCountAsync(branchId); + // } + + // /// + // /// 获取全部实体列表 + // /// + // /// 实体DTO列表 + // [HttpGet] + // [Route("all")] + // virtual public async Task> GetAllAsync(Guid branchId) + // { + // var entities = await _repository.GetAllAsync(branchId, true); + + + // var dtos = ObjectMapper.Map, List>(entities); + + + // return new ListResultDto(dtos); + // } + + + + + // /// + // /// 新增实体 + // /// + // /// 新增实体DTO + // /// 实体DTO + + // [HttpPost] + // [Route("")] + //[Authorize(SettleAccountPermissions.CentralizedControls.Create)] + // virtual public async Task CreateAsync(CentralizedControlCreateDto input) + // { + // var _first= _repository.Where(p => p.Version == input.Version).FirstOrDefault(); + + // if (_first != null) + // { + // throw new BusinessException("001", "已经存在该期间,不能重复添加!"); + // } + + // var entity = new CentralizedControl( + // GuidGenerator.Create(), + // input.BranchId, + // input.Year, + // input.Period, + // input.Year+input.Period, + // input.State + + + // ); + + // await _repository.InsertAsync(entity); + + // //create cache + // //await Cache.SetAsync(entity.Id.ToString(), entity,CacheStrategyConst.FIVE_MINUTES); + + // var dto = ObjectMapper.Map(entity); + // return dto; + + // } + + // /// + // /// 修改实体 + // /// + // /// ID + // /// 修改实体DTO + // /// 实体DTO + // [HttpPut] + // [Route("{id}")] + //[Authorize(SettleAccountPermissions.CentralizedControls.Update)] + // virtual public async Task UpdateAsync(Guid id, CentralizedControlUpdateDto input) + // { + // var entity = await _repository.GetAsync(id); + // entity.Update(input.Remark); + // await _repository.UpdateAsync(entity); + // //update cache + // //await Cache.SetAsync(id.ToString(), entity, CacheStrategyConst.FIVE_MINUTES); + // var dto = ObjectMapper.Map(entity); + // return dto; + + + + // } + + // /// + // /// 删除实体 + // /// + // /// ID + // /// + // [HttpDelete] + // [Route("{id}")] + //[Authorize(SettleAccountPermissions.CentralizedControls.Delete)] + // virtual public async Task DeleteAsync(Guid id) + // { + // var entity = await GetFromCacheAsync(id); + // await Cache.DeleteAsync(id.ToString()); + // await _repository.DeleteAsync(id); + // } + + // /// + // /// 按IDs删除实体列表 + // /// + // /// IDs + // /// 是否执行成功 + // [HttpPost] + // [Route("delete")] + //[Authorize(SettleAccountPermissions.CentralizedControls.Delete)] + // virtual public async Task DeleteListAsync(List ids) + // { + // var _query = _repository.Where(p => ids.Contains(p.Id)); + // int i = await _query.BatchDeleteAsync(); + + // if (i == 0) + // { + // return false; + // } + // return true; + // } + // [HttpPost] + // [Route("open")] + // [Authorize(SettleAccountPermissions.CentralizedControls.Create)] + // public async Task OpenVersion(List ids) + // { + // foreach (var id in ids) + // { + // var _entity = await _repository.GetAsync(id); + // _entity.OpenVersion(); + + // } + // return true; + // } + // [HttpPost] + // [Route("close")] + // [Authorize(SettleAccountPermissions.CentralizedControls.Create)] + // /// + // /// 关闭版本 + // /// + // /// 选择要关闭的ID + // /// + // public async Task ClosedVersion(List ids) + // { + // foreach (var id in ids) + // { + // var _entity = await _repository.GetAsync(id); + // _entity.ClosedVersion(); + // } + // return true; + // } + // [HttpPost] + // [Route("openlist")] + // /// + // /// 获得开放的版本列表 + // /// + // /// + // public async Task> GetOpenVersionList() + // { + // var _list = await _repository.Where(p => p.State == 0).ToListAsync(); + + // var dtos = ObjectMapper.Map, List>(_list); + + // return dtos; + // } + #endregion - return dtos; - } - } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs index 9aa8e504..fcf5fba2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs @@ -1,25 +1,13 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using EFCore.BulkExtensions; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Excel; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Caching.Distributed; +using Microsoft.EntityFrameworkCore; using Shouldly; -using Volo.Abp; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.BackgroundJobs; using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Guids; -using Volo.Abp.ObjectMapping; -using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Boms; @@ -31,41 +19,34 @@ using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; - using Win.Sfs.SettleAccount.MaterialRelationships; -using Win.Sfs.Shared.CacheBase; -using Win.Utils; +using Win.Sfs.Shared.RepositoryBase; + namespace Win.Sfs.SettleAccount.Entities.Materials { - /// - /// 物料主数据应用服务 + /// 物料主数据 /// - [Authorize(SettleAccountPermissions.Materials.Default)] - //[AllowAnonymous] + //[Authorize(SettleAccountPermissions.Materials.Default)] + [AllowAnonymous] [Route("api/settleaccount/Material")] - public class MaterialAppService : SettleAccountApplicationBase, IMaterialAppService + public class MaterialAppService : SettleAccountApplicationBase { - - private readonly IExcelImportAppService _excelImportService; - private readonly ISettleAccountBranchEfCoreRepository _repository; + private readonly INormalEfCoreRepository _repository; + private readonly ISettleAccountBranchEfCoreRepository _bomRepository; private readonly ISettleAccountBranchEfCoreRepository _bomversionRepository; private readonly ISettleAccountBranchEfCoreRepository _priceRepository; private readonly ISettleAccountBranchEfCoreRepository _priceversionRepository; private readonly ISettleAccountBranchEfCoreRepository _mapRepository; private readonly ISettleAccountBranchEfCoreRepository _relationshipRepository; + /// /// 构建方法 /// - /// 构建UID - /// 自动map - /// 仓储接口 - /// 缓存 public MaterialAppService( - - ISettleAccountBranchEfCoreRepository repository, + INormalEfCoreRepository repository, ISettleAccountBranchEfCoreRepository mapRepository, ISettleAccountBranchEfCoreRepository bomRepository, ISettleAccountBranchEfCoreRepository bomversionRepository, @@ -92,465 +73,516 @@ namespace Win.Sfs.SettleAccount.Entities.Materials } - + #region 导入、导出 /// - /// 导入功能 + /// 导出 /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// [HttpPost] - [Route("ExcelImport-TH")] - [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.Materials.Default)] - public async Task MaterialUploadExcelImportMap([FromForm] IFormFileCollection files,string version) + [Route("Export")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + public virtual async Task ExportAsync(MaterialRequestDto input) { + string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, + 0, true); + var dtoDetails = ObjectMapper.Map, List>(entities); + + //声明导出容器 ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); - await UpdateMaterial(result,version); - await UpdateBom(result,version); - await UpdatePrice(result,version); + var result = await _exportImporter.ExcelExporter(dtoDetails); - return ApplicationConsts.SuccessStr; - } - private async Task> UpdateBom(List result,string version) - { - var _versionQuery = _bomversionRepository.Where(p => p.Version == version ); - await _versionQuery.BatchDeleteAsync(); - var _query = _bomRepository.Where(p => p.Version == version ); - await _query.BatchDeleteAsync(); - var entityList = new List(); - - var _ls=result.Where(p=>!string.IsNullOrEmpty(p.ChildMaterialCode) && !string.IsNullOrEmpty(p.MaterialCode)).ToList(); - - foreach (var itm in _ls) - { - entityList.Add(new Bom(GuidGenerator.Create(),GuidGenerator.Create(),itm.MaterialCode,itm.MaterialDesc,itm.ChildMaterialCode,itm.ChildMaterialDesc,string.Empty,itm.Qty,0,itm.Qty,string.Empty,DateTime.Now,DateTime.Now,string.Empty,0,GuidGenerator.Create(),string.Empty)); - } - var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(), ParentItmeCode = p.Key.ParentItemCode, ChildItemCode = p.Key.ChildItemCode }); - foreach (var itm in _group) - { - if (itm.Count > 1) - { - checkList.Add(new ErrorExportDto(version, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); - } - } - var _id = GuidGenerator.Create(); - var _bomList = new List(); - _bomList.Add(new BomVersion(_id, GuidGenerator.Create(), DateTime.Now.Year.ToString(),DateTime.Now.Month.ToString(), version, string.Empty, string.Empty)); - foreach (var itm in entityList) - { - itm.SetValue(GuidGenerator.Create(), GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version, _id, string.Empty); - } - await _bomRepository.GetDbContext().BulkInsertAsync(entityList); - await _bomversionRepository.GetDbContext().BulkInsertAsync(_bomList); - return checkList; + result.ShouldNotBeNull(); + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; } + #endregion - private async Task> UpdatePrice(List result,string version) + #region CURD + /// + /// 获取列表 + /// + [HttpPost] + [Route("list")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + virtual public async Task> GetListAsync(MaterialRequestDto input) { - var checkList = new List(); - var _priceversion= _priceversionRepository.Where(p => p.Version == version); - await _priceversion.BatchDeleteAsync(); - var _prices=_priceRepository.Where(p => p.Version == version); - await _prices.BatchDeleteAsync(); - - var _materialList = result.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).Select(p => p.MaterialCode).Distinct().ToList(); - _materialList.Remove("xxbmr016.p b+"); - _materialList.Remove(null); - _materialList.Remove("END OF REPORT"); - _materialList.Remove("Report Attributes (see Comment)"); - _materialList.Remove("Report Criteria (see Comment)"); - var _partList = result.Where(p => !string.IsNullOrEmpty(p.ChildMaterialCode)).Select(p => p.ChildMaterialCode).Distinct().ToList(); - _partList.Remove(null); - List _priceList = new List(); - List _priceVersion = new List(); - foreach (var itm in _materialList) - { - var _first = result.FirstOrDefault(p => p.MaterialCode == itm); - if (_first != null) - { - var _price = new PriceList(GuidGenerator.Create(), DateTime.MinValue, DateTime.MaxValue, _first.MaterialPrice, _first.MaterialCode, 0, GuidGenerator.Create(), version,string.Empty); - _priceList.Add(_price); - } - } - foreach (var itm in _partList) - { - var _first = result.FirstOrDefault(p => p.ChildMaterialCode == itm); - if (_first != null) - { - var _price = new PriceList(GuidGenerator.Create(), DateTime.MinValue, DateTime.MaxValue, _first.ChildMaterialPrice, _first.ChildMaterialCode, 0, GuidGenerator.Create(), version,string.Empty); - _priceList.Add(_price); - } - } - var _versionList= new List() { new PriceListVersion(GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version) }; - - await _priceRepository.GetDbContext().BulkInsertAsync(_priceList); - await _priceversionRepository.GetDbContext().BulkInsertAsync(_versionList); - - return checkList; + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, + input.SkipCount, true); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); } + #endregion + #region 原方法(废弃) + ///// + ///// 导入功能 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("ExcelImport-TH")] + //[DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //public async Task MaterialUploadExcelImportMap([FromForm] IFormFileCollection files, string version) + //{ + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + // await UpdateMaterial(result, version); + // await UpdateBom(result, version); + // await UpdatePrice(result, version); - private async Task> UpdateMaterial(List result,string version) - { + // return ApplicationConsts.SuccessStr; + //} + //private async Task> UpdateBom(List result, string version) + //{ + // var _versionQuery = _bomversionRepository.Where(p => p.Version == version); + // await _versionQuery.BatchDeleteAsync(); + // var _query = _bomRepository.Where(p => p.Version == version); + // await _query.BatchDeleteAsync(); + // var entityList = new List(); + + // var _ls = result.Where(p => !string.IsNullOrEmpty(p.ChildMaterialCode) && !string.IsNullOrEmpty(p.MaterialCode)).ToList(); + + // foreach (var itm in _ls) + // { + // entityList.Add(new Bom(GuidGenerator.Create(), GuidGenerator.Create(), itm.MaterialCode, itm.MaterialDesc, itm.ChildMaterialCode, itm.ChildMaterialDesc, string.Empty, itm.Qty, 0, itm.Qty, string.Empty, DateTime.Now, DateTime.Now, string.Empty, 0, GuidGenerator.Create(), string.Empty)); + // } + // var checkList = new List(); + // var _group = entityList.GroupBy(x => new { x.ParentItemCode, x.ChildItemCode, x.Version }).Select(p => new { Count = p.Count(), ParentItmeCode = p.Key.ParentItemCode, ChildItemCode = p.Key.ChildItemCode }); + // foreach (var itm in _group) + // { + // if (itm.Count > 1) + // { + // checkList.Add(new ErrorExportDto(version, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); + // } + // } + // var _id = GuidGenerator.Create(); + // var _bomList = new List(); + // _bomList.Add(new BomVersion(_id, GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version, string.Empty, string.Empty)); + // foreach (var itm in entityList) + // { + // itm.SetValue(GuidGenerator.Create(), GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version, _id, string.Empty); + // } + // await _bomRepository.GetDbContext().BulkInsertAsync(entityList); + // await _bomversionRepository.GetDbContext().BulkInsertAsync(_bomList); + // return checkList; - var _list = await _repository.GetAllAsync(GuidGenerator.Create()); - //var _relationshiplist = _relationshipRepository.GetAllAsync(GuidGenerator.Create()); - - - List _errorList = new List(); - - List _insertls = new List(); - var materialList = result.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).Select(p => p.MaterialCode).Distinct().ToList(); - materialList.Remove("xxbmr016.p b+"); - materialList.Remove(null); - materialList.Remove("END OF REPORT"); - materialList.Remove("Report Attributes (see Comment)"); - materialList.Remove("Report Criteria (see Comment)"); - - //xxbmr016.p b+ - foreach (var itm in materialList) - { - var _material = result.Where(p => p.MaterialCode == itm).FirstOrDefault(); - if (_material != null) - { - var _m = new Material(GuidGenerator.Create(), GuidGenerator.Create(), string.Empty, _material.MaterialCode, _material.MaterialDesc, string.Empty, _material.EstimateType, string.Empty); - _insertls.Add(_m); - - } - } - var _ls = from r1 in _insertls - join r2 in _list on r1.MaterialCode equals r2.MaterialCode - into temp - from t in temp.DefaultIfEmpty() - where t == null - select r1; - var _ls1 = from r1 in _insertls - join r2 in _list on r1.MaterialCode equals r2.MaterialCode - select r1; - var checkList = new List(); - var check = _ls.Where(p => string.IsNullOrEmpty(p.EstimateType)).ToList(); - - if (_ls.Count() > 0) - { - await _repository.GetDbContext().BulkInsertAsync(_ls.ToList()); - } - if (_ls1.Count() > 0) - { - await _repository.GetDbContext().BulkUpdateAsync(_ls1.ToList()); - } - return _errorList; - } + //} + //private async Task> UpdatePrice(List result, string version) + //{ + // var checkList = new List(); + // var _priceversion = _priceversionRepository.Where(p => p.Version == version); + // await _priceversion.BatchDeleteAsync(); + // var _prices = _priceRepository.Where(p => p.Version == version); + // await _prices.BatchDeleteAsync(); + + // var _materialList = result.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).Select(p => p.MaterialCode).Distinct().ToList(); + // _materialList.Remove("xxbmr016.p b+"); + // _materialList.Remove(null); + // _materialList.Remove("END OF REPORT"); + // _materialList.Remove("Report Attributes (see Comment)"); + // _materialList.Remove("Report Criteria (see Comment)"); + // var _partList = result.Where(p => !string.IsNullOrEmpty(p.ChildMaterialCode)).Select(p => p.ChildMaterialCode).Distinct().ToList(); + // _partList.Remove(null); + // List _priceList = new List(); + // List _priceVersion = new List(); + // foreach (var itm in _materialList) + // { + // var _first = result.FirstOrDefault(p => p.MaterialCode == itm); + // if (_first != null) + // { + // var _price = new PriceList(GuidGenerator.Create(), DateTime.MinValue, DateTime.MaxValue, _first.MaterialPrice, _first.MaterialCode, 0, GuidGenerator.Create(), version, string.Empty); + // _priceList.Add(_price); + // } + // } + // foreach (var itm in _partList) + // { + // var _first = result.FirstOrDefault(p => p.ChildMaterialCode == itm); + // if (_first != null) + // { + // var _price = new PriceList(GuidGenerator.Create(), DateTime.MinValue, DateTime.MaxValue, _first.ChildMaterialPrice, _first.ChildMaterialCode, 0, GuidGenerator.Create(), version, string.Empty); + // _priceList.Add(_price); + // } + // } + // var _versionList = new List() { new PriceListVersion(GuidGenerator.Create(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), version) }; + + // await _priceRepository.GetDbContext().BulkInsertAsync(_priceList); + // await _priceversionRepository.GetDbContext().BulkInsertAsync(_versionList); + + // return checkList; + //} + //private async Task> UpdateMaterial(List result, string version) + //{ + // var _list = await _repository.GetAllAsync(GuidGenerator.Create()); + // //var _relationshiplist = _relationshipRepository.GetAllAsync(GuidGenerator.Create()); + + + // List _errorList = new List(); + + // List _insertls = new List(); + // var materialList = result.Where(p => !string.IsNullOrEmpty(p.MaterialCode)).Select(p => p.MaterialCode).Distinct().ToList(); + // materialList.Remove("xxbmr016.p b+"); + // materialList.Remove(null); + // materialList.Remove("END OF REPORT"); + // materialList.Remove("Report Attributes (see Comment)"); + // materialList.Remove("Report Criteria (see Comment)"); + + // //xxbmr016.p b+ + // foreach (var itm in materialList) + // { + // var _material = result.Where(p => p.MaterialCode == itm).FirstOrDefault(); + // if (_material != null) + // { + // var _m = new Material(GuidGenerator.Create(), GuidGenerator.Create(), string.Empty, _material.MaterialCode, _material.MaterialDesc, string.Empty, _material.EstimateType, string.Empty); + // _insertls.Add(_m); + + // } + // } + // var _ls = from r1 in _insertls + // join r2 in _list on r1.MaterialCode equals r2.MaterialCode + // into temp + // from t in temp.DefaultIfEmpty() + // where t == null + // select r1; + // var _ls1 = from r1 in _insertls + // join r2 in _list on r1.MaterialCode equals r2.MaterialCode + // select r1; + // var checkList = new List(); + // var check = _ls.Where(p => string.IsNullOrEmpty(p.EstimateType)).ToList(); + + // if (_ls.Count() > 0) + // { + // await _repository.GetDbContext().BulkInsertAsync(_ls.ToList()); + // } + // if (_ls1.Count() > 0) + // { + // await _repository.GetDbContext().BulkUpdateAsync(_ls1.ToList()); + // } + // return _errorList; + //} - /// - /// 导入功能 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("ExcelImport")] - [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.Materials.Default)] - public async Task MaterialUploadExcelImport([FromForm] IFormFileCollection files) - { - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.UploadExcelImport(files, _excelImportService); - var _ls = ObjectMapper.Map, List>(result); - var checkList = new List(); - foreach (var itm in _ls) - { - var _first = await _repository.FirstOrDefaultAsync(p => p.MaterialCode == itm.MaterialCode); - if (_first == null) - { - var entity = new Material( - GuidGenerator.Create(), - GuidGenerator.Create(), - itm.Factory, - itm.MaterialCode, - itm.MaterialDesc, - itm.Unit, - itm.EstimateType, - itm.EstimateTypeDesc - ); - await _repository.InsertAsync(entity); - } - else - { - _first.Update(itm.MaterialDesc, itm.Unit, itm.EstimateType, itm.EstimateTypeDesc, itm.Factory - ); - await _repository.UpdateAsync(_first); - } - var _f = await _relationshipRepository.FirstOrDefaultAsync(p => p.ErpMaterialCode == itm.MaterialCode); - if (_f != null) - { - _f.Update(itm.MaterialDesc, _f.MaterialProperty, _f.SettleMaterialCode, _f.ShipMaterailCode); - await _relationshipRepository.UpdateAsync(_f); - } - else - { - var _r = new MaterialRelationship(GuidGenerator.Create(), GuidGenerator.Create(), itm.MaterialCode, itm.MaterialDesc, string.Empty, string.Empty, string.Empty, itm.EstimateType); - await _relationshipRepository.InsertAsync(_r); - } - } - return ApplicationConsts.SuccessStr; - } - /// - /// 按ID获取唯一实体 - /// - /// - /// 返回实体全部属性 - /// - /// ID - /// 实体DTO - [HttpGet] - [Route("{id}")] - [Authorize(SettleAccountPermissions.Materials.Default)] - virtual public async Task GetAsync(Guid id) - { - - - var result = await GetFromCacheAsync(id); - var dto = ObjectMapper.Map(result); - return dto; - } - private async Task GetFromCacheAsync(Guid id) - { - var result = await _repository.GetAsync(id); - - return result; - } + ///// + ///// 导入功能 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("ExcelImport")] + //[DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //public async Task MaterialUploadExcelImport([FromForm] IFormFileCollection files) + //{ + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + // var _ls = ObjectMapper.Map, List>(result); + // var checkList = new List(); + // foreach (var itm in _ls) + // { + // var _first = await _repository.FirstOrDefaultAsync(p => p.MaterialCode == itm.MaterialCode); + // if (_first == null) + // { + // var entity = new Material( + // GuidGenerator.Create(), + // GuidGenerator.Create(), + // itm.Factory, + // itm.MaterialCode, + // itm.MaterialDesc, + // itm.Unit, + // itm.EstimateType, + // itm.EstimateTypeDesc + // ); + // await _repository.InsertAsync(entity); + // } + // else + // { + // _first.Update(itm.MaterialDesc, itm.Unit, itm.EstimateType, itm.EstimateTypeDesc, itm.Factory + // ); + // await _repository.UpdateAsync(_first); + // } + // var _f = await _relationshipRepository.FirstOrDefaultAsync(p => p.ErpMaterialCode == itm.MaterialCode); + // if (_f != null) + // { + // _f.Update(itm.MaterialDesc, _f.MaterialProperty, _f.SettleMaterialCode, _f.ShipMaterailCode); + // await _relationshipRepository.UpdateAsync(_f); + // } + // else + // { + // var _r = new MaterialRelationship(GuidGenerator.Create(), GuidGenerator.Create(), itm.MaterialCode, itm.MaterialDesc, string.Empty, string.Empty, string.Empty, itm.EstimateType); + // await _relationshipRepository.InsertAsync(_r); + // } + // } + // return ApplicationConsts.SuccessStr; + //} - private async Task GetCountAsync(MaterialRequestDto input) - { - return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); - } + ///// + ///// 按ID获取唯一实体 + ///// + ///// + ///// 返回实体全部属性 + ///// + ///// ID + ///// 实体DTO + //[HttpGet] + //[Route("{id}")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //virtual public async Task GetAsync(Guid id) + //{ + + + // var result = await GetFromCacheAsync(id); + // var dto = ObjectMapper.Map(result); + // return dto; + //} + + + //private async Task GetFromCacheAsync(Guid id) + //{ + // var result = await _repository.GetAsync(id); + + // return result; + //} + + + //private async Task GetCountAsync(MaterialRequestDto input) + //{ + // return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + //} + + /////// + ///// + ///// 根据筛选条件获取实体列表 + ///// + ///// + ///// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + ///// + ///// 请求条件 + ///// 实体DTO列表 + //[HttpPost] + //[Route("list")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //virtual public async Task> GetListAsync(MaterialRequestDto input) + //{ + // var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, + // input.SkipCount, true); - /// - /// 根据筛选条件获取实体列表 - /// - /// - /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 - /// - /// 请求条件 - /// 实体DTO列表 - [HttpPost] - [Route("list")] - [Authorize(SettleAccountPermissions.Materials.Default)] - virtual public async Task> GetListAsync(MaterialRequestDto input) - { - var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, - input.SkipCount, true); + // var totalCount = await GetCountAsync(input); + // var dtos = ObjectMapper.Map, List>(entities); - var totalCount = await GetCountAsync(input); - var dtos = ObjectMapper.Map, List>(entities); + // return new PagedResultDto(totalCount, dtos); + //} - return new PagedResultDto(totalCount, dtos); - } + ///// + ///// 获取实体总数 + ///// + ///// 实体总数 + //[HttpGet] + //[Route("count")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //virtual public async Task GetTotalCountAsync(Guid branchId) + //{ + // return await _repository.GetCountAsync(branchId); + //} - /// - /// 获取实体总数 - /// - /// 实体总数 - [HttpGet] - [Route("count")] - [Authorize(SettleAccountPermissions.Materials.Default)] - virtual public async Task GetTotalCountAsync(Guid branchId) - { - return await _repository.GetCountAsync(branchId); - } + ///// + ///// 获取全部实体列表 + ///// + ///// 实体DTO列表 + //[HttpGet] + //[Route("all")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //virtual public async Task> GetAllAsync(Guid branchId) + //{ + // var entities = await _repository.GetAllAsync(branchId, true); - /// - /// 获取全部实体列表 - /// - /// 实体DTO列表 - [HttpGet] - [Route("all")] - [Authorize(SettleAccountPermissions.Materials.Default)] - virtual public async Task> GetAllAsync(Guid branchId) - { - var entities = await _repository.GetAllAsync(branchId, true); + // var dtos = ObjectMapper.Map, List>(entities); - var dtos = ObjectMapper.Map, List>(entities); + // return new ListResultDto(dtos); + //} - return new ListResultDto(dtos); - } - - /// - /// 批量导入实体列表 - /// - /// - /// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改 - /// - /// 实体列表 - /// 是否导入成功 + ///// + ///// 批量导入实体列表 + ///// + ///// + ///// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改 + ///// + ///// 实体列表 + ///// 是否导入成功 + ////[HttpPost] + ////[Route("import")] + //[Authorize(SettleAccountPermissions.Materials.Create)] + ////virtual public async Task ImportAsync(List dtos) + ////{ + //// var entities =ObjectMapper.Map, List>(dtos); + + //// var result = await _repository.ImportAsync(entities); + + + //// return result; + ////} + + ///// + ///// 新增实体 + ///// + ///// 新增实体DTO + ///// 实体DTO + //[HttpPost] - //[Route("import")] - [Authorize(SettleAccountPermissions.Materials.Create)] - //virtual public async Task ImportAsync(List dtos) + //[Route("")] + //[Authorize(SettleAccountPermissions.Materials.Create)] + //virtual public async Task CreateAsync(MaterialCreateDto input) //{ - // var entities =ObjectMapper.Map, List>(dtos); - // var result = await _repository.ImportAsync(entities); + // try + // { + // if (_repository.Any(p => p.MaterialCode == input.MaterialCode)) + // { + // throw new BusinessException("8989", string.Format("已存在编号{0}的物料数据", input.MaterialCode)); + // } + // var entity = new Material( + // GuidGenerator.Create(), + // input.BranchId, + // input.Factory, + // input.MaterialCode, + // input.MaterialDesc, + // input.Unit, + // input.EstimateType, + // input.EstimateTypeDesc + // ); + // await _repository.InsertAsync(entity); + // var dto = ObjectMapper.Map(entity); + // return dto; + // } + // catch + // { + // throw new BusinessException("", "数据项有重复,或其他问题请检查!"); + // } + + // return null; - - // return result; //} - /// - /// 新增实体 - /// - /// 新增实体DTO - /// 实体DTO + ///// + ///// 修改实体 + ///// + ///// ID + ///// 修改实体DTO + ///// 实体DTO + //[HttpPut] + //[Route("{id}")] + //[Authorize(SettleAccountPermissions.Materials.Update)] + //virtual public async Task UpdateAsync(Guid id, MaterialUpdateDto input) + //{ + // var entity = await _repository.GetAsync(id); - [HttpPost] - [Route("")] - [Authorize(SettleAccountPermissions.Materials.Create)] - virtual public async Task CreateAsync(MaterialCreateDto input) - { + // await Cache.SetAsync(id.ToString(), entity, CacheStrategyConst.FIVE_MINUTES); - try - { - if (_repository.Any(p => p.MaterialCode == input.MaterialCode)) - { - throw new BusinessException("8989",string.Format("已存在编号{0}的物料数据",input.MaterialCode)); - } - var entity = new Material( - GuidGenerator.Create(), - input.BranchId, - input.Factory, - input.MaterialCode, - input.MaterialDesc, - input.Unit, - input.EstimateType, - input.EstimateTypeDesc - ); - await _repository.InsertAsync(entity); - var dto = ObjectMapper.Map(entity); - return dto; - } - catch - { - throw new BusinessException("", "数据项有重复,或其他问题请检查!"); - } - - return null; + // var dto = ObjectMapper.Map(entity); + // return dto; - } - /// - /// 修改实体 - /// - /// ID - /// 修改实体DTO - /// 实体DTO - [HttpPut] - [Route("{id}")] - [Authorize(SettleAccountPermissions.Materials.Update)] - virtual public async Task UpdateAsync(Guid id, MaterialUpdateDto input) - { - var entity = await _repository.GetAsync(id); - - await Cache.SetAsync(id.ToString(), entity, CacheStrategyConst.FIVE_MINUTES); + //} - var dto = ObjectMapper.Map(entity); - return dto; - + ///// + ///// 删除实体 + ///// + ///// ID + ///// + //[HttpDelete] + //[Route("{id}")] + //[Authorize(SettleAccountPermissions.Materials.Delete)] + //virtual public async Task DeleteAsync(Guid id) + //{ + // var entity = await GetFromCacheAsync(id); + // await Cache.DeleteAsync(id.ToString()); + // await _repository.DeleteAsync(id); + //} - } + ///// + ///// 按IDs删除实体列表 + ///// + ///// IDs + ///// 是否执行成功 + //[HttpPost] + //[Route("delete")] + //[Authorize(SettleAccountPermissions.Materials.Delete)] + //virtual public async Task DeleteListAsync(List ids) + //{ + // var _query = _repository.Where(p => ids.Contains(p.Id)); + // int i = await _query.BatchDeleteAsync(); + + // if (i == 0) + // { + // return false; + // } + // return true; + //} + //[HttpPost] + //[Route("Export")] + //[Authorize(SettleAccountPermissions.Materials.Default)] + //virtual public async Task ExportAsync(MaterialRequestDto input) + //{ + // string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); + // var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, + // 0, true); - /// - /// 删除实体 - /// - /// ID - /// - [HttpDelete] - [Route("{id}")] - [Authorize(SettleAccountPermissions.Materials.Delete)] - virtual public async Task DeleteAsync(Guid id) - { - var entity = await GetFromCacheAsync(id); - await Cache.DeleteAsync(id.ToString()); - await _repository.DeleteAsync(id); - } + // var dtoDetails = ObjectMapper.Map, List>(entities); - /// - /// 按IDs删除实体列表 - /// - /// IDs - /// 是否执行成功 - [HttpPost] - [Route("delete")] - [Authorize(SettleAccountPermissions.Materials.Delete)] - virtual public async Task DeleteListAsync(List ids) - { - var _query = _repository.Where(p => ids.Contains(p.Id)); - int i = await _query.BatchDeleteAsync(); - - if (i == 0) - { - return false; - } - return true; - } - [HttpPost] - [Route("Export")] - [Authorize(SettleAccountPermissions.Materials.Default)] - virtual public async Task ExportAsync(MaterialRequestDto input) - { - string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); - var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, - 0, true); + // //声明导出容器 + // ExportImporter _exportImporter = new ExportImporter(); - var dtoDetails = ObjectMapper.Map, List>(entities); + // var result = await _exportImporter.ExcelExporter(dtoDetails); - //声明导出容器 - ExportImporter _exportImporter = new ExportImporter(); + // result.ShouldNotBeNull(); + + // //保存导出文件到服务器存成二进制 + // await _excelImportService.SaveBlobAsync( + // new SaveExcelImportInputDto + // { + // Name = _fileName, + // Content = result + // } + // ); + // return _fileName; + //} + #endregion - var result = await _exportImporter.ExcelExporter(dtoDetails); - result.ShouldNotBeNull(); - //保存导出文件到服务器存成二进制 - await _excelImportService.SaveBlobAsync( - new SaveExcelImportInputDto - { - Name = _fileName, - Content = result - } - ); - return _fileName; - } - - - } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 005bbb76..17de68ad 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -1,24 +1,15 @@ -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Csv; -using Magicodes.ExporterAndImporter.Excel; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Shouldly; using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.ExcelImporter; -using Win.Sfs.SettleAccount.Repository; -using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.Prices @@ -29,7 +20,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices //[Authorize(SettleAccountPermissions.PriceLists.Default)] [AllowAnonymous] [Route("api/SettleAccount/PriceListBJ")] - public class PriceListAppServiceBJ : CurdBaseAppService + public class PriceListAppServiceBJ : CurdBaseAppService { private readonly INormalEfCoreRepository _repository; private readonly PriceListManagerBJ _priceListManagerBJ; diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_CAN_SAController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_CAN_SAController.cs index c56b538a..2e29841b 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_CAN_SAController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_CAN_SAController.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using WTA.Application.Identity.Entities.SystemManagement; -using WTA.Shared.Application; using WTA.Shared.Attributes; using WTA.Shared.Controllers; using WTA.Shared.Data; @@ -28,11 +27,11 @@ public class BBAC_CAN_SAController : GenericController model, bool includeAll = false, bool includeDeleted = false) - { - return base.Export(model, includeAll, includeDeleted); - } + //[NonAction] + //public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + //{ + // return base.Export(model, includeAll, includeDeleted); + //} [NonAction] public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) @@ -40,7 +39,7 @@ public class BBAC_CAN_SAController : GenericController model, bool includeAll = false, bool includeDeleted = false) - { - return base.Export(model, includeAll, includeDeleted); - } + //[NonAction] + //public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + //{ + // return base.Export(model, includeAll, includeDeleted); + //} [NonAction] public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_SAController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_SAController.cs index 80696e58..1b938fab 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_SAController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/BBAC_SAController.cs @@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using WTA.Application.Identity.Entities.SystemManagement; using WTA.Shared.Application; -using WTA.Shared.Attributes; using WTA.Shared.Controllers; using WTA.Shared.Data; @@ -16,11 +15,11 @@ public class BBAC_SAController : GenericController model, bool includeAll = false, bool includeDeleted = false) diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_CAN_SAController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_CAN_SAController.cs index e61eabbb..11f1bdf3 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_CAN_SAController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_CAN_SAController.cs @@ -30,6 +30,12 @@ public class BJ_PUB_CAN_SAController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } + [HttpPost, Multiple, Display(Name = "生成发票数据")] public virtual IActionResult? GenerateInvoice() { diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_NOT_SA_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_NOT_SA_DETAILController.cs index 898e126f..d4ffd405 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_NOT_SA_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_NOT_SA_DETAILController.cs @@ -30,6 +30,12 @@ public class BJ_PUB_NOT_SA_DETAILController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } + [HttpPost, Multiple, Display(Name = "生成可结算单")] public virtual IActionResult? GenerateSettlementOrder() { diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_PD_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_PD_DETAILController.cs index a8fee760..272bc540 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_PD_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/BJ_PUB_PD_DETAILController.cs @@ -41,6 +41,12 @@ public class BJ_PUB_PD_DETAILController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) - { - return base.Export(model, includeAll, includeDeleted); - } + //[NonAction] + //public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + //{ + // return base.Export(model, includeAll, includeDeleted); + //} [NonAction] public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_NOT_SA_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_NOT_SA_DETAILController.cs index 45df727a..315ad567 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_NOT_SA_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_NOT_SA_DETAILController.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using WTA.Application.Identity.Entities.SystemManagement; -using WTA.Shared.Application; using WTA.Shared.Attributes; using WTA.Shared.Controllers; using WTA.Shared.Data; @@ -28,11 +27,11 @@ public class HBPO_NOT_SA_DETAILController : GenericController model, bool includeAll = false, bool includeDeleted = false) - { - return base.Export(model, includeAll, includeDeleted); - } + //[NonAction] + //public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + //{ + // return base.Export(model, includeAll, includeDeleted); + //} [NonAction] public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_SAController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_SAController.cs index 3838df6d..b7d29d56 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_SAController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/HBPO_SAController.cs @@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using WTA.Application.Identity.Entities.SystemManagement; using WTA.Shared.Application; -using WTA.Shared.Attributes; using WTA.Shared.Controllers; using WTA.Shared.Data; @@ -34,21 +33,21 @@ public class HBPO_SAController : GenericController +{ + public INVOICE_MAP_GROUPController(ILogger logger, IRepository repository) : base(logger, repository) + { + } + + [NonAction] + public override IActionResult Create([FromBody] INVOICE_MAP_GROUP model) + { + return base.Create(model); + } + + [NonAction] + public override IActionResult Delete([FromBody] Guid[] guids) + { + return base.Delete(guids); + } + + [NonAction] + public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) + { + return base.Import(file, partial, replace); + } + + [NonAction] + public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + { + return base.Export(model, includeAll, includeDeleted); + } +} diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_NOT_SETTLEController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_NOT_SETTLEController.cs new file mode 100644 index 00000000..2f248380 --- /dev/null +++ b/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_NOT_SETTLEController.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using WTA.Application.Identity.Entities.SystemManagement; +using WTA.Shared.Application; +using WTA.Shared.Controllers; +using WTA.Shared.Data; + +namespace WTA.Application.Identity.Controllers; + +public class INVOICE_NOT_SETTLEController : GenericController +{ + public INVOICE_NOT_SETTLEController(ILogger logger, IRepository repository) : base(logger, repository) + { + } + + [NonAction] + public override IActionResult Delete([FromBody] Guid[] guids) + { + return base.Delete(guids); + } + + [NonAction] + public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + { + return base.Export(model, includeAll, includeDeleted); + } + + [NonAction] + public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) + { + return base.Import(file, partial, replace); + } + + [NonAction] + public override IActionResult Create([FromBody] INVOICE_NOT_SETTLE model) + { + return base.Create(model); + } +} diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_WAIT_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_WAIT_DETAILController.cs new file mode 100644 index 00000000..a7e41d7f --- /dev/null +++ b/docs/demo/src/WTA.Application/Identity/Controllers/INVOICE_WAIT_DETAILController.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using WTA.Application.Identity.Entities.SystemManagement; +using WTA.Shared.Application; +using WTA.Shared.Controllers; +using WTA.Shared.Data; + +namespace WTA.Application.Identity.Controllers; + +public class INVOICE_WAIT_DETAILController : GenericController +{ + public INVOICE_WAIT_DETAILController(ILogger logger, IRepository repository) : base(logger, repository) + { + } + + [NonAction] + public override IActionResult Create([FromBody] INVOICE_WAIT_DETAIL model) + { + return base.Create(model); + } + + [NonAction] + public override IActionResult Delete([FromBody] Guid[] guids) + { + return base.Delete(guids); + } + + [NonAction] + public override IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + { + return base.Export(model, includeAll, includeDeleted); + } + + [NonAction] + public override IActionResult Import([Required] IFormFile file, bool partial = false, bool replace = false) + { + return base.Import(file, partial, replace); + } +} diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_CAN_SAController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_CAN_SAController.cs index 3a095096..9e3ece6c 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_CAN_SAController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_CAN_SAController.cs @@ -30,6 +30,12 @@ public class IN_PUB_CAN_SAController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } + [HttpPost, Multiple, Display(Name = "生成发票数据")] public virtual IActionResult? GenerateInvoice() { diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_NOT_SA_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_NOT_SA_DETAILController.cs index d629ae4c..d3368807 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_NOT_SA_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_NOT_SA_DETAILController.cs @@ -30,6 +30,12 @@ public class IN_PUB_NOT_SA_DETAILController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } + [HttpPost, Multiple, Display(Name = "生成可结算单")] public virtual IActionResult? GenerateSettlementOrder() { diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_PD_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_PD_DETAILController.cs index 79fd7143..c025d9ef 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_PD_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/IN_PUB_PD_DETAILController.cs @@ -41,10 +41,16 @@ public class IN_PUB_PD_DETAILController : BaseController, IResourceService model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } } [Display(Name = "可结算单")] diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_NOT_SA_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_NOT_SA_DETAILController.cs index 740d4a1b..cd888f02 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_NOT_SA_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_NOT_SA_DETAILController.cs @@ -30,6 +30,12 @@ public class JIT_PUB_NOT_SA_DETAILController : BaseController, IResourceService< return this._genericController.Index(model); } + [HttpPost, Multiple, Order(-1), HtmlClass("el-button--warning")] + public virtual IActionResult Export([FromBody] PaginationModel model, bool includeAll = false, bool includeDeleted = false) + { + return this._genericController.Export(model, includeAll, includeDeleted); + } + [HttpPost, Multiple, Display(Name = "生成可结算单")] public virtual IActionResult? GenerateSettlementOrder() { diff --git a/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_PD_DETAILController.cs b/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_PD_DETAILController.cs index 067a8e07..0afdf01e 100644 --- a/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_PD_DETAILController.cs +++ b/docs/demo/src/WTA.Application/Identity/Controllers/JIT_PUB_PD_DETAILController.cs @@ -41,6 +41,12 @@ public class JIT_PUB_PD_DETAILController : BaseController, IResourceService context.Set().Add(new BBAC_CAN_SA { SettleBillNum = "测试数据", Version = "测试数据", BillNum = "456", State = "测试数据", InvGroupNum = "测试数据" }); context.Set().Add(new BBAC_CAN_SA_DETAIL { SettleBillNum = "测试数据", InvGroupNum = "测试数据", KeyCode = "测试数据", Version = "测试数据", BillNum = "123", LU = "测试数据", PN = "测试数据", Site = "测试数据", SettleDate = new DateTime(), GroupNum = "测试数据", Category = "测试数据", IsReturn = "测试数据" }); context.Set().Add(new BBAC_CAN_SA_DETAIL { SettleBillNum = "测试数据", InvGroupNum = "测试数据", KeyCode = "测试数据", Version = "测试数据", BillNum = "456", LU = "测试数据", PN = "测试数据", Site = "测试数据", SettleDate = new DateTime(), GroupNum = "测试数据", Category = "测试数据", IsReturn = "测试数据" }); - context.Set().Add(new INVOICE_GRP { RealnvBillNum = "测试数据", InvbillNum = "123", InvGroupNum = "分组号测试数据一", FileName = "测试数据", BusinessType = "测试数据" }); - context.Set().Add(new INVOICE_GRP { RealnvBillNum = "测试数据", InvbillNum = "456", InvGroupNum = "分组号测试数据二", FileName = "测试数据", BusinessType = "测试数据" }); + context.Set().Add(new INVOICE_GRP { Version = "测试数据", RealnvBillNum = "测试数据", InvbillNum = "123", InvGroupNum = "分组号测试数据一", FileName = "测试数据", BusinessType = "测试数据" }); + context.Set().Add(new INVOICE_GRP { Version = "测试数据", RealnvBillNum = "测试数据", InvbillNum = "456", InvGroupNum = "分组号测试数据二", FileName = "测试数据", BusinessType = "测试数据" }); context.Set().Add(new INVOICE_WAIT_DETAIL { InvbillNum = "待开票明细123", InvGroupNum = "待开票明细分组号测试数据一", Version = "测试数据", LU = "测试数据", BussiessType = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据", Extend3 = "测试数据", Extend4 = "测试数据" }); context.Set().Add(new INVOICE_WAIT_DETAIL { InvbillNum = "待开票明细456", InvGroupNum = "待开票明细分组号测试数据二", Version = "测试数据", LU = "测试数据", BussiessType = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据", Extend3 = "测试数据", Extend4 = "测试数据" }); context.Set().Add(new INVOICE_MAP_GROUP { InvbillNum = "发票和结算分组对应关系123", InvGroupNum = "发票和结算分组对应关系分组号测试数据一", Version = "测试数据", SettleGroupNum = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据" }); context.Set().Add(new INVOICE_MAP_GROUP { InvbillNum = "发票和结算分组对应关系456", InvGroupNum = "发票和结算分组对应关系分组号测试数据二", Version = "测试数据", SettleGroupNum = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据" }); context.Set().Add(new INVOICE_NOT_SETTLE { InvGroupNum = "分组号测试数据一", Version = "测试数据", SettleGroupNum = "测试数据", LU = "测试数据", LU1 = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据" }); context.Set().Add(new INVOICE_NOT_SETTLE { InvGroupNum = "分组号测试数据二", Version = "测试数据", SettleGroupNum = "测试数据", LU = "测试数据", LU1 = "测试数据", Extend1 = "测试数据", Extend2 = "测试数据" }); - context.Set().Add(new PUB_SA { Version = "测试数据", BillNum = "一号", State = "测试数据" }); - context.Set().Add(new PUB_SA { Version = "测试数据", BillNum = "二号", State = "测试数据" }); - context.Set().Add(new PUB_SA_DETAIL { KeyCode = "测试数据", Version = "测试数据", BillNum = "一号", LU = "测试数据", PN = "测试数据", Site = "测试数据", InvGroupNum = "测试数据", SettleDate = new DateTime(), Extend1 = "测试数据", Extend2 = "测试数据", Extend3 = "测试数据", GroupNum = "测试数据" }); - context.Set().Add(new PUB_SA_DETAIL { KeyCode = "测试数据", Version = "测试数据", BillNum = "二号", LU = "测试数据", PN = "测试数据", Site = "测试数据", InvGroupNum = "测试数据", SettleDate = new DateTime(), Extend1 = "测试数据", Extend2 = "测试数据", Extend3 = "测试数据", GroupNum = "测试数据" }); - context.Set().Add(new PUB_CAN_SA { Version = "测试数据", BillNum = "一号", InvGroupNum = "测试数据", SettleBillNum = "测试数据", BusinessType = "测试数据", State = "测试数据" }); - context.Set().Add(new PUB_CAN_SA { Version = "测试数据", BillNum = "二号", InvGroupNum = "测试数据", SettleBillNum = "测试数据", BusinessType = "测试数据", State = "测试数据" }); - context.Set().Add(new PUB_CAN_SA_DETAIL { Version = "测试数据", BillNum = "一号", InvGroupNum = "测试数据", SettleBillNum = "测试数据", BusinessType = "测试数据", LU = "测试数据", PN = "测试数据", Site = "测试数据", SettleDate=new DateTime(), GroupNum= "测试数据",KeyCode= "测试数据" }); - context.Set().Add(new PUB_CAN_SA_DETAIL { Version = "测试数据", BillNum = "二号", InvGroupNum = "测试数据", SettleBillNum = "测试数据", BusinessType = "测试数据", LU = "测试数据", PN = "测试数据", Site = "测试数据", SettleDate=new DateTime(), GroupNum= "测试数据",KeyCode="测试数据" }); - } private static void InitDictionaries(DbContext context) diff --git a/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/BBAC_CAN_SA.cs b/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/BBAC_CAN_SA.cs index 30f134dc..1d26e962 100644 --- a/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/BBAC_CAN_SA.cs +++ b/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/BBAC_CAN_SA.cs @@ -5,7 +5,7 @@ using WTA.Shared.Domain; namespace WTA.Application.Identity.Entities.SystemManagement; [JISBBACSettlementInvoicingGroup] -[Display(Name = "可结算单")] +[Display(Name = "发票分组号")] [Order(1)] //BBAC可结算导入 public class BBAC_CAN_SA : BaseEntity diff --git a/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/INVOICE_GRP.cs b/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/INVOICE_GRP.cs index f07d0c02..1b1c860a 100644 --- a/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/INVOICE_GRP.cs +++ b/docs/demo/src/WTA.Application/Identity/Entities/SystemManagement/INVOICE_GRP.cs @@ -9,6 +9,8 @@ namespace WTA.Application.Identity.Entities.SystemManagement; //发票分组 public class INVOICE_GRP : BaseEntity { + [Display(Name = "期间")] + public string Version { get; set; } = null!; [Display(Name = "实际纸质发票号")] public string RealnvBillNum { get; set; } = null!; [OneToMany]