jianghaiqing 10 months ago
commit 90566a19ec

@ -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
{

@ -6,11 +6,6 @@ namespace Myshipping.Application.Service.Fee.Dto
{
public class FeeRecordDto : FeeRecord
{
/// <summary>
/// 是否标记为删除
/// </summary>
public bool MarkDelete { get; set; }
/// <summary>
/// 是否标记为修改
/// </summary>
@ -25,6 +20,14 @@ namespace Myshipping.Application.Service.Fee.Dto
}
public class FeeRecordSaveDto
{
public List<FeeRecordDto> FeeRecordList { get; set; }
/// <summary>
/// 待新增或修改费用列表
/// </summary>
public List<FeeRecordDto> SaveList { get; set; }
/// <summary>
/// 待删除删除费用列表
/// </summary>
public List<FeeRecordDto> DeleteList { get; set; }
}
}

@ -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
});
}
}
}

@ -80,11 +80,11 @@ namespace Myshipping.Application
[SqlSugarUnitOfWork]
public async Task Save(FeeRecordSaveDto input)
{
input.FeeRecordList ??= new List<FeeRecordDto>();
input.SaveList ??= new List<FeeRecordDto>();
input.DeleteList ??= new List<FeeRecordDto>();
var waitDeleteList = input.FeeRecordList.Where(r => r.MarkDelete && r.Id != 0).ToList();
var waitInsertList = input.FeeRecordList.Where(r => !r.MarkDelete && r.Id == 0).ToList();
var waitUpdateList = input.FeeRecordList.Where(r => !r.MarkDelete && r.MarkModify && r.Id != 0).ToList();
var waitInsertList = input.SaveList.Where(r => r.Id == 0).ToList();
var waitUpdateList = input.SaveList.Where(r => r.Id != 0 && r.MarkModify).ToList();
#region 校验
foreach (var item in waitInsertList.Concat(waitUpdateList))
@ -102,9 +102,9 @@ namespace Myshipping.Application
#endregion
// 删除
if (waitDeleteList.Any())
if (input.DeleteList.Any())
{
var waitDeleteListTemp = waitDeleteList.Select(r => r.Id).ToList();
var waitDeleteListTemp = input.DeleteList.Select(r => r.Id).ToList();
await _repRecord.UpdateAsync(r => waitDeleteListTemp.Contains(r.Id), r => new FeeRecord() { IsDeleted = true });
}

@ -128,6 +128,11 @@ namespace Myshipping.Application
/// 委托单位联系人名称
/// </summary>
public string CustomerContactName { get; set; }
/// <summary>
/// 是否直接发送邮件给订舱联系人
/// </summary>
public bool IsDirectSend { get; set; } = false;
}
}

@ -56,7 +56,7 @@
},
"Cache": {
"CacheType": "RedisCache", // RedisCache
"RedisConnectionString": "192.168.0.180:6379,password=,defaultDatabase=11"
"RedisConnectionString": "192.168.0.80:6379,password=,defaultDatabase=11"
},
"SnowId": {
"WorkerId": "1" // 0~63,1

Loading…
Cancel
Save