From 1dbbb3b61e759c7ce6cf00f4dd6a505d6593de86 Mon Sep 17 00:00:00 2001 From: zhaoxinyu <89237069@qq.com> Date: Thu, 27 Jun 2024 08:54:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/INVOICE_SERVICE.cs | 109 +++++++++++++++++- .../Entities/BQ/VmiAppService.cs | 22 ++-- .../src/SettleAccount.Domain/EnumBillState.cs | 5 +- 3 files changed, 116 insertions(+), 20 deletions(-) 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 56b32183..13010e5e 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 @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Linq.Dynamic.Core; using System.Reflection; using System.Threading.Tasks; using DocumentFormat.OpenXml.Bibliography; @@ -25,6 +26,7 @@ using SettleAccount.Bases; using SettleAccount.Domain.BQ; using Shouldly; using SqlSugar; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Data; using Volo.Abp.Uow; @@ -184,19 +186,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public virtual async Task CancelToQad(List invbillNums) { _globalConfigOptions.IsSyncInvoiceQadState = true; - var invoiceGrps1 = _settleAccountDbContext.Set() .Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.红冲发票); + var grouplist=invoiceGrps1.Select(p => p.InvGroupNum).ToList();//发票分组 + var invList=_settleAccountDbContext.Set().Where(p => grouplist.Contains(p.InvGroupNum)).ToList(); + var query =from itm in invList join itm1 in invoiceGrps1 on new { itm.InvGroupNum, itm.InvbillNum } equals new { itm1.InvGroupNum, itm1.InvbillNum } + into temp + from tm in temp.DefaultIfEmpty() + where tm == null + select itm; + + var invoices = query.ToList(); + if (invoices.Count > 0) + { + var invbilllist=invoices.Select(p => p.InvGroupNum).ToList(); + var invs = invoiceGrps1.Where(p => invbilllist.Contains(p.InvGroupNum)).Select(p => p.InvbillNum).ToList(); + throw new UserFriendlyException($"发票{string.Join(",", invs.ToArray())}对应结算单(发票分组)有其他发票状态不在撤销状态,不能退回", "400"); + } + foreach (var itm in invoiceGrps1) { - itm.State = SettleBillState.提交QAD退回到财务审核中; + itm.State = SettleBillState.提交QAD退回到已开票; } await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false); - var invoiceGrps = _settleAccountDbContext.Set() - .Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.提交QAD退回到财务审核中); - + .Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.提交QAD退回到已开票); var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC); var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO); @@ -1983,8 +1998,90 @@ namespace Win.Sfs.SettleAccount.Entities.BQ break; } } - return new JsonResult(new { Code = 200, Message = "重开成功" }); ; + return new JsonResult(new { Code = 200, Message = "退回成功" }); ; } + + //[HttpPost] + //public virtual async Task RejectAsync(INVOICE_GRP_DTO p_dto) + //{ + + // var invgrouplist=_repository.Where(p=>p.InvGroupNum==p_dto.InvGroupNum); + + // if (invgrouplist.Count(p => p.State < SettleBillState.财务已审核) == invgrouplist.Count())//所有发票分组下的放票全为财务已审核的 + // { + // await RejectAsync(p_dto.InvGroupNum).ConfigureAwait(false); + // } + // else + // { + // var inv= _repository.FirstOrDefault(p => p.InvbillNum == p_dto.InvbillNum); + // if (inv == null) + // { + // return new JsonResult(new { Code = 500, Message = "发票不存在" }); + // } + + + + + // } + + + + + + + + + + + // //var entities = await _invMng.GetMainListAsync(p_invGroupNum).ConfigureAwait(false); + // //var entity = entities.FirstOrDefault(); + // //bool state = await _invMng.Reject(p_invGroupNum).ConfigureAwait(false); + // //if (state == true) + // //{ + // // switch (entity.BusinessType) + // // { + // // case EnumBusinessType.BeiJian: + // // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // case EnumBusinessType.ZhiGongJianBBAC: + // // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // case EnumBusinessType.ZhiGongJianHBPO: + // // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // case EnumBusinessType.YinDuJian: + // // await _pubMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // case EnumBusinessType.JisBBAC: + // // await _bbacMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // case EnumBusinessType.JisHBPO: + // // await _hbpoMng.SetNewState(p_invGroupNum).ConfigureAwait(false); + // // break; + // // } + // //} + // return new JsonResult(new { Code = 200, Message = "退回成功" }); ; + //} + + + + + + + + + + + + + + + + + + + + /// /// 同步QAD /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index 1f976622..54e19429 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -304,27 +304,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dtos = _maper.Map, List>(entities); dtos = dtos.OrderByDescending(p => p.BillTime).ToList(); var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.zip"; - //ExportImporter _exportImporter = new ExportImporter(); - //var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); - //result.ShouldNotBeNull(); - //await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); + result.ShouldNotBeNull(); + await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); + + //ExtendExcel.BucketName = _cfg.GetValue("MinIO:BucketName", "default"); - ExtendExcel.BucketName = _cfg.GetValue("MinIO:BucketName", "default"); + //ExtendExcel.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre"); - ExtendExcel.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre"); + //ExtendExcel.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); - ExtendExcel.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); + //ExtendExcel.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684"); - ExtendExcel.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684"); + //return await ExtendExcel.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false); - return await ExtendExcel.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false); - - // return fileName; + return fileName; } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs index d408866c..5a6f58e7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs @@ -41,9 +41,8 @@ namespace Win.Sfs.SettleAccount 发票同步中 = 12, [Description("可结退回不可结同步中")] 可结退回不可结同步中 = 13, - - [Description("提交QAD退回到财务审核中")] - 提交QAD退回到财务审核中 = 14, + [Description("提交QAD退回到已开票")] + 提交QAD退回到已开票 = 14,