From e7a8c804703bec40d3d74c4cae7534a5197e4d63 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 23 Jul 2024 18:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=AF=B9=E8=B4=A6=E5=90=88?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CheckBillController.cs | 8 +- .../Check/Dtos/CheckBillBusinessRes.cs | 30 ++++++ .../DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs | 93 ++++++++++++++-- .../Check/Dtos/CheckBillTotalRes.cs | 101 ++++++++++++++++++ .../Check/Interface/ICheckBillService.cs | 4 +- .../Check/Method/CheckBillService.cs | 99 ++++++++++++++--- 6 files changed, 304 insertions(+), 31 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs create mode 100644 ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs diff --git a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs index 63e8363f..537930b1 100644 --- a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs +++ b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs @@ -57,9 +57,9 @@ public class CheckBillController : ApiController /// [HttpPost] [Route("GetCheckBillList")] - public DataResult> GetCheckBillList([FromBody] PageRequest request) + public async Task> GetCheckBillList([FromBody] PageRequest request) { - var res = _invokeService.GetCheckBillList(request); + var res = await _invokeService.GetCheckBillList(request); return res; } /// @@ -93,9 +93,9 @@ public class CheckBillController : ApiController /// [HttpPost] [Route("GetCheckBillBusinessList")] - public DataResult> GetCheckBillBusinessList([FromBody] PageRequest request) + public async Task> GetCheckBillBusinessList([FromBody] PageRequest request) { - var res = _invokeService.GetCheckBillBusinessList(request); + var res = await _invokeService.GetCheckBillBusinessList(request); return res; } diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs new file mode 100644 index 00000000..701003af --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillBusinessRes.cs @@ -0,0 +1,30 @@ +using DS.WMS.Core.Check.View; +using DS.WMS.Core.Op.Dtos; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Check.Dtos +{ + /// + /// 客户对账业务明细 + /// + public class CheckBillBusinessRes + { + /// + /// 列表数据 + /// + public List List { get; set; } + + /// + /// 合计数 + /// + public int TotalCount { get; set; } + /// + /// 合计信息 + /// + public CheckBillTotalRes DataTotal { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs index b2f89e12..dadcabd0 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using DS.WMS.Core.Op.Dtos; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -50,37 +51,88 @@ namespace DS.WMS.Core.Check.Dtos /// /// RMB应收 /// - public decimal? RMBDR { get; set; } = 0; + public decimal RMBDR { get; set; } = 0; /// /// RMB应付 /// - public decimal? RMBCR { get; set; } = 0; + public decimal RMBCR { get; set; } = 0; /// /// USD应收 /// - public decimal? USDDR { get; set; } = 0; + public decimal USDDR { get; set; } = 0; /// /// USD应付 /// - public decimal? USDCR { get; set; } = 0; + public decimal USDCR { get; set; } = 0; /// /// RMB未收 /// - public decimal? BALRMBDR { get; set; } = 0; + public decimal BALRMBDR { get; set; } = 0; /// /// RMB未付 /// - public decimal? BALRMBCR { get; set; } = 0; + public decimal BALRMBCR { get; set; } = 0; /// /// USD未收 /// - public decimal? BALUSDDR { get; set; } = 0; + public decimal BALUSDDR { get; set; } = 0; /// /// USD未付 /// - public decimal? BALUSDCR { get; set; } = 0; + public decimal BALUSDCR { get; set; } = 0; + /// + /// 其他应收 + /// + public decimal OtherDR { get; set; } + /// + /// 其他应付 + /// + public decimal OtherCR { get; set; } + + + /// + /// 其他未收 + /// + public decimal BALOtherDR { get; set; } + /// + /// 其他未付 + /// + public decimal BALOtherCR { get; set; } + + /// + /// TTL应收 + /// + public decimal TTLDR { get; set; } + /// + /// TTL应付 + /// + public decimal TTLCR { get; set; } + /// + /// TTL未收 + /// + public decimal BALTTLDR { get; set; } + /// + /// TTL未付 + /// + public decimal BALTTLCR { get; set; } + /// + /// 开票RMB应收 + /// + public decimal OrderInvoiceRMBDR { get; set; } + /// + /// 开票USD应收 + /// + public decimal OrderInvoiceUSDDR { get; set; } + /// + /// 订单金额RMB应付 + /// + public decimal OrderAmountRMBCR { get; set; } + /// + /// 订单金额USD应付 + /// + public decimal OrderAmountUSDCR { get; set; } /// /// 对账时间 /// @@ -96,10 +148,31 @@ namespace DS.WMS.Core.Check.Dtos /// 对账人 /// - public string CreateByName { get; set; } + public string CreateUserName { get; set; } /// /// 备注 /// public string Note { get; set; } = ""; } + + /// + /// 客户对账列表返回 + /// + public class CheckBillListRes + { + /// + /// 列表数据 + /// + public List List { get; set; } + + /// + /// 合计数 + /// + public int TotalCount { get; set; } + /// + /// 合计信息 + /// + public CheckBillTotalRes DataTotal { get; set; } + + } } diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs new file mode 100644 index 00000000..95eaabe1 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillTotalRes.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Check.Dtos +{ + /// + /// 客户对账列表合计 + /// + public class CheckBillTotalRes + { + /// + /// RMB应收 + /// + public decimal RMBDR { get; set; } + /// + /// RMB应付 + /// + public decimal RMBCR { get; set; } + + /// + /// USD应收 + /// + public decimal USDDR { get; set; } + /// + /// USD应付 + /// + public decimal USDCR { get; set; } + + /// + /// RMB未收 + /// + public decimal BALRMBDR { get; set; } + /// + /// RMB未付 + /// + public decimal BALRMBCR { get; set; } + + /// + /// USD未收 + /// + public decimal BALUSDDR { get; set; } + /// + /// USD未付 + /// + public decimal BALUSDCR { get; set; } + /// + /// 其他应收 + /// + public decimal OtherDR { get; set; } + /// + /// 其他应付 + /// + public decimal OtherCR { get; set; } + + + /// + /// 其他未收 + /// + public decimal BALOtherDR { get; set; } + /// + /// 其他未付 + /// + public decimal BALOtherCR { get; set; } + + /// + /// TTL应收 + /// + public decimal TTLDR { get; set; } + /// + /// TTL应付 + /// + public decimal TTLCR { get; set; } + /// + /// TTL未收 + /// + public decimal BALTTLDR { get; set; } + /// + /// TTL未付 + /// + public decimal BALTTLCR { get; set; } + /// + /// 开票RMB应收 + /// + public decimal OrderInvoiceRMBDR { get; set; } + /// + /// 开票USD应收 + /// + public decimal OrderInvoiceUSDDR { get; set; } + /// + /// 订单金额RMB应付 + /// + public decimal OrderAmountRMBCR { get; set; } + /// + /// 订单金额USD应付 + /// + public decimal OrderAmountUSDCR { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs b/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs index d096ee5b..4fce7077 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Interface/ICheckBillService.cs @@ -17,7 +17,7 @@ namespace DS.WMS.Core.Check.Interface /// /// /// - public DataResult> GetCheckBillList(PageRequest request); + public Task> GetCheckBillList(PageRequest request); /// @@ -31,7 +31,7 @@ namespace DS.WMS.Core.Check.Interface /// /// /// - public DataResult> GetCheckBillBusinessList(PageRequest request); + public Task> GetCheckBillBusinessList(PageRequest request); /// /// 客户对账明细对应费用列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs b/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs index 54f179e3..5a7a534a 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs @@ -18,6 +18,7 @@ using DS.WMS.Core.Op.View; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Method; +using LanguageExt.Common; using Mapster; using Microsoft.Extensions.DependencyInjection; using SqlSugar; @@ -86,16 +87,13 @@ namespace DS.WMS.Core.Check.Method .Where(whereList).Select() .ToQueryPage(request.PageCondition); return data; - } - - - + } /// /// 客户对账列表 /// /// /// - public DataResult> GetCheckBillList(PageRequest request) + public async Task> GetCheckBillList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var users = db.Queryable().Select(x => new { x.Id, x.UserName }).ToList(); @@ -116,10 +114,10 @@ namespace DS.WMS.Core.Check.Method queryData = queryData.Where(x => checkIds.Contains(x.Id)); } - var data = queryData.Mapper(it => + var result = queryData.Mapper(it => { var checkBillDetails = tenantDb.Queryable().Where(x => x.CheckId == it.Id).ToList(); - it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName; + //it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName; it.RMBDR = checkBillDetails.Sum(x => x.RMBDR); it.RMBCR = checkBillDetails.Sum(x => x.RMBCR); it.USDDR = checkBillDetails.Sum(x => x.USDDR); @@ -128,10 +126,52 @@ namespace DS.WMS.Core.Check.Method it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR); it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR); it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR); + it.OtherDR = checkBillDetails.Sum(x => x.OtherDR); + it.OtherCR = checkBillDetails.Sum(x => x.OtherCR); + it.BALOtherDR = checkBillDetails.Sum(x => x.BALOtherDR); + it.TTLDR = checkBillDetails.Sum(x => x.TTLDR); + it.TTLCR = checkBillDetails.Sum(x => x.TTLCR); + it.BALTTLDR = checkBillDetails.Sum(x => x.BALTTLDR); + it.BALTTLCR = checkBillDetails.Sum(x => x.BALTTLCR); + it.OrderInvoiceRMBDR = checkBillDetails.Sum(x => x.OrderInvoiceRMBDR); + it.OrderInvoiceUSDDR = checkBillDetails.Sum(x => x.OrderInvoiceUSDDR); + it.OrderAmountRMBCR = checkBillDetails.Sum(x => x.OrderAmountRMBCR); + it.OrderAmountUSDCR = checkBillDetails.Sum(x => x.OrderAmountUSDCR); } - ) - .ToQueryPage(request.PageCondition); - return data; + ); + var list = result.ToList(); + var data = await result.ToQueryPageAsync(request.PageCondition); + var totalData = new CheckBillTotalRes() + { + RMBDR = list.Sum(x => x.RMBDR), + RMBCR = list.Sum(x => x.RMBCR), + USDDR = list.Sum(x => x.USDDR), + USDCR = list.Sum(x => x.USDCR), + BALRMBDR = list.Sum(x => x.BALRMBDR), + BALRMBCR = list.Sum(x => x.BALRMBCR), + BALUSDDR = list.Sum(x => x.BALUSDDR), + BALUSDCR = list.Sum(x => x.BALUSDCR), + OtherDR = list.Sum(x => x.OtherDR), + OtherCR = list.Sum(x => x.OtherCR), + BALOtherDR = list.Sum(x => x.BALOtherDR), + TTLDR = list.Sum(x => x.TTLDR), + TTLCR = list.Sum(x => x.TTLCR), + BALTTLDR = list.Sum(x => x.BALTTLDR), + BALTTLCR = list.Sum(x => x.BALTTLCR), + OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR), + OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR), + OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR), + OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR), + }; + var res = new CheckBillListRes() + { + List = data.Data, + TotalCount = list.Count(), + DataTotal = totalData + }; + return await Task.FromResult(DataResult.Success(res, MultiLanguageConst.DataQuerySuccess)); + //.ToQueryPage(request.PageCondition); + //return data; } /// /// 详情 @@ -153,16 +193,45 @@ namespace DS.WMS.Core.Check.Method /// /// /// - public DataResult> GetCheckBillBusinessList(PageRequest request) + public async Task> GetCheckBillBusinessList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() - .Where(whereList) - .ToQueryPage(request.PageCondition); - return data; + var result = tenantDb.Queryable() + .Where(whereList); + var list = result.ToList(); + var data = await result.ToQueryPageAsync(request.PageCondition); + var totalData = new CheckBillTotalRes() + { + RMBDR = list.Sum(x => x.RMBDR), + RMBCR = list.Sum(x => x.RMBCR), + USDDR = list.Sum(x => x.USDDR), + USDCR = list.Sum(x => x.USDCR), + BALRMBDR = list.Sum(x => x.BALRMBDR), + BALRMBCR = list.Sum(x => x.BALRMBCR), + BALUSDDR = list.Sum(x => x.BALUSDDR), + BALUSDCR = list.Sum(x => x.BALUSDCR), + OtherDR = list.Sum(x => x.OtherDR), + OtherCR = list.Sum(x => x.OtherCR), + BALOtherDR = list.Sum(x => x.BALOtherDR), + TTLDR = list.Sum(x => x.TTLDR), + TTLCR = list.Sum(x => x.TTLCR), + BALTTLDR = list.Sum(x => x.BALTTLDR), + BALTTLCR = list.Sum(x => x.BALTTLCR), + OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR), + OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR), + OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR), + OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR), + }; + var res = new CheckBillBusinessRes() + { + List = data.Data, + TotalCount = list.Count(), + DataTotal = totalData + }; + return await Task.FromResult(DataResult.Success(res, MultiLanguageConst.DataQuerySuccess)); } ///