zhangxiaofeng 10 months ago
commit 2ef0422ddb

@ -0,0 +1,256 @@
using Myshipping.Core;
using SqlSugar;
using System.ComponentModel;
using System;
using System.Collections.Generic;
namespace Myshipping.Application.Service.Fee.Dto
{
public class FeeTemplateDto
{
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[Description("业务类型")]
public string OpType { get; set; }
/// <summary>
/// 收付类型(收、付)
/// </summary>
[Description("收付类型(收、付)")]
public string FeeType { get; set; }
/// <summary>
/// 费用模板名称
/// </summary>
[Description("费用模板名称")]
public string Name { get; set; }
/// <summary>
/// 费用模板描述
/// </summary>
[Description("费用模板描述")]
public string Description { get; set; }
/// <summary>
/// 备注
/// </summary>
[Description("备注")]
public string Remark { get; set; }
/// <summary>
/// 是否公共
/// </summary>
[Description("是否公共")]
public bool IsPublic { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[Description("开始时间")]
public DateTime BgnDate { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[Description("结束时间")]
public DateTime EndDate { get; set; }
}
/// <summary>
/// 查询
/// </summary>
public class FeeTemplatePageInput : PageInputBase
{
/// <summary>
/// 业务类型
/// </summary>
[Description("业务类型")]
public string OpType { get; set; }
/// <summary>
/// 收付类型(收、付)
/// </summary>
[Description("收付类型(收、付)")]
public string FeeType { get; set; }
/// <summary>
/// 费用模板名称
/// </summary>
[Description("费用模板名称")]
public string Name { get; set; }
}
/// <summary>
/// 台账列表
/// </summary>
public class FeeTemplatePageOutput : FeeTemplateDto
{
}
/// <summary>
/// 保存
/// </summary>
public class FeeTemplateSaveDto : FeeTemplateDto
{
/// <summary>
/// 明细
/// </summary>
public List<FeeTemplateDetailDto> Detail { get; set; }
}
/// <summary>
/// 费用模板明细dto
/// </summary>
public class FeeTemplateDetailDto
{
/// <summary>
/// ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板ID
/// </summary>
[Description("模板ID")]
public long TemplateID { get; set; }
/// <summary>
/// 费用名称;取【费用代码】 中的费用名称,录入是可以 通过过费用代码、费用名称检索
/// </summary>
[Description("费用名称;取【费用代码】 中的费用名称,录入是可以 通过过费用代码、费用名称检索")]
public string FeeName { get; set; }
/// <summary>
/// 费用对象;可以为空,为空时 录入费用按客户类型提取业务数据费用对象
/// </summary>
[Description("费用对象;可以为空,为空时 录入费用按客户类型提取业务数据费用对象")]
public string CustomerName { get; set; }
/// <summary>
/// 客户类别;可枚举维护、(船公司、委托单位、场站、车队等)
/// </summary>
[Description("客户类别;可枚举维护、(船公司、委托单位、场站、车队等)")]
public string CustType { 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>
[Description("收付类别(收、付)")]
public string FeeType { get; set; }
/// <summary>
/// 汇率;可以选择 本公司中的 各分公司
/// </summary>
[Description("汇率;可以选择 本公司中的 各分公司")]
public decimal ExchangeRate { get; set; }
/// <summary>
/// 是否按箱型;如果选择了否,则假如前面标准选择了以 20GP为标准则在调用时不管业务信息里有无20GP的箱子都是以20GP为标准有20GP的则调用其数量没有20GP的则生成一条标准为20GP数量为0的费用如果选择了是则只有当业务信息里有 20GP这种箱型时才调用这条费用
/// </summary>
[Description("是否按箱型")]
public bool IsCtn { 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>
/// 税率;含税单价=单价*1+(税率/100录入单价或税率自动计算 含税单价
/// </summary>
[Description("税率;含税单价=单价*1+(税率/100录入单价或税率自动计算 含税单价")]
public decimal TaxRate { get; set; }
/// <summary>
/// 税额
/// </summary>
[Description("税额")]
public decimal Tax { get; set; }
/// <summary>
/// 核算单位
/// </summary>
[Description("核算单位")]
public string SaleCorp { get; set; }
/// <summary>
/// 含税单价
/// </summary>
[Description("含税单价")]
public decimal TaxUnitPrice { get; set; }
/// <summary>
/// 财务税率
/// </summary>
[Description("财务税率")]
public decimal AccTaxRate { get; set; }
/// <summary>
/// 费用英文名称;录入费用名称时,自动带出【费用代码】的 费用英文名称
/// </summary>
[Description("费用英文名称;录入费用名称时,自动带出【费用代码】的 费用英文名称")]
public string FeeDescription { get; set; }
/// <summary>
/// 费用分组;枚举中设置的 费用分组
/// </summary>
[Description("费用分组;枚举中设置的 费用分组")]
public string FeeGroup { get; set; }
}
}

@ -19,7 +19,7 @@ namespace Myshipping.Application
/// <summary>
/// 往来单位固定费用
/// </summary>
[ApiDescriptionSettings("Application", Name = "FeeTemplate", Order = 1)]
[ApiDescriptionSettings("Application", Name = "FeeCustTemplate", Order = 1)]
public class FeeCustTemplateService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<FeeCustTemplateDetail> _repCustTemplete;

@ -0,0 +1,154 @@
using Furion;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.EventBus;
using Furion.FriendlyException;
using Furion.LinqBuilder;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity;
using Myshipping.Application.Event;
using Myshipping.Application.Service.BookingOrder.Dto;
using Myshipping.Application.Service.BookingSlot.Dto;
using Myshipping.Application.Service.Fee.Dto;
using Myshipping.Core;
using Myshipping.Core.Service;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Yitter.IdGenerator;
namespace Myshipping.Application
{
/// <summary>
/// 费用模板
/// </summary>
[ApiDescriptionSettings("Application", Name = "FeeTemplate", Order = 1)]
public class FeeTemplateService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<FeeTemplate> _repTemplate;
private readonly SqlSugarRepository<FeeTemplateDetail> _repTemplateDetail;
private readonly ILogger<FeeTemplateService> _logger;
private readonly ISysCacheService _cache;
private readonly IEventPublisher _publisher;
public FeeTemplateService(SqlSugarRepository<FeeTemplate> repTemplate,
SqlSugarRepository<FeeTemplateDetail> repTemplateDetail,
ILogger<FeeTemplateService> logger,
ISysCacheService cache,
IEventPublisher publisher)
{
_repTemplate = repTemplate;
_repTemplateDetail = repTemplateDetail;
_logger = logger;
_cache = cache;
_publisher = publisher;
}
/// <summary>
/// 费用模板查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/FeeTemplate/Page")]
public async Task<dynamic> Page(FeeTemplatePageInput input)
{
var entities = await _repTemplate.AsQueryable()
.WhereIF(!string.IsNullOrEmpty(input.OpType), u => u.OpType == input.OpType)
.WhereIF(!string.IsNullOrEmpty(input.FeeType), u => u.OpType == input.FeeType)
.WhereIF(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name))
.ToPagedListAsync(input.PageNo, input.PageSize);
var result = entities.Adapt<SqlSugarPagedList<FeeTemplatePageOutput>>();
return result.XnPagedResult();
}
/// <summary>
/// 保存
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/FeeTemplate/Save")]
public async Task<FeeTemplateSaveDto> Save(FeeTemplateSaveDto input)
{
if (input == null)
{
throw Oops.Bah("请传入正常数据!");
}
FeeTemplate entity = null;
if (input.Id == 0)
{
entity = input.Adapt<FeeTemplate>();
entity.Id = YitIdHelper.NextId();
await _repTemplate.InsertAsync(entity);
}
else
{
entity = await _repTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == input.Id);
entity = input.Adapt(entity);
await _repTemplate.UpdateAsync(entity);
}
await _repTemplateDetail.DeleteAsync(x => x.TemplateID == entity.Id);
foreach (var det in input.Detail)
{
var detail = det.Adapt<FeeTemplateDetail>();
detail.Id = YitIdHelper.NextId();
detail.TemplateID = entity.Id;
await _repTemplateDetail.InsertAsync(detail);
}
var rtn = entity.Adapt<FeeTemplateSaveDto>();
rtn.Detail = input.Detail;
return rtn;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("/FeeTemplate/Detail")]
public async Task<FeeTemplateSaveDto> Detail(long id)
{
var entity = await _repTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
var detailList = await _repTemplateDetail.AsQueryable().Where(x => x.TemplateID == id).ToListAsync();
var rtn = entity.Adapt<FeeTemplateSaveDto>();
rtn.Detail = detailList.Adapt<List<FeeTemplateDetailDto>>();
return rtn;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[HttpPost("/FeeTemplate/Delete")]
public async Task Delete(List<long> ids)
{
var list = await _repTemplate.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync();
list.ForEach(x => x.IsDeleted = true);
await _repTemplate.AsUpdateable(list).ExecuteCommandAsync();
}
}
}
Loading…
Cancel
Save