diff --git a/ds-wms-service/DS.Module.Core/PageQuery/PageRequest.cs b/ds-wms-service/DS.Module.Core/PageQuery/PageRequest.cs index 44a2c250..96cca9ff 100644 --- a/ds-wms-service/DS.Module.Core/PageQuery/PageRequest.cs +++ b/ds-wms-service/DS.Module.Core/PageQuery/PageRequest.cs @@ -9,9 +9,14 @@ public class PageRequest /// 查询条件 /// public string QueryCondition { get; set; } - + /// + /// 其他查询条件 + /// + public string OtherQueryCondition { get; set; } /// /// 分页排序条件 /// public PageCondition PageCondition { get; set; } + + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs index dba00dc6..b5797f7a 100644 --- a/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs +++ b/ds-wms-service/DS.WMS.CheckApi/Controllers/CheckBillController.cs @@ -57,7 +57,7 @@ public class CheckBillController : ApiController /// [HttpPost] [Route("GetCheckBillList")] - public DataResult> GetCheckBillList([FromBody] PageRequest request) + public DataResult> GetCheckBillList([FromBody] PageRequest request) { var res = _invokeService.GetCheckBillList(request); return res; diff --git a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillRes.cs b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillRes.cs index f9bf9f10..856a6a7e 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillRes.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillRes.cs @@ -80,5 +80,40 @@ namespace DS.WMS.Core.Check.Dtos /// USD未付 /// public decimal? BALUSDCR { get; set; } = 0; + + /// + /// 对账时间 + /// + + public DateTime CreateTime { get; set; } + + /// + /// 对账人Id + /// + + public long CreateBy { get; set; } + /// + /// 对账人 + /// + + public string CreateByName { get; set; } + /// + /// 备注 + /// + public string Note { get; set; } = ""; + + /// + /// 船名 t_code_vessel + /// + public string Vessel { get; set; } + + /// + /// 船名Id t_code_vessel + /// + public long VesselId { get; set; } + /// + /// 航次 + /// + public string Voyno { 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 new file mode 100644 index 00000000..b2f89e12 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Check/Dtos/CheckBillSumRes.cs @@ -0,0 +1,105 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Check.Dtos +{ + /// + /// 客户对账列表合计数据 + /// + public class CheckBillSumRes + { + /// + /// + /// + public long Id { get; set; } + + public string BillNo { get; set; } + /// + /// 对账单名称 + /// + public string BillName { get; set; } + + /// + /// 收付类型(收、付)0 全部 1应收 2 应付 + /// + public int BillType { get; set; } + /// + /// 对账客户Id + /// + public long CustomerId { get; set; } + /// + /// 对账客户名称 t_info_client CUSTNAME + /// + public string CustomerName { get; set; } + + /// + /// Desc:账单状态 是否锁定 + /// + public bool? IsLocking { get; set; } = false; + + /// + /// Desc:是否不含税 + /// + public bool? IsNoTax { get; set; } = false; + + + /// + /// RMB应收 + /// + public decimal? RMBDR { get; set; } = 0; + /// + /// RMB应付 + /// + public decimal? RMBCR { get; set; } = 0; + /// + /// USD应收 + /// + public decimal? USDDR { get; set; } = 0; + /// + /// USD应付 + /// + public decimal? USDCR { get; set; } = 0; + + /// + /// RMB未收 + /// + public decimal? BALRMBDR { get; set; } = 0; + /// + /// RMB未付 + /// + public decimal? BALRMBCR { get; set; } = 0; + /// + /// USD未收 + /// + public decimal? BALUSDDR { get; set; } = 0; + /// + /// USD未付 + /// + public decimal? BALUSDCR { get; set; } = 0; + + /// + /// 对账时间 + /// + + public DateTime CreateTime { get; set; } + + /// + /// 对账人Id + /// + + public long CreateBy { get; set; } + /// + /// 对账人 + /// + + public string CreateByName { get; set; } + /// + /// 备注 + /// + public string Note { 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 785a1af0..b122697b 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 DataResult> GetCheckBillList(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 e5e24f11..086ed929 100644 --- a/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs +++ b/ds-wms-service/DS.WMS.Core/Check/Method/CheckBillService.cs @@ -14,6 +14,7 @@ using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Op.Dtos; using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Method; using Mapster; @@ -50,11 +51,23 @@ namespace DS.WMS.Core.Check.Method public DataResult> GetBusinessQueryList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - + var users = db.Queryable().Select(x => new { x.Id, x.UserName }).ToList(); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() - .Where(whereList).ToQueryPage(request.PageCondition); + + var otherConditons = new List(); + if (request.OtherQueryCondition.IsNotNull()) + otherConditons = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.OtherQueryCondition); + + var queryData = tenantDb.Queryable() + .Where(whereList); + if (otherConditons.Count > 0) + { + var businessIds = tenantDb.Queryable().Where(otherConditons).Select(x => x.BusinessId).Distinct().ToList(); + + queryData = queryData.Where(x => businessIds.Contains(x.Id)); + } + var data = queryData.ToQueryPage(request.PageCondition); return data; } /// @@ -81,31 +94,64 @@ namespace DS.WMS.Core.Check.Method /// /// /// - public DataResult> GetCheckBillList(PageRequest request) + public DataResult> GetCheckBillList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - + var users = db.Queryable().Select(x => new { x.Id, x.UserName }).ToList(); //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() - //.LeftJoin((a,b)=>a.Id == b.CheckId) + + var otherConditons = new List(); + if (request.OtherQueryCondition.IsNotNull()) + otherConditons = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.OtherQueryCondition); + + var queryData = tenantDb.Queryable() .Where(whereList) - .Select() - .Mapper(it => - { - var checkBillDetails = tenantDb.Queryable().Where(x => x.CheckId == it.Id).ToList(); - it.RMBDR = checkBillDetails.Sum(x => x.RMBDR); - it.RMBCR = checkBillDetails.Sum(x => x.RMBCR); - it.USDDR = checkBillDetails.Sum(x => x.USDDR); - it.USDCR = checkBillDetails.Sum(x => x.USDCR); - it.BALRMBDR = checkBillDetails.Sum(x => x.BALRMBDR); - it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR); - it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR); - it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR); - } - ) - .ToQueryPage(request.PageCondition); + .Select(); + if (otherConditons.Count > 0) + { + var checkIds = tenantDb.Queryable().Where(otherConditons).Select(x => x.CheckId).Distinct().ToList(); + + queryData = queryData.Where(x => checkIds.Contains(x.Id)); + } + + var data = 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.RMBDR = checkBillDetails.Sum(x => x.RMBDR); + it.RMBCR = checkBillDetails.Sum(x => x.RMBCR); + it.USDDR = checkBillDetails.Sum(x => x.USDDR); + it.USDCR = checkBillDetails.Sum(x => x.USDCR); + it.BALRMBDR = checkBillDetails.Sum(x => x.BALRMBDR); + it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR); + it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR); + it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR); + } + ) + .ToQueryPage(request.PageCondition); return data; + //var data = tenantDb.Queryable() + // //.LeftJoin((a,b)=>a.Id == b.CheckId) + // //.Select() + // .Where(whereList) + // .Select() + // .Mapper(it => + // { + // var checkBillDetails = tenantDb.Queryable().Where(x => x.CheckId == it.Id).ToList(); + // 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); + // it.USDCR = checkBillDetails.Sum(x => x.USDCR); + // it.BALRMBDR = checkBillDetails.Sum(x => x.BALRMBDR); + // it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR); + // it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR); + // it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR); + // } + // ) + // .ToQueryPage(request.PageCondition); + //return data; } /// /// 详情 @@ -371,7 +417,7 @@ namespace DS.WMS.Core.Check.Method } tenantDb.Insertable(businessList).ExecuteCommand(); tenantDb.Insertable(feeList).ExecuteCommand(); - } + } return DataResult.Successed("添加成功!", MultiLanguageConst.DataUpdateSuccess); } @@ -398,7 +444,7 @@ namespace DS.WMS.Core.Check.Method return DataResult.Failed("客户对账信息已锁定"); var feeList = new List(); - var feeIds = tenantDb.Queryable().Where(x => x.CheckId == checkId ).Select(x => x.FeeRecordId).ToList(); + var feeIds = tenantDb.Queryable().Where(x => x.CheckId == checkId).Select(x => x.FeeRecordId).ToList(); var addFeeIds = req.Ids.AsQueryable().Except(feeIds); @@ -406,7 +452,7 @@ namespace DS.WMS.Core.Check.Method { foreach (var item in addFeeIds) - { + { var feeRecords = tenantDb.Queryable().Where(x => x.Id == item).ToList(); foreach (var record in feeRecords) { @@ -418,7 +464,7 @@ namespace DS.WMS.Core.Check.Method CheckBillAmount = record.Amount, }); } - } + } tenantDb.Insertable(feeList).ExecuteCommand(); } return DataResult.Successed("添加成功!", MultiLanguageConst.DataUpdateSuccess); @@ -432,17 +478,18 @@ namespace DS.WMS.Core.Check.Method public DataResult CheckBillLocking(IdModel req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - if (req.Ids.Length==0) + if (req.Ids.Length == 0) return DataResult.Failed("业务Ids不能为空"); - if (tenantDb.Queryable().Where(x=> req.Ids.Contains(x.Id) && x.IsLocking == true).Any()) + if (tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id) && x.IsLocking == true).Any()) return DataResult.Failed("存在已锁定的客户对账信息"); var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); //tenantDb.Updateable(list).SetColumns(it=>it.IsLocking == true).ExecuteCommand(); - foreach (var item in list) { + foreach (var item in list) + { item.IsLocking = true; } tenantDb.Updateable(list).ExecuteCommand(); diff --git a/ds-wms-service/DS.WMS.Core/Check/View/VW_CheckBill_Detail.cs b/ds-wms-service/DS.WMS.Core/Check/View/VW_CheckBill_Detail.cs index c989176e..ebbdd814 100644 --- a/ds-wms-service/DS.WMS.Core/Check/View/VW_CheckBill_Detail.cs +++ b/ds-wms-service/DS.WMS.Core/Check/View/VW_CheckBill_Detail.cs @@ -181,6 +181,11 @@ namespace DS.WMS.Core.Check.View /// public string InspectionNo { get; set; } + + /// + /// Desc:创建时间 + /// + public DateTime CreateTime { get; set; } /// /// Desc:创建人 ///