费用提交优化

usertest
嵇文龙 6 months ago
parent e60a6966f1
commit 51886aaf15

@ -1,4 +1,5 @@
using System.ComponentModel;
using SqlSugar;
namespace DS.Module.Core.Data;
@ -11,63 +12,63 @@ public abstract class BaseModel<TKey>: IDeleted
/// 主键ID
/// </summary>
[Description("主键ID")]
[SqlSugar.SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")]
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")]
public TKey Id { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
[SqlSugar.SugarColumn(IsNullable = true,ColumnDescription = "备注", Length = 200)]
[SugarColumn(IsNullable = true, ColumnDescription = "备注", Length = 200)]
public string Note { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
[SqlSugar.SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")]
[SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
[Description("创建人")]
[SqlSugar.SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人")]
[SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人")]
public long CreateBy { get; set; }
/// <summary>
/// 修改人
/// </summary>
[Description("修改人")]
[SqlSugar.SugarColumn(IsNullable = true, ColumnDescription = "修改人")]
[SugarColumn(IsNullable = true, ColumnDescription = "修改人")]
public long UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Description("更新时间")]
[SqlSugar.SugarColumn(IsNullable = true,ColumnDescription = "更新时间")]
[SugarColumn(IsNullable = true, ColumnDescription = "更新时间")]
public DateTime UpdateTime { get; set; }
/// <summary>
/// 删除
/// </summary>
[Description("删除")]
[SqlSugar.SugarColumn(ColumnDescription = "是否删除")]
[SugarColumn(ColumnDescription = "是否删除")]
public bool Deleted { get; set; } = false;
/// <summary>
/// 删除时间
/// </summary>
[Description("删除时间")]
[SqlSugar.SugarColumn(IsNullable = true,ColumnDescription = "删除时间")]
[SugarColumn(IsNullable = true, ColumnDescription = "删除时间")]
public DateTime DeleteTime { get; set; }
/// <summary>
/// 删除人
/// </summary>
[Description("删除人")]
[SqlSugar.SugarColumn(IsNullable = true, ColumnDescription = "删除人")]
[SugarColumn(IsNullable = true, ColumnDescription = "删除人")]
public long DeleteBy { get; set; }
// /// <summary>
@ -76,3 +77,72 @@ public abstract class BaseModel<TKey>: IDeleted
// [SqlSugar.SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
// public long TenantId { get; set; } = 0;
}
/// <summary>
/// 实体类基类
/// </summary>
public abstract class BaseModelV2<TKey> : IDeleted
{
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键ID")]
public TKey Id { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
[SugarColumn(IsNullable = true, ColumnDescription = "备注", Length = 200)]
public string? Note { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Description("创建时间")]
[SqlSugar.SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
[Description("创建人")]
[SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人")]
public long CreateBy { get; set; }
/// <summary>
/// 修改人
/// </summary>
[Description("修改人")]
[SugarColumn(IsNullable = true, ColumnDescription = "修改人")]
public long? UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Description("更新时间")]
[SugarColumn(IsNullable = true, ColumnDescription = "更新时间")]
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 删除
/// </summary>
[Description("删除")]
[SugarColumn(ColumnDescription = "是否删除")]
public bool Deleted { get; set; }
/// <summary>
/// 删除时间
/// </summary>
[Description("删除时间")]
[SugarColumn(IsNullable = true, ColumnDescription = "删除时间")]
public DateTime? DeleteTime { get; set; }
/// <summary>
/// 删除人
/// </summary>
[Description("删除人")]
[SugarColumn(IsNullable = true, ColumnDescription = "删除人")]
public long? DeleteBy { get; set; }
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using FluentValidation;
namespace DS.WMS.Core.Fee.Dtos;
@ -17,6 +18,9 @@ public class FeeRecordReq
/// 业务Id
/// </summary>
public long BusinessId { get; set; }
public BusinessType BusinessType { get; set; }
/// <summary>
/// 收付类型(收、付) 1应收 2 应付
/// </summary>
@ -101,29 +105,29 @@ public class FeeRecordReq
/// <summary>
/// Desc:佣金比率
/// </summary>
public decimal? CommissionRate { get; set; } = 0;
public decimal? CommissionRate { get; set; }
/// <summary>
/// Desc:结算金额
/// </summary>
public decimal? SettlementAmount { get; set; } = 0;
public decimal? SettlementAmount { get; set; }
/// <summary>
/// Desc:开票金额
/// </summary>
public decimal? InvoiceAmount { get; set; } = 0;
public decimal? InvoiceAmount { get; set; }
/// <summary>
/// Desc:申请金额
/// </summary>
public decimal? OrderAmount { get; set; } = 0;
public decimal? OrderAmount { get; set; }
/// <summary>
/// Desc:申请开票金额
/// </summary>
public decimal? OrderInvoiceAmount { get; set; } = 0;
public decimal? OrderInvoiceAmount { get; set; }
/// <summary>
/// 是否机密费用
/// </summary>
public bool? IsOpen { get; set; } = false;
public bool? IsOpen { get; set; }
/// <summary>
/// 对帐编号
/// </summary>
@ -131,23 +135,23 @@ public class FeeRecordReq
/// <summary>
/// 是否对帐
/// </summary>
public bool IsDebit { get; set; } = false;
public bool IsDebit { get; set; }
/// <summary>
/// 是否垫付费用
/// </summary>
public bool? IsAdvancedPay { get; set; } = false;
public bool? IsAdvancedPay { get; set; }
/// <summary>
/// 是否禁开发票
/// </summary>
public bool? IsInvoice { get; set; } = false;
public bool? IsInvoice { get; set; }
/// <summary>
/// 是否销售订舱
/// </summary>
public bool? IsCrmOrderFee { get; set; } = false;
public bool? IsCrmOrderFee { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
public int? OrderNo { get; set; }
/// <summary>
/// 费用状态
@ -280,9 +284,7 @@ public class FeeRecordReq
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
public string Note { get; set; }
}
/// <summary>

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using Masuit.Tools.Systems;
namespace DS.WMS.Core.Fee.Dtos;
@ -18,6 +19,8 @@ public class FeeRecordRes
/// </summary>
public long BusinessId { get; set; }
public BusinessType BusinessType { get; set; }
/// <summary>
/// 收付类型(收、付) 1应收 2 应付
/// </summary>
@ -103,16 +106,16 @@ public class FeeRecordRes
/// <summary>
/// Desc:佣金比率
/// </summary>
public decimal? CommissionRate { get; set; } = 0;
public decimal? CommissionRate { get; set; }
/// <summary>
/// Desc:结算金额
/// </summary>
public decimal? SettlementAmount { get; set; } = 0;
public decimal? SettlementAmount { get; set; }
/// <summary>
/// Desc:开票金额
/// </summary>
public decimal? InvoiceAmount { get; set; } = 0;
public decimal? InvoiceAmount { get; set; }
/// <summary>
/// 未开票金额
@ -122,11 +125,11 @@ public class FeeRecordRes
/// <summary>
/// Desc:申请金额
/// </summary>
public decimal? OrderAmount { get; set; } = 0;
public decimal? OrderAmount { get; set; }
/// <summary>
/// Desc:申请开票金额
/// </summary>
public decimal? OrderInvoiceAmount { get; set; } = 0;
public decimal? OrderInvoiceAmount { get; set; }
public long? SubmitBy { get; set; }
/// <summary>
@ -156,7 +159,7 @@ public class FeeRecordRes
/// <summary>
/// 是否机密费用
/// </summary>
public bool? IsOpen { get; set; } = false;
public bool? IsOpen { get; set; }
/// <summary>
/// 对帐编号
/// </summary>
@ -164,23 +167,23 @@ public class FeeRecordRes
/// <summary>
/// 是否对帐
/// </summary>
public bool IsDebit { get; set; } = false;
public bool IsDebit { get; set; }
/// <summary>
/// 是否垫付费用
/// </summary>
public bool? IsAdvancedPay { get; set; } = false;
public bool? IsAdvancedPay { get; set; }
/// <summary>
/// 是否禁开发票
/// </summary>
public bool? IsInvoice { get; set; } = false;
public bool? IsInvoice { get; set; }
/// <summary>
/// 是否销售订舱
/// </summary>
public bool? IsCrmOrderFee { get; set; } = false;
public bool? IsCrmOrderFee { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
public int? OrderNo { get; set; }
/// <summary>
/// 费用状态
@ -325,7 +328,7 @@ public class FeeRecordRes
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
public string Note { get; set; }
/// <summary>
/// 创建人

@ -1,4 +1,5 @@
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
{
@ -14,7 +15,7 @@ namespace DS.WMS.Core.Fee.Dtos
/// <summary>
/// 要提交的费用项
/// </summary>
public List<FeeRecordReq> Items { get; set; }
public List<FeeRecord> Items { get; set; }
}
public class FeeRecordByTemplate

@ -6,7 +6,7 @@ using SqlSugar;
namespace DS.WMS.Core.Fee.Entity
{
[SugarTable("fee_modification", TableDescription = "费用修改记录")]
public class FeeModification : BaseModel<long>
public class FeeModification : BaseModelV2<long>
{
/// <summary>
/// 费用记录ID

@ -10,7 +10,7 @@ namespace DS.WMS.Core.Fee.Entity
/// 费用记录
/// </summary>
[SugarTable("fee_record", TableDescription = "费用记录")]
public class FeeRecord : BaseModel<long>
public class FeeRecord : BaseModelV2<long>
{
/// <summary>
/// 业务Id

@ -175,41 +175,31 @@ namespace DS.WMS.Core.Fee.Method
//若计价货币单位不等于默认货币则尝试获取最新汇率
await FetchExchangeRateAsync(tenantDb, items);
List<FeeRecord> list = new List<FeeRecord>(items.Count());
foreach (var item in items)
{
item.FeeStatus = FeeStatus.Entering;
var createList = items.Where(x => x.Id == 0).ToList();
await tenantDb.Insertable(createList).ExecuteCommandAsync();
if (item.Id == 0)
{
item.BusinessId = first.BusinessId;
item.BusinessType = first.BusinessType;
await tenantDb.Insertable(item).ExecuteCommandAsync();
}
else
{
await tenantDb.Updateable(item).IgnoreColumns(x => new
var updateList = items.Where(x => x.Id > 0).ToList();
await tenantDb.Updateable(updateList).IgnoreColumns(x => new
{
x.FeeStatus,
x.CreateBy,
x.CreateTime,
x.BusinessId,
x.BusinessType,
x.CreateBy,
x.CreateTime,
x.DeleteBy,
x.Deleted,
x.DeleteTime,
x.SubmitDate,
x.SubmitBy
x.SubmitBy,
x.AuditBy,
x.AuditOperator,
x.AuditDate
}).ExecuteCommandAsync();
}
list.Add(item);
}
await tenantDb.Ado.CommitTranAsync();
var list2 = list.Select(x => x.Adapt<FeeRecordRes>()).ToList();
return DataResult.Successed("保存成功", list2, MultiLanguageConst.DataUpdateSuccess);
var list = createList.Union(updateList).Select(x => x.Adapt<FeeRecordRes>());
return DataResult.Successed("保存成功", list, MultiLanguageConst.DataUpdateSuccess);
}
catch (Exception ex)
{

@ -5,7 +5,6 @@ using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Op.Entity;
using Mapster;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
@ -72,13 +71,13 @@ namespace DS.WMS.FeeApi.Controllers
if (recordSubmit.Items.Any(x => x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission))
return DataResult.Failed("只能提交状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.IllegalRequest);
var list = recordSubmit.Items.Select(x => x.Adapt<FeeRecord>());
foreach (var item in list)
foreach (var item in recordSubmit.Items)
{
item.BusinessId = recordSubmit.BusinessId;
item.BusinessType = recordSubmit.BusinessType;
item.FeeStatus = FeeStatus.Entering;
}
return await _feeService.SaveAsync(list);
return await _feeService.SaveAsync(recordSubmit.Items);
}
/// <summary>

@ -1055,3 +1055,45 @@
2024-06-05 13:49:01.3461 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 13:49:01.3530 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 13:49:01.3530 Info Configuration initialized.
2024-06-06 11:15:36.1961 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:15:36.2251 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:15:36.2294 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:15:36.2294 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:15:36.2466 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:15:36.2466 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:15:36.2466 Info Configuration initialized.
2024-06-06 11:20:12.4679 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:20:12.5323 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:20:12.5323 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:20:12.5593 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:20:12.5732 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:20:12.5732 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:20:12.5902 Info Configuration initialized.
2024-06-06 11:22:49.6422 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:22:49.6772 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:22:49.6808 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:22:49.6808 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:22:49.6978 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:22:49.6978 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:22:49.6978 Info Configuration initialized.
2024-06-06 11:25:57.2510 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:25:57.2818 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:25:57.2818 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:25:57.2952 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:25:57.2952 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:25:57.2952 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:25:57.3107 Info Configuration initialized.
2024-06-06 11:28:13.3136 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:28:13.3704 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:28:13.3704 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:28:13.3850 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:28:13.3850 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:28:13.3850 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:28:13.3850 Info Configuration initialized.
2024-06-06 11:37:02.2037 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-06 11:37:02.2311 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-06 11:37:02.2311 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-06 11:37:02.2441 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-06 11:37:02.2441 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-06 11:37:02.2441 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-06 11:37:02.2441 Info Configuration initialized.

Loading…
Cancel
Save