From 06d3c4e6faa33c6fdcad787bd034b728a5a6016e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Fri, 18 Aug 2023 17:34:25 +0800 Subject: [PATCH 1/8] =?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/Dtos/INVOICE_GRP_DTO.cs | 69 +++++++++++++++++-- .../Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs | 5 ++ .../Entities/BQ/BBAC_BA_SERVICE.cs | 53 ++++++++++---- .../Entities/BQ/INVOICE_SERVICE.cs | 3 - .../Entities/BQ/PUB_BA_SERVICE.cs | 3 +- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 2 +- .../Entities/BQ/INVOICE_WAIT_DETAIL.cs | 1 + .../Entities/BQ/Managers/INV_MNG.cs | 58 +++++++--------- .../Entities/BQ/Managers/INV_MNG_EXT.cs | 2 - .../Entities/BQ/Managers/PUB_NOT_SA_MNG.cs | 6 +- .../Entities/BQ/PUB_CAN_SA.cs | 7 +- .../Entities/BQ/PUB_NOT_SA_DETAIL.cs | 6 +- 12 files changed, 153 insertions(+), 62 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 0738520f..b7aa58df 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 @@ -38,7 +38,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// [Display(Name = "税后金额")] public decimal TaxAmt { get; set; } - [Display(Name = "金税发票金额")] public decimal RealAmt { get; set; } /// @@ -46,7 +45,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// [Display(Name = "发票分组号")] public string InvGroupNum { get; set; } - /// ///业务类别 /// @@ -63,11 +61,74 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public decimal TaxDiff { get; set; } [Display(Name = "客户代码")] public string ClientCode { get; set; } - + } + + + [Display(Name = "发票")] + public class INVOICE_REPEAT_DTO : EntityDto + { + /// + ///系统生成发票号 + /// + [Display(Name = "系统发票号")] + public string InvbillNum { get; set; } + /// + ///未税金额 + /// + [Display(Name = "未税金额")] + public decimal Amt { get; set; } + + /// + ///未税金额 + /// + [Display(Name = "未税金额")] + public decimal Tax { get; set; } + + + /// + ///税后金额 + /// + [Display(Name = "税后金额")] + public decimal TaxAmt { get; set; } + + [Display(Name = "金税发票金额")] + public decimal RealAmt { get; set; } + /// + ///发票分组号 + /// + [Display(Name = "发票分组号")] + public string InvGroupNum { get; set; } + /// + ///业务类别 + /// + [Display(Name = "业务类别")] + public EnumBusinessType BusinessType { get; set; } + + + public List DETIAL { set; get; } + + + + + + + + + + } + + + + + + + + + public class INVOICE_GRP_EXP_DTO { /// @@ -111,11 +172,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos //public decimal TaxDiff { get; set; } [Display(Name = "客户代码")] public string ClientCode { get; set; } + } - } public class INVOICE_GRP_IMP_DTO { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs index d29a9198..3b2e3310 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs @@ -110,6 +110,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos [Display(Name = "客户零件号")] public string PartCode { get; set; } + [Display(Name = "订单号")] + public string Extend4 { 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 f7346834..6f9206ff 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 @@ -324,10 +324,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// /// /// - public virtual async Task> ReissueInvoiceList(List p_list) + public virtual async Task> ReissueInvoiceList(List p_list) { - List ls = new List(); - + + var invBill = new INVOICE_REPEAT_DTO(); var adjlist=ObjectMapper.Map, List>(p_list); if (adjlist == null && adjlist.Count==0) { @@ -426,16 +426,41 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dtos = q.ToList(); if (dtos != null && dtos.Count > 0) { - if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 - { - var entities=await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); - ls= ObjectMapper.Map, List>(entities); - } - else//二次开票 - { - var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); - ls=ObjectMapper.Map, List>(entities); - } + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + + + var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + + var ls = ObjectMapper.Map, List>(entities); + + var tax = inv.Tax; + var amt = entities.Sum(p => p.Amt); + var taxamt =amt+ Math.Round(amt * tax, 2); + var billnum = string.Empty; + invBill.Amt = amt; + invBill.TaxAmt = taxamt; + invBill.Tax = tax; + invBill.BusinessType=inv.BusinessType; + invBill.DETIAL = ls; + + + } + else//二次开票 + { + var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + var ls = ObjectMapper.Map, List>(entities); + + var tax = inv.Tax; + var amt = entities.Sum(p => p.Amt); + var taxamt = amt + Math.Round(amt * tax, 2); + var billnum = string.Empty; + invBill.Amt = amt; + invBill.TaxAmt = taxamt; + invBill.Tax = tax; + invBill.BusinessType = inv.BusinessType; + invBill.DETIAL = ls; + } } } else @@ -447,7 +472,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ //{ // throw new UserFriendlyException($"不存发票号:{p_invbillnum}对应的结算分组号"); //} - return ls; + return invBill; } 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 90c89eb6..4b892728 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 @@ -263,9 +263,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { 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(); 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 3a6b24f9..0e2d2126 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 @@ -109,7 +109,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ groupNum: itm.GroupNum, invGroupNum: itm.InvGroupNum, invbillnum: string.Empty, - partcode: itm.PartCode + partcode: itm.PartCode, + pobillnum:itm.bil )); 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 f5f1e24a..79cfda4b 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 @@ -116,7 +116,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ BeginDate = p.BeginTime, EndDate = p.EndTime, PartCode=d.PartCode,//客户零件号 - PoNum="" + PoNum= }; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs index ce5d27cf..abe97ec5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs @@ -5,6 +5,7 @@ using Win.Sfs.SettleAccount; namespace SettleAccount.Domain.BQ; + [Display(Name = "待开票明细")] public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot { 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 f1a6b967..c2b9c11e 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 @@ -985,12 +985,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers /// 原发票号 public async Task> SecInvoice(List p_list, List p_ajdlist, List dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) where TDetail : SA_CAN_BASE - + { List _invls = new List(); - var groups1 = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + var groups1 = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV { - PartCode=p.Key.PartCode, + PartCode = p.Key.PartCode, LU = p.Key.LU, Amt = p.Sum(itm => itm.Amt), Qty = p.Sum(itm => itm.Qty), @@ -999,7 +999,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers BeginDate = p.Key.BeginDate, EndDate = p.Key.EndDate }).ToList();//汇总记录不出现重复值 - var groups = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + var groups = dtos.GroupBy(p => new { p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV { PartCode = p.Key.PartCode, LU = p.Key.LU, @@ -1014,7 +1014,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers foreach (var group in groups) { int i = groups1.Count(p => p.LU == group.LU - && p.PartCode==group.PartCode + && p.PartCode == group.PartCode && p.BeginDate == group.BeginDate && p.EndDate == group.EndDate && p.ContractDocID == group.ContractDocID @@ -1053,8 +1053,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers invoiceMap.Add(invoiceBillNum, tempList); var query = from itm in groups1 //更新分组 join itm1 in tempList - on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID ,itm.PartCode} - equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID,itm1.PartCode } into temp + on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID, itm.PartCode } + equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID, itm1.PartCode } into temp from tm in temp where tm == null select new TMEP_INV @@ -1071,7 +1071,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } if (invoiceMap.Count > 0) { - var groupList = new List(); var notDetialList = new List(); var detailList = new List(); @@ -1082,36 +1081,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { var key = group.Key;//发票票号 var ls = group.Value;//发票明细 - - //反向查找结算数据 - var query = from itm in dtos - join itm1 in ls - on new { itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } - join itm2 in p_list on new { itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.PartCode,itm2.PN, itm2.SettleDate } - select itm2; - foreach (var itm in query) - { - itm.InvbillNum = key; - salist.Add(itm); - } + //反向查找结算数据 + var query = from itm in dtos + join itm1 in ls + on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate } + join itm2 in p_list on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } + select itm2; + foreach (var itm in query) + { + itm.InvbillNum = key; + salist.Add(itm); + } if (!string.IsNullOrEmpty(p_parentInvBillNum)) { //反向查找调整数据 var query1 = from itm in dtos - join itm1 in ls - on new { itm.LU,itm.PartCode ,itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } - join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } - select itm2; - + join itm1 in ls + on new { itm.LU, itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.PartCode, itm1.BeginDate, itm1.EndDate } + join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } + select itm2; foreach (var itm in query1) { itm.InvBillNum = key; adjlist.Add(itm); } - } - - List < INVOICE_WAIT_DETAIL > _entityDetailList = new List(); + List _entityDetailList = new List(); foreach (var detail in ls) { _entityDetailList.Add( @@ -1129,7 +1124,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers extend2: string.Empty, beginDate: detail.BeginDate, endDate: detail.EndDate, - partcode:detail.PartCode + partcode: detail.PartCode )); } if (_entityDetailList.Count > 0) @@ -1184,12 +1179,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers ); invlist.Add(invbill); } - - await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(detailList); - if(salist.Count>0) + if (salist.Count > 0) { await _repository.DbContext.BulkUpdateAsync(salist); } @@ -1197,7 +1190,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { await _repository.DbContext.BulkUpdateAsync(adjlist); } - //await _repository.DbContext.BulkInsertAsync(notDetialList); _invls = invlist.Select(p => p.InvbillNum).ToList(); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs index 8daf8064..18f1092f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs @@ -640,8 +640,6 @@ 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 invbill = new INVOICE_GRP (guid: GuidGenerator.Create(), realnvBillNum: string.Empty, 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 7fa06984..3feae13f 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 @@ -107,7 +107,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers groupNum: itm.GroupNum, invGroupNum: billNumber, invbillnum: string.Empty, - partcode: itm.PartCode + partcode: itm.PartCode, + pobillnum:string.Empty ); _entityList.Add(_detailEntity); @@ -145,7 +146,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers groupNum: itm.GroupNum, invGroupNum: billNumber, invbillnum: string.Empty, - partcode: itm.PartCode + partcode: itm.PartCode, + pobillnum: string.Empty ); _entityList.Add(_detailEntity); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs index 9966b222..50f71ddc 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs @@ -112,6 +112,9 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE [Display(Name = "业务类别")] public EnumBusinessType BusinessType { get; set; } + [Display(Name = "订单号")] + public string PoBillNum { get; set; } + /// /// 对应字段DeliveryNode /// @@ -120,7 +123,8 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE public PUB_CAN_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType,string partcode, string groupNum, - string invbillnum + string invbillnum, + string pobillnum ) { InvbillNum=invbillnum; @@ -139,6 +143,7 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE BusinessType = businessType; GroupNum = groupNum; PartCode = partcode; + PoBillNum = pobillnum; } public PUB_CAN_SA_DETAIL() diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs index 9d4b3741..f3a9058b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs @@ -69,8 +69,11 @@ public class PUB_NOT_SA_DETAIL : SA_NOT_BASE public EnumBusinessType BusinessType { get; set; } //[Display(Name = "结算分组")] //public string GroupNum { get; set; } = null!; + [Display(Name ="订单号")] + public string PoBillNum { get; set; } - public PUB_NOT_SA_DETAIL(string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, string extend1, string extend2, string extend3, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType, string groupNum,string partcode) + + public PUB_NOT_SA_DETAIL(string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, string extend1, string extend2, string extend3, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType, string groupNum,string partcode,string pobillnum) { KeyCode = keyCode; Version = version; @@ -88,6 +91,7 @@ public class PUB_NOT_SA_DETAIL : SA_NOT_BASE BusinessType = businessType; GroupNum = groupNum; PartCode = partcode; + PoBillNum = pobillnum; } public PUB_NOT_SA_DETAIL() From ed4aee8ffcbece7917a9f62341853272f2c86705 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 19 Aug 2023 08:54:15 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/components/table/index.js | 14 +++++++------- .../wwwroot/models/input/fa-yun.js | 5 +---- .../wwwroot/views/input/fa-yun.js | 8 +++++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js index b9f5c709..fdf9420e 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js @@ -3,40 +3,40 @@ import { reactive, ref } from "vue"; export default { template: html`
-
+
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js index 4e91019a..a7cea341 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/input/fa-yun.js @@ -312,19 +312,16 @@ const schema2 = { export default function (businessType) { let schema = null; let service = null; - let syncService = null; + const syncService = "hand-se-sync/sync"; if (businessType === "JisBBAC") { schema = schema1; service = "bbac_se_detail_service"; - syncService = "bbacse-sync/invoke"; } else if (businessType === "JisHBPO") { schema = schema1; service = "hbpo_se_detail_service"; - syncService = "hbpose-sync/invoke"; } else { schema = schema2; service = "pub_se_detail_service"; - syncService = "hand-se-sync/sync"; } const queryUrl = `settleaccount/${service}/get-list`; const exportUrl = `settleaccount/${service}/export`; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js index 72f4cc63..6eb00d2e 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/input/fa-yun.js @@ -1,13 +1,15 @@ import AppList from "../../components/list/index.js"; import html from "html"; +import { ref } from "vue"; import { useRoute } from "vue-router"; import useConfig from "../../models/input/fa-yun.js"; import request from "../../request/index.js"; export default { components: { AppList }, - template: html``, + template: html``, setup() { + const appListRef = ref(null); const route = useRoute(); const businessType = route.meta.businessType; const config = useConfig(businessType); @@ -16,9 +18,9 @@ export default { if (item.path === "sync") { const url = config.edit.syncUrl; const method = config.edit.syncMethod; - await request(url, route.meta.businessType, { method }); + await appListRef.value.action(async () => await request(url, route.meta.businessType, { method }), `确认手动同步吗?`); } }; - return { config, onCommand }; + return { appListRef, config, onCommand }; }, }; From b4ca7963a5fc8fafa3ac7e6a641d0af14666541a Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 19 Aug 2023 09:34:47 +0800 Subject: [PATCH 3/8] update --- .../wwwroot/components/table/index.js | 2 +- .../wwwroot/models/settle/commerce.js | 2 +- .../wwwroot/router/business.js | 2 +- .../wwwroot/views/base-data/user.js | 2 +- .../wwwroot/views/settle/_check.js | 13 +++++++++++++ .../wwwroot/views/settle/commerce.js | 17 +++++++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js index fdf9420e..d820c71a 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js @@ -22,7 +22,7 @@ export default {
-
+
@@ -137,13 +156,11 @@ export default { .el-dialog__body { height: calc(100% - 120px); } - /* - .re-open .el-scrollbar, - .re-open .el-scrollbar__view { - height: calc(100% - 120px); - } */ + .cell.diff { + background: yellow; + } `, - props: ["modelValue", "data", "isBusiness"], + props: ["modelValue", "data", "isBusiness", "businessType"], emit: ["update:modelValue"], setup(props, context) { const show = ref(props.modelValue); @@ -156,6 +173,7 @@ export default { adJ_DETAIL: [], }); // + const refreshRef = ref(true); const columns1 = { type: "object", title: "发票和结算分组对应关系", @@ -281,21 +299,23 @@ export default { }, }; const setup2columns = { - lu: { - type: "string", - title: "零件号", - }, - price: { - type: "number", - title: "单价", - }, - qty: { - type: "number", - title: "数量", - }, - amt: { - type: "number", - title: "金额", + properties: { + lu: { + type: "string", + title: "零件号", + }, + price: { + type: "number", + title: "单价", + }, + qty: { + type: "number", + title: "数量", + }, + amt: { + type: "number", + title: "金额", + }, }, }; delete columns5.properties["oldInvBillNum"]; @@ -439,47 +459,103 @@ export default { loading.value = false; } }; + const addDiff = (o, list2, nodeClass, diffClass = "diff") => { + const key = o.querySelector(".lu")?.innerText; + var node = o.querySelector(nodeClass); + var nodeValue = node?.innerText; + var node2 = Array.from(list2) + .find((o) => o.querySelector(".lu").innerText === key) + ?.querySelector(nodeClass); + var nodeValue2 = node2?.innerText; + if (nodeValue !== nodeValue2) { + node?.classList.add(diffClass); + node2?.classList.add(diffClass); + } else { + node?.classList.remove(diffClass); + node2?.classList.remove(diffClass); + } + }; const next = async () => { if (setupRef.value === 1) { try { - setupRef.value += 1; - //处理高亮 - nextTick(() => { - console.log(setup2table1Ref.value); - console.log(setup2table2Ref.value); - const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); - const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); - list1.forEach((o) => { - const key = o.querySelector(".lu").innerText; - var qty = o.querySelector(".qty"); - var qtyValue = qty.innerText; - var qty2 = Array.from(list2).find((o) => o.querySelector(".lu").innerText === key); - var qtyValue2 = qty2?.innerText; - if (qtyValue !== qty2) { - qty.classList.addClass("diff"); - qty2?.addClass("diff"); - } - }); - }); + // setupRef.value += 1; + // return; //临时 + //发到服务的校验 + const result = await request(`settleaccount/adj_service/check-import`, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + adjList.value = result.data.data; + setupRef.value += 1; + //处理高亮 + nextTick(() => { + const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); + const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); + list1.forEach((o) => { + addDiff(o, list2, ".qty"); + addDiff(o, list2, ".amt"); + }); + list2.forEach((o) => { + addDiff(o, list1, ".qty"); + addDiff(o, list1, ".amt"); + }); + }); + } else if (result.data?.code === 400) { + ElMessage({ + type: "error", + message: "校验失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } } catch (e) { console.log(e); } } else if (setupRef.value === 2) { - // const url = "settleaccount/adj_service/check-import"; - // const result = await request(url, adjList.value, { method: "POST" }); - // if (!result.errors) { - // if (result.data?.code === 200) { - // setupRef.value += 1; - // } else if (result.data?.code === 400 && result.data.fileName) { - // window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); - // } - // } - setupRef.value += 1; + let service = null; + if (props.businessType === "JisBBAC") { + service = "bbac_ba_service"; + } else if (bprops.usinessType === "JisHBPO") { + service = "hbpo_ba_service"; + } else { + service = "pub_ba_service"; + } + const url = `settleaccount/${service}}/reissue-invoice-list`; + const result = await request(url, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + //setup3的数据来源 + setup3Model.value = result.data.data; + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "提交失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } + } else if (setupRef.value === 3) { + const url = `settleaccount/${service}}/reissue-invoice-extend`; + const result = await request(url, adjList.value, { method: "POST" }); + if (!result.errors) { + if (result.data?.code === 200) { + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "提交失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); + } + } } else { - setupRef.value += 1; + setupDialogVisable.value = false; + refreshRef.value = false; + nextTick(() => { + refreshRef.value = true; + }); } }; - const submitReOpen = async () => {}; // onMounted(async () => { loading.value = true; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js index 48af9dd5..4b2e75bf 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/commerce.js @@ -9,7 +9,8 @@ import AppCheck from "./_check.js"; export default { components: { AppList, AppCheck }, - template: html` `, + template: html` + `, setup() { const appListRef = ref(null); const visable = ref(false); @@ -69,6 +70,6 @@ export default { } console.log(item.path, item, rows); }; - return { appListRef, config, onCommand, visable, data }; + return { appListRef, config, onCommand, visable, data, businessType }; }, }; From c3b0ec6800035e9b37bca95da0bc73e7d1f5a3af Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 19 Aug 2023 10:52:26 +0800 Subject: [PATCH 7/8] update --- .../SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js index f69831f5..54c5b71a 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js @@ -87,6 +87,7 @@ export default {

发票预览

+
{{setup3Model}}
@@ -330,6 +331,7 @@ export default { const importDialogVisible = ref(false); const setup2table1Ref = ref(null); const setup2table2Ref = ref(null); + const setup3Model = ref(null); const showSetupDialog = () => { //重开发票号 //invBillNum= @@ -604,6 +606,8 @@ export default { next, setup2table1Ref, setup2table2Ref, + refreshRef, + setup3Model, }; }, }; From 2818c26274b3e93ad998b44b29ea1f520e712c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Sat, 19 Aug 2023 11:02:23 +0800 Subject: [PATCH 8/8] =?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/Dtos/INVOICE_GRP_DTO.cs | 4 + .../Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs | 4 + .../Bases/ADJ_SERVICE.cs | 93 ++++++++++++++++--- 3 files changed, 88 insertions(+), 13 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 1a789a81..6e49217f 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 @@ -463,6 +463,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public string LU1 { get; set; } + [Display(Name = "不可结算零件号")] + public string InvBillNum { get; set; } + + //[Display(Name = "不可结算零件号")] //public string LU1 { get; set; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs index 18a55fd1..c96fcb90 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; @@ -42,6 +43,9 @@ public class PUB_ADJ_DETAIL_DTO : EntityDto [Display(Name = "键值")] public string KeyCode { get; set; } + [Display(Name = "价格")] + public string Price { get; set; } + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs index 12d2d490..1f41e39f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs @@ -1,15 +1,18 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Linq.Dynamic.Core; using System.Text; using System.Threading.Tasks; using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Office2010.Excel; +using DocumentFormat.OpenXml.Wordprocessing; using EFCore.BulkExtensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using SettleAccount.Bases; using SettleAccount.Domain.BQ; using Volo.Abp; @@ -22,10 +25,12 @@ 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.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; +using static System.Runtime.CompilerServices.RuntimeHelpers; namespace Win.Sfs.SettleAccount.Bases; /// @@ -42,6 +47,8 @@ public class ADJ_SERVICE : BASE_SERVICE protected readonly INormalEfCoreRepository _bbacRepository; protected readonly INormalEfCoreRepository _pubRepository; protected readonly INormalEfCoreRepository _hbpoRepository; + protected readonly INormalEfCoreRepository _priceRepository; + protected readonly INormalEfCoreRepository _pricebjRepository; public ADJ_SERVICE( @@ -54,7 +61,9 @@ public class ADJ_SERVICE : BASE_SERVICE INormalEfCoreRepository relRepository, INormalEfCoreRepository bbacRepository, INormalEfCoreRepository pubRepository, - INormalEfCoreRepository hbpoRepository + INormalEfCoreRepository hbpoRepository, + INormalEfCoreRepository priceRepository, + INormalEfCoreRepository pricebjRepository ) : base(excelImportService, snowflakeIdGenerator, commonManager) @@ -65,7 +74,9 @@ public class ADJ_SERVICE : BASE_SERVICE _baseDomainService = baseDomainService; _bbacRepository = bbacRepository; _pubRepository = pubRepository; - _hbpoRepository= hbpoRepository; + _hbpoRepository = hbpoRepository; + _priceRepository = priceRepository; + _pricebjRepository = pricebjRepository; } /// ///查询明细 @@ -73,7 +84,7 @@ public class ADJ_SERVICE : BASE_SERVICE /// 明细查询条件 /// [HttpPost] - + public virtual async Task> DetailQueryAsync(PUB_ADJ_DETAIL_REQ_DTO input) { var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); @@ -193,11 +204,11 @@ public class ADJ_SERVICE : BASE_SERVICE { itm.KeyCode = itm.PN + itm.LU.Replace(" ", "").Trim(); } - var pnlist=p_list.Select(p => p.PN).Distinct(); - + var pnlist = p_list.Select(p => p.PN).Distinct(); + int flag = 0; var keylist = p_list.Select(p => p.KeyCode).Distinct(); List errorList = new List(); - var first=p_list.FirstOrDefault(); + var first = p_list.FirstOrDefault(); if (first != null) { var inv = _invRepository.Where(p => p.InvbillNum == first.InvBillNum).FirstOrDefault(); @@ -228,6 +239,7 @@ public class ADJ_SERVICE : BASE_SERVICE } break; case EnumBusinessType.BeiJian: + flag = 1; var errors3 = _pubRepository.Where(p => pnlist.Contains(p.PN)); foreach (var p in errors3) { @@ -238,18 +250,18 @@ public class ADJ_SERVICE : BASE_SERVICE var errors4 = _bbacRepository.Where(p => keylist.Contains(p.KeyCode)); foreach (var p in errors4) { - errorList.Add(new ERR_EXP_DTO() {Message=$"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" }); + errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" }); } break; case EnumBusinessType.JisHBPO: - var errors5=_hbpoRepository.Where(p => keylist.Contains(p.KeyCode)); + var errors5 = _hbpoRepository.Where(p => keylist.Contains(p.KeyCode)); foreach (var p in errors5) { errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在生产码{p.PN}结算零件{p.PartCode},不能导入调整表" }); } break; case EnumBusinessType.YinDuJian: - var errors6=_pubRepository.Where(p => pnlist.Contains(p.PN)); + var errors6 = _pubRepository.Where(p => pnlist.Contains(p.PN)); foreach (var p in errors6) { errorList.Add(new ERR_EXP_DTO() { Message = $"不能结算数据中存在发货单{p.PN}数据,不能导入调整表" }); @@ -259,7 +271,7 @@ public class ADJ_SERVICE : BASE_SERVICE } } - + var entityList = ObjectMapper.Map, List>(p_list); var codelist = entityList.Select(p => p.LU).ToList(); var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true }); @@ -279,10 +291,65 @@ public class ADJ_SERVICE : BASE_SERVICE if (errorList.Count > 0) { return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = await ExportErrorReportAsync(errorList) }); - + + } + List ls = new List(); + if (flag == 1) + { + var pricebjlist = _pricebjRepository.ToList(); + + + var inner = from d in p_list + join p in pricebjlist on d.LU equals p.LU + where + d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate + select + new PUB_ADJ_DETAIL_DTO() + { + InvBillNum = d.InvBillNum, + SettleDate = d.SettleDate, + LU = d.LU, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + KeyCode = d.KeyCode, + Price = d.Price, + }; + + ls = inner.ToList(); + } + else + { + var pricelist = _priceRepository.ToList(); + + + var inner = from d in p_list + join p in pricelist on d.LU equals p.LU + where + d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select new PUB_ADJ_DETAIL_DTO() + { + InvBillNum = d.InvBillNum, + SettleDate = d.SettleDate, + LU = d.LU, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + KeyCode = d.KeyCode, + Price = d.Price, + }; + ls = inner.ToList(); + } - - return new JsonResult(new { Code = 200, Message = "校验成功" }); ; + + + + + + + + + return new JsonResult(new { Code = 200, Message =ls }); ; } }