From ffa35fb167b55e0b937abfdee875bbc9b48fc813 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 31 Jul 2023 14:01:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AF=B9=E6=AF=94Job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/TaskJobs/JobAppService.cs | 154 ++++++------------ 1 file changed, 49 insertions(+), 105 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs index 484d33b4..b492ede7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs @@ -1,135 +1,79 @@ - - 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.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Caching.Distributed; -using SettleAccount.Job.Services; -using Shouldly; -using Volo.Abp; -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.CommonManagers; -using Win.Sfs.SettleAccount.Constant; -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; - -namespace Win.Sfs.SettleAccount.Entities.TaskJobs -{ - //调整权限-派格张影导入数据时此模块她要看 - [Authorize(SettleAccountPermissions.HQ_FPlatform.Default)] - //[AllowAnonymous] - [Route("api/settleaccount/Job")] - public class JobAppService: ApplicationService - { - - private readonly TaskJobService _service; - public JobAppService(TaskJobService service) - { - - _service = service; - } +namespace Win.Sfs.SettleAccount.Entities.TaskJobs; - /// - /// 根据筛选条件获取实体列表 - /// - /// - /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 - /// - /// 请求条件 - /// 实体DTO列表 - [HttpPost] - [Route("list")] - //[Authorize(SettleAccountPermissions.Materials.Default)] - [UnitOfWork(false)] - virtual public async Task> GetListAsync(JobRequestDto input) - { - - - //SettleAccount.Job.Services.Report.SettleKBWithCodeExportService - //switch (input.ServiceName) - //{ - // case typeof(InvoiceSettledDetailDiffExportService).FullName: - // break; - // case "": - // break; - // case "": - // break; - // case "": - // break; - //} - +[AllowAnonymous] +[Route("api/settleaccount/Job")] +public class JobAppService: ApplicationService +{ + private readonly TaskJobService _service; - return await _service.GetListAsync(input); - } + public JobAppService(TaskJobService service) + { + _service = service; + } + /// + /// 根据筛选条件获取实体列表 + /// + /// + [HttpPost] + [Route("list")] + [UnitOfWork(false)] + public virtual async Task> GetListAsync(JobRequestDto input) + { + return await _service.GetListAsync(input); + } - [HttpGet] - [Route("{id}")] + [HttpGet] + [Route("{id}")] - //[Authorize(SettleAccountPermissions.Materials.Default)] - [UnitOfWork(false)] - virtual public async Task> GetUploadListAsync(string id) - { - return await _service.GetUpFileListAsync(id); - } + //[Authorize(SettleAccountPermissions.Materials.Default)] + [UnitOfWork(false)] + virtual public async Task> GetUploadListAsync(string id) + { + return await _service.GetUpFileListAsync(id); + } - [HttpPost] - [Route("versionlist")] + [HttpPost] + [Route("versionlist")] - [UnitOfWork(false)] - virtual public async Task> GetVersionListAsync() - { - return await _service.GetVersionListAsync(); - } + [UnitOfWork(false)] + virtual public async Task> GetVersionListAsync() + { + return await _service.GetVersionListAsync(); + } - [HttpPost] - [Route("delete")] + [HttpPost] + [Route("delete")] - - virtual public async Task DeleteListAsync(List ids) - { - return await _service.DeleteListAsync(ids); - } + + virtual public async Task DeleteListAsync(List ids) + { + return await _service.DeleteListAsync(ids); + } - [HttpGet] - [Route("updateRemark")] + [HttpGet] + [Route("updateRemark")] - virtual public async Task UpdateRemarkAsync(Guid p_id,string remark) - { - return await _service.UpdateAsync(p_id,remark); - } + virtual public async Task UpdateRemarkAsync(Guid p_id,string remark) + { + return await _service.UpdateAsync(p_id,remark); + } - } } From 8594f6e425b809a86c134f28b5f4e6d59fb2cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 31 Jul 2023 16:02:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Dtos/INVOICE_GRP_DTO.cs | 46 +- .../Bases/BA_SERVICE.cs | 46 +- .../Bases/CAN_SA_SERVICE.cs | 13 +- .../Bases/NOT_SA_SERVICE.cs | 4 - .../Entities/BQ/BBAC_BA_SERVICE.cs | 26 +- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 3 +- .../Entities/BQ/HBPO_BA_SERVICE.cs | 141 +++- .../Entities/BQ/HBPO_CAN_SA_SERVICE.cs | 3 +- .../Entities/BQ/INVOICE_SERVICE.cs | 126 ++- .../Entities/BQ/PUB_BA_SERVICE.cs | 140 +++- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 35 +- .../Entities/BQ/PUB_NOT_SA_SERVICE.cs | 1 - .../ReportServices/ReportMakeService.cs | 790 +++++++++--------- .../Entities/BQ/BBAC_NOT_SA_DETAIL.cs | 4 +- .../Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs | 31 +- .../Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs | 10 +- .../Entities/BQ/Managers/INV_MNG.cs | 30 +- .../Entities/BQ/Managers/PUB_CAN_SA_MNG.cs | 13 +- .../Entities/BQ/Managers/PUB_NOT_SA_MNG.cs | 31 +- 19 files changed, 931 insertions(+), 562 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs index ba3c8229..8f339f7e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.Shared.Constant; using Win.Sfs.Shared.Filter; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos @@ -85,43 +86,46 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [ExporterHeader(DisplayName = "未税金额")] public decimal Amt { get; set; } /// + ///税额 + /// + [ExporterHeader(DisplayName = "税额")] + public decimal Tax { get; set; } + /// ///税后金额 /// [ExporterHeader(DisplayName = "税后金额")] public decimal TaxAmt { get; set; } - /// - ///发票分组号 - /// - [ExporterHeader(DisplayName = "发票分组号")] - public string InvGroupNum { get; set; } - /// - ///开票Excel文件 - /// - [ExporterHeader(DisplayName = "开票Excel文件")] - public string FileName { get; set; } - /// - ///业务类别 - /// - [ExporterHeader(DisplayName = "业务类别")] - public EnumBusinessType BusinessType { get; set; } + + + } public class INVOICE_GRP_IMP_DTO { - /// ///实际纸质发票号 /// - [ImporterHeader(Name = "实际纸质发票号")] + [ImporterHeader(Name = "实际纸质发票号", FixAllSpace = true)] + [Required(ErrorMessage = "{0}是必填项")] + [MaxLength(CommonConsts.MaxNameLength, ErrorMessage = "{0}最多输入{1}个字符")] public string RealnvBillNum { get; set; } + /// - ///系统生成发票号 + ///实际纸质发票号 /// - [ImporterHeader(Name = "系统生成发票号")] + [ImporterHeader(Name = "系统生成发票号", FixAllSpace = true)] + [Required(ErrorMessage = "{0}是必填项")] + [MaxLength(200, ErrorMessage = "{0}最多输入{1}个字符")] public string InvbillNum { get; set; } - - + /// + ///税额 + /// + [ImporterHeader(Name = "税额", FixAllSpace = true)] + [Required(ErrorMessage = "{0}是必填项")] + + public decimal Tax { get; set; } + } public class INVOICE_GRP_REQ_DTO : RequestInputBase diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index 364980a3..a6893f26 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -14,9 +14,11 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.LinqAsync; using System.Reflection; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; @@ -45,9 +47,9 @@ namespace Win.Sfs.SettleAccount.Bases protected readonly INormalEfCoreRepository _sRepository; protected readonly INormalEfCoreRepository _mRepository; protected readonly INormalEfCoreRepository _adjRepository; - protected readonly HBPO_CAN_SA_MNG _pubMng; + protected readonly HBPO_CAN_SA_MNG _hbpoMng; protected readonly BBAC_CAN_SA_MNG _bbacMng; - protected readonly PUB_CAN_SA_MNG _hbpoMng; + protected readonly PUB_CAN_SA_MNG _pubMng; protected readonly INV_MNG _invMng; @@ -60,9 +62,9 @@ namespace Win.Sfs.SettleAccount.Bases INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService, - HBPO_CAN_SA_MNG pubMng, + HBPO_CAN_SA_MNG hbpoMng, BBAC_CAN_SA_MNG bbacMng, - PUB_CAN_SA_MNG hbpoMng, + PUB_CAN_SA_MNG pubMng, INV_MNG invMng //INormalEfCoreRepository detailRepository @@ -103,7 +105,12 @@ namespace Win.Sfs.SettleAccount.Bases { } - + /// + /// 审核通过 + /// + /// + /// + [HttpPost] public virtual async Task GenerateInvoice(INVOICE_GRP_REQ_DTO input) { @@ -117,7 +124,8 @@ namespace Win.Sfs.SettleAccount.Bases /// /// /// - public virtual async Task ReissueInvoice(INVOICE_GRP_REQ_DTO input) + [HttpPost] + public virtual async Task ReissueInvoice(string input) { // await _invMng.SetForwardState(input.InvGroupNum, SettleBillState.商务已审核); @@ -206,15 +214,12 @@ namespace Win.Sfs.SettleAccount.Bases public virtual async Task RejectAsync(INVOICE_GRP_REQ_DTO input) { + await _invMng.Reject(input.InvGroupNum); return ApplicationConsts.SuccessStr; - } - - - - + [HttpPost] public virtual async Task ReceivedAsync(INVOICE_GRP_REQ_DTO input) { @@ -299,16 +304,16 @@ namespace Win.Sfs.SettleAccount.Bases } return null; - } - /// - /// hbpo、jit、备件等 - /// - /// 可结算明细列表 - /// 版本号 - /// 发票分组 - /// 原发票号 - protected async Task ReissueSecInvoice(List p_list, int p_version, string p_parentInvBillNum) + + /// + /// hbpo、jit、备件等 + /// + /// 可结算明细列表 + /// 版本号 + /// 发票分组 + /// 原发票号 + protected async Task ReissueSecInvoice(List p_list, int p_version, string p_parentInvBillNum) { return await _invMng.ReissueSecInvoice(p_list,p_parentInvBillNum, p_version); @@ -345,7 +350,6 @@ namespace Win.Sfs.SettleAccount.Bases select d; var left = from d in dto1s join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } - into temp from tm in temp.DefaultIfEmpty()//校验错误项 where tm == null diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs index b29a92e1..05636cf9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs @@ -39,12 +39,6 @@ using static Win.Sfs.SettleAccount.SettleAccountPermissions; namespace Win.Sfs.SettleAccount.Bases { - - - - - - public abstract class CAN_SA_SERVICE : BASE_SERVICE where TEntity : SA_CAN_BASE_MAIN @@ -144,8 +138,10 @@ namespace Win.Sfs.SettleAccount.Bases //[Route("generateinvoice")] public virtual async Task GenerateInvoice(TRequestMainInput input) { + return ApplicationConsts.SuccessStr; } + /// /// 查询主表 /// @@ -205,14 +201,11 @@ namespace Win.Sfs.SettleAccount.Bases select d; var left = from d in dto1s join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN } - into temp from tm in temp.DefaultIfEmpty()//校验错误项 where tm == null select d; - List errorList = new List (); - string name = string.Empty; string keyname = string.Empty; switch (p_businessType) @@ -245,9 +238,7 @@ namespace Win.Sfs.SettleAccount.Bases name = "备件"; keyname = "交付识别号"; break; - } - foreach (var error in left) { errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU}{keyname}:{error.PN},下线日期:{error.SettleDate}没有对应区间销售价格表!" }); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs index 8348d160..f634c492 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs @@ -60,12 +60,10 @@ namespace Win.Sfs.SettleAccount.Bases //[Route("detailquery")] public virtual async Task> DetailQueryAsync(TRequestDetailInput input) { - var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters); var dtos = ObjectMapper.Map, List>(entitys); return new PagedResultDto(totalCount, dtos); - } /// /// 导出 @@ -78,10 +76,8 @@ namespace Win.Sfs.SettleAccount.Bases { IExporter _csv = new CsvExporter(); IExporter _excel = new ExcelExporter(); - var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var dtoDetails = ObjectMapper.Map, List>(entities); - var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute()?.Name ?? typeof(TEntityDetailExportDto).Name; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; byte[] result = null; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index 4335b6ff..a54f18f5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -1,7 +1,8 @@ using DocumentFormat.OpenXml.Bibliography; using EFCore.BulkExtensions; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; + +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using SettleAccount.Domain.BQ; using System; @@ -23,7 +24,6 @@ using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; - namespace Win.Sfs.SettleAccount.Entities.BQ { /// @@ -33,7 +33,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [Route("api/settleaccount/[controller]/[action]")] public class BBAC_BA_SERVICE : BA_SERVICE { - private readonly INormalEfCoreRepository _adjRepository; private readonly INormalEfCoreRepository _priceRepository; public BBAC_BA_SERVICE(IExcelImportAppService excelImportService, @@ -55,24 +54,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { _adjRepository = adjRepository; _priceRepository = priceRepository; - - } - + /// /// 发票重开 /// /// /// - public virtual async Task ReissueInvoice(string p_invbillnum) + public override async Task ReissueInvoice(string p_invbillnum) { var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 - if (mappingList != null && mappingList.Count() > 0) { var version=int.Parse(DateTime.Now.ToString("yyyymm")); var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 var inv= await GetInvoiceGroupByInvBillNum(p_invbillnum); + + var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum); + + if(settle==null) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + } + + version=settle.Version; if (inv != null) { if (inv.InvoiceState == InvoiceBillState.报废) @@ -109,13 +114,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 - var dto1s = ObjectMapper.Map, List>(entitys); + var priceList = _priceRepository.ToList();//价格单 var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); if (errorList.Count() > 0) { return await ExportErrorReportAsync(errorList); } + var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime @@ -141,7 +147,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dtos = q.ToList(); if (dtos != null && dtos.Count > 0) { - if (p_invbillnum.Substring(0, 1) == "INV")//一次开票重开 + if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 { await ReissueFirstInvoice(dtos, version, p_invbillnum); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index 73fe672d..cea5892e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -93,7 +93,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); var notQuery = _notRepository.Where(p => groupNumList.Contains(p.InvGroupNum)).ToList();//不能结算 - var dto1s = ObjectMapper.Map, List>(entitys); + var priceList = _priceRepository.ToList();//价格单 var errorList = await CheckInvoiceGenerationRules(entitys, priceList,main.BusinessType);//校验生成规则 @@ -102,6 +102,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { return await ExportErrorReportAsync(errorList); } + var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs index 429fedec..28636ca3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs @@ -1,17 +1,24 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; + +using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using System; using System.Collections.Generic; using System.Linq; +using System.LinqAsync; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Services; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; +using Win.Sfs.SettleAccount.Entities.BQ.Temp; +using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ @@ -20,8 +27,138 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [Route("api/settleaccount/[controller]/[action]")] public class HBPO_BA_SERVICE : BA_SERVICE { - public HBPO_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository pubRepository, INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, BBAC_CAN_SA_MNG pubMng, HBPO_CAN_SA_MNG bbacMng, PUB_CAN_SA_MNG hbpoMng, INV_MNG invMng) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) + private readonly INormalEfCoreRepository _adjRepository; + private readonly INormalEfCoreRepository _priceRepository; + public HBPO_BA_SERVICE( + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, + INormalEfCoreRepository pubRepository, + INormalEfCoreRepository repository, + INormalEfCoreRepository wRepository, + INormalEfCoreRepository sRepository, + INormalEfCoreRepository mRepository, + BBAC_CAN_SA_MNG pubMng, + HBPO_CAN_SA_MNG bbacMng, + PUB_CAN_SA_MNG hbpoMng, + INV_MNG invMng, + INormalEfCoreRepository adjRepository, + INormalEfCoreRepository priceRepository + + ) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) { + _adjRepository = adjRepository; + _priceRepository = priceRepository; + } + + /// + /// 发票重开 + /// + /// + /// + public override async Task ReissueInvoice(string p_invbillnum) + { + var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + if (mappingList != null && mappingList.Count() > 0) + { + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum); + var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum); + if (settle == null) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + } + var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 + var adjlist = await _adjRepository.Where(p => p.InvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + hbpolist.Add(new HBPO_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum + + )); + } + } + var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); + //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 + var priceList = _priceRepository.ToList();//价格单 + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + if (errorList.Count() > 0) + { + return await ExportErrorReportAsync(errorList); + } + // var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in entitys + join p in priceList on d.LU equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select new TEMP_CAN_SA_DETAIL + { + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + // MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "n", + BeginDate = p.BeginTime, + EndDate = p.EndTime + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + await ReissueFirstInvoice(dtos, version, p_invbillnum); + } + else//二次开票 + { + await ReissueSecInvoice(dtos, version, p_invbillnum); + } + } + } + else + { + throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票"); + } + } + else + { + throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + } + return ApplicationConsts.SuccessStr; } } + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs index 9efd5628..027f0243 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs @@ -86,13 +86,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var entitys = await _hbpoMng.GetDetalListAsync(input.BillNum); var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var notQuery = _notRepository.Where(p => groupNumList.Contains(p.InvGroupNum)).ToList(); - var dto1s = ObjectMapper.Map, List>(entitys); + var priceList = _priceRepository.ToList();//价格单 var errorList=await CheckInvoiceGenerationRules(entitys, priceList,main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { return await ExportErrorReportAsync(errorList); } + var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs index f02e19fa..cc001ab1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs @@ -1,8 +1,13 @@ +using DocumentFormat.OpenXml.Bibliography; +using DocumentFormat.OpenXml.Drawing.Diagrams; +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 NPOI.HPSF; using SettleAccount.Domain.BQ; using Shouldly; using System; @@ -14,17 +19,21 @@ using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; +using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] - public class INVOICE_SERVICE:ApplicationService + public class INVOICE_SERVICE : BASE_SERVICE { private readonly INormalEfCoreRepository _repository; private readonly INormalEfCoreRepository _wRepository; @@ -34,22 +43,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private readonly BBAC_CAN_SA_MNG _bbacMng; private readonly HBPO_CAN_SA_MNG _hbpoMng; private readonly INV_MNG _invMng; - //private readonly INormalEfCoreRepository _detailRepository; - private readonly IExcelImportAppService _excelImportService; - - protected INVOICE_SERVICE( + public INVOICE_SERVICE(IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, - IExcelImportAppService excelImportService, - PUB_CAN_SA_MNG pubMng, + PUB_CAN_SA_MNG pubMng, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, INV_MNG invMng - ) + + ) : base(excelImportService, snowflakeIdGenerator, commonManager) { - _excelImportService = excelImportService; _repository = repository; _wRepository = wRepository; _mRepository = mRepository; @@ -59,15 +66,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _hbpoMng = hbpoMng; _invMng = invMng; } + [HttpPost] public virtual async Task ApprovalPassed(INVOICE_GRP_REQ_DTO input) { - var inv=_repository.Where(p=>p.InvGroupNum == input.InvGroupNum).FirstOrDefault(); - + var inv = _repository.Where(p => p.InvGroupNum == input.InvGroupNum).FirstOrDefault(); await _invMng.SetForwardState(inv, SettleBillState.财务已审核); - - - return ApplicationConsts.SuccessStr; + return ApplicationConsts.SuccessStr; } [HttpPost] @@ -131,11 +136,53 @@ namespace Win.Sfs.SettleAccount.Entities.BQ ); return _fileName; } + /// + /// 导出发票组明细 + /// + /// 查询条件 + /// + [HttpPost] + public virtual async Task ExportDetailAsync(INVOICE_GRP_REQ_DTO input) + { + IExporter _csv = new CsvExporter(); + ExcelExporter _excel = new ExcelExporter(); + + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtoDetails = ObjectMapper.Map, List>(entities); + + var invdetail= await DetailQueryAsync(input); + var m = invdetail.INVOICE_MAP_GROUP; + var not=invdetail.INVOICE_NOT_SETTLE; + var detail =invdetail.INVOICE_WAIT_DETAIL; + + var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute()?.Name ?? typeof(INVOICE_GRP_DTO).Name; + string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; + + + var result = _excel.Append(dtoDetails,"发票表").SeparateBySheet() + .Append(m, "发票和结算分组关系") + .SeparateBySheet() + .Append(not, "对应未结结算分组") + .SeparateBySheet() + .Append(detail, "发票明细") + .ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result.Result + } + ); + return _fileName; + } + [HttpPost] public virtual async Task RejectAsync(INVOICE_GRP_REQ_DTO input) { bool state = await _invMng.Reject(input.InvGroupNum); - if (state==true) + if (state == true) { switch (input.BusinessType) { @@ -143,6 +190,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ await _pubMng.SetNewState(input.InvGroupNum); break; case EnumBusinessType.ZhiGongJianBBAC: + await _pubMng.SetNewState(input.InvGroupNum); + break; case EnumBusinessType.ZhiGongJianHBPO: await _pubMng.SetNewState(input.InvGroupNum); break; @@ -159,21 +208,50 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } return string.Empty; } + /// + /// 同步QAD + /// + /// + /// [HttpPost] public virtual async Task Sync_QAD(INVOICE_GRP_REQ_DTO input) { return string.Empty; - } - - - - - - - - + /// + /// 导入发票 + /// + /// + /// + /// + [HttpPost] + [DisableRequestSizeLimit] + + public async Task ExcelImport([FromForm] IFormFileCollection files) + { + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + var ls = ObjectMapper.Map, List>(result); + var namelist = ls.Select(p => p.InvbillNum).Distinct(); + var invlist = _repository.Where(p => namelist.Contains(p.InvbillNum)).ToList(); + var invdetail = _wRepository.Where(p => namelist.Contains(p.InvbillNum)).ToList(); + var first = ls.FirstOrDefault(); + foreach (var inv in invlist) + { + var newinv = ls.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault(); + inv.Tax = newinv.Tax; + inv.TaxAmt = Math.Round(inv.Amt * newinv.Tax, 2); + inv.RealnvBillNum = newinv.RealnvBillNum; + } + foreach (var detail in invdetail) + { + detail.Extend1 = Math.Round(detail.Amt * first.Tax, 2).ToString(); + } + await _repository.DbContext.BulkUpdateAsync(invlist); + await _repository.DbContext.BulkUpdateAsync(invdetail); + return ApplicationConsts.SuccessStr; + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs index 3df748a7..41772615 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs @@ -1,17 +1,23 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; + +using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using System; using System.Collections.Generic; using System.Linq; +using System.LinqAsync; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Services; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Managers; +using Win.Sfs.SettleAccount.Entities.BQ.Temp; +using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ @@ -20,8 +26,138 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [Route("api/settleaccount/[controller]/[action]")] public class PUB_BA_SERVICE : BA_SERVICE { - public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository pubRepository, INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, BBAC_CAN_SA_MNG pubMng, HBPO_CAN_SA_MNG bbacMng, PUB_CAN_SA_MNG hbpoMng, INV_MNG invMng) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) + + private readonly INormalEfCoreRepository _adjRepository; + private readonly INormalEfCoreRepository _priceRepository; + + public PUB_BA_SERVICE(IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager, + INormalEfCoreRepository pubRepository, + INormalEfCoreRepository repository, + INormalEfCoreRepository wRepository, + INormalEfCoreRepository sRepository, + INormalEfCoreRepository mRepository, + BBAC_CAN_SA_MNG pubMng, + HBPO_CAN_SA_MNG bbacMng, + PUB_CAN_SA_MNG hbpoMng, + INormalEfCoreRepository adjRepository, + INormalEfCoreRepository priceRepository, + INV_MNG invMng) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) + { + _adjRepository = adjRepository; + _priceRepository = priceRepository; + } + // + /// 发票重开 + /// + /// + /// + + public override async Task ReissueInvoice(string p_invbillnum) { + var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + if (mappingList != null && mappingList.Count() > 0) + { + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum); + + var settle = await _pubMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + } + var hbpolist = await _pubMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 + var adjlist = await _adjRepository.Where(p => p.InvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + hbpolist.Add(new PUB_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum + + )); + } + } + var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); + //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 + + var priceList = _priceRepository.ToList();//价格单 + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + if (errorList.Count() > 0) + { + return await ExportErrorReportAsync(errorList); + } + // var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in entitys + join p in priceList on d.LU equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select new TEMP_CAN_SA_DETAIL + { + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + // MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "n", + BeginDate = p.BeginTime, + EndDate = p.EndTime + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + await ReissueFirstInvoice(dtos, version, p_invbillnum); + } + else//二次开票 + { + await ReissueSecInvoice(dtos, version, p_invbillnum); + } + } + } + else + { + throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票"); + } + } + else + { + throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + } + return ApplicationConsts.SuccessStr; } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs index cd07c9cc..2fcd29a4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs @@ -71,31 +71,26 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { var entitys = await _pubMng.GetDetalListAsync(input.BillNum); var groupNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); - - var dto1s = ObjectMapper.Map, List>(entitys); - List priceList=new List(); + List priceList = new List(); if (main.BusinessType == EnumBusinessType.BeiJian) { var priceListbj = _pricebjRepository.ToList();//价格单 foreach (var itm in priceListbj) { - priceList.Add(new PriceList() {LU=itm.LU,BeginTime=itm.BeginDate,EndTime=itm.EndDate }); + priceList.Add(new PriceList() { LU = itm.LU, BeginTime = itm.BeginDate, EndTime = itm.EndDate, Price = itm.Price }); } } else { - priceList = _priceRepository.ToList();//价格单 - } - var errorList = await CheckInvoiceGenerationRules(entitys, priceList,main.BusinessType);//校验生成规则 - if (errorList.Count() > 0) - { - return await ExportErrorReportAsync(errorList); + priceList = _priceRepository.ToList();//价格单 } + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, main.BusinessType);//校验生成规则 if (errorList.Count() > 0) { return await ExportErrorReportAsync(errorList); } + var dto1s = ObjectMapper.Map, List>(entitys); var q = from d in dto1s join p in priceList on d.LU equals p.LU where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime @@ -114,22 +109,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ Qty = d.Qty, GroupNum = d.GroupNum, Amt = Math.Round(d.Qty * p.Price, 2), - ContractDocID="no", + ContractDocID = "no", BeginDate = p.BeginTime, EndDate = p.EndTime }; var dtos = q.ToList(); if (dtos != null && dtos.Count > 0) { - if (input.BillNum.Substring(0, 1) == "C")//一次开票 - { - - await FirstInvoice(dtos,new List(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType); - } - else//二次开票 - { - await SecInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); - } + if (input.BillNum.Substring(0, 1) == "C")//一次开票 + { + + await FirstInvoice(dtos, new List(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType); + } + else//二次开票 + { + await SecInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); + } } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs index 52d03cfb..fbe2bae9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs @@ -44,7 +44,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public override async Task GenerateSettlementOrder(PUB_NOT_SA_DETAIL_REQ_DTO input) { var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); - _pubNotMng.GenerateSettlementOrder(entitys); return ApplicationConsts.SuccessStr; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index 5796ad19..d731ad35 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -1,4 +1,4 @@ -using Magicodes.ExporterAndImporter.Excel; +using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; @@ -73,259 +73,259 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices _invoiceVersionRepository = invoiceVersionRepository; _fisVersionrepository = fisVersionrepository; _itemInvoicePriceVersionrepository = itemInvoicePriceVersionrepository; - + _service = service; } - #region 派格大众看板-备件结算报表 + //#region 派格大众看板-备件结算报表 - /// - /// 大众准时化结算门板价格差异比对报表 - /// - /// 客户物料号 - /// 版本 - /// - /// 厂内物料号 - /// 物料组 - /// - [HttpPost] - [Route("SettleDoorPanel")] - [DisableRequestSizeLimit] - - public async Task SettleDoorPanel( - BaseRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(input.Version) ? string.Empty : input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(input.MaterialCode) ? string.Empty : input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); - customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(input.Cp7Begin) ? string.Empty : input.Cp7Begin }); - customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(input.Cp7End) ? string.Empty : input.Cp7End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("准时化结算门板价格差异比对报表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => - { - }); - return _taskid; - } - /// - /// 有条码看板结算核对 - /// - /// 看板号 - /// 厂内零件号 - /// 版本 - /// - /// 客户物料号 - /// 物料组(车型) - /// - /// - /// - /// - [HttpPost] - [Route("SettleKanBan-WithCode")] - [DisableRequestSizeLimit] - - public async Task SettledKanBanWithCode(BaseKanbanReqestDto input) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); - var _taskid = await _service.ExportEnqueueAsync("看板结算输出", ExportExtentsion.Excel,input.Version ,string.Empty,CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) => - { - }); - return _taskid; - } - - [HttpPost] - [Route("SettleKanBan-WithOutCode")] - [DisableRequestSizeLimit] + ///// + ///// 大众准时化结算门板价格差异比对报表 + ///// + ///// 客户物料号 + ///// 版本 + ///// + ///// 厂内物料号 + ///// 物料组 + ///// + //[HttpPost] + //[Route("SettleDoorPanel")] + //[DisableRequestSizeLimit] - public async Task SettledKanBanWithOutCode(BaseKanbanReqestDto input) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); - var _taskid = await _service.ExportEnqueueAsync("无条码看板结算输出", ExportExtentsion.Excel, input.Version,string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) => - { - }); - return _taskid; - } - #region 大众备件0-90天和90天以上输出 + //public async Task SettleDoorPanel( + // BaseRequestDto input + // ) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(input.Version) ? string.Empty : input.Version }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = string.IsNullOrEmpty(input.MaterialCode) ? string.Empty : input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); + // customConditionList.Add(new CustomCondition() { Name = "Cp7BeginTime", Value = string.IsNullOrEmpty(input.Cp7Begin) ? string.Empty : input.Cp7Begin }); + // customConditionList.Add(new CustomCondition() { Name = "Cp7EndTime", Value = string.IsNullOrEmpty(input.Cp7End) ? string.Empty : input.Cp7End }); + // customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); + // customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // var _taskid = await _service.ExportEnqueueAsync("准时化结算门板价格差异比对报表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} + ///// + ///// 有条码看板结算核对 + ///// + ///// 看板号 + ///// 厂内零件号 + ///// 版本 + ///// + ///// 客户物料号 + ///// 物料组(车型) + ///// + ///// + ///// + ///// + //[HttpPost] + //[Route("SettleKanBan-WithCode")] + //[DisableRequestSizeLimit] - /// - /// 大众备件数据调整结算输出 - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - [HttpGet] - [Route("SettleSparePart90Export")] - [DisableRequestSizeLimit] + //public async Task SettledKanBanWithCode(BaseKanbanReqestDto input) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); + // var _taskid = await _service.ExportEnqueueAsync("看板结算输出", ExportExtentsion.Excel,input.Version ,string.Empty,CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - public async Task SettledSparePart90(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) - { + //[HttpPost] + //[Route("SettleKanBan-WithOutCode")] + //[DisableRequestSizeLimit] - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + //public async Task SettledKanBanWithOutCode(BaseKanbanReqestDto input) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End ?? string.Empty }); + // var _taskid = await _service.ExportEnqueueAsync("无条码看板结算输出", ExportExtentsion.Excel, input.Version,string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} + //#region 大众备件0-90天和90天以上输出 - var _taskid = await _service.ExportEnqueueAsync("大众备件数据调整结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) => - { + ///// + ///// 大众备件数据调整结算输出 + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + //[HttpGet] + //[Route("SettleSparePart90Export")] + //[DisableRequestSizeLimit] - }); - return _taskid; - } + //public async Task SettledSparePart90(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + // string state, DateTime begin, DateTime end) + //{ - /// - /// 大众备件输出(包括带订货单号和无订单号) - /// - /// 采购订单号 - /// 厂内物料号 - /// 版本 - /// - /// - /// 物料代码 - /// - /// - /// - /// - [HttpGet] - [Route("SettleSparePartExport")] - [DisableRequestSizeLimit] + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + + // var _taskid = await _service.ExportEnqueueAsync("大众备件数据调整结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) => + // { - public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) - { + // }); + // return _taskid; + //} - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + ///// + ///// 大众备件输出(包括带订货单号和无订单号) + ///// + ///// 采购订单号 + ///// 厂内物料号 + ///// 版本 + ///// + ///// + ///// 物料代码 + ///// + ///// + ///// + ///// + //[HttpGet] + //[Route("SettleSparePartExport")] + //[DisableRequestSizeLimit] - var _taskid = await _service.ExportEnqueueAsync("大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => - { + //public async Task SettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + // string state, DateTime begin, DateTime end) + //{ - }); - return _taskid; - } + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + + // var _taskid = await _service.ExportEnqueueAsync("大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => + // { - /// - /// 大众备件未结明细 - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - [HttpGet] - [Route("UnSettleSparePartExport")] - [DisableRequestSizeLimit] + // }); + // return _taskid; + //} - public async Task UnSettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) - { + ///// + ///// 大众备件未结明细 + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + ///// + //[HttpGet] + //[Route("UnSettleSparePartExport")] + //[DisableRequestSizeLimit] - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + //public async Task UnSettledSparePart(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + // string state, DateTime begin, DateTime end) + //{ - var _taskid = await _service.ExportEnqueueAsync("大众备件未结输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleUnSparePartExportService), customConditionList, (rs) => - { + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + + // var _taskid = await _service.ExportEnqueueAsync("大众备件未结输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleUnSparePartExportService), customConditionList, (rs) => + // { - }); - return _taskid; - } - #endregion - /// - /// 无订单备件结算输出 - /// - /// 采购订单号 - /// 厂内物料号 - /// 版本 - /// - /// - /// 物料代码 - /// - /// - /// - /// - [HttpGet] - [Route("SettleSparePartExportExtend")] - [DisableRequestSizeLimit] + // }); + // return _taskid; + //} + //#endregion + ///// + ///// 无订单备件结算输出 + ///// + ///// 采购订单号 + ///// 厂内物料号 + ///// 版本 + ///// + ///// + ///// 物料代码 + ///// + ///// + ///// + ///// + //[HttpGet] + //[Route("SettleSparePartExportExtend")] + //[DisableRequestSizeLimit] - public async Task SettledSparePartExtend(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, - string state, DateTime begin, DateTime end) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); - customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); - var _taskid = await _service.ExportEnqueueAsync("无订单备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => - { + //public async Task SettledSparePartExtend(string purchaseOrderNo, string sapCode, string version, string customerCode, string factory, string matialCode, + // string state, DateTime begin, DateTime end) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "PurchaseOrderNo", Value = purchaseOrderNo ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "State", Value = state ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "MatialCode", Value = matialCode ?? "0" }); + // customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众备件结算核对" }); + // customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() }); + // var _taskid = await _service.ExportEnqueueAsync("无订单备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) => + // { - }); - return _taskid; - } - #endregion + // }); + // return _taskid; + //} + //#endregion [HttpGet] [Route("SharePartUnSettledExport")] @@ -692,189 +692,189 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices // return _taskid; //} - #region 红旗、一汽轿车的输出报表 + //#region 红旗、一汽轿车的输出报表 - /// - ///红旗工厂核对明细 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("HQHSettledDetailDiffExportService")] - [DisableRequestSizeLimit] - [UnitOfWork(false)] - public async Task HQHSettledDetailDiffExportServiceMake( - HQKanbanRequestDto input - ) - { - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("红旗工厂核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + ///// + /////红旗工厂核对明细 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("HQHSettledDetailDiffExportService")] + //[DisableRequestSizeLimit] + //[UnitOfWork(false)] + //public async Task HQHSettledDetailDiffExportServiceMake( + // HQKanbanRequestDto input + // ) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); + // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // var _taskid = await _service.ExportEnqueueAsync("红旗工厂核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSettledDetailDiffExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - /// - ///红旗工厂未结明细 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("HQHUnSettledDetailDiffExportService")] - [DisableRequestSizeLimit] - public async Task HQHUnSettledDetailDiffExportServiceMake( - HQKanbanRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); - var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + ///// + /////红旗工厂未结明细 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("HQHUnSettledDetailDiffExportService")] + //[DisableRequestSizeLimit] + //public async Task HQHUnSettledDetailDiffExportServiceMake( + // HQKanbanRequestDto input + // ) + //{ - /// - ///红旗未结核对 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("HQFactoryUnSettledDetailDiffExportService")] - [DisableRequestSizeLimit] - public async Task HQFactoryUnSettledDetailDiffExportService( - HQKanbanRequestDto input - ) - { + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); + // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); + // var _taskid = await _service.ExportEnqueueAsync("红旗工厂未结明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHUnSettledDetailDiffExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); - var _taskid = await _service.ExportEnqueueAsync("红旗未结核对", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFactoryUnSettledDetailDiffExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + ///// + /////红旗未结核对 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("HQFactoryUnSettledDetailDiffExportService")] + //[DisableRequestSizeLimit] + //public async Task HQFactoryUnSettledDetailDiffExportService( + // HQKanbanRequestDto input + // ) + //{ - /// - /// 红旗工厂备件明细 - /// - /// - /// - [HttpPost] - [Route("HQHSharePartSettledDetailDiffExportService")] - [DisableRequestSizeLimit] - public async Task HQHSharePartSettledDetailDiffExportServiceMake( - HQKanbanRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); + // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion }); + // var _taskid = await _service.ExportEnqueueAsync("红旗未结核对", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFactoryUnSettledDetailDiffExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); - customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); - customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); - customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("H平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSharePartSettledDetailDiffExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + ///// + ///// 红旗工厂备件明细 + ///// + ///// + ///// + //[HttpPost] + //[Route("HQHSharePartSettledDetailDiffExportService")] + //[DisableRequestSizeLimit] + //public async Task HQHSharePartSettledDetailDiffExportServiceMake( + // HQKanbanRequestDto input + // ) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); + // customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo }); + // customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc }); + // customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // var _taskid = await _service.ExportEnqueueAsync("H平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSharePartSettledDetailDiffExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - [HttpPost] - [Route("FisUpdateExportService")] - [DisableRequestSizeLimit] - [UnitOfWork(isTransactional: false)] - public async Task FisUpdateExportServiceMake( - HQKanbanRequestDto input - ) - { - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); - customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); - var _taskid = await _service.ExportEnqueueAsync("Fis发货数据更新状态", ExportExtentsion.Excel, input.Version, null, CurrentUser, typeof(FisUpdateExportService), customConditionList, (rs) => - { - }); - return _taskid; - } + //[HttpPost] + //[Route("FisUpdateExportService")] + //[DisableRequestSizeLimit] + //[UnitOfWork(isTransactional: false)] + //public async Task FisUpdateExportServiceMake( + // HQKanbanRequestDto input + // ) + //{ + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); + // customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End }); + // var _taskid = await _service.ExportEnqueueAsync("Fis发货数据更新状态", ExportExtentsion.Excel, input.Version, null, CurrentUser, typeof(FisUpdateExportService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - /// - /// 结算未结寄售核对表 - /// - /// 上传的文件(前端已经限制只能上传一个附件) - /// - [HttpPost] - [Route("UnSettledSum-Make")] - [DisableRequestSizeLimit] - [UnitOfWork(false)] - public async Task UnSettledSumServiceMake( + ///// + ///// 结算未结寄售核对表 + ///// + ///// 上传的文件(前端已经限制只能上传一个附件) + ///// + //[HttpPost] + //[Route("UnSettledSum-Make")] + //[DisableRequestSizeLimit] + //[UnitOfWork(false)] + //public async Task UnSettledSumServiceMake( - BaseRequestDto input + // BaseRequestDto input - ) - { + // ) + //{ - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(input.Version) ? input.Version : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode) ? input.MaterialCode : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup) ? input.MaterialGroup : string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty }); - customConditionList.Add(new CustomCondition() { Name = "Begin", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); - customConditionList.Add(new CustomCondition() { Name = "End", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); - customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); - customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); - customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); - var _taskid = await _service.ExportEnqueueAsync("结算未结寄售核对表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnSettledSumService), customConditionList, (rs) => - { - }); - return _taskid; - } + // List customConditionList = new List(); + // customConditionList.Add(new CustomCondition() { Name = "Version", Value = !string.IsNullOrEmpty(input.Version) ? input.Version : string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = !string.IsNullOrEmpty(input.MaterialCode) ? input.MaterialCode : string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = !string.IsNullOrEmpty(input.MaterialGroup) ? input.MaterialGroup : string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = string.Empty }); + // customConditionList.Add(new CustomCondition() { Name = "Begin", Value = string.IsNullOrEmpty(input.Begin) ? string.Empty : input.Begin }); + // customConditionList.Add(new CustomCondition() { Name = "End", Value = string.IsNullOrEmpty(input.End) ? string.Empty : input.End }); + // customConditionList.Add(new CustomCondition() { Name = "KennCode", Value = string.IsNullOrEmpty(input.Kenncode) ? string.Empty : input.Kenncode }); + // customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(input.ChassisNumber) ? string.Empty : input.ChassisNumber }); + // customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode }); + // var _taskid = await _service.ExportEnqueueAsync("结算未结寄售核对表", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(UnSettledSumService), customConditionList, (rs) => + // { + // }); + // return _taskid; + //} - #endregion + //#endregion } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs index 61b66f5f..668b9935 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs @@ -67,7 +67,7 @@ public class BBAC_NOT_SA_DETAIL:SA_NOT_BASE /// 对应字段MovementType,996正常,997为退货 /// [Display(Name = "是否退货")] - public string IsReturn { get; set; } = null!; + public bool IsReturn { get; set; } =false; //[Display(Name = "发票分组号")] //public string InvGroupNum { get; set; } = null!; @@ -92,7 +92,7 @@ public class BBAC_NOT_SA_DETAIL:SA_NOT_BASE } - public BBAC_NOT_SA_DETAIL(Guid guid, string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, string isReturn, string invGroupNum, DateTime settleDate, string groupNum,string contractDocID) + public BBAC_NOT_SA_DETAIL(Guid guid, string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, bool isReturn, string invGroupNum, DateTime settleDate, string groupNum,string contractDocID) { Id = guid; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs index 92910d01..01a059d3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs @@ -53,18 +53,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers var _entityList = new List(); foreach (var itm in p_list) { - var _detailEntity = new BBAC_CAN_SA_DETAIL(); - { - _detailEntity.SettleBillNum = itm.SettleBillNum; - _detailEntity.BillNum = billNumber; - _detailEntity.InvGroupNum = billNumber; - _detailEntity.LU = itm.LU; - _detailEntity.PN = itm.PN; - _detailEntity.GroupNum = itm.GroupNum; - _detailEntity.KeyCode = itm.KeyCode; - _detailEntity.Price = itm.Price; - _detailEntity.Version = itm.Version; - }; + var _detailEntity = new BBAC_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: billNumber, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + category: itm.BusinessType, + isReturn: itm.IsReturn, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: billNumber, + contactid: itm.ContractDocID + ); + _entityList.Add(_detailEntity); } await _repository.DbContext.BulkDeleteAsync(p_list); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs index ba3e3d79..e7869440 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs @@ -253,7 +253,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); } - + /// + /// 获取发票对应结算分组所有零件 + /// + /// + /// + public virtual async Task> GetContainsAsync(string p_canSettleBillNum, List p_list) + { + return await _detailRepository.Where(p => p.InvGroupNum == p_canSettleBillNum && p_list.Contains(p.GroupNum)).ToListAsync(); + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index d3929488..02a06670 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -263,6 +263,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } + + + + /// @@ -497,10 +501,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } } - - - - //if (_ls != null && _ls.Count > 0) //{ // foreach (var p_entity in _ls) @@ -522,28 +522,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers // await _repository.DbContext.BulkDeleteAsync(notList); // await _repository.DbContext.BulkDeleteAsync(detailList); // //await _repository.DbContext.BulkUpdateAsync(canList); - - - // } // if (p_entity.State == InvoiceBillState.已扣减) // { - // } // } - //} //else //{ - //} - - - - return true; - } /// /// hbpo、jit、备件等 @@ -572,6 +561,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers Amt = p.Sum(itm => itm.Amt), Qty = p.Sum(itm => itm.Qty), Price = p.Key.Price, + ContractDocID = p.Key.ContractDocID, BeginDate = p.Key.BeginDate, EndDate = p.Key.EndDate }).ToList();//汇总记录不出现重复值 @@ -629,7 +619,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers ContractDocID = itm.ContractDocID, EndDate = itm.EndDate }; - groups1 = query.ToList(); } } @@ -669,6 +658,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } decimal amt = detailList.Sum(k => k.Amt); decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + var contractList = ls.Select(p => p.ContractDocID).Distinct(); var _groupList = dtos.Where(p => contractList.Contains(p.ContractDocID)).GroupBy(p => new { p.GroupNum }) .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); @@ -790,6 +780,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { var key = itm.Key;//发票票号 var ls = itm.Value;//结算分组号列表 + //if(businessType==EnumBusinessType.JisBBAC) + //{ + + //} var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) .Select(itm => new { @@ -902,7 +896,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } /// - /// + /// 重开一次开票 /// /// /// @@ -931,7 +925,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return false; } /// - /// + /// 重开二次开票 /// /// /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs index c2ed5609..18020ba6 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs @@ -219,10 +219,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers var entity= await GetMainAsync(billNum); if (entity != null ) { - entity.State = SettleBillState.未结状态; - - await _repository.UpdateAsync(entity); return true; } @@ -247,7 +244,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync(); } - + /// + /// 获取发票对应结算分组所有零件 + /// + /// + /// + public virtual async Task> GetContainsAsync(string p_canSettleBillNum, List p_list) + { + return await _detailRepository.Where(p => p.InvGroupNum == p_canSettleBillNum && p_list.Contains(p.GroupNum)).ToListAsync(); + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs index cf7677b1..b152151a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs @@ -55,18 +55,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers var _entityList = new List(); foreach (var itm in p_list) { - var _detailEntity = new PUB_CAN_SA_DETAIL(); - { - _detailEntity.SettleBillNum = itm.SettleBillNum; - _detailEntity.BillNum = billNumber; - _detailEntity.InvGroupNum = billNumber; - _detailEntity.LU = itm.LU; - _detailEntity.PN = itm.PN; - _detailEntity.GroupNum = itm.GroupNum; - _detailEntity.KeyCode = itm.KeyCode; - _detailEntity.Price = itm.Price; - _detailEntity.Version = itm.Version; - }; + var _detailEntity = new PUB_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: billNumber, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: billNumber + + ); + _entityList.Add(_detailEntity); } await _notRepository.DbContext.BulkDeleteAsync(p_list); From 4e025a9d507088ff6c8cd5007acb586bf6c6df97 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 31 Jul 2023 16:46:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=94=80=E5=94=AE=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E5=8D=95=E6=98=BE=E7=A4=BA=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Prices/PriceListDtoBase.cs | 50 +++++++++++-------- .../Entities/Prices/PriceListAppService.cs | 14 ++---- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index db6d348b..9ec961ed 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -12,40 +12,46 @@ namespace Win.Sfs.SettleAccount.Entities.Prices; public class PriceListDto : EntityDto { /// - /// 版本 + /// 零件号 /// - [Display(Name = "版本")] - public string Version { set; get; } + [Display(Name = "零件号")] + public string LU { get; set; } + /// - ///开始时间 + /// 价格 /// - [Display(Name = "开始时间")] - public DateTime BeginDate { get; set; } + [Display(Name = "价格")] + public Decimal Price { set; get; } + /// - ///结算时间 + /// 开始时间 /// - [Display(Name = "结算时间")] - public DateTime EndDate { get; set; } + [Display(Name = "开始时间")] + public DateTime BeginTime { set; get; } + /// - ///价格 + /// 结束时间 /// - [Display(Name = "价格")] - public decimal Price { get; set; } + [Display(Name = "结束时间")] + public DateTime EndTime { set; get; } + /// - ///物料编号 + /// 客户编码 /// - [Display(Name = "物料编号")] - public string MaterialCode { get; set; } + [Display(Name = "客户编码")] + public string ClientCode { get; set; } + /// - ///价格类型 + /// 合同签订时间 /// - [Display(Name = "价格类型")] - public int Type { get; set; } - - public Guid ParentId { set; get; } - [Display(Name = "客户")] - public string CustomerCode { get; set; } + [Display(Name = "合同签订时间")] + public DateTime Date { get; set; } + /// + /// 合同号 + /// + [Display(Name = "合同号")] + public string ContractNo { get; set; } } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index e32c83c9..64166057 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -1,20 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; 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 NPOI.SS.UserModel; -using NPOI.SS.Util; using Shouldly; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; @@ -124,7 +119,6 @@ public class PriceListAppService : SettleAccountApplicationBase [HttpPost] public virtual async Task ExportAsync(RequestDto input) { - IExporter _csv = new CsvExporter(); IExporter _excel = new ExcelExporter(); var entities = await _priceListManager.GetListAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var dtoDetails = ObjectMapper.Map, List>(entities);