diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs index d422a3e6..e57cb582 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs @@ -87,6 +87,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [ExporterHeader(DisplayName = "期间")] public int Version { get; set; } + + + [Display(Name = "原客户零件号")] + + public string CustomerPartCodeNoSpace { set; get; } /// /// 零件号 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs index 4c2f128e..f6f4ed45 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs @@ -1,4 +1,4 @@ -using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Core; using System; using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; @@ -22,6 +22,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [Display(Name = "期间")] public int Version { get; set; } + [Display(Name = "原客户零件号")] + + public string CustomerPartCodeNoSpace { set; get; } /// /// 零件号 /// 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 043beb46..0e6a4f29 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 @@ -172,22 +172,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [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; } + ///// + /////税额 + ///// + //[ImporterHeader(Name = "税率", FixAllSpace = true)] + //[Required(ErrorMessage = "{0}是必填项")] + //public decimal Tax { get; set; } [ImporterHeader(Name = "客户代码", FixAllSpace = true)] [Required(ErrorMessage = "{0}是必填项")] public string ClientCode { get; set; } + [ImporterHeader(Name = "发票尾差", FixAllSpace = true)] + [Required(ErrorMessage = "{0}是必填项")] + public decimal PreTaxDiff { get; set; } - [ImporterHeader(Name = "税后金额", FixAllSpace = true)] - [Required(ErrorMessage = "{0}是必填项")] - public decimal RealAmt { get; set; } + + + + //[ImporterHeader(Name = "税后金额", FixAllSpace = true)] + //[Required(ErrorMessage = "{0}是必填项")] + //public decimal RealAmt { get; set; } } 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 a5938623..35f4ca01 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 @@ -114,7 +114,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { throw new UserFriendlyException($"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!"); } - var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 if (adjlist != null && adjlist.Count() > 0) @@ -151,6 +150,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 var priceList = _priceRepository.ToList();//价格单 + + + priceList.GroupBy(p => new { p.BeginTime, p.EndTime }).Select(p => p.First()); + + + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); if (errorList.Count() > 0) { 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 c0640c41..ff3a8438 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 @@ -160,9 +160,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var AMap = ObjectMapper.Map, List>(A); var wquery = from itm in AMap join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum - join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp - - + join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp select from tm in temp.DefaultIfEmpty() select new INVOICE_WAIT_DETAIL_BBAC_DTO() @@ -348,6 +346,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { IExporter _csv = new CsvExporter(); ExcelExporter _excel = new ExcelExporter(); + + var materialList = await _baseservice.GetMaterialList(); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var dtoDetails = ObjectMapper.Map, List>(entities); var invdetail= await DetailQueryAsync(input); @@ -361,6 +362,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC) { + _excel.Append(bbac, "发票明细"); } else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian) @@ -506,16 +508,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ for (int i = 0; i < disList.Count; i++) { ls[i].SettleGroupNum = disList[i]; - } - _excel.Append(ls, "结算分组零件" + itm.InvbillNum); _excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet(); _excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet(); } - var result = _excel.ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); //保存导出文件到服务器存成二进制 @@ -593,11 +592,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ foreach (var inv in invlist) { var newinv = ls.Where(p => p.InvbillNum == inv.InvbillNum).FirstOrDefault(); - inv.Tax = newinv.Tax; - inv.TaxAmt = inv.Amt+ Math.Round(inv.Amt * newinv.Tax, 2); + inv.Tax = 0.13m; + //inv.RealAmt = Math.Round(inv.Amt * newinv.Tax, 2); + //inv.TaxAmt = inv.Amt+ Math.Round(inv.Amt * newinv.Tax, 2); inv.RealnvBillNum = newinv.RealnvBillNum; - inv.RealAmt = newinv.RealAmt; - inv.TaxDiff = inv.TaxAmt-newinv.RealAmt; + // inv.RealAmt = newinv.RealAmt; + inv.TaxDiff =inv.TaxAmt+ newinv.PreTaxDiff; + inv.ClientCode = newinv.ClientCode; } foreach (var detail in invdetail) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs index 1a952f09..41d118bd 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs @@ -54,7 +54,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices List ls = new List(); var lst = await _relationshipRepository.Where(p => !string.IsNullOrEmpty(p.SettleMaterialCode)).ToListAsync(); - var l=lst.GroupBy(p => p.SettleMaterialCode).Select(g=> g.First()); return l.ToList(); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs index d908b876..0a34b464 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs @@ -58,11 +58,17 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot [MaxLength(50)] public string LineStationCode { set; get; } + + + [Display(Name = "原客户零件号")] + [MaxLength(50)] + public string CustomerPartCodeNoSpace { set; get; } + public BBAC_SE_EDI() { } public BBAC_SE_EDI(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate - ,string site, string extend1, string extend2, string extend3, string extend4) + ,string site, string extend1, string extend2, string extend3, string extend4,string customerPartCodeNoSpace) { Id = guid; @@ -80,6 +86,7 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot Extend2 = extend2; Extend3 = extend3; Extend4 = extend4; + customerPartCodeNoSpace = customerPartCodeNoSpace; } public BBAC_SE_EDI SetQty(decimal qty) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs index cf20f14d..c28c952f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs @@ -47,13 +47,21 @@ public class HBPO_SE_EDI :FullAuditedAggregateRoot public string Extend3 { set; get; } public string Extend4 { set; get; } + + /// /// 是否有发运数据 /// [Display(Name = "是否有发运数据")] public bool IsHaveSeData { get; set; } - public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4) + + [Display(Name = "原客户零件号")] + [MaxLength(50)] + public string CustomerPartCodeNoSpace { set; get; } + + + public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4, string customerPartCodeNoSpace) { Id = guid; KeyCode = keyCode; @@ -70,6 +78,7 @@ public class HBPO_SE_EDI :FullAuditedAggregateRoot Extend2 = extend2; Extend3 = extend3; Extend4 = extend4; + CustomerPartCodeNoSpace = customerPartCodeNoSpace; } //public HBPO_SE_EDI(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs index c3db702c..9bc935fd 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs @@ -19,7 +19,7 @@ public class INVOICE_GRP : FullAuditedAggregateRoot [Display(Name = "税后金额")] public decimal TaxAmt { get; set; } - [Display(Name = "税额")] + [Display(Name = "税率")] public decimal Tax { get; set; } [Display(Name = "原发票号")] @@ -45,14 +45,14 @@ public class INVOICE_GRP : FullAuditedAggregateRoot [Display(Name = "发票状态")] public InvoiceBillState InvoiceState { get; set; } - [Display(Name = "发票未税尾差")] + [Display(Name = "发票税后尾差")] public decimal PreTaxDiff { get; set; } [Display(Name = "发票税后尾差")] public decimal TaxDiff { get; set; } [Display(Name = "客户代码")] public string ClientCode { get; set; } - [Display(Name = "金税发票金额")] + [Display(Name = "税额")] public decimal RealAmt { get; set; } 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 e62b7828..2c0db594 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 @@ -1197,8 +1197,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { detailList.AddRange(_entityDetailList); } - decimal amt = detailList.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + decimal amt = detailList.Sum(k => k.Amt);//金额 + decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal readAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额 + + //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 }) @@ -1241,7 +1245,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: readAmt ); invlist.Add(invbill); } @@ -1355,8 +1359,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers BeginDate = itm.Key.BeginDate, EndDate = itm.Key.EndDate }).ToList(); - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + + + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt =detailDtos.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 + + //decimal amt = detailDtos.Sum(k => k.Amt); + //decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); var mapList = new List(); foreach (var groupnum in ls) { @@ -1466,7 +1476,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: realAmt ); invbill.CreationTime = DateTime.Now; invlist.Add(invbill); @@ -1685,8 +1695,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { detailList.AddRange(_entityDetailList); } - decimal amt = detailList.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + decimal amt = detailList.Sum(k => k.Amt);//金额 + decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额 + + + //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 }) @@ -1867,8 +1882,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers EndDate = itm.Key.EndDate }) .ToList(); - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt = detailDtos.Sum(k => k.Amt)+ Math.Round(detailDtos.Sum(k => k.Amt)*0.13m, 2);//税后金额 + decimal realAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 + var mapList = new List(); foreach (var groupnum in ls) { @@ -1954,7 +1971,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers preTaxDiff: 0, taxDiff: 0, clientCode: string.Empty, - realAmt: 0 + realAmt: realAmt ); invbill.CreationTime = DateTime.Now; invlist.Add(invbill); @@ -2185,8 +2202,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers PartName = inv1.GetProperty("PartName", ""),//零件名称 }; - decimal amt = detailDtos.Sum(k => k.Amt); - decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + + decimal amt = detailDtos.Sum(k => k.Amt);//金额 + decimal txtAmt = detailDtos.Sum(k => k.Amt) + Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税后金额 + decimal readAmt = Math.Round(detailDtos.Sum(k => k.Amt) * 0.13m, 2);//税额 + + + var mapList = new List(); foreach (var groupnum in ls) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs index 1895b21c..5df596aa 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs @@ -22,8 +22,6 @@ public class ExChangeCenterDbContext:DbContext { } - - protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);