发票开出相关类的签入

usertest
嵇文龙 5 months ago
parent 5870172a0b
commit a38309c4f6

@ -5,7 +5,7 @@ namespace DS.Module.Core.Enums
/// <summary> /// <summary>
/// 费用明细类别 /// 费用明细类别
/// </summary> /// </summary>
public enum FeeCategory public enum DetailCategory
{ {
/// <summary> /// <summary>
/// 付费申请结算 /// 付费申请结算
@ -62,51 +62,4 @@ namespace DS.Module.Core.Enums
ChargeApplicationSettlement = 9 ChargeApplicationSettlement = 9
} }
/// <summary>
/// 发票类别
/// </summary>
public enum InvoiceCategory
{
/// <summary>
/// 电子发票
/// </summary>
[Description("电子发票")]
Electronic = 0,
/// <summary>
/// 纸质发票
/// </summary>
[Description("纸质发票")]
Paper = 1
}
/// <summary>
/// 推送方式
/// </summary>
public enum PushMode
{
/// <summary>
/// 不推送
/// </summary>
[Description("不推送")]
Disabled = 0,
/// <summary>
/// 电子邮件
/// </summary>
[Description("电子邮件")]
Email = 1,
/// <summary>
/// 短信
/// </summary>
[Description("短信")]
SMS = 2,
/// <summary>
/// 微信
/// </summary>
[Description("微信")]
Wechat = 3
}
} }

@ -0,0 +1,86 @@
using System.ComponentModel;
namespace DS.Module.Core.Enums
{
/// <summary>
/// 发票类别
/// </summary>
public enum InvoiceCategory
{
/// <summary>
/// 电子发票
/// </summary>
[Description("电子发票")]
Electronic = 0,
/// <summary>
/// 纸质发票
/// </summary>
[Description("纸质发票")]
Paper = 1
}
/// <summary>
/// 开票方式
/// </summary>
public enum InvoiceType
{
/// <summary>
/// 自由发票
/// </summary>
[Description("自由发票")]
Free = 1,
/// <summary>
/// 申请发票
/// </summary>
[Description("申请发票")]
Applcation = 2,
}
/// <summary>
/// 发票接口类型
/// </summary>
public enum InvoiceApiType
{
/// <summary>
/// 诺诺
/// </summary>
NuoNuo,
/// <summary>
/// 航信
/// </summary>
Hangxin,
}
/// <summary>
/// 推送方式
/// </summary>
public enum PushMode
{
/// <summary>
/// 不推送
/// </summary>
[Description("不推送")]
Disabled = 0,
/// <summary>
/// 电子邮件
/// </summary>
[Description("电子邮件")]
Email = 1,
/// <summary>
/// 短信
/// </summary>
[Description("短信")]
SMS = 2,
/// <summary>
/// 微信
/// </summary>
[Description("微信")]
Wechat = 3
}
}

@ -5,9 +5,9 @@ using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Application.Dtos namespace DS.WMS.Core.Application.Dtos
{ {
/// <summary> /// <summary>
/// 申请单明细 /// 费用明细
/// </summary> /// </summary>
public class ApplicationDetailDto public class FeeDetailDto
{ {
/// <summary> /// <summary>
/// 明细ID /// 明细ID
@ -40,135 +40,146 @@ namespace DS.WMS.Core.Application.Dtos
public BusinessType BusinessType { get; set; } public BusinessType BusinessType { get; set; }
/// <summary> /// <summary>
/// 主提单号 /// 费用对象ID
/// </summary> /// </summary>
public string? MBLNO { get; set; } public long? CustomerId { get; set; }
/// <summary> /// <summary>
/// 分提单号 /// 费用对象名称
/// </summary> /// </summary>
public string? HBLNO { get; set; } public string? CustomerName { get; set; }
/// <summary> /// <summary>
/// 委托编号 /// 费用名称
/// </summary> /// </summary>
public string? CustomerNo { get; set; } public long FeeId { get; set; }
/// <summary> /// <summary>
/// 委托单位 /// 费用名称
/// </summary> /// </summary>
public string? ClientName { get; set; } public string? FeeName { get; set; }
/// <summary> /// <summary>
/// 费用对象ID /// 费用类型
/// </summary> /// </summary>
public long? CustomerId { get; set; } public FeeType FeeType { get; set; }
/// <summary> /// <summary>
/// 费用对象名称 /// 申请金额
/// </summary> /// </summary>
public string? CustomerName { get; set; } public decimal Amount { get; set; }
/// <summary> /// <summary>
/// 业务锁定 /// 原始金额
/// </summary> /// </summary>
public bool? IsBusinessLocking { get; set; } public decimal OriginalAmount { get; set; }
/// <summary> /// <summary>
/// 费用锁定 /// 币别
/// </summary> /// </summary>
public bool? IsFeeLocking { get; set; } public string Currency { get; set; }
/// <summary> /// <summary>
/// 开船日期 /// 原始币别
/// </summary> /// </summary>
public DateTime? ETD { get; set; } public string OriginalCurrency { get; set; }
/// <summary> /// <summary>
/// 业务来源 /// 原始汇率
/// </summary> /// </summary>
public string? SourceName { get; set; } public decimal? OriginalRate { get; set; }
/// <summary> /// <summary>
/// 揽货人 /// 折算汇率
/// </summary> /// </summary>
public string? SaleName { get; set; } public decimal? ExchangeRate { get; set; }
/// <summary> /// <summary>
/// 集装箱 /// 销项税率
/// </summary> /// </summary>
public string? CntrTotal { get; set; } public decimal AccTaxRate { get; set; }
/// <summary> /// <summary>
/// 会计期间 /// 剩余金额
/// </summary> /// </summary>
public string? AccountDate { get; set; } public decimal RestAmount { get; set; }
/// <summary> /// <summary>
/// 所属分部 /// 备注
/// </summary> /// </summary>
[IgnoreDataMember] public string? Note { get; set; }
public long? SaleDeptId { get; set; } }
/// <summary>
/// 申请单明细
/// </summary>
public class ApplicationDetailDto : FeeDetailDto
{
/// <summary>
/// 主提单号
/// </summary>
public string? MBLNO { get; set; }
/// <summary> /// <summary>
/// 所属分部 /// 分提单号
/// </summary> /// </summary>
public string? SaleDeptName { get; set; } public string? HBLNO { get; set; }
/// <summary> /// <summary>
/// 费用名称 /// 委托编号
/// </summary> /// </summary>
public long FeeId { get; set; } public string? CustomerNo { get; set; }
/// <summary> /// <summary>
/// 费用名称 /// 委托单位
/// </summary> /// </summary>
public string? FeeName { get; set; } public string? ClientName { get; set; }
/// <summary> /// <summary>
/// 费用类型 /// 业务锁定
/// </summary> /// </summary>
public FeeType FeeType { get; set; } public bool? IsBusinessLocking { get; set; }
/// <summary> /// <summary>
/// 申请金额 /// 费用锁定
/// </summary> /// </summary>
public decimal Amount { get; set; } public bool? IsFeeLocking { get; set; }
/// <summary> /// <summary>
/// 原始金额 /// 开船日期
/// </summary> /// </summary>
public decimal OriginalAmount { get; set; } public DateTime? ETD { get; set; }
/// <summary> /// <summary>
/// 币别 /// 业务来源
/// </summary> /// </summary>
public string Currency { get; set; } public string? SourceName { get; set; }
/// <summary> /// <summary>
/// 原始币别 /// 揽货人
/// </summary> /// </summary>
public string OriginalCurrency { get; set; } public string? SaleName { get; set; }
/// <summary> /// <summary>
/// 原始汇率 /// 集装箱
/// </summary> /// </summary>
public decimal? OriginalRate { get; set; } public string? CntrTotal { get; set; }
/// <summary> /// <summary>
/// 折算汇率 /// 会计期间
/// </summary> /// </summary>
public decimal? ExchangeRate { get; set; } public string? AccountDate { get; set; }
/// <summary> /// <summary>
/// 销项税率 /// 所属分部
/// </summary> /// </summary>
public decimal AccTaxRate { get; set; } [IgnoreDataMember]
public long? SaleDeptId { get; set; }
/// <summary> /// <summary>
/// 剩余金额 /// 所属分部
/// </summary> /// </summary>
public decimal RestAmount { get; set; } public string? SaleDeptName { get; set; }
/// <summary> /// <summary>
/// 操作 /// 操作
@ -199,11 +210,6 @@ namespace DS.WMS.Core.Application.Dtos
/// 订舱编号 /// 订舱编号
/// </summary> /// </summary>
public string? BookingNo { get; set; } public string? BookingNo { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? Note { get; set; }
} }
/// <summary> /// <summary>
@ -235,7 +241,7 @@ namespace DS.WMS.Core.Application.Dtos
/// <summary> /// <summary>
/// 发票申请单明细 /// 发票申请单明细
/// </summary> /// </summary>
public class InvoiceApplicationDetailDto : ApplicationDetailDto public class InvoiceApplicationDetailDto : ApplicationDetailDto
{ {
/// <summary> /// <summary>
/// 录入方式 /// 录入方式
@ -243,5 +249,11 @@ namespace DS.WMS.Core.Application.Dtos
public string? InputMethod { get; set; } public string? InputMethod { get; set; }
} }
/// <summary>
/// 发票费用明细
/// </summary>
public class InvoiceDetailDto : FeeDetailDto
{
}
} }

@ -2,7 +2,6 @@
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Enums; using DS.Module.Core.Enums;
using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Entity;
using SqlSugar; using SqlSugar;
namespace DS.WMS.Core.Application.Entity namespace DS.WMS.Core.Application.Entity
@ -19,18 +18,6 @@ namespace DS.WMS.Core.Application.Entity
[SugarColumn(ColumnDescription = "申请单ID")] [SugarColumn(ColumnDescription = "申请单ID")]
public long ApplicationId { get; set; } public long ApplicationId { get; set; }
/// <summary>
/// 业务ID
/// </summary>
[SugarColumn(ColumnDescription = "业务ID")]
public long BusinessId { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[SugarColumn(ColumnDescription = "业务类型")]
public BusinessType BusinessType { get; set; }
/// <summary> /// <summary>
/// 费用记录ID /// 费用记录ID
/// </summary> /// </summary>
@ -55,6 +42,12 @@ namespace DS.WMS.Core.Application.Entity
[Navigate(NavigateType.OneToOne, nameof(DetailId))] [Navigate(NavigateType.OneToOne, nameof(DetailId))]
public ApplicationDetail? RefDetail { get; set; } public ApplicationDetail? RefDetail { get; set; }
/// <summary>
/// 引用的业务ID
/// </summary>
[SugarColumn(ColumnDescription = "引用的业务ID")]
public long? RefId { get; set; }
/// <summary> /// <summary>
/// 结算对象名称 /// 结算对象名称
/// </summary> /// </summary>
@ -83,7 +76,7 @@ namespace DS.WMS.Core.Application.Entity
/// 类别1-付费申请结算 2-收费自由结算 3-发票结算 4-收费申请 5-付费申请 6-发票申请 7-发票开出 8-付费自由结算 9-收费申请结算) /// 类别1-付费申请结算 2-收费自由结算 3-发票结算 4-收费申请 5-付费申请 6-发票申请 7-发票开出 8-付费自由结算 9-收费申请结算)
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "类别", IsNullable = true)] [SugarColumn(ColumnDescription = "类别", IsNullable = true)]
public FeeCategory? Category { get; set; } public DetailCategory? Category { get; set; }
/// <summary> /// <summary>
/// 申请金额 /// 申请金额

@ -1,4 +1,5 @@
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Enums;
using SqlSugar; using SqlSugar;
namespace DS.WMS.Core.Application.Entity namespace DS.WMS.Core.Application.Entity
@ -56,5 +57,11 @@ namespace DS.WMS.Core.Application.Entity
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "税额", IsNullable = false)] [SugarColumn(ColumnDescription = "税额", IsNullable = false)]
public decimal TaxAmount { get; set; } public decimal TaxAmount { get; set; }
/// <summary>
/// 明细类别
/// </summary>
[SugarColumn(ColumnDescription = "类别", IsNullable = true)]
public DetailCategory Category { get; set; }
} }
} }

@ -110,8 +110,8 @@ namespace DS.WMS.Core.Application.Method
{ {
detail.ApplicationId = application.Id; detail.ApplicationId = application.Id;
var fee = fees.Find(x => x.Id == detail.RecordId); var fee = fees.Find(x => x.Id == detail.RecordId);
detail.BusinessId = fee.BusinessId; //detail.BusinessId = fee.BusinessId;
detail.BusinessType = fee.BusinessType; //detail.BusinessType = fee.BusinessType;
detail.ExchangeRate = detail.ExchangeRate ?? fee.ExchangeRate; detail.ExchangeRate = detail.ExchangeRate ?? fee.ExchangeRate;
detail.FeeId = fee.FeeId; detail.FeeId = fee.FeeId;
detail.FeeName = fee.FeeName; detail.FeeName = fee.FeeName;

@ -4,6 +4,7 @@ using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface; using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
@ -82,8 +83,9 @@ namespace DS.WMS.Core.Application.Method
{ {
var query1 = TenantDb.Queryable<InvoiceApplication>().Where(x => x.Status == InvoiceApplicationStatus.AuditSubmittd) var query1 = TenantDb.Queryable<InvoiceApplication>().Where(x => x.Status == InvoiceApplicationStatus.AuditSubmittd)
.InnerJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId) .InnerJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId)
.LeftJoin<SeaExport>((a, d, s) => d.BusinessId == s.Id) .InnerJoin<FeeRecord>((a, d, f) => d.RecordId == f.Id)
.LeftJoin<InfoClientBank>((a, d, s, b) => a.CustomerBankId == b.Id) .LeftJoin<SeaExport>((a, d, f, s) => f.BusinessId == s.Id)
.LeftJoin<InfoClientBank>((a, d, f, s, b) => a.CustomerBankId == b.Id)
.Select((a, d, s, b) => new InvoiceApplicationDto .Select((a, d, s, b) => new InvoiceApplicationDto
{ {
Id = a.Id, Id = a.Id,

@ -338,8 +338,8 @@ namespace DS.WMS.Core.Application.Method
OriginalRate = f.ExchangeRate, OriginalRate = f.ExchangeRate,
ExchangeRate = d.ExchangeRate, ExchangeRate = d.ExchangeRate,
AccTaxRate = f.AccTaxRate, AccTaxRate = f.AccTaxRate,
BusinessId = d.BusinessId, BusinessId = f.BusinessId,
BusinessType = d.BusinessType BusinessType = f.BusinessType
}).ToListAsync(); }).ToListAsync();
var gList = dto.Details.GroupBy(x => x.BusinessType).ToList(); var gList = dto.Details.GroupBy(x => x.BusinessType).ToList();
@ -411,8 +411,8 @@ namespace DS.WMS.Core.Application.Method
.Select(x => new ApplicationDetail .Select(x => new ApplicationDetail
{ {
Id = x.Id, Id = x.Id,
BusinessId = x.BusinessId, //BusinessId = x.BusinessId,
BusinessType = x.BusinessType, //BusinessType = x.BusinessType,
ApplyAmount = x.Amount - x.InvoiceAmount - x.OrderInvoiceAmount + x.OrderInvSettlementAmount, ApplyAmount = x.Amount - x.InvoiceAmount - x.OrderInvoiceAmount + x.OrderInvSettlementAmount,
ExchangeRate = x.ExchangeRate, ExchangeRate = x.ExchangeRate,
OriginalCurrency = x.Currency OriginalCurrency = x.Currency
@ -492,7 +492,7 @@ namespace DS.WMS.Core.Application.Method
//更新费用记录的申请开票金额 //更新费用记录的申请开票金额
fee.OrderInvoiceAmount += detail.OriginalAmount; fee.OrderInvoiceAmount += detail.OriginalAmount;
//类别固定为发票申请 //类别固定为发票申请
detail.Category = FeeCategory.InvoiceApplication; detail.Category = DetailCategory.InvoiceApplication;
} }
if (sb.Length > 0) if (sb.Length > 0)
@ -549,7 +549,8 @@ namespace DS.WMS.Core.Application.Method
ApplicationId = application.Id, ApplicationId = application.Id,
Name = x.GoodName, Name = x.GoodName,
TaxRate = application.TaxRate, TaxRate = application.TaxRate,
TaxUnitPrice = application.Details.FindAll(y => y.FeeId == x.FeeId).Sum(x => x.ApplyAmount) TaxUnitPrice = application.Details.FindAll(y => y.FeeId == x.FeeId).Sum(x => x.ApplyAmount),
Category = DetailCategory.InvoiceApplication
}).ToList(); }).ToList();
} }

@ -79,9 +79,10 @@ namespace DS.WMS.Core.Application.Method
{ {
var query1 = TenantDb.Queryable<PaymentApplication>().Where(x => x.Status == PaymentApplicationStatus.AuditSubmittd) var query1 = TenantDb.Queryable<PaymentApplication>().Where(x => x.Status == PaymentApplicationStatus.AuditSubmittd)
.LeftJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId) .LeftJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId)
.LeftJoin<SeaExport>((a, d, s) => d.BusinessId == s.Id) .InnerJoin<FeeRecord>((a, d, f) => d.RecordId == f.Id)
.LeftJoin<InfoClientBank>((a, d, s, b) => a.CustomerBankId == b.Id) .LeftJoin<SeaExport>((a, d, f, s) => f.BusinessId == s.Id)
.Select((a, d, s, b) => new PaymentApplicationDto .LeftJoin<InfoClientBank>((a, d, f, s, b) => a.CustomerBankId == b.Id)
.Select((a, d, f, s, b) => new PaymentApplicationDto
{ {
Id = a.Id, Id = a.Id,
ApplicationNO = a.ApplicationNO, ApplicationNO = a.ApplicationNO,

@ -66,8 +66,9 @@ namespace DS.WMS.Core.Application.Method
{ {
var query1 = TenantDb.Queryable<PaymentApplication>() var query1 = TenantDb.Queryable<PaymentApplication>()
.LeftJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId) .LeftJoin<ApplicationDetail>((a, d) => a.Id == d.ApplicationId)
.LeftJoin<SeaExport>((a, d, s) => d.BusinessId == s.Id) .LeftJoin<FeeRecord>((a, d, f) => d.RecordId == f.Id)
.Select((a, d, s) => new PaymentApplicationDto .LeftJoin<SeaExport>((a, d, f, s) => f.BusinessId == s.Id)
.Select((a, d, f, s) => new PaymentApplicationDto
{ {
Id = a.Id, Id = a.Id,
ApplicationNO = a.ApplicationNO, ApplicationNO = a.ApplicationNO,
@ -314,8 +315,8 @@ namespace DS.WMS.Core.Application.Method
OriginalAmount = d.OriginalAmount, OriginalAmount = d.OriginalAmount,
//未申请金额=(金额-结算金额-申请金额+申请金额已结算) //未申请金额=(金额-结算金额-申请金额+申请金额已结算)
RestAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount, RestAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount,
BusinessId = d.BusinessId, BusinessId = f.BusinessId,
BusinessType = d.BusinessType, BusinessType = f.BusinessType,
IsBusinessLocking = b.IsBusinessLocking, IsBusinessLocking = b.IsBusinessLocking,
IsFeeLocking = b.IsFeeLocking IsFeeLocking = b.IsFeeLocking
}).ToListAsync(); }).ToListAsync();
@ -457,7 +458,7 @@ namespace DS.WMS.Core.Application.Method
//更新费用记录的已申请金额 //更新费用记录的已申请金额
fee.OrderAmount += detail.OriginalAmount; fee.OrderAmount += detail.OriginalAmount;
//类别固定为付费申请 //类别固定为付费申请
detail.Category = FeeCategory.PaidApplication; detail.Category = DetailCategory.PaidApplication;
} }
return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success; return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success;

@ -0,0 +1,251 @@
using System.Runtime.Serialization;
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Dtos;
using Masuit.Tools.Systems;
namespace DS.WMS.Core.Invoice.Dto
{
/// <summary>
/// 发票
/// </summary>
public class InvoiceDto
{
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 发票号
/// </summary>
public string InvoiceNO { get; set; }
/// <summary>
/// 发票业务编号
/// </summary>
public string BillNO { get; set; }
/// <summary>
/// 开票时间
/// </summary>
public DateTime InvoiceDate { get; set; }
/// <summary>
/// 开票单位ID
/// </summary>
public long CustomerId { get; set; }
/// <summary>
/// 开票单位名称
/// </summary>
public string? CustomerName { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
public string? InvoiceHeader { get; set; }
/// <summary>
/// 收款单位银行
/// </summary>
public string? Account { get; set; }
/// <summary>
/// 申请金额(费用明细的合计)
/// </summary>
public decimal ApplyAmount { get; set; }
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 实收币别
/// </summary>
public string? ReceiptCurrency { get; set; }
/// <summary>
/// 锁定状态
/// </summary>
public bool IsLocked { get; set; }
/// <summary>
/// 锁定人ID
/// </summary>
[IgnoreDataMember]
public long? LockUserId { get; set; }
/// <summary>
/// 锁定人
/// </summary>
public string? LockUserName { get; set; }
/// <summary>
/// 锁定时间
/// </summary>
public DateTime? LockTime { get; set; }
/// <summary>
/// 开票人ID
/// </summary>
public long? OperatorId { get; set; }
/// <summary>
/// 开票人
/// </summary>
public string? OperatorName { get; set; }
/// <summary>
/// 开票方式
/// </summary>
public InvoiceType Type { get; set; }
/// <summary>
/// 开票方式文本
/// </summary>
public string TypeText => Type.GetDescription();
/// <summary>
/// 是否已打印
/// </summary>
public bool IsPrinted { get; set; }
/// <summary>
/// 是否已结算
/// </summary>
public bool IsSettled { get; set; }
/// <summary>
/// 开票税率
/// </summary>
public decimal TaxRate { get; set; }
/// <summary>
/// 税额
/// </summary>
public decimal Tax => ApplyAmount - ApplyAmount * TaxRate;
/// <summary>
/// 不含税金额
/// </summary>
public decimal NoTaxAmount => ApplyAmount - Tax;
/// <summary>
/// 所属机构(公司)
/// </summary>
[IgnoreDataMember]
public long? OrgId { get; set; }
/// <summary>
/// 所属部门
/// </summary>
public string? OrgName { get; set; }
/// <summary>
/// 纳税人识别号
/// </summary>
public string? TaxID { get; set; }
/// <summary>
/// 客户地址电话
/// </summary>
public string? CustomerAddTel { get; set; }
/// <summary>
/// 客户银行
/// </summary>
public string? CustomerBank { get; set; }
/// <summary>
/// 代开客户
/// </summary>
public string? AutualCustomerName { get; set; }
/// <summary>
/// 发票类别
/// </summary>
public InvoiceCategory Category { get; set; }
/// <summary>
/// 发票类别文本
/// </summary>
public string CategoryText => Category.GetDescription();
/// <summary>
/// 开票金额(开票明细的合计)
/// </summary>
public decimal InvoiceAmount { get; set; }
/// <summary>
/// 原币金额
/// </summary>
public string OriginalAmount => Details == null ? string.Empty : string.Join(" ", Details.Select(x => x.Currency + x.OriginalAmount));
/// <summary>
/// 开票分公司ID所属机构
/// </summary>
[IgnoreDataMember]
public long? SaleDeptId { get; set; }
/// <summary>
/// 所属分部
/// </summary>
public string? SaleDeptName { get; set; }
/// <summary>
/// 电子发票PDF地址
/// </summary>
public string? PDFUrl { get; set; }
/// <summary>
/// 是否已作废
/// </summary>
public bool IsCancelled { get; set; }
/// <summary>
/// 作废人ID
/// </summary>
[IgnoreDataMember]
public long? CancelUserId { get; set; }
/// <summary>
/// 作废人
/// </summary>
public string? CancelUserName { get; set; }
/// <summary>
/// 作废时间
/// </summary>
public DateTime CancelTime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
[IgnoreDataMember]
public long CreateBy { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string? CreateByName { get; set; }
[IgnoreDataMember]
public IEnumerable<string>? InvoiceApplicationList { get; set; }
/// <summary>
/// 发票申请单号
/// </summary>
public string InvoiceApplicationNO => InvoiceApplicationList == null ? string.Empty : string.Join(',', InvoiceApplicationList);
/// <summary>
/// 费用明细
/// </summary>
public List<InvoiceDetailDto>? Details { get; set; }
}
}

@ -0,0 +1,321 @@
using DS.Module.Core.Data;
using DS.Module.Core.Enums;
using DS.WMS.Core.Info.Entity;
using SqlSugar;
namespace DS.WMS.Core.Invoice.Entity
{
/// <summary>
/// 发票相关基类
/// </summary>
public class Invoice : BaseModelV2<long>
{
/// <summary>
/// 发票号
/// </summary>
[SugarColumn(ColumnDescription = "发票号", Length = 200, IsNullable = false)]
public string InvoiceNO { get; set; }
/// <summary>
/// 发票业务编号
/// </summary>
[SugarColumn(ColumnDescription = "发票业务编号", Length = 20, IsNullable = false)]
public string BillNO { get; set; }
/// <summary>
/// 开票时间
/// </summary>
[SugarColumn(ColumnDescription = "开票时间")]
public DateTime InvoiceDate { get; set; }
/// <summary>
/// 开票单位ID
/// </summary>
[SugarColumn(ColumnDescription = "开票单位ID", IsNullable = false)]
public long CustomerId { get; set; }
/// <summary>
/// 开票单位
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(CustomerId))]
public InfoClient? Customer { get; set; }
/// <summary>
/// 开票单位名称
/// </summary>
[SugarColumn(ColumnDescription = "开票单位名称", Length = 200)]
public string? CustomerName { get; set; }
/// <summary>
/// 发票抬头
/// </summary>
[SugarColumn(ColumnDescription = "发票抬头", Length = 200)]
public string? InvoiceHeader { get; set; }
/// <summary>
/// 收款单位银行
/// </summary>
[SugarColumn(ColumnDescription = "收款单位银行", Length = 200)]
public string? Account { get; set; }
/// <summary>
/// 申请金额(费用明细的合计)
/// </summary>
[SugarColumn(ColumnDescription = "申请金额")]
public decimal ApplyAmount { get; set; }
/// <summary>
/// 申请金额大写
/// </summary>
[SugarColumn(ColumnDescription = "申请金额大写", Length = 100, IsNullable = true)]
public string? AmountUppercase { get; set; }
/// <summary>
/// 币别
/// </summary>
[SugarColumn(ColumnDescription = "币别", IsNullable = false, Length = 3)]
public string Currency { get; set; }
/// <summary>
/// 锁定状态
/// </summary>
[SugarColumn(ColumnDescription = "锁定状态", DefaultValue = "0")]
public bool IsLocked { get; set; }
/// <summary>
/// 锁定人ID
/// </summary>
[SugarColumn(ColumnDescription = "锁定人ID", IsNullable = true)]
public long? LockUserId { get; set; }
/// <summary>
/// 锁定时间
/// </summary>
[SugarColumn(ColumnDescription = "锁定时间", IsNullable = true)]
public DateTime? LockTime { get; set; }
/// <summary>
/// 开票人ID
/// </summary>
[SugarColumn(ColumnDescription = "开票人ID", IsNullable = true)]
public long? OperatorId { get; set; }
/// <summary>
/// 开票方式
/// </summary>
[SugarColumn(ColumnDescription = "开票方式")]
public InvoiceType Type { get; set; }
/// <summary>
/// 是否已打印
/// </summary>
[SugarColumn(ColumnDescription = "是否已打印", DefaultValue = "0")]
public bool IsPrinted { get; set; }
/// <summary>
/// 是否已结算
/// </summary>
[SugarColumn(ColumnDescription = "是否已结算", DefaultValue = "0")]
public bool IsSettled { get; set; }
/// <summary>
/// 开票税率
/// </summary>
[SugarColumn(ColumnDescription = "开票税率")]
public decimal TaxRate { get; set; }
/// <summary>
/// 所属机构(公司)
/// </summary>
[SugarColumn(ColumnDescription = "所属机构(公司)")]
public long? OrgId { get; set; }
/// <summary>
/// 纳税人识别号
/// </summary>
[SugarColumn(ColumnDescription = "纳税人识别号", Length = 60, IsNullable = true)]
public string? TaxID { get; set; }
/// <summary>
/// 客户地址电话
/// </summary>
[SugarColumn(ColumnDescription = "客户地址电话", Length = 200, IsNullable = true)]
public string? CustomerAddTel { get; set; }
/// <summary>
/// 客户银行
/// </summary>
[SugarColumn(ColumnDescription = "客户银行", Length = 100, IsNullable = true)]
public string? CustomerBank { get; set; }
/// <summary>
/// 代开客户
/// </summary>
[SugarColumn(ColumnDescription = "代开客户", Length = 200, IsNullable = true)]
public string? AutualCustomerName { get; set; }
/// <summary>
/// 发票类别
/// </summary>
[SugarColumn(ColumnDescription = "发票类别")]
public InvoiceCategory Category { get; set; }
/// <summary>
/// 开票金额(开票明细的合计)
/// </summary>
[SugarColumn(ColumnDescription = "开票金额")]
public decimal InvoiceAmount { get; set; }
/// <summary>
/// 外币金额(费用明细的外币合计)
/// </summary>
[SugarColumn(ColumnDescription = "外币金额")]
public decimal OtherInvoiceAmount { get; set; }
/// <summary>
/// 原币金额
/// </summary>
[SugarColumn(ColumnDescription = "原币金额")]
public decimal OriginalAmount { get; set; }
/// <summary>
/// 开票分公司ID所属机构
/// </summary>
[SugarColumn(ColumnDescription = "开票分公司ID所属机构")]
public long? SaleDeptId { get; set; }
/// <summary>
/// 收款人
/// </summary>
[SugarColumn(ColumnDescription = "收款人", Length = 50, IsNullable = true)]
public string? Payee { get; set; }
/// <summary>
/// 复核人
/// </summary>
[SugarColumn(ColumnDescription = "复核人", Length = 50, IsNullable = true)]
public string? Checker { get; set; }
/// <summary>
/// 是否境外发票
/// </summary>
[SugarColumn(ColumnDescription = "是否境外发票", DefaultValue = "0")]
public bool IsOverseasInvoice { get; set; }
/// <summary>
/// 正票,冲红
/// </summary>
[SugarColumn(ColumnDescription = "正票,冲红", IsNullable = true, Length = 2)]
public string? Reversal { get; set; }
/// <summary>
/// 红票发票代码
/// </summary>
[SugarColumn(ColumnDescription = "红票发票代码", IsNullable = true, Length = 50)]
public string? RedCode { get; set; }
/// <summary>
/// 红票发票号
/// </summary>
[SugarColumn(ColumnDescription = "红票发票号", IsNullable = true, Length = 50)]
public string? RedNO { get; set; }
/// <summary>
/// 是否被冲红
/// </summary>
[SugarColumn(ColumnDescription = "是否被冲红", DefaultValue = "0")]
public bool IsSetRed { get; set; }
/// <summary>
/// 冲红原因
/// </summary>
[SugarColumn(ColumnDescription = "冲红原因", Length = 100, IsNullable = true)]
public string? RedReason { get; set; }
/// <summary>
/// 冲红确认单ID
/// </summary>
[SugarColumn(ColumnDescription = "冲红确认单ID", IsNullable = true)]
public long? RedBillId { get; set; }
/// <summary>
/// 收款币别
/// </summary>
[SugarColumn(ColumnDescription = "收款币别", IsNullable = true, Length = 3)]
public string? ReceiptCurrency { get; set; }
/// <summary>
/// 推送方式
/// </summary>
[SugarColumn(ColumnDescription = "推送方式")]
public PushMode PushMode { get; set; }
/// <summary>
/// 手机号
/// </summary>
[SugarColumn(ColumnDescription = "手机号", Length = 20, IsNullable = true)]
public string? CellPhoneNO { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[SugarColumn(ColumnDescription = "邮箱", Length = 100, IsNullable = true)]
public string? Email { get; set; }
/// <summary>
/// 电子发票接口类型
/// </summary>
[SugarColumn(ColumnDescription = "电子发票接口类型")]
public InvoiceApiType? ApiType { get; set; }
/// <summary>
/// 电子发票接口类型
/// </summary>
[SugarColumn(ColumnDescription = "电子发票接口类型", Length = 50, IsNullable = true)]
public string? ApiLine { get; set; }
/// <summary>
/// 电子发票接口状态
/// </summary>
[SugarColumn(ColumnDescription = "电子发票接口状态", Length = 50, IsNullable = true)]
public string? ApiStatus { get; set; }
/// <summary>
/// 电子发票接口顺序号
/// </summary>
[SugarColumn(ColumnDescription = "电子发票接口顺序号", Length = 50, IsNullable = true)]
public string? ApiSerial { get; set; }
/// <summary>
/// 电子发票接口代码
/// </summary>
[SugarColumn(ColumnDescription = "电子发票接口代码", Length = 50, IsNullable = true)]
public string? ApiCode { get; set; }
/// <summary>
/// 电子发票PDF地址
/// </summary>
[SugarColumn(ColumnDescription = "电子发票PDF地址", Length = 300, IsNullable = true)]
public string? PDFUrl { get; set; }
/// <summary>
/// 是否已作废
/// </summary>
[SugarColumn(ColumnDescription = "是否已作废", DefaultValue = "0")]
public bool IsCancelled { get; set; }
/// <summary>
/// 作废人ID
/// </summary>
[SugarColumn(ColumnDescription = "作废人ID", IsNullable = true)]
public long? CancelUserId { get; set; }
/// <summary>
/// 作废时间
/// </summary>
[SugarColumn(ColumnDescription = "作废时间")]
public DateTime CancelTime { get; set; }
}
}

@ -0,0 +1,41 @@
using DS.Module.Core;
using DS.WMS.Core.Invoice.Entity;
namespace DS.WMS.Core.Invoice.Interface
{
/// <summary>
/// 结算单基础服务定义
/// </summary>
/// <typeparam name="TEntity">实体的类型声明</typeparam>
public interface IInvoiceService<TEntity> where TEntity : Entity.Invoice, new()
{
///// <summary>
///// 提交结算单
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//Task<DataResult<TEntity>> SaveAsync(SettlementRequest<TEntity> request);
/// <summary>
/// 删除发票明细
/// </summary>
/// <param name="ids">明细ID</param>
/// <returns></returns>
Task<DataResult> DeleteDetailAsync(params long[] ids);
/// <summary>
/// 删除发票
/// </summary>
/// <param name="ids">发票ID</param>
/// <returns></returns>
Task<DataResult> DeleteAsync(params long[] ids);
/// <summary>
/// 设置发票的锁定状态
/// </summary>
/// <param name="isLocked">是否锁定</param>
/// <param name="ids">发票ID</param>
/// <returns></returns>
Task<DataResult> SetLockAsync(bool isLocked, params long[] ids);
}
}

@ -0,0 +1,124 @@
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Fee.Method;
using DS.WMS.Core.Invoice.Dto;
using DS.WMS.Core.Invoice.Interface;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Sys.Entity;
using SqlSugar;
namespace DS.WMS.Core.Invoice.Method
{
/// <summary>
/// 发票服务基类
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public class InvoiceService<TEntity> : FeeServiceBase, IInvoiceService<TEntity>
where TEntity : Entity.Invoice, new()
{
/// <summary>
/// 初始化
/// </summary>
/// <param name="provider"></param>
public InvoiceService(IServiceProvider provider) : base(provider)
{
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult<List<InvoiceDto>>> GetListAsync(PageRequest<string> request)
{
var query = TenantDb.Queryable<Entity.Invoice>()
.Select(i => new InvoiceDto
{
Id = i.Id,
InvoiceNO = i.InvoiceNO,
BillNO = i.BillNO,
InvoiceDate = i.InvoiceDate,
CustomerId = i.CustomerId,
CustomerName = i.CustomerName,
Type = i.Type,
Category = i.Category,
InvoiceHeader = i.InvoiceHeader,
TaxID = i.TaxID,
CustomerAddTel = i.CustomerAddTel,
CustomerBank = i.CustomerBank,
AutualCustomerName = i.AutualCustomerName,
Currency = i.Currency,
ReceiptCurrency = i.ReceiptCurrency,
ApplyAmount = i.ApplyAmount,
InvoiceAmount = i.InvoiceAmount,
OperatorId = i.OperatorId,
IsLocked = i.IsLocked,
LockUserId = i.LockUserId,
LockTime = i.LockTime,
TaxRate = i.TaxRate,
OrgId = i.OrgId,
SaleDeptId = i.SaleDeptId,
IsCancelled = i.IsCancelled,
CancelUserId = i.CancelUserId,
CancelTime = i.CancelTime,
CreateTime = i.CreateTime,
CreateBy = i.CreateBy,
InvoiceApplicationList = SqlFunc.Subqueryable<ApplicationDetail>().InnerJoin<InvoiceApplication>((d, a) =>
d.ApplicationId == i.Id && d.Category == DetailCategory.InvoiceIssuance && d.RefId == a.Id)
.GroupBy((d, a) => a.ApplicationNO).ToList((d, a) => a.ApplicationNO)
});
if (!request.OtherQueryCondition.IsNullOrEmpty())
{
query = query.Where(i => i.InvoiceApplicationList.Contains(request.OtherQueryCondition));
}
var whereList = request.GetConditionalModels(Db);
var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition);
if (result.Data.Count > 0)
{
var userIds = result.Data.Select(x => x.CreateBy)
.Union(result.Data.Where(x => x.LockUserId.HasValue).Select(x => x.LockUserId.Value))
.Union(result.Data.Where(x => x.OperatorId.HasValue).Select(x => x.OperatorId.Value))
.Distinct();
var users = await Db.Queryable<SysUser>().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync();
var orgIds = result.Data.Where(x => x.SaleDeptId.HasValue).Select(x => x.SaleDeptId.Value)
.Union(result.Data.Where(x => x.OrgId.HasValue).Select(x => x.OrgId.Value))
.Distinct();
var orgs = await Db.Queryable<SysOrg>().Where(x => orgIds.Contains(x.Id)).Select(x => new { x.Id, x.OrgName }).ToListAsync();
foreach (var item in result.Data)
{
item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName;
item.LockUserName = users.Find(x => x.Id == item.LockUserId)?.UserName;
item.OperatorName = users.Find(x => x.Id == item.OperatorId)?.UserName;
item.SaleDeptName = orgs.Find(x => x.Id == item.SaleDeptId)?.OrgName;
item.OrgName = orgs.Find(x => x.Id == item.OrgId)?.OrgName;
}
}
return result;
}
public Task<DataResult> DeleteAsync(params long[] ids)
{
throw new NotImplementedException();
}
public Task<DataResult> DeleteDetailAsync(params long[] ids)
{
throw new NotImplementedException();
}
public Task<DataResult> SetLockAsync(bool isLocked, params long[] ids)
{
throw new NotImplementedException();
}
}
}

@ -1,5 +1,4 @@
using DS.Module.Core; using DS.Module.Core;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Entity;

@ -1,6 +1,5 @@
using DS.Module.Core; using DS.Module.Core;
using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Entity;

@ -2,7 +2,7 @@
using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Entity;
namespace DS.WMS.Core.Application.Interface namespace DS.WMS.Core.Settlement.Interface
{ {
/// <summary> /// <summary>
/// 结算单基础服务定义 /// 结算单基础服务定义

@ -241,7 +241,7 @@ namespace DS.WMS.Core.Settlement.Method
public async Task<DataResult<FreeSettlement>> GetDetailsAsync(PageRequest<long> request) public async Task<DataResult<FreeSettlement>> GetDetailsAsync(PageRequest<long> request)
{ {
var model = new FreeSettlement(); var model = new FreeSettlement();
model.Details = await TenantDb.Queryable<ApplicationDetail>().Where(x => x.ApplicationId == request.OtherQueryCondition && x.Category == FeeCategory.PaidFreeSettlement) model.Details = await TenantDb.Queryable<ApplicationDetail>().Where(x => x.ApplicationId == request.OtherQueryCondition && x.Category == DetailCategory.PaidFreeSettlement)
.InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id) .InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
.Select((d, f) => new FreeSettlementDetailDto .Select((d, f) => new FreeSettlementDetailDto
{ {
@ -363,7 +363,7 @@ namespace DS.WMS.Core.Settlement.Method
continue; continue;
} }
detail.Category = FeeCategory.PaidApplicationSettlement; detail.Category = DetailCategory.PaidApplicationSettlement;
} }
return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success; return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success;

@ -177,7 +177,7 @@ namespace DS.WMS.Core.Settlement.Method
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<List<SettlementDetailDto>>> GetDetailsAsync(PageRequest<long> request) public async Task<DataResult<List<SettlementDetailDto>>> GetDetailsAsync(PageRequest<long> request)
{ {
var list = await TenantDb.Queryable<ApplicationDetail>() var list = await TenantDb.Queryable<ApplicationDetail>()
.InnerJoin<ApplicationDetail>((d, pd) => d.DetailId == pd.Id) .InnerJoin<ApplicationDetail>((d, pd) => d.DetailId == pd.Id)
@ -251,8 +251,10 @@ namespace DS.WMS.Core.Settlement.Method
var query = TenantDb.Queryable<PaymentApplication>() var query = TenantDb.Queryable<PaymentApplication>()
.InnerJoinIF<ApplicationDetail>(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, .InnerJoinIF<ApplicationDetail>(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue,
(a, d) => a.Id == d.ApplicationId) (a, d) => a.Id == d.ApplicationId)
.InnerJoinIF<FeeRecord>(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue,
(a, d, f) => d.RecordId == f.Id)
.InnerJoinIF<SeaExport>(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, .InnerJoinIF<SeaExport>(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue,
(a, d, s) => s.Id == d.BusinessId && (s.LoadPortId == request.OtherQueryCondition.PortId.Value || s.DischargePortId == request.OtherQueryCondition.PortId.Value)) (a, d, f, s) => f.BusinessId == s.Id && (s.LoadPortId == request.OtherQueryCondition.PortId.Value || s.DischargePortId == request.OtherQueryCondition.PortId.Value))
.GroupByIF(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, .GroupByIF(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue,
(a, d, s) => a.Id) (a, d, s) => a.Id)
.Select(a => new PaymentApplicationDtoV2 .Select(a => new PaymentApplicationDtoV2
@ -323,15 +325,15 @@ namespace DS.WMS.Core.Settlement.Method
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id) public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id)
{ {
var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => d.ApplicationId == id && d.Category == FeeCategory.PaidApplication && (d.ApplyAmount - d.ProcessedAmount) != 0) var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => d.ApplicationId == id && d.Category == DetailCategory.PaidApplication && (d.ApplyAmount - d.ProcessedAmount) != 0)
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id) .LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
.LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType) .LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType)
.Select((d, f, b) => new PaymentApplicationDetailDto .Select((d, f, b) => new PaymentApplicationDetailDto
{ {
Id = d.Id, Id = d.Id,
ApplicationId = d.ApplicationId, ApplicationId = d.ApplicationId,
BusinessId = d.BusinessId, BusinessId = f.BusinessId,
BusinessType = d.BusinessType, BusinessType = f.BusinessType,
RecordId = d.RecordId, RecordId = d.RecordId,
FeeName = d.FeeName, FeeName = d.FeeName,
FeeType = d.FeeType, //收付 FeeType = d.FeeType, //收付
@ -358,7 +360,7 @@ namespace DS.WMS.Core.Settlement.Method
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long[] ids) public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long[] ids)
{ {
var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => ids.Contains(d.Id) && d.Category == FeeCategory.PaidApplicationSettlement) var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => ids.Contains(d.Id) && d.Category == DetailCategory.PaidApplicationSettlement)
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id) .LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
.LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType) .LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType)
.LeftJoin<PaymentApplication>((d, f, b, p) => d.ApplicationId == p.Id) .LeftJoin<PaymentApplication>((d, f, b, p) => d.ApplicationId == p.Id)
@ -366,8 +368,8 @@ namespace DS.WMS.Core.Settlement.Method
{ {
Id = d.Id, Id = d.Id,
ApplicationId = d.ApplicationId, ApplicationId = d.ApplicationId,
BusinessId = d.BusinessId, BusinessId = f.BusinessId,
BusinessType = d.BusinessType, BusinessType = f.BusinessType,
RecordId = d.RecordId, RecordId = d.RecordId,
FeeName = d.FeeName, FeeName = d.FeeName,
FeeType = d.FeeType, //收付 FeeType = d.FeeType, //收付
@ -461,7 +463,7 @@ namespace DS.WMS.Core.Settlement.Method
//获取剩余待结算金额 //获取剩余待结算金额
var ids2 = settlement.Details.Select(x => x.DetailId); var ids2 = settlement.Details.Select(x => x.DetailId);
var appDetails = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids2.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) var appDetails = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids2.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
.Select(x => new .Select(x => new
{ {
x.Id, x.Id,
@ -492,7 +494,7 @@ namespace DS.WMS.Core.Settlement.Method
continue; continue;
} }
detail.Category = FeeCategory.PaidFreeSettlement; detail.Category = DetailCategory.PaidFreeSettlement;
} }
return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success; return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success;
@ -518,15 +520,15 @@ namespace DS.WMS.Core.Settlement.Method
{ {
//回写付费申请的状态 //回写付费申请的状态
var ids = settlement.Details.Select(x => x.DetailId); var ids = settlement.Details.Select(x => x.DetailId);
var appIds = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) var appIds = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
.Select(x => x.ApplicationId).ToListAsync(); .Select(x => x.ApplicationId).ToListAsync();
var details = await TenantDb.Queryable<ApplicationDetail>().Where(x => appIds.Contains(x.ApplicationId) && x.Category == FeeCategory.PaidApplication).GroupBy(x => x.ApplicationId).Select(x => new var details = await TenantDb.Queryable<ApplicationDetail>().Where(x => appIds.Contains(x.ApplicationId) && x.Category == DetailCategory.PaidApplication).GroupBy(x => x.ApplicationId).Select(x => new
{ {
x.ApplicationId, x.ApplicationId,
Count = SqlFunc.AggregateCount(x.Id), Count = SqlFunc.AggregateCount(x.Id),
ProcessedCount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => y.ApplicationId == x.ApplicationId && ProcessedCount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => y.ApplicationId == x.ApplicationId &&
y.Category == FeeCategory.PaidApplication && y.OriginalAmount - y.OriginalProcessedAmount == 0).Count() y.Category == DetailCategory.PaidApplication && y.OriginalAmount - y.OriginalProcessedAmount == 0).Count()
}).ToListAsync(); }).ToListAsync();
List<PaymentApplication> applications = []; List<PaymentApplication> applications = [];
@ -572,7 +574,7 @@ namespace DS.WMS.Core.Settlement.Method
{ {
var items = list.SelectMany(x => x.Details); var items = list.SelectMany(x => x.Details);
var ids = items.Select(x => x.DetailId); var ids = items.Select(x => x.DetailId);
var details = TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) var details = TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
.Select(x => new ApplicationDetail .Select(x => new ApplicationDetail
{ {
Id = x.Id, Id = x.Id,

@ -2,11 +2,11 @@
using DS.Module.Core.Enums; using DS.Module.Core.Enums;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Method; using DS.WMS.Core.Fee.Method;
using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Entity;
using DS.WMS.Core.Settlement.Interface;
using DS.WMS.Core.Sys.Interface; using DS.WMS.Core.Sys.Interface;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
@ -57,7 +57,7 @@ namespace DS.WMS.Core.Settlement.Method
Mode = x.Mode Mode = x.Mode
}).FirstAsync(x => x.Id == request.Settlement.Id); }).FirstAsync(x => x.Id == request.Settlement.Id);
if (dbValue.IsLocked) if (dbValue != null && dbValue.IsLocked)
return DataResult<TEntity>.FailedWithDesc(nameof(MultiLanguageConst.SettlementIsLocked)); return DataResult<TEntity>.FailedWithDesc(nameof(MultiLanguageConst.SettlementIsLocked));
} }
var result = EnsureSettlement(request.Settlement, dbValue); var result = EnsureSettlement(request.Settlement, dbValue);
@ -78,8 +78,8 @@ namespace DS.WMS.Core.Settlement.Method
ApplicationId = x.ApplicationId, ApplicationId = x.ApplicationId,
DetailId = x.Id == 0 ? null : x.Id, DetailId = x.Id == 0 ? null : x.Id,
RecordId = x.RecordId, RecordId = x.RecordId,
BusinessId = x.BusinessId, //BusinessId = x.BusinessId,
BusinessType = x.BusinessType, //BusinessType = x.BusinessType,
CustomerName = x.CustomerName ?? settlement.CustomerName, CustomerName = x.CustomerName ?? settlement.CustomerName,
FeeId = x.FeeId, FeeId = x.FeeId,
FeeName = x.FeeName, FeeName = x.FeeName,

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl> <_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-07-04T09:20:50.0175739Z||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||;</History> <History>True|2024-07-11T03:40:17.3581147Z||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;True|2024-05-22T09:48:40.8753914+08:00||;True|2024-05-22T09:25:06.2068137+08:00||;True|2024-05-22T09:18:53.0759815+08:00||;True|2024-05-21T17:13:36.4091775+08:00||;True|2024-05-21T14:41:18.8486299+08:00||;True|2024-05-21T11:04:27.3649637+08:00||;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>
Loading…
Cancel
Save