往来单位固定费用功能调整

optimize
zhangxiaofeng 10 months ago
parent d39ac5847f
commit 265ebff769

@ -1,16 +1,97 @@
using Myshipping.Application.Entity;
using Myshipping.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.Fee.Dto
{
public class FeeCustTemplateDto : FeeCustTemplateDetail
public class FeeCustTemplateDto
{
public long Id { get; set; }
/// <summary>
/// 费用名称
/// </summary>
[Description("费用名称")]
public string FeeName { get; set; }
/// <summary>
/// 客户名称
/// </summary>
[Description("客户名称")]
public string CustomerName { get; set; }
/// <summary>
/// 费用标准
/// </summary>
[Description("费用标准")]
public string Unit { get; set; }
/// <summary>
/// 币别
/// </summary>
[Description("币别")]
public string Currency { get; set; }
/// <summary>
/// 单价
/// </summary>
[Description("单价")]
public decimal UnitPrice { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
public string Remark { get; set; }
/// <summary>
/// 排序号
/// </summary>
[Description("排序号")]
public int Sort { get; set; }
/// <summary>
/// 汇率
/// </summary>
[SugarColumn(ColumnName = "ExchangeRate")]
[Description("汇率")]
public decimal ExchangeRate { get; set; }
/// <summary>
/// 是否开票
/// </summary>
[Description("是否开票")]
public bool IsInvoice { get; set; }
/// <summary>
/// 是否垫付
/// </summary>
[Description("是否垫付")]
public bool IsAdvancedPay { get; set; }
/// <summary>
/// Frt PP CC
/// </summary>
[Description("Frt PP CC")]
public string FeeFrt { get; set; }
/// <summary>
/// 税率
/// </summary>
[Description("税率")]
public decimal TaxRate { get; set; }
/// <summary>
/// 财务税率
/// </summary>
[Description("财务税率")]
public decimal AccTaxRate { get; set; }
}
public class FeeCustTemplatePageInput : PageInputBase
{

@ -1,5 +1,4 @@
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.EventBus;
using Furion.FriendlyException;
@ -10,8 +9,7 @@ using Myshipping.Application.Entity;
using Myshipping.Application.Service.Fee.Dto;
using Myshipping.Core;
using Myshipping.Core.Service;
using SqlSugar;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Threading.Tasks;
@ -45,6 +43,9 @@ namespace Myshipping.Application
_repCustTemplete = repCustTemplete;
}
/// <summary>
/// 分页查询往来单位固定费用列表
/// </summary>
[HttpGet("/FeeCustTemplate/Page")]
public async Task<dynamic> Page(FeeCustTemplatePageInput input)
{
@ -69,9 +70,13 @@ namespace Myshipping.Application
return detail?.Adapt<FeeCustTemplateDto>();
}
/// <summary>
/// 往来单位固定费用保存
/// </summary>
[HttpPost("/FeeCustTemplate/Save")]
public async Task Save(FeeCustTemplateDto input)
{
var entity = input.Adapt<FeeCustTemplateDetail>();
if (input.Id == 0)
{
// 判断是否已经存在同单位、同费用的记录
@ -79,7 +84,7 @@ namespace Myshipping.Application
{
throw Oops.Bah("此往来单位下已存在此费用项");
}
await _repCustTemplete.InsertAsync(input);
await _repCustTemplete.InsertAsync(entity);
}
else
{
@ -88,13 +93,23 @@ namespace Myshipping.Application
{
throw Oops.Bah("此往来单位下已存在此费用项");
}
await _repCustTemplete.AsUpdateable(input).IgnoreColumns(c => new { c.TenantId, c.TenantName }).ExecuteCommandAsync();
await _repCustTemplete.AsUpdateable(entity).IgnoreColumns(c => new { c.TenantId, c.TenantName }).ExecuteCommandAsync();
}
}
//[HttpPost("/FeeCustTemplate/Delete")]
//public async Task Delete()
//{
//}
/// <summary>
/// 往来单位固定费用删除
/// </summary>
[HttpPost("/FeeCustTemplate/Delete")]
public async Task Delete([FromBody] long[] ids)
{
await _repCustTemplete.UpdateAsync(c => ids.Contains(c.Id), c => new FeeCustTemplateDetail
{
IsDeleted = true,
UpdatedTime = DateTime.Now,
UpdatedUserId = UserManager.UserId,
UpdatedUserName = UserManager.Name
});
}
}
}

Loading…
Cancel
Save