费用审核bug修复

usertest
嵇文龙 6 months ago
parent f8ef514762
commit 379ebe5ed3

@ -1,5 +1,5 @@
using DS.Module.Core;
using System.Runtime.Serialization;
using System.Runtime.Serialization;
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Op.Entity;
@ -30,6 +30,11 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal? AmountUSD { get; set; }
/// <summary>
/// 其他币别申请金额
/// </summary>
public decimal? AmountOther { get; set; }
/// <summary>
/// 申请币别
/// </summary>
@ -91,7 +96,7 @@ namespace DS.WMS.Core.Fee.Dtos
public string? Reason { get; set; }
/// <summary>
/// 客户名称
/// 客户名称/结算单位
/// </summary>
public string? CustomerName { get; set; }
@ -143,6 +148,7 @@ namespace DS.WMS.Core.Fee.Dtos
/// <summary>
/// 所属分部
/// </summary>
[IgnoreDataMember]
public long? SaleDeptId { get; set; }
public string? SaleDeptName { get; set; }
@ -165,6 +171,16 @@ namespace DS.WMS.Core.Fee.Dtos
public string CreateByName { get; set; }
public List<FeeApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 委托单位
/// </summary>
public string? Client { get; set; }
/// <summary>
/// 结算对象银行
/// </summary>
public string? CustomerBank { get; set; }
}
/// <summary>
@ -189,6 +205,11 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public string? MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string? HBLNO { get; set; }
/// <summary>
/// 委托编号
/// </summary>
@ -203,6 +224,7 @@ namespace DS.WMS.Core.Fee.Dtos
/// 业务锁定
/// </summary>
public bool? IsBusinessLocking { get; set; }
/// <summary>
/// 费用锁定
/// </summary>
@ -258,6 +280,11 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
public decimal OriginalAmount { get; set; }
/// <summary>
/// 原始币别
/// </summary>
@ -273,11 +300,6 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 原始金额
/// </summary>
public decimal OriginalAmount { get; set; }
/// <summary>
/// 销项税率
/// </summary>
@ -312,5 +334,78 @@ namespace DS.WMS.Core.Fee.Dtos
/// 订舱代理
/// </summary>
public string? Forwarder { get; set; }
/// <summary>
/// 未收合计
/// </summary>
public decimal? OutstandingAmount { get; set; }
/// <summary>
/// 发票备注
/// </summary>
public string? InvoiceRemark { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string? BookingNo { get; set; }
}
/// <summary>
/// 费用申请单审核信息展示
/// </summary>
public class FeeApplicationSummary
{
/// <summary>
/// 费用汇总
/// </summary>
public List<SummaryItem> SummaryItems { get; set; }
/// <summary>
/// 申请单明细
/// </summary>
public List<FeeApplicationDetailDto>? Details { get; set; }
/// <summary>
/// 初始化
/// </summary>
/// <param name="details">申请单明细</param>
public FeeApplicationSummary(List<FeeApplicationDetailDto> details)
{
Details = details;
SummaryItems = details.GroupBy(x => new { x.FeeType, x.OriginalCurrency }).Select(x => new SummaryItem
{
FeeType = x.Key.FeeType,
Currency = x.Key.OriginalCurrency,
Amount = x.Sum(y => y.Amount),
OriginalAmount = x.Sum(y => y.OriginalAmount)
}).ToList();
}
}
/// <summary>
/// 申请单费用汇总
/// </summary>
public class SummaryItem
{
/// <summary>
/// 费用类型
/// </summary>
public FeeType FeeType { get; set; }
/// <summary>
/// 币别
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 申请金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
public decimal OriginalAmount { get; set; }
}
}

@ -42,4 +42,17 @@ namespace DS.WMS.Core.Fee.Dtos
public BusinessType BusinessType { get; set; }
}
public class BizOperation
{
/// <summary>
/// 请求值object类型根据业务按需传值
/// </summary>
public object Value { get; set; }
/// <summary>
/// 业务ID与类型
/// </summary>
public List<BizAudit> Items { get; set; }
}
}

@ -33,6 +33,12 @@ namespace DS.WMS.Core.Fee.Entity
[SugarColumn(ColumnDescription = "美元申请金额", IsNullable = true)]
public decimal? AmountUSD { get; set; }
/// <summary>
/// 其他币别申请金额
/// </summary>
[SugarColumn(ColumnDescription = "其他币别申请金额", IsNullable = true)]
public decimal? AmountOther { get; set; }
/// <summary>
/// 申请币别
/// </summary>

@ -1,6 +1,5 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Interface
{
@ -9,7 +8,11 @@ namespace DS.WMS.Core.Fee.Interface
/// </summary>
public interface IFeeApplicationAuditService
{
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<List<FeeApplicationDetailDto>>> GetDetailsAsync(long id);
}
}

@ -6,6 +6,8 @@ using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;
using Microsoft.Extensions.DependencyInjection;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Method
{
@ -25,6 +27,89 @@ namespace DS.WMS.Core.Fee.Method
flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>();
}
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
public async Task<DataResult<List<FeeApplicationDetailDto>>> GetDetailsAsync(long id)
{
var details = await TenantDb.Queryable<FeeApplicationDetail>()
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
.LeftJoin<BusinessFeeStatus>((d, f, b) => f.BusinessId == b.BusinessId && f.BusinessType == b.BusinessType)
.Where(d => d.ApplicationId == id)
.Select((d, f, b) => new FeeApplicationDetailDto
{
AccTaxRate = f.AccTaxRate,
Amount = d.Amount,
FeeName = d.FeeName,
FeeType = f.FeeType,
FeeObject = f.CustomerName,
OriginalCurrency = d.OriginalCurrency,
OriginalRate = f.ExchangeRate,
ExchangeRate = d.ExchangeRate,
OriginalAmount = d.OriginalAmount,
BusinessId = b.BusinessId,
BusinessType = b.BusinessType,
IsBusinessLocking = b.IsBusinessLocking,
IsFeeLocking = b.IsFeeLocking
}).ToListAsync();
if (details.Count > 0)
{
var gList = details.GroupBy(x => x.BusinessType).ToList();
foreach (var g in gList)
{
var ids = g.Select(x => x.BusinessId).ToList();
switch (g.Key)
{
case BusinessType.OceanShippingExport:
var list1 = await TenantDb.Queryable<SeaExport>().Where(x => ids.Contains(x.Id)).Select(x => new
{
x.Id,
x.MBLNO,
x.CustomerNo,
x.CustomerName,
x.ETD,
x.CntrTotal,
x.AccountDate,
x.OperatorCode,
x.Vessel,
x.Voyno,
x.Carrier,
x.Forwarder,
x.BookingNo
}).ToListAsync();
foreach (var item in g)
{
var biz = list1.Find(x => x.Id == item.BusinessId);
if (biz != null)
{
item.MBLNO = biz.MBLNO;
item.CustomerName = biz.CustomerName;
item.CustomerNo = biz.CustomerNo;
item.ETD = biz.ETD;
item.CntrTotal = biz.CntrTotal;
item.AccountDate = biz.AccountDate;
item.Operator = biz.OperatorCode;
item.Vessel = biz.Vessel;
item.Voyage = biz.Voyno;
item.Carrier = biz.Carrier;
item.Forwarder = biz.Forwarder;
item.BookingNo = biz.BookingNo;
}
}
break;
case BusinessType.OceanShippingImport:
break;
}
}
}
return DataResult<List<FeeApplicationDetailDto>>.Success(details);
}
//public async Task<DataResult> AuditAsync()
//{

@ -11,6 +11,7 @@ using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using LanguageExt.Common;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -182,19 +183,9 @@ namespace DS.WMS.Core.Fee.Method
public async Task<DataResult<List<FeeApplicationDto>>> GetListAsync(PageRequest request)
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = await TenantDb.Queryable<FeeApplication>().Where(whereList).Select<FeeApplicationDto>().ToQueryPageAsync(request.PageCondition);
var result = await TenantDb.Queryable<FeeApplication>().Where(whereList).Select<FeeApplicationDto>().ToQueryPageAsync(request.PageCondition);
//关联用户名称
var userIds = data.Data.Select(x => x.CreateBy).Distinct(); //.Union(data.Data.Select(x => x.CreateBy))
var users = await Db.Queryable<SysUser>().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync();
foreach (var item in data.Data)
{
item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName;
}
return data;
return result;
}
/// <summary>
@ -359,6 +350,7 @@ namespace DS.WMS.Core.Fee.Method
application.AmountRMB = application.Details.Where(x => x.Currency == "CNY").Sum(x => x.Amount);
application.AmountUSD = application.Details.Where(x => x.Currency == "USD").Sum(x => x.Amount);
application.AmountOther = application.Details.Where(x => x.Currency != "CNY" && x.Currency != "USD").Sum(x => x.Amount);
}
//关联用户名称

@ -76,10 +76,10 @@ namespace DS.WMS.Core.Fee.Method
if (result.Data.Count > 0)
{
//关联用户名称
var UserIds = result.Data.Where(x => x.OperatorId.HasValue).Select(x => x.OperatorId.Value)
var userIds = result.Data.Where(x => x.OperatorId.HasValue).Select(x => x.OperatorId.Value)
.Union(result.Data.Select(x => x.CreateBy))
.Distinct();
var Users = await Db.Queryable<SysUser>().Where(x => UserIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync();
var Users = await Db.Queryable<SysUser>().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync();
foreach (var item in result.Data)
{
item.CreateByName = Users.Find(x => x.Id == item.CreateBy)?.UserName;
@ -399,8 +399,8 @@ namespace DS.WMS.Core.Fee.Method
{
var list1 = request.Items.Select(x => x.Id).ToList();
var list2 = request.Items.Select(x => x.BusinessType).Distinct().ToList();
var recordIds = await Db.Queryable<FeeRecord>().Where(x =>
list1.Contains(x.BusinessId) && list2.Contains(x.BusinessType))
var recordIds = await TenantDb.Queryable<FeeRecord>().Where(x =>
list1.Contains(x.BusinessId) && list2.Contains(x.BusinessType) && AuditStatusArray.Contains(x.FeeStatus))
.Select(x => x.Id).ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询

@ -305,7 +305,8 @@ namespace DS.WMS.Core.Fee.Method
FeeName = x.FeeName,
FeeStatus = x.FeeStatus,
FlowId = x.FlowId,
BusinessId = x.BusinessId
BusinessId = x.BusinessId,
BusinessType = x.BusinessType
}).ToListAsync();
if (fees.IsNullOrEmpty())
return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed);

@ -8,6 +8,7 @@ using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using MathNet.Numerics.Distributions;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
@ -446,8 +447,10 @@ public class FlowInstanceService : IFlowInstanceService
}
//更新回调执行标识
instance.IsCallbackExecuted = true;
await db.Updateable(instance).UpdateColumns(x => new { x.IsCallbackExecuted }).ExecuteCommandAsync();
db.Updateable<FlowInstance>().SetColumns(it => new FlowInstance { IsCallbackExecuted = true })
.Where(it => it.Id == instance.Id).ExecuteCommand();
//instance.IsCallbackExecuted = true;
//await db.Updateable(instance).UpdateColumns(x => new { x.IsCallbackExecuted }).ExecuteCommandAsync();
}
catch (Exception ex)
{

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
@ -79,7 +80,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="remark">审批备注</param>
/// <returns></returns>
[HttpPost, Route("OneClickAudit")]
public async Task<DataResult> OneClickAuditAsync(int status, string remark)
public async Task<DataResult> OneClickAuditAsync(int status, string remark)
{
if (status != 1 && status != 2)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
@ -101,6 +102,32 @@ namespace DS.WMS.FeeApi.Controllers
return await _auditService.AuditBusinessAsync(request);
}
/// <summary>
/// 设置业务锁定状态
/// </summary>
/// <param name="operation">请求信息</param>
/// <returns></returns>
[HttpPost, Route("SetLocking")]
public async Task<DataResult> SetLockingAsync(BizOperation operation)
{
bool? isLocked = null;
try
{
isLocked = Convert.ToBoolean(operation.Value);
}
catch
{
return DataResult.Failed($"参数{nameof(operation.Value)}无效", MultiLanguageConst.IllegalRequest);
}
return await _auditService.SetFeeLockingAsync(operation.Items.Select(x => new Core.Op.Entity.BusinessFeeStatus
{
BusinessId = x.Id,
BusinessType = x.BusinessType,
IsFeeLocking = isLocked
}));
}
/// <summary>
/// 变更费用审批状态(用于工作流框架的回调)
/// </summary>

@ -1265,3 +1265,24 @@
2024-06-14 10:05:36.0521 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-14 10:05:36.0521 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-14 10:05:36.0521 Info Configuration initialized.
2024-06-14 14:51:42.8478 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-14 14:51:42.8881 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-14 14:51:42.8881 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-14 14:51:42.9077 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-14 14:51:42.9077 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-14 14:51:42.9077 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-14 14:51:42.9250 Info Configuration initialized.
2024-06-14 14:53:00.1289 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-14 14:53:00.1663 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-14 14:53:00.1663 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-14 14:53:00.1919 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-14 14:53:00.1919 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-14 14:53:00.2085 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-14 14:53:00.2085 Info Configuration initialized.
2024-06-14 14:56:41.2790 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-14 14:56:41.3109 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-14 14:56:41.3109 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-14 14:56:41.3248 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-14 14:56:41.3248 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-14 14:56:41.3331 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-14 14:56:41.3331 Info Configuration initialized.

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-06-14T01:42:21.5397525Z||;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-06-14T07:19:45.7395180Z||;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 />
</PropertyGroup>
</Project>
Loading…
Cancel
Save