客户对账拓展业务查询

usertest
ZR20090193-陈敬勇 6 months ago
parent c321a798c4
commit 11406ea952

@ -9,9 +9,14 @@ public class PageRequest
/// 查询条件
/// </summary>
public string QueryCondition { get; set; }
/// <summary>
/// 其他查询条件
/// </summary>
public string OtherQueryCondition { get; set; }
/// <summary>
/// 分页排序条件
/// </summary>
public PageCondition PageCondition { get; set; }
}

@ -57,7 +57,7 @@ public class CheckBillController : ApiController
/// <returns></returns>
[HttpPost]
[Route("GetCheckBillList")]
public DataResult<List<CheckBillRes>> GetCheckBillList([FromBody] PageRequest request)
public DataResult<List<CheckBillSumRes>> GetCheckBillList([FromBody] PageRequest request)
{
var res = _invokeService.GetCheckBillList(request);
return res;

@ -80,5 +80,40 @@ namespace DS.WMS.Core.Check.Dtos
/// USD未付
/// </summary>
public decimal? BALUSDCR { get; set; } = 0;
/// <summary>
/// 对账时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 对账人Id
/// </summary>
public long CreateBy { get; set; }
/// <summary>
/// 对账人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 船名 t_code_vessel
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 船名Id t_code_vessel
/// </summary>
public long VesselId { get; set; }
/// <summary>
/// 航次
/// </summary>
public string Voyno { get; set; }
}
}

@ -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
{
/// <summary>
/// 客户对账列表合计数据
/// </summary>
public class CheckBillSumRes
{
/// <summary>
///
/// </summary>
public long Id { get; set; }
public string BillNo { get; set; }
/// <summary>
/// 对账单名称
/// </summary>
public string BillName { get; set; }
/// <summary>
/// 收付类型收、付0 全部 1应收 2 应付
/// </summary>
public int BillType { get; set; }
/// <summary>
/// 对账客户Id
/// </summary>
public long CustomerId { get; set; }
/// <summary>
/// 对账客户名称 t_info_client CUSTNAME
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// Desc:账单状态 是否锁定
/// </summary>
public bool? IsLocking { get; set; } = false;
/// <summary>
/// Desc:是否不含税
/// </summary>
public bool? IsNoTax { get; set; } = false;
/// <summary>
/// RMB应收
/// </summary>
public decimal? RMBDR { get; set; } = 0;
/// <summary>
/// RMB应付
/// </summary>
public decimal? RMBCR { get; set; } = 0;
/// <summary>
/// USD应收
/// </summary>
public decimal? USDDR { get; set; } = 0;
/// <summary>
/// USD应付
/// </summary>
public decimal? USDCR { get; set; } = 0;
/// <summary>
/// RMB未收
/// </summary>
public decimal? BALRMBDR { get; set; } = 0;
/// <summary>
/// RMB未付
/// </summary>
public decimal? BALRMBCR { get; set; } = 0;
/// <summary>
/// USD未收
/// </summary>
public decimal? BALUSDDR { get; set; } = 0;
/// <summary>
/// USD未付
/// </summary>
public decimal? BALUSDCR { get; set; } = 0;
/// <summary>
/// 对账时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 对账人Id
/// </summary>
public long CreateBy { get; set; }
/// <summary>
/// 对账人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
}

@ -17,7 +17,7 @@ namespace DS.WMS.Core.Check.Interface
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<CheckBillRes>> GetCheckBillList(PageRequest request);
public DataResult<List<CheckBillSumRes>> GetCheckBillList(PageRequest request);
/// <summary>

@ -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<List<VW_CheckBill_Detail>> GetBusinessQueryList(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var users = db.Queryable<SysUser>().Select(x => new { x.Id, x.UserName }).ToList();
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<VW_CheckBill_Detail>()
.Where(whereList).ToQueryPage(request.PageCondition);
var otherConditons = new List<IConditionalModel>();
if (request.OtherQueryCondition.IsNotNull())
otherConditons = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.OtherQueryCondition);
var queryData = tenantDb.Queryable<VW_CheckBill_Detail>()
.Where(whereList);
if (otherConditons.Count > 0)
{
var businessIds = tenantDb.Queryable<FeeRecord>().Where(otherConditons).Select(x => x.BusinessId).Distinct().ToList();
queryData = queryData.Where(x => businessIds.Contains(x.Id));
}
var data = queryData.ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
@ -81,31 +94,64 @@ namespace DS.WMS.Core.Check.Method
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<CheckBillRes>> GetCheckBillList(PageRequest request)
public DataResult<List<CheckBillSumRes>> GetCheckBillList(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var users = db.Queryable<SysUser>().Select(x => new { x.Id, x.UserName }).ToList();
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<CheckBill>()
//.LeftJoin<VW_CheckBill_Bussiness>((a,b)=>a.Id == b.CheckId)
var otherConditons = new List<IConditionalModel>();
if (request.OtherQueryCondition.IsNotNull())
otherConditons = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.OtherQueryCondition);
var queryData = tenantDb.Queryable<CheckBill>()
.Where(whereList)
.Select<CheckBillRes>()
.Mapper(it =>
{
var checkBillDetails = tenantDb.Queryable<VW_CheckBill_Business>().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<CheckBillSumRes>();
if (otherConditons.Count > 0)
{
var checkIds = tenantDb.Queryable<VW_CheckBill_Business>().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<VW_CheckBill_Business>().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<CheckBill>()
// //.LeftJoin<VW_CheckBill_Business>((a,b)=>a.Id == b.CheckId)
// //.Select<CheckBillRes>()
// .Where(whereList)
// .Select<CheckBillSumRes>()
// .Mapper(it =>
// {
// var checkBillDetails = tenantDb.Queryable<VW_CheckBill_Business>().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;
}
/// <summary>
/// 详情
@ -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<CheckBillFeeRecords>();
var feeIds = tenantDb.Queryable<CheckBillFeeRecords>().Where(x => x.CheckId == checkId ).Select(x => x.FeeRecordId).ToList();
var feeIds = tenantDb.Queryable<CheckBillFeeRecords>().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<FeeRecord>().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<CheckBill>().Where(x=> req.Ids.Contains(x.Id) && x.IsLocking == true).Any())
if (tenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains(x.Id) && x.IsLocking == true).Any())
return DataResult.Failed("存在已锁定的客户对账信息");
var list = tenantDb.Queryable<CheckBill>().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();

@ -181,6 +181,11 @@ namespace DS.WMS.Core.Check.View
/// </summary>
public string InspectionNo { get; set; }
/// <summary>
/// Desc:创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// Desc:创建人
/// </summary>

Loading…
Cancel
Save