From 0f576bc1cee5ef2ab98f60625d855752734c357a Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Sat, 1 Jan 2022 10:17:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E6=97=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/HQ_F/HQ_F_PlatformCreateDto.cs | 14 + .../Entities/HQ_F/HQ_F_PlatformDto.cs | 72 ++++ .../Entities/HQ_F/HQ_F_PlatformDtoBase.cs | 72 ++++ .../Entities/HQ_F/HQ_F_PlatformExportDto.cs | 85 +++++ .../Entities/HQ_F/HQ_F_PlatformImportDto.cs | 85 +++++ .../Entities/HQ_F/HQ_F_PlatformRequestDto.cs | 81 +++++ .../HQ_F/HQ_F_PlatformVersionDtoBase.cs | 100 ++++++ .../Entities/HQ_F/IHQ_F_PlatformAppService.cs | 91 +++++ .../Entities/Invoices/InvoiceDtoBase.cs | 4 +- .../Entities/HQ_F/HQ_F_PlatformAppService.cs | 316 ++++++++++++++++++ .../Entities/Invoices/InvoiceAppService.cs | 2 +- .../SettleAccount.Application.xml | 100 ++++++ .../Entities/HQ_F/HQ_F_Platform.cs | 156 +++++++++ .../Entities/HQ_F/HQ_F_PlatformVersion.cs | 47 +++ 14 files changed, 1222 insertions(+), 3 deletions(-) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformCreateDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDtoBase.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformExportDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformImportDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformRequestDto.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformVersionDtoBase.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/IHQ_F_PlatformAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_PlatformVersion.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformCreateDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformCreateDto.cs new file mode 100644 index 00000000..6a314857 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformCreateDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformCreateDto : HQ_F_PlatformDtoBase, IBranch + { + public virtual Guid BranchId { get; set; } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDto.cs new file mode 100644 index 00000000..f49ce8ce --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDto.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DtoBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformDto : AuditedEntityDtoBase + { + /// + ///工厂 + /// + public string Factory { get; set; } + /// + ///外部看板编号 + /// + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + public string MaterialVoucherNo { get; set; } + + /// + ///会计年度 + /// + public string Year { get; set; } + /// + /// 期间 + /// + public string Period { set; get; } + /// + /// 版本号 + /// + public string Version { set; get; } + /// + /// 看板号 + /// + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + public string Supplier { get; set; } + + /// + /// 存储地点 + /// + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + public string StorageLocationDesc { get; set; } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDtoBase.cs new file mode 100644 index 00000000..3d3cf82a --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformDtoBase.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DtoBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformDtoBase : CreateOrUpdateEntityDtoBase + { + /// + ///工厂 + /// + public string Factory { get; set; } + /// + ///外部看板编号 + /// + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + public string MaterialVoucherNo { get; set; } + + /// + ///会计年度 + /// + public string Year { get; set; } + /// + /// 期间 + /// + public string Period { set; get; } + /// + /// 版本号 + /// + public string Version { set; get; } + /// + /// 类型:CP7报废和索赔两种 + /// + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + public string Supplier { get; set; } + + /// + /// 存储地点描述 + /// + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + public string StorageLocationDesc { get; set; } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformExportDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformExportDto.cs new file mode 100644 index 00000000..086fab5e --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformExportDto.cs @@ -0,0 +1,85 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformExportDto + { + /// + ///工厂 + /// + [ExporterHeader(DisplayName = "工厂")] + public string Factory { get; set; } + /// + ///外部看板编号 + /// + [ExporterHeader(DisplayName = "外部看板编号")] + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + [ExporterHeader(DisplayName = "看板编号")] + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + [ExporterHeader(DisplayName = "物料凭证号")] + public string MaterialVoucherNo { get; set; } + + /// + ///会计年度 + /// + [ExporterHeader(DisplayName = "会计年度")] + public string Year { get; set; } + /// + /// 期间 + /// + [ExporterHeader(DisplayName = "期间")] + public string Period { set; get; } + /// + /// 版本号 + /// + [ExporterHeader(DisplayName = "版本号")] + public string Version { set; get; } + /// + /// 看板号 + /// + [ExporterHeader(DisplayName = "看板号")] + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + [ExporterHeader(DisplayName = "物料号")] + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + [ExporterHeader(DisplayName = "验收单日期")] + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + [ExporterHeader(DisplayName = "供应商")] + public string Supplier { get; set; } + + /// + /// 存储地点 + /// + [ExporterHeader(DisplayName = "存储地点")] + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + [ExporterHeader(DisplayName = "存储地点描述")] + public string StorageLocationDesc { get; set; } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformImportDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformImportDto.cs new file mode 100644 index 00000000..6bbeaf48 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformImportDto.cs @@ -0,0 +1,85 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformImportDto + { + /// + ///工厂 + /// + [ImporterHeader(Name = "工厂")] + public string Factory { get; set; } + /// + ///外部看板编号 + /// + [ImporterHeader(Name = "外部看板编号")] + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + [ImporterHeader(Name = "看板编号")] + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + [ImporterHeader(Name = "物料凭证号")] + public string MaterialVoucherNo { get; set; } + + /// + ///会计年度 + /// + [ImporterHeader(Name = "会计年度")] + public string Year { get; set; } + /// + /// 期间 + /// + //[ImporterHeader(Name = "期间")] + //public string Period { set; get; } + /// + /// 版本号 + /// + //[ImporterHeader(Name = "版本号")] + //public string Version { set; get; } + /// + /// 看板号 + /// + [ImporterHeader(Name = "看板号")] + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + [ImporterHeader(Name = "物料号")] + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + [ImporterHeader(Name = "验收单日期")] + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + [ImporterHeader(Name = "供应商")] + public string Supplier { get; set; } + + /// + /// 存储地点 + /// + [ImporterHeader(Name = "存储地点")] + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + [ImporterHeader(Name = "存储地点描述")] + public string StorageLocationDesc { get; set; } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformRequestDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformRequestDto.cs new file mode 100644 index 00000000..52b1bc57 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformRequestDto.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DtoBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformRequestDto : RequestDtoBase + { + + /// + ///工厂 + /// + public string Factory { get; set; } + /// + ///外部看板编号 + /// + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + public string MaterialVoucherNo { get; set; } + + /// + ///会计年度 + /// + public string Year { get; set; } + /// + /// 期间 + /// + public string Period { set; get; } + /// + /// 版本号 + /// + public string Version { set; get; } + /// + /// 看板号 + /// + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + public string Supplier { get; set; } + + /// + /// 存储地点 + /// + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + public string StorageLocationDesc { get; set; } + + public virtual Guid ParentId { get; set; } + public virtual Guid BranchId { get; set; } + + public virtual Guid UserId { get; set; } + + public virtual int FileType { get; set; } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformVersionDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformVersionDtoBase.cs new file mode 100644 index 00000000..8c38b32e --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/HQ_F_PlatformVersionDtoBase.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared; +using Win.Sfs.Shared.DtoBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + /// + /// SettleAccountVersion + /// + public class HQ_F_PlatformVersionDtoBase : CreateOrUpdateEntityDtoBase + { + + public string Year { get; private set; } + /// + /// 期间 + /// + public string Period { get; private set; } + /// + /// 版本号 + /// + public string Version { get; private set; } + + /// + /// 客户号 + /// + public string CustomerCode { private set; get; } + + + } + + + + public class HQ_F_PlatformVersionDto : AuditedEntityDtoBase, IBranch + { + public string Year { get; set; } + /// + /// 期间 + /// + public string Period { get; set; } + /// + /// 版本号 + /// + public string Version { get; set; } + + /// + /// 客户号 + /// + public string CustomerCode { set; get; } + public Guid BranchId { get; set; } + } + + public class HQ_F_PlatformVersionCreateDto : HQ_F_PlatformVersionDtoBase + { } + public class HQ_F_PlatformVersionUpdateDto : HQ_F_PlatformVersionDtoBase + { } + public class HQ_F_PlatformVersionRequestDto : RequestDtoBase, IBranch + { + + public string Year { get; private set; } + /// + /// 期间 + /// + public string Period { get; private set; } + /// + /// 版本号 + /// + public string Version { get; private set; } + + /// + /// 客户号 + /// + public string CustomerCode { private set; get; } + public Guid BranchId { get; set; } + } + + public class HQ_F_PlatformVersionImportDto + { + + public string Year { get; private set; } + /// + /// 期间 + /// + public string Period { get; private set; } + /// + /// 版本号 + /// + public string Version { get; private set; } + + /// + /// 客户号 + /// + public string CustomerCode { private set; get; } + + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/IHQ_F_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/IHQ_F_PlatformAppService.cs new file mode 100644 index 00000000..ccc8f0be --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/HQ_F/IHQ_F_PlatformAppService.cs @@ -0,0 +1,91 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public interface IHQ_F_PlatformAppService + { + /// + /// 导入功能 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + + Task HQ_F_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, + string year, string period, string version, string customerCode); + + /// + /// 按ID获取唯一实体 + /// + /// + /// 返回实体全部属性 + /// + /// ID + /// 实体DTO + + Task GetAsync(Guid id); + + /// + /// 根据筛选条件获取实体列表 + /// + /// + /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + /// + /// 请求条件 + /// 实体DTO列表 + + Task> GetListAsync(HQ_F_PlatformRequestDto input); + + + + + /// + /// 根据筛选条件获取实体列表 + /// + /// + /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + /// + /// 请求条件 + /// 实体DTO列表 + + Task> GetVersionListAsync(HQ_F_PlatformVersionRequestDto input); + + + Task ExportAsync(HQ_F_PlatformRequestDto input); + + /// + /// 获取实体总数 + /// + /// 实体总数 + + Task GetTotalCountAsync(Guid branchId); + + + + + + ///// + ///// 删除实体 + ///// + ///// ID + ///// + + Task DeleteAsync(Guid id); + + + /// + /// 按IDs删除实体列表 + /// + /// IDs + /// 是否执行成功 + + Task DeleteListAsync(List ids); + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs index 365e33a6..8645ef8e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Invoices/InvoiceDtoBase.cs @@ -198,12 +198,12 @@ namespace Win.Sfs.SettleAccount.Entities.Invoices /// ///数量 /// - [ExporterHeader(DisplayName = "数量")] + [ExporterHeader(DisplayName = "数量", Format = "0,000")] public decimal Qty { get; set; } /// ///金额 /// - [ExporterHeader(DisplayName = "金额")] + [ExporterHeader(DisplayName = "金额", Format = "0,000")] public decimal Amt { get; set; } /// ///记账号码 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs new file mode 100644 index 00000000..57a9c452 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs @@ -0,0 +1,316 @@ +using EFCore.BulkExtensions; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Csv; +using Magicodes.ExporterAndImporter.Excel; +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.Caching; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.Shared.Filter; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + /// + /// 红旗F平台导入 + /// + //[Authorize(SettleAccountPermissions.HQ_FPlatform.Default)] + //[AllowAnonymous] + [Route("api/settleaccount/HQFPlatform")] + public class HQ_F_PlatformAppService : SettleAccountApplicationBase, IHQ_F_PlatformAppService + { + private readonly IGuidGenerator _guidGenerator; + + private readonly IExcelImportAppService _excelImportService; + + private readonly ISettleAccountBranchEfCoreRepository _versionRepository; + + private readonly ISettleAccountBranchEfCoreRepository _repository; + /// + /// 构建方法 + /// + /// 构建UID + /// 仓储接口 + /// 缓存 + public HQ_F_PlatformAppService(IGuidGenerator guidGenerator, + ISettleAccountBranchEfCoreRepository versionRepository, + ISettleAccountBranchEfCoreRepository repository, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _versionRepository = versionRepository; + _guidGenerator = guidGenerator; + _excelImportService = excelImportService; + _repository = repository; + } + + + /// + /// 导入功能 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + [HttpPost] + [Route("ExcelImport")] + [DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + public async Task HQ_F_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) + { + 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); + await _versionQuery.BatchDeleteAsync(); + //删除明细 + var _query = _repository.Where(p => p.Version == version); + await _query.BatchDeleteAsync(); + //插入数据前检验 + var checkList = new List(); + var _group = entityList.GroupBy(x => new { x.HQHKanBan, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), HQHKanBan = p.Key.HQHKanBan, MaterialCode = p.Key.MaterialCode }); + foreach (var itm in _group) + { + if (string.IsNullOrEmpty(itm.HQHKanBan)) + { + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的物料号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.HQHKanBan), string.Empty)); + } + } + var _id = GuidGenerator.Create(); + var _bomList = new List(); + _bomList.Add(new HQ_F_PlatformVersion(_id, branchId, year, period, version, customerCode)); + foreach (var itm in entityList) + { + //赋值上主键ID + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + } + if (checkList.Count > 0) + { + return await ExportErrorReportAsync(checkList); + } + await _repository.GetDbContext().BulkInsertAsync(entityList); + await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + return ApplicationConsts.SuccessStr; + } + + /// + /// 按ID获取唯一实体 + /// + /// + /// 返回实体全部属性 + /// + /// ID + /// 实体DTO + [HttpGet] + [Route("{id}")] + //[Authorize(SettleAccountPermissions.SettleAccounts.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(HQ_F_PlatformRequestDto input) + { + return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + private async Task GetCountAsync(HQ_F_PlatformVersionRequestDto input) + { + return await _versionRepository.GetCountByFilterAsync(input.BranchId, input.Filters); + } + + + /// + /// 导出文件 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(HQ_F_PlatformRequestDto input) + { + + IExporter _csv = new CsvExporter(); + IExporter _excel = new ExcelExporter(); + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + 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("红旗工厂F平台验收结算明细_{0}.csv", input.UserId.ToString()); + result = await _csv.ExportAsByteArray(dtoDetails); + break; + case 1: + _fileName = string.Format("红旗工厂F平台验收结算明细_{0}.xlsx", input.UserId.ToString()); + result = await _excel.ExportAsByteArray(dtoDetails); + break; + } + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + } + + + /// + /// 根据筛选条件获取实体列表 + /// + /// + /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + /// + /// 请求条件 + /// 实体DTO列表 + [HttpPost] + [Route("list")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetListAsync(HQ_F_PlatformRequestDto input) + { + if (!string.IsNullOrEmpty(input.Version)) + { + input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); + } + 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); + } + + + /// + /// 获取实体总数 + /// + /// 实体总数 + [HttpGet] + [Route("count")] + [Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task GetTotalCountAsync(Guid branchId) + { + return await _repository.GetCountAsync(branchId); + } + + /// + /// 获取全部实体列表 + /// + /// 实体DTO列表 + [HttpGet] + [Route("all")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task> GetAllAsync(Guid branchId) + { + var entities = await _repository.GetAllAsync(branchId, true); + + + var dtos = ObjectMapper.Map, List>(entities); + + + return new ListResultDto(dtos); + } + + + + /// + /// 删除实体 + /// + /// ID + /// + [HttpDelete] + [Route("{id}")] + /// [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteAsync(Guid id) + { + await _repository.DeleteAsync(id); + } + + /// + /// 按IDs删除实体列表 + /// + /// IDs + /// 是否执行成功 + [HttpPost] + [Route("delete")] + // [Authorize(SettleAccountPermissions.SettleAccounts.Delete)] + virtual public async Task DeleteListAsync(List ids) + { + foreach (var id in ids) + { + var entity = await GetFromCacheAsync(id); + //await Cache.DeleteAsync(id.ToString()); + } + + return await _repository.DeleteListAsync(ids); + } + + + + /// + /// 版本列表查询 + /// + /// + /// + [HttpPost] + [Route("listversion")] + public async Task> GetVersionListAsync(HQ_F_PlatformVersionRequestDto 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); + + return new PagedResultDto(totalCount, dtos); + } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs index 6941507f..a284e803 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Invoices/InvoiceAppService.cs @@ -336,7 +336,7 @@ namespace Win.Sfs.SettleAccount.Entities.Invoices var entities = await _repository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); - var dtoDetails = ObjectMapper.Map, List>(entities); + var dtoDetails = ObjectMapper.Map, List>(entities); string _fileName = string.Empty; //声明导出容器 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 6a0db3b6..f3115353 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -738,6 +738,86 @@ IDs 是否执行成功 + + + 红旗F平台导入 + + + + + 构建方法 + + 构建UID + 仓储接口 + 缓存 + + + + 导入功能 + + 上传的文件(前端已经限制只能上传一个附件) + + + + + 按ID获取唯一实体 + + + 返回实体全部属性 + + ID + 实体DTO + + + + 导出文件 + + + + + + + 根据筛选条件获取实体列表 + + + 请求条件包括:筛选条件列表,排序条件,数据数量,页码 + + 请求条件 + 实体DTO列表 + + + + 获取实体总数 + + 实体总数 + + + + 获取全部实体列表 + + 实体DTO列表 + + + + 删除实体 + + ID + + + + + 按IDs删除实体列表 + + IDs + 是否执行成功 + + + + 版本列表查询 + + + + 红旗H平台导入 @@ -2916,6 +2996,26 @@ 上传的文件(前端已经限制只能上传一个附件) + + + 红旗F平台导入 + + + + + 红旗F平台-版本 + + + + + 红旗M平台导入 + + + + + 红旗M平台-版本 + + 红旗H平台导入 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs new file mode 100644 index 00000000..f871b668 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DomainBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_Platform : FullAuditedAggregateRootBase, ISettleAccountEntityBase + { + public HQ_F_Platform() + { } + + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) + { + Period = peroid; + Year = year; + Id = guid; + Version = version; + BranchId = branchId; + } + public HQ_F_Platform(Guid Id, string materialVoucherNo, string externalKanbanNumber, + string kanbanNumber, string year, string factory, DateTime acceptanceDate, + string period, string version, string kanBan, string supplier, string storageLocation, string storageLocationDesc, + string materialCode) : base(Id) + { + MaterialVoucherNo = materialVoucherNo; + KanbanNumber = kanbanNumber; + ExternalKanbanNumber = externalKanbanNumber; + Year = year; + Factory = factory; + AcceptanceDate = acceptanceDate; + Period = period; + Version = version; + MaterialCode = materialCode; + HQHKanBan = kanBan; + Supplier = supplier; + StorageLocation = storageLocation; + StorageLocationDesc = storageLocationDesc; + } + + //验收单号 外部单号 物料凭证号 物料凭证日期 物料凭证记账日期 看板编号 外部看板编号 物料号 物料描述 数量 单价 金额 + //工厂 备注 创建者 创建时间 修改人 修改时间 公司 验收单号 外部单号 发票号 会计年度 金额 计划员 存储地点 + //存储地点描述 状态 验收单日期 供应商 录入人 录入人描述 看板号 + + + + /// + ///工厂 + /// + [Display(Name = "工厂")] + public string Factory { get; set; } + /// + ///外部看板编号 + /// + [Display(Name = "外部看板编号")] + public string ExternalKanbanNumber { get; set; } + /// + ///看板编号 + /// + [Display(Name = "看板编号")] + public string KanbanNumber { get; set; } + /// + ///物料凭证号 + /// + [Display(Name = "物料凭证号")] + public string MaterialVoucherNo { get; set; } + ///// + /////验收单号 + ///// + //[Display(Name = "验收单号")] + //public string AcceptanceNo { get; set; } + /// + ///会计年度 + /// + [Display(Name = "会计年度")] + public string Year { get; set; } + /// + /// 期间 + /// + [Display(Name = "期间")] + public string Period { set; get; } + /// + /// 版本号 + /// + [Display(Name = "版本号")] + public string Version { set; get; } + /// + /// 看板号 + /// + [Display(Name = "看板号")] + public string HQHKanBan { set; get; } + + + /// + /// 物料号 + /// + [Display(Name = "物料号")] + public string MaterialCode { get; set; } + + /// + /// 验收单日期 + /// + [Display(Name = "验收单日期")] + public DateTime AcceptanceDate { get; set; } + + /// + /// 供应商 + /// + [Display(Name = "供应商")] + public string Supplier { get; set; } + + /// + /// 存储地点 + /// + [Display(Name = "存储地点")] + public string StorageLocation { get; set; } + + /// + /// 存储地点描述 + /// + [Display(Name = "存储地点描述")] + public string StorageLocationDesc { get; set; } + + + ///// + ///// 数量 + ///// + //[Display(Name = "数量")] + //public decimal Qty { set; get; } + + ///// + ///// 单价 + ///// + //[Display(Name = "单价")] + //public decimal Price { set; get; } + + ///// + ///// 金额 + ///// + //[Display(Name = "金额")] + //public decimal Amt { set; get; } + + + /// + /// 备注 + /// + [Display(Name = "备注")] + public string Extend { set; get; } + + + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_PlatformVersion.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_PlatformVersion.cs new file mode 100644 index 00000000..8b9b47b1 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_PlatformVersion.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DomainBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + public class HQ_F_PlatformVersion : FullAuditedAggregateRootBase, ISettleAccountEntityBase + { + + public HQ_F_PlatformVersion() + { } + + public string Year { get; private set; } + /// + /// 期间 + /// + public string Period { get; private set; } + /// + /// 版本号 + /// + public string Version { get; set; } + + /// + /// 客户号 + /// + public string CustomerCode { private set; get; } + + + public HQ_F_PlatformVersion( + Guid id, + Guid branchId, + string year, string period, string version, string customerCode) : base(id) + { + BranchId = branchId; + Year = year; + Period = period; + Version = version; + CustomerCode = customerCode; + + } + + + } +}