wanggang 1 year ago
parent
commit
30afe65308
  1. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  2. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
  3. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  4. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  6. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  7. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  8. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs
  9. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

25
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -105,7 +105,6 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost] [HttpPost]
public virtual async Task<IActionResult> GenerateInvoice(List<string> p_invs) public virtual async Task<IActionResult> GenerateInvoice(List<string> p_invs)
{ {
var issucess=await _invMng.SetForwardState(p_invs, SettleBillState.); var issucess=await _invMng.SetForwardState(p_invs, SettleBillState.);
if (issucess == true) if (issucess == true)
{ {
@ -122,11 +121,7 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost] [HttpPost]
public virtual async Task<IActionResult> ReissueInvoice([FromBody] string input) public virtual async Task<IActionResult> ReissueInvoice([FromBody] string input)
{ {
// await _invMng.SetForwardState(input.InvGroupNum, SettleBillState.商务已审核);
return new JsonResult(new { Code = 200, Message = "重开成功" }); return new JsonResult(new { Code = 200, Message = "重开成功" });
} }
/// <summary> /// <summary>
/// 主表查询 /// 主表查询
@ -144,7 +139,6 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff; itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff;
} }
return new PagedResultDto<INVOICE_GRP_DTO>(totalCount, dtos); return new PagedResultDto<INVOICE_GRP_DTO>(totalCount, dtos);
} }
/// <summary> /// <summary>
@ -314,8 +308,6 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff; itm.TaxAmtDiff = itm.TaxAmt + itm.TaxDiff;
} }
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null; byte[] result = null;
@ -354,12 +346,9 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
return new JsonResult(new { Code = 200, Message = "退回成功" }); return new JsonResult(new { Code = 200, Message = "退回成功" });
} }
return new JsonResult(new { Code = 400, Message = "退回失败" }); return new JsonResult(new { Code = 400, Message = "退回失败" });
} }
[HttpPost] [HttpPost]
public virtual async Task<IActionResult> ReceivedAsync(List<string> p_ins) public virtual async Task<IActionResult> ReceivedAsync(List<string> p_ins)
{ {
@ -478,8 +467,7 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
return true; return true;
} }
throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容"); throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容");
} }
[UnitOfWork(false)] [UnitOfWork(false)]
/// <summary> /// <summary>
@ -526,9 +514,11 @@ namespace Win.Sfs.SettleAccount.Bases
/// <summary>
/// 检查是否有重复
/// </summary>
/// <param name="p_list">调整明细数据</param>
/// <returns></returns>
protected async Task<List<ERR_EXP_DTO>> CheckRepeat(List<PUB_ADJ_DETAIL_DTO> p_list) protected async Task<List<ERR_EXP_DTO>> CheckRepeat(List<PUB_ADJ_DETAIL_DTO> p_list)
{ {
var errorlist = p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList(); var errorlist = p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList();
@ -544,9 +534,6 @@ namespace Win.Sfs.SettleAccount.Bases
} }
/// <summary> /// <summary>
/// 校验规则 /// 校验规则
/// </summary> /// </summary>

16
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs

@ -138,8 +138,6 @@ namespace Win.Sfs.SettleAccount.Bases
//[Route("generateinvoice")] //[Route("generateinvoice")]
public virtual async Task<string> ApprovalPassed(List<string> p_list) public virtual async Task<string> ApprovalPassed(List<string> p_list)
{ {
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
/// <summary> /// <summary>
@ -164,21 +162,7 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost] [HttpPost]
public virtual async Task<string> RejectAsync(TRequestMainInput input) public virtual async Task<string> RejectAsync(TRequestMainInput input)
{ {
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
public virtual async Task<TEntity> GetMainAsync([FromBody] string billNum) public virtual async Task<TEntity> GetMainAsync([FromBody] string billNum)
{ {

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -226,16 +226,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns> /// <returns></returns>
public virtual async Task<IActionResult> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list) public virtual async Task<IActionResult> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{ {
var errorlist = await CheckRepeat(p_list);//是否录入数据重复
var errorlist = await CheckRepeat(p_list);
if (errorlist.Count > 0) if (errorlist.Count > 0)
{ {
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) });
} }
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list); var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0) if (adjlist == null && adjlist.Count == 0)
{ {
@ -243,18 +238,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
} }
var first = p_list.FirstOrDefault(); var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum; var invbillnum = first.InvBillNum;
var version=int.Parse(DateTime.Now.ToString("yyyymm")); var version=int.Parse(DateTime.Now.ToString("yyyymm"));
var inv= await GetInvoiceGroupByInvBillNum(invbillnum); var inv= await GetInvoiceGroupByInvBillNum(invbillnum);
var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum); var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum);
if(settle==null) if(settle==null)
{ {
throw new UserFriendlyException( $"选择发票:{invbillnum}对应的可结算单不粗拿在在请检查!", "400"); throw new UserFriendlyException( $"选择发票:{invbillnum}对应的可结算单不粗拿在在请检查!", "400");
} }
version=settle.Version; version=settle.Version;
if (inv != null) if (inv != null)
{ {
@ -298,7 +288,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { 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 notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单 var priceList = _priceRepository.Where(p => p.ClientCode == inv.Site && p.IsCancel == false).ToList();//价格单
//var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); //var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0) //if (errorList.Count() > 0)
//{ //{

31
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs

@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components; //using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using SettleAccount.Job.Services.Report; using SettleAccount.Job.Services.Report;
using SettleAccount.Job.Services; using SettleAccount.Job.Services;
@ -23,6 +23,7 @@ using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Volo.Abp; using Volo.Abp;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Mvc;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
@ -70,7 +71,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}); });
return _taskid; return _taskid;
} }
//[HttpPost]
//public virtual async Task<string> RejectAsync(List<string> p_list)
//{
// var detailist = _detailRepository.Where(p => p_list.Contains(p.BillNum)).ToList();
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "BillNumList", Value = string.Join(",", p_list) });
// customConditionList.Add(new CustomCondition() { Name = "Type", Value = EnumBusinessType.JisBBAC.ToString() });
// customConditionList.Add(new CustomCondition() { Name = "IsOut", Value = "out" });
// var ls = _repository.Where(p => p_list.Contains(p.BillNum)).ToList();
// var lst = ls.Where(p => (p.State == SettleBillState.已提交扣减 || p.State == SettleBillState.已扣减));
// if (lst.Count() > 0)
// {
// throw new UserFriendlyException("当前状态是已提交状态,不能重复已提交", "400");
// }
// foreach (var item in ls)
// {
// item.State = SettleBillState.已提交扣减;
// }
// await _repository.DbContext.BulkUpdateAsync(ls);
// var _taskid = await _service.ExportEnqueueAsync("BBAC待扣减任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(PendingDeductionService), customConditionList, (rs) =>
// {
// });
// return _taskid;
//}
} }
} }

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -655,7 +655,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//inv.TaxAmt = inv.Amt+ Math.Round(inv.Amt * newinv.Tax, 2); //inv.TaxAmt = inv.Amt+ Math.Round(inv.Amt * newinv.Tax, 2);
inv.RealnvBillNum = newinv.RealnvBillNum; inv.RealnvBillNum = newinv.RealnvBillNum;
// inv.RealAmt = newinv.RealAmt; // inv.RealAmt = newinv.RealAmt;
inv.TaxDiff =inv.TaxAmt+ newinv.PreTaxDiff; inv.TaxDiff =newinv.PreTaxDiff;
// inv.ClientCode = newinv.ClientCode; // inv.ClientCode = newinv.ClientCode;
} }

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Security.Policy;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
@ -153,7 +154,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
[HttpPost] [HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(PUB_SARequestDto input) public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(PUB_SARequestDto input)
{ {
input.Filters.RemoveAll(t => t.Column.ToLower() == "site");
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities); var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities);
@ -451,6 +451,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
EnumBusinessType.YinDuJian => "1040", EnumBusinessType.YinDuJian => "1040",
_ => throw new UserFriendlyException($"业务编码错误", "400") _ => throw new UserFriendlyException($"业务编码错误", "400")
}; };
site = clientCode;
if (businessType == EnumBusinessType.BeiJian) if (businessType == EnumBusinessType.BeiJian)
{ {
@ -526,7 +527,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
BillNum = pubSaBillNum, BillNum = pubSaBillNum,
State = "0", State = "0",
BusinessType = pubSaFirstDetail.BusinessType, BusinessType = pubSaFirstDetail.BusinessType,
Version = pubSaFirstDetail.Version Version = pubSaFirstDetail.Version,
Site = site
}; };
//可结算单号 //可结算单号
var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C"); var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
@ -538,13 +540,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
SettleBillNum = pubSaBillNum, SettleBillNum = pubSaBillNum,
State = SettleBillState., State = SettleBillState.,
BusinessType = pubSa.BusinessType, BusinessType = pubSa.BusinessType,
Version = pubSa.Version Version = pubSa.Version,
Site = site
}; };
#region 入库数据赋值 #region 入库数据赋值
pubSaDetails.ForEach(pubSaDetail => pubSaDetails.ForEach(pubSaDetail =>
{ {
pubSaDetail.BillNum = pubSaBillNum; pubSaDetail.BillNum = pubSaBillNum;
pubSaDetail.Site = site;
}); });
//不可结算 结算分组号码(根据价格区分结算、不可结算) //不可结算 结算分组号码(根据价格区分结算、不可结算)
var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct(); var pubNotSaGroupNums = pubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct();

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -1376,6 +1376,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var detail in adjdetails) foreach (var detail in adjdetails)
{ {
detail.InvBillNum = key; detail.InvBillNum = key;
adjlist.Add(detail);
} }
} }
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU }) var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU })
@ -1916,7 +1917,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var detail in adjdetails) foreach (var detail in adjdetails)
{ {
detail.InvBillNum = key; detail.InvBillNum = key;
adjdetails.Add(detail); adjlist.Add(detail);
} }
} }

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

@ -577,6 +577,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
return detailList; return detailList;
} }
[UnitOfWork(false)]
/// <summary> /// <summary>
/// 第一次开票 /// 第一次开票
/// </summary> /// </summary>
@ -675,7 +676,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var detail in adjdetails) foreach (var detail in adjdetails)
{ {
detail.InvBillNum = key; detail.InvBillNum = key;
adjdetails.Add(detail);
} }
} }
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU }) var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU })
@ -942,7 +943,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
foreach (var detail in adjdetails) foreach (var detail in adjdetails)
{ {
detail.InvBillNum = key; detail.InvBillNum = key;
adjdetails.Add(detail);
} }
} }

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

@ -34,6 +34,30 @@ namespace Win.Sfs.SettleAccount
= 6 = 6
} }
public enum PDBillState
{
[Description("新建")]
= 4,
[Description("已扣减")]
= 5,
[Description("已提交扣减")]
= 6,
[Description("已提交反结")]
= 7
}
public enum InvoiceBillState public enum InvoiceBillState
{ {
[Description("在用")] [Description("在用")]

Loading…
Cancel
Save