Browse Source

更新版本

master
zhaoxinyu 5 months ago
parent
commit
1dbbb3b61e
  1. 109
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  2. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  3. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

109
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.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Bibliography;
@ -25,6 +26,7 @@ using SettleAccount.Bases;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Shouldly; using Shouldly;
using SqlSugar; using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.Uow; using Volo.Abp.Uow;
@ -184,19 +186,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public virtual async Task<IActionResult> CancelToQad(List<string> invbillNums) public virtual async Task<IActionResult> CancelToQad(List<string> invbillNums)
{ {
_globalConfigOptions.IsSyncInvoiceQadState = true; _globalConfigOptions.IsSyncInvoiceQadState = true;
var invoiceGrps1 = _settleAccountDbContext.Set<INVOICE_GRP>() var invoiceGrps1 = _settleAccountDbContext.Set<INVOICE_GRP>()
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.); .Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.);
var grouplist=invoiceGrps1.Select(p => p.InvGroupNum).ToList();//发票分组
var invList=_settleAccountDbContext.Set<INVOICE_GRP>().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) foreach (var itm in invoiceGrps1)
{ {
itm.State = SettleBillState.QAD退回到财务审核中; itm.State = SettleBillState.QAD退回到已开票;
} }
await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false); await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false);
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>() var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>()
.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 invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC);
var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO); var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO);
@ -1983,8 +1998,90 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
break; break;
} }
} }
return new JsonResult(new { Code = 200, Message = "重开成功" }); ; return new JsonResult(new { Code = 200, Message = "退回成功" }); ;
} }
//[HttpPost]
//public virtual async Task<IActionResult> 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 = "退回成功" }); ;
//}
/// <summary> /// <summary>
/// 同步QAD /// 同步QAD
/// </summary> /// </summary>

22
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<VmiBalanceSumDetail>, List<VmiBalanceSumDetailDto>>(entities); var dtos = _maper.Map<List<VmiBalanceSumDetail>, List<VmiBalanceSumDetailDto>>(entities);
dtos = dtos.OrderByDescending(p => p.BillTime).ToList(); dtos = dtos.OrderByDescending(p => p.BillTime).ToList();
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.zip"; var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.zip";
//ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
//var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false);
//result.ShouldNotBeNull(); result.ShouldNotBeNull();
//await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
//ExtendExcel<VmiBalanceSumDetailDto>.BucketName = _cfg.GetValue("MinIO:BucketName", "default");
ExtendExcel<VmiBalanceSumDetailDto>.BucketName = _cfg.GetValue("MinIO:BucketName", "default"); //ExtendExcel<VmiBalanceSumDetailDto>.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre");
ExtendExcel<VmiBalanceSumDetailDto>.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre"); //ExtendExcel<VmiBalanceSumDetailDto>.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv");
ExtendExcel<VmiBalanceSumDetailDto>.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); //ExtendExcel<VmiBalanceSumDetailDto>.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684");
ExtendExcel<VmiBalanceSumDetailDto>.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684"); //return await ExtendExcel<VmiBalanceSumDetailDto>.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false);
return await ExtendExcel<VmiBalanceSumDetailDto>.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false);
// return fileName; return fileName;
} }
/// <summary> /// <summary>

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

@ -41,9 +41,8 @@ namespace Win.Sfs.SettleAccount
= 12, = 12,
[Description("可结退回不可结同步中")] [Description("可结退回不可结同步中")]
退 = 13, 退 = 13,
[Description("提交QAD退回到已开票")]
[Description("提交QAD退回到财务审核中")] QAD退回到已开票 = 14,
QAD退回到财务审核中 = 14,

Loading…
Cancel
Save