申请单审核服务

usertest
嵇文龙 5 months ago
parent cd05267d2c
commit 6ca2e89b86

@ -3,9 +3,9 @@
namespace DS.WMS.Core.Fee.Dtos
{
/// <summary>
/// 审批请求
/// 审批请求基类
/// </summary>
public class AuditRequest
public class AuditRequestBase
{
/// <summary>
/// 审核结果1=通过2=驳回
@ -18,33 +18,41 @@ namespace DS.WMS.Core.Fee.Dtos
public string? Remark { get; set; }
}
public class FeeAuditRequest : AuditRequest
/// <summary>
/// 按业务类型一致的审批请求
/// </summary>
public class AuditRequest : AuditRequestBase
{
/// <summary>
/// 审批的费用ID
/// 审批的ID
/// </summary>
public long[] Ids { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public BusinessType BusinessType { get; set; }
public BusinessType? BusinessType { get; set; }
}
public class FeeBizAuditRequest: AuditRequest
/// <summary>
/// 不同业务类型的审批请求
/// </summary>
public class BizAuditRequest : AuditRequestBase
{
public string? QueryCondition { get; set; }
public List<BizAudit> Items { get; set; }
public List<BizAuditItem> Items { get; set; }
}
public class BizAudit
public class BizAuditItem
{
public long Id { get; set; }
public BusinessType BusinessType { get; set; }
}
public class BizOperation
{
/// <summary>
@ -55,6 +63,11 @@ namespace DS.WMS.Core.Fee.Dtos
/// <summary>
/// 业务ID与类型
/// </summary>
public List<BizAudit> Items { get; set; }
public List<BizAuditItem> Items { get; set; }
}
public class AuditDetailRequest : BizAuditItem
{
public string? QueryCondition { get; set; }
}
}

@ -1,4 +1,5 @@
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Runtime.Serialization;
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Op.Entity;
@ -181,6 +182,30 @@ namespace DS.WMS.Core.Fee.Dtos
/// 结算对象银行
/// </summary>
public string? CustomerBank { get; set; }
/// <summary>
/// 审核状态(仅查询用)
/// </summary>
public AuditStatusForQuery? AuditStatus { get; set; }
}
public enum AuditStatusForQuery
{
/// <summary>
/// 未审核
/// </summary>
Pending = 1,
/// <summary>
/// 已审核
/// </summary>
Audited = 2,
/// <summary>
/// 仅需自己审核
/// </summary>
MarkerOnly = 3
}
/// <summary>
@ -352,7 +377,7 @@ namespace DS.WMS.Core.Fee.Dtos
}
/// <summary>
/// 费用申请单审核信息展示
/// 费用申请单审核明细展示
/// </summary>
public class FeeApplicationSummary
{
@ -408,4 +433,12 @@ namespace DS.WMS.Core.Fee.Dtos
/// </summary>
public decimal OriginalAmount { get; set; }
}
/// <summary>
/// 申请单费用合计项
/// </summary>
public class TotalItem
{
}
}

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
namespace DS.WMS.Core.Fee.Interface
{
@ -13,6 +14,35 @@ namespace DS.WMS.Core.Fee.Interface
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<List<FeeApplicationDetailDto>>> GetDetailsAsync(long id);
Task<DataResult<FeeApplicationSummary>> GetDetailsAsync(long id);
/// <summary>
/// 一键审核当前登录用户的所有待审核项
/// </summary>
/// <param name="yesOrNo">审批结果1=通过2=驳回</param>
/// <param name="remark">备注</param>
/// <returns></returns>
Task<DataResult> AuditAsync(int yesOrNo, string? remark);
/// <summary>
/// 费用申请单审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult> AuditAsync(AuditRequest request);
/// <summary>
/// 将申请单重置为未打印状态
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
Task<DataResult> SetUnPrinted(params long[] ids);
/// <summary>
/// 根据审批结果更新审批状态
/// </summary>
///<param name="callback">回调信息</param>
/// <returns></returns>
Task<DataResult> UpdateStatusAsync(FlowCallback callback);
}
}

@ -24,6 +24,15 @@ namespace DS.WMS.Core.Fee.Interface
/// <returns></returns>
Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest request);
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="query"></param>
/// <returns></returns>
Task<DataResult<List<FeeAuditItem>>> GetFeesAsync(long id, BusinessType businessType, string query);
/// <summary>
/// 按费用批量审批
/// </summary>
@ -38,7 +47,7 @@ namespace DS.WMS.Core.Fee.Interface
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult> AuditAsync(FeeBizAuditRequest request);
Task<DataResult> AuditAsync(BizAuditRequest request);
/// <summary>
/// 本票审核(一键审核当前登录用户的所有待审核项)
@ -52,7 +61,7 @@ namespace DS.WMS.Core.Fee.Interface
/// 整票审核
/// </summary>
/// <param name="request"></param>
Task<DataResult> AuditBusinessAsync(FeeBizAuditRequest request);
Task<DataResult> AuditBusinessAsync(BizAuditRequest request);
/// <summary>
/// 设置业务费用锁定状态

@ -1,13 +1,13 @@
using DS.Module.Core.Enums;
using DS.Module.Core;
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
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;
using Microsoft.Extensions.DependencyInjection;
namespace DS.WMS.Core.Fee.Method
{
@ -16,6 +16,7 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
public class FeeApplicationAuditService : FeeServiceBase, IFeeApplicationAuditService
{
internal static readonly string[] AuditTypes = [AuditType.PaidApplication.ToString()];
readonly IClientFlowInstanceService flowService;
/// <summary>
@ -32,7 +33,7 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
public async Task<DataResult<List<FeeApplicationDetailDto>>> GetDetailsAsync(long id)
public async Task<DataResult<FeeApplicationSummary>> GetDetailsAsync(long id)
{
var details = await TenantDb.Queryable<FeeApplicationDetail>()
.LeftJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
@ -107,13 +108,113 @@ namespace DS.WMS.Core.Fee.Method
}
}
return DataResult<List<FeeApplicationDetailDto>>.Success(details);
return DataResult<FeeApplicationSummary>.Success(new FeeApplicationSummary(details));
}
/// <summary>
/// 一键审核当前登录用户的所有待审核项
/// </summary>
/// <param name="yesOrNo">审批结果1=通过2=驳回</param>
/// <param name="remark">备注</param>
/// <returns></returns>
public async Task<DataResult> AuditAsync(int yesOrNo, string? remark)
{
var recordIds = await GetCurrentFlowsQuery(AuditTypes).Select(x => x.BusinessId).ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询
if (recordIds.Length == 0)
return DataResult.Failed("当前暂无待审批的费用");
return await AuditAsync(new AuditRequest { Ids = recordIds, Remark = remark, Result = yesOrNo });
}
/// <summary>
/// 费用申请单审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult> AuditAsync(AuditRequest request)
{
var apps = await TenantDb.Queryable<FeeApplication>().Where(x => request.Ids.Contains(x.Id)).Select(x => new
{
x.Id,
x.ApplicationNO,
x.Status,
x.FlowId
}).ToListAsync();
if (apps.Count == 0)
return DataResult.Failed("未能获取申请单信息");
if (apps.Exists(x => !x.FlowId.HasValue))
return DataResult.Failed("提交数据中包含不在审批流程中的申请单");
if (apps.Exists(x => x.Status != ApplicationStatus.AuditSubmittd))
return DataResult.Failed("提交数据中包含不在待审批状态的申请单");
var flowIds = apps.Select(x => x.FlowId.GetValueOrDefault());
var flows = await Db.Queryable<FlowInstance>().Where(x => flowIds.Contains(x.Id)).ToListAsync();
if (apps.Count == 0)
return DataResult.Failed("未能获取审批工作流");
if (flows.Exists(x => !x.MakerList.Contains(User.UserId)))
return DataResult.Failed("所选申请单包含不属于当前用户权限范围内的审批,禁止提交");
List<string> list = [];
foreach (var app in apps)
{
var flow = flows.Find(x => x.Id == app.FlowId.Value);
if (flow == null)
{
continue;
}
var result = flowService.AuditFlowInstance(new FlowAuditInfo
{
Instance = flow,
Status = request.Result,
AuditNote = request.Remark
});
if (!result.Succeeded)
{
list.Add(app.ApplicationNO);
}
}
if (list.Count > 0)
return DataResult.Failed($"下列申请单审批失败:{string.Join("", list)}");
return DataResult.Success;
}
//public async Task<DataResult> AuditAsync()
//{
/// <summary>
/// 将申请单重置为未打印状态
/// </summary>
/// <param name="ids">申请单ID</param>
/// <returns></returns>
public async Task<DataResult> SetUnPrinted(params long[] ids)
{
var list = ids.Select(x => new FeeApplication
{
Id = x,
IsPrinted = false,
PrintTimes = 0,
//PrinterId = null,
//PrinterName = null,
//PrintTime = null
}).ToList();
int rows = await TenantDb.Updateable(list).UpdateColumns(x => new
{
x.IsPrinted,
x.PrintTimes,
x.PrinterId,
x.PrinterName,
x.PrintTime
}).ExecuteCommandAsync();
//}
return rows > 0 ? DataResult.Success : DataResult.Failed("设置失败");
}
/// <summary>
/// 根据审批结果更新申请单状态

@ -11,7 +11,6 @@ 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;
@ -36,7 +35,7 @@ namespace DS.WMS.Core.Fee.Method
}
/// <summary>
/// 获取待付费的业务列表
/// 获取待付费的业务列表(编辑用)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
@ -159,6 +158,7 @@ namespace DS.WMS.Core.Fee.Method
CreateBy = f.CreateBy
}).ToListAsync();
//移除未接金额为0的项
list.RemoveAll(f => f.RestAmount == 0);
if (list.Count > 0)
@ -182,10 +182,46 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public async Task<DataResult<List<FeeApplicationDto>>> GetListAsync(PageRequest request)
{
var query = TenantDb.Queryable<FeeApplication>();
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var result = await TenantDb.Queryable<FeeApplication>().Where(whereList).Select<FeeApplicationDto>().ToQueryPageAsync(request.PageCondition);
int? index = null;
foreach (var item in whereList)
{
ConditionalModel? model = item as ConditionalModel;
return result;
//设置了状态筛选
if (model != null && string.Equals(model.FieldName, nameof(FeeApplicationDto.AuditStatus))
&& int.TryParse(model.FieldValue, out int statusValue))
{
AuditStatusForQuery status = (AuditStatusForQuery)statusValue;
switch (status)
{
case AuditStatusForQuery.Pending:
query = query.Where(x => x.AuditerId == null);
break;
case AuditStatusForQuery.Audited:
query = query.Where(x => x.AuditerId != null);
break;
case AuditStatusForQuery.MarkerOnly:
var ids = await GetCurrentFlowsQuery(FeeApplicationAuditService.AuditTypes).Select(x => x.BusinessId).ToListAsync();
if (ids.Count == 0)
ids.Add(0L);
query = query.Where(x => ids.Contains(x.Id));
break;
}
index = whereList.IndexOf(item);
break;
}
}
if (index.HasValue)
whereList.RemoveAt(index.Value);
return await query.Where(whereList).Select<FeeApplicationDto>().ToQueryPageAsync(request.PageCondition);
}
/// <summary>

@ -1,5 +1,4 @@
using Castle.Core.Resource;
using DS.Module.Core;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
@ -13,8 +12,6 @@ using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using NPOI.SS.Formula.Functions;
using NPOI.Util;
using SqlSugar;
namespace DS.WMS.Core.Fee.Method
@ -31,15 +28,8 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
public static readonly FeeStatus[] AuditStatusArray = [FeeStatus.AuditSubmitted, FeeStatus.ApplyDeletion, FeeStatus.ApplyModification];
/// <summary>
/// 一键审核支持的类型
/// </summary>
public static readonly string[] AuditTypes = [AuditType.FeeAudit.ToString(), AuditType.FeeModify.ToString(), AuditType.FeeDelete.ToString()];
/// <summary>
/// 工作流运行状态值
/// </summary>
public static readonly int RunningStatus = (int)FlowStatusEnum.Running;
//一键审核支持的类型
static readonly string[] AuditTypes = [AuditType.FeeAudit.ToString(), AuditType.FeeModify.ToString(), AuditType.FeeDelete.ToString()];
readonly IClientFlowInstanceService flowService;
readonly IFeeRecordService feeService;
@ -102,7 +92,7 @@ namespace DS.WMS.Core.Fee.Method
}
//创建各项费用数据的查询并集
internal ISugarQueryable<FeeAuditBusinessQuery> CreateQuery(IEnumerable<FlowInstance>? additions)
internal ISugarQueryable<FeeAuditBusinessQuery> CreateQuery(List<FlowInstance>? additions)
{
//海运出口
var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray();
@ -238,7 +228,7 @@ namespace DS.WMS.Core.Fee.Method
}
//创建各项业务数据的查询并集
internal ISugarQueryable<FeeAuditBusinessQuery> CreateBizQuery(IEnumerable<FlowInstance>? additions)
internal ISugarQueryable<FeeAuditBusinessQuery> CreateBizQuery(List<FlowInstance>? additions)
{
//海运出口
var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray();
@ -326,12 +316,96 @@ namespace DS.WMS.Core.Fee.Method
return TenantDb.UnionAll(new List<ISugarQueryable<FeeAuditBusinessQuery>> { query1 });
}
//获取当前登录用户的待审批工作流的查询对象
internal ISugarQueryable<FlowInstance> GetCurrentFlowsQuery(string[] auditTypes)
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="query"></param>
/// <returns></returns>
public async Task<DataResult<List<FeeAuditItem>>> GetFeesAsync(long id, BusinessType businessType, string query)
{
var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == id &&
f.BusinessType == businessType && AuditStatusArray.Contains(f.FeeStatus))
.InnerJoin<SeaExport>((f, s) => f.BusinessId == s.Id)
.LeftJoin<InfoClient>((f, s, i) => f.CustomerId == i.Id)
.Select((f, s, i) => new FeeAuditItemQuery
{
Id = f.Id,
BusinessId = f.BusinessId,
BusinessType = f.BusinessType,
FeeStatus = f.FeeStatus,
FeeType = f.FeeType,
FeeId = f.FeeId,
FeeName = f.FeeName,
FeeEnName = f.FeeEnName,
FeeCustomerId = f.CustomerId,
CustomerName = s.CustomerName,
CustomerFullName = i.Description, //结算对象全称
CustomerType = f.CustomerType,
CustomerTypeText = f.CustomerTypeText,
Unit = f.Unit,
UnitText = f.UnitText,
UnitPrice = f.UnitPrice,
TaxUnitPrice = f.TaxUnitPrice,
Quantity = f.Quantity,
TaxRate = f.TaxRate,
NoTaxAmount = f.NoTaxAmount,
Amount = f.Amount,
Currency = f.Currency,
CurrencyText = f.CurrencyText,
ExchangeRate = f.ExchangeRate,
AccTaxRate = f.AccTaxRate,//销项汇率
Remark = f.Remark,
IsAdvancedPay = f.IsAdvancedPay,//是否垫付
IsInvoice = f.IsInvoice, //是否开发票
//FRT
CommissionRate = f.CommissionRate, //佣金比率
CreateBy = f.CreateBy,
CreateTime = f.CreateTime,
SettlementAmount = f.SettlementAmount,//结算金额
InvoiceAmount = f.InvoiceAmount,//开票金额
OrderAmount = f.OrderAmount,//申请金额
InvoiceNum = f.InvoiceNum,//发票号
Tax = f.Tax,//税额
DebitNo = f.DebitNo,//对账编号
SaleOrg = f.SaleOrg,
Reason = f.Reason,
CustomerNo = s.CustomerNo,
Vessel = s.Vessel,
Voyage = s.Voyno,
SaleId = s.SaleId,
CustomerId = s.CustomerId,
BusinessDate = s.BusinessDate,
SourceId = s.SourceId,
AccountDate = s.AccountDate,
OperatorId = s.OperatorId
});
var queryList = TenantDb.UnionAll(new List<ISugarQueryable<FeeAuditItemQuery>> { query1 });
if (!query.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(query);
queryList = queryList.Where(whereList);
}
var list = await queryList.Select<FeeAuditItem>().ToListAsync();
if (list.Count > 0)
{
//关联用户名称
var UserIds = list.Select(x => x.CreateBy).Distinct();
var Users = Db.Queryable<SysUser>().Where(x => UserIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToList();
foreach (var item in list)
{
return Db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus
&& SqlFunc.SplitIn(x.MakerList, User.UserId) && auditTypes.Contains(x.AuditType))
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType });
item.CreateByName = Users.Find(x => x.Id == item.CreateBy)?.UserName;
}
}
var result = DataResult<List<FeeAuditItem>>.Success(list);
result.Count = list.Count;
return result;
}
/// <summary>
@ -417,7 +491,7 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult> AuditAsync(FeeBizAuditRequest request)
public async Task<DataResult> AuditAsync(BizAuditRequest request)
{
var flowList = await GetCurrentFlowsQuery(AuditTypes).ToListAsync();
var query = CreateQuery(flowList);
@ -428,7 +502,7 @@ namespace DS.WMS.Core.Fee.Method
query = query.Where(whereList);
}
var bizList = await query.Select(x => new BizAudit { Id = x.Id, BusinessType = x.BusinessType }).ToArrayAsync();
var bizList = await query.Select(x => new BizAuditItem { Id = x.Id, BusinessType = x.BusinessType }).ToArrayAsync();
//取所选业务与过滤条件所产生的并集
var intersects = request.Items.Intersect(bizList);
if (!intersects.Any())
@ -453,7 +527,7 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="request">审批请求</param>
/// <returns></returns>
public async Task<DataResult> AuditBusinessAsync(FeeBizAuditRequest request)
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request)
{
var gpList = request.Items.GroupBy(x => x.BusinessType).ToList();
foreach (var gp in gpList)
@ -716,91 +790,5 @@ namespace DS.WMS.Core.Fee.Method
}
}
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public async Task<DataResult<List<FeeAuditItem>>> GetFeesAsync(string query)
{
var query1 = TenantDb.Queryable<FeeRecord>()
.InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id)
.LeftJoin<InfoClient>((x, y, z) => x.CustomerId == z.Id)
.Select((f, s, i) => new FeeAuditItemQuery
{
Id = f.Id,
BusinessId = f.BusinessId,
BusinessType = f.BusinessType,
FeeStatus = f.FeeStatus,
FeeType = f.FeeType,
FeeId = f.FeeId,
FeeName = f.FeeName,
FeeEnName = f.FeeEnName,
FeeCustomerId = f.CustomerId,
CustomerName = s.CustomerName,
CustomerFullName = i.Description, //结算对象全称
CustomerType = f.CustomerType,
CustomerTypeText = f.CustomerTypeText,
Unit = f.Unit,
UnitText = f.UnitText,
UnitPrice = f.UnitPrice,
TaxUnitPrice = f.TaxUnitPrice,
Quantity = f.Quantity,
TaxRate = f.TaxRate,
NoTaxAmount = f.NoTaxAmount,
Amount = f.Amount,
Currency = f.Currency,
CurrencyText = f.CurrencyText,
ExchangeRate = f.ExchangeRate,
AccTaxRate = f.AccTaxRate,//销项汇率
Remark = f.Remark,
IsAdvancedPay = f.IsAdvancedPay,//是否垫付
IsInvoice = f.IsInvoice, //是否开发票
//FRT
CommissionRate = f.CommissionRate, //佣金比率
CreateBy = f.CreateBy,
CreateTime = f.CreateTime,
SettlementAmount = f.SettlementAmount,//结算金额
InvoiceAmount = f.InvoiceAmount,//开票金额
OrderAmount = f.OrderAmount,//申请金额
InvoiceNum = f.InvoiceNum,//发票号
Tax = f.Tax,//税额
DebitNo = f.DebitNo,//对账编号
SaleOrg = f.SaleOrg,
Reason = f.Reason,
CustomerNo = s.CustomerNo,
Vessel = s.Vessel,
Voyage = s.Voyno,
SaleId = s.SaleId,
CustomerId = s.CustomerId,
BusinessDate = s.BusinessDate,
SourceId = s.SourceId,
AccountDate = s.AccountDate,
OperatorId = s.OperatorId
});
var queryList = TenantDb.UnionAll(new List<ISugarQueryable<FeeAuditItemQuery>> { query1 });
if (!query.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(query);
queryList = queryList.Where(whereList);
}
var result = await queryList.Select<FeeAuditItem>().ToListAsync();
if (result.Count > 0)
{
//关联用户名称
var UserIds = result.Select(x => x.CreateBy).Distinct();
var Users = Db.Queryable<SysUser>().Where(x => UserIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToList();
foreach (var item in result)
{
item.CreateByName = Users.Find(x => x.Id == item.CreateBy)?.UserName;
}
}
return DataResult<List<FeeAuditItem>>.Success(result);
}
}
}

@ -20,6 +20,11 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
protected const string DefaultCurrency = "CNY";
/// <summary>
/// 工作流运行状态值
/// </summary>
public static readonly int RunningStatus = (int)FlowStatusEnum.Running;
/// <summary>
/// 获取用户相关信息
/// </summary>
@ -103,5 +108,17 @@ namespace DS.WMS.Core.Fee.Method
}
}
}
/// <summary>
/// 获取当前登录用户的待审批工作流的查询对象
/// </summary>
/// <param name="auditTypes">审核类型</param>
/// <returns></returns>
protected ISugarQueryable<FlowInstance> GetCurrentFlowsQuery(string[] auditTypes)
{
return Db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus
&& SqlFunc.SplitIn(x.MakerList, User.UserId) && auditTypes.Contains(x.AuditType))
.Select(x => new FlowInstance { Id = x.Id, BusinessId = x.BusinessId, BusinessType = x.BusinessType });
}
}
}

@ -40,5 +40,5 @@ public class FlowAuditInfo
/// <summary>
/// 审批备注
/// </summary>
public string AuditNote { get; set; }
public string? AuditNote { get; set; }
}

@ -0,0 +1,93 @@
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;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
/// <summary>
/// 申请单审核服务
/// </summary>
public class FeeApplicationAuditController : ApiController
{
readonly IFeeApplicationAuditService _auditService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="auditService"></param>
public FeeApplicationAuditController(IFeeApplicationAuditService auditService)
{
_auditService = auditService;
}
/// <summary>
/// 获取申请单明细
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
[HttpGet, Route("GetDetails")]
public async Task<DataResult<FeeApplicationSummary>> GetDetailsAsync([FromQuery] long id)
{
return await _auditService.GetDetailsAsync(id);
}
/// <summary>
/// 按申请单审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async Task<DataResult> AuditAsync([FromBody] AuditRequest request)
{
if (request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(request);
}
/// <summary>
///一键审核当前登录用户的所有待审核项
/// </summary>
/// <param name="status">审批结果: 1=通过 2=驳回</param>
/// <param name="remark">审批备注</param>
/// <returns></returns>
[HttpPost, Route("OneClickAudit")]
public async Task<DataResult> OneClickAuditAsync(int status, string remark)
{
if (status != 1 && status != 2)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(status, remark);
}
/// <summary>
/// 将申请单重置为未打印状态
/// </summary>
/// <param name="model">申请单ID</param>
/// <returns></returns>
public async Task<DataResult> SetUnPrinted(IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.SetUnPrinted(model.Ids);
}
/// <summary>
/// 变更申请单审批状态(用于工作流框架的回调)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("ChangeStatus")]
public async Task<DataResult> ChangeStatusAsync([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.UpdateStatusAsync(callback);
}
}
}

@ -135,5 +135,6 @@ namespace DS.WMS.FeeApi.Controllers
return await _service.WithdrawAsync(model.Ids);
}
}
}

@ -33,6 +33,17 @@ namespace DS.WMS.FeeApi.Controllers
return await _auditService.GetListAsync(request);
}
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<List<FeeAuditItem>>> GetFeesAsync([FromBody] AuditDetailRequest request)
{
return await _auditService.GetFeesAsync(request.Id, request.BusinessType, request.QueryCondition);
}
/// <summary>
/// 获取整票待审核列表
/// </summary>
@ -50,7 +61,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async Task<DataResult> AuditAsync(FeeAuditRequest request)
public async Task<DataResult> AuditAsync(AuditRequest request)
{
if (request == null || request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
@ -64,7 +75,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("AuditByBiz")]
public async Task<DataResult> AuditAsync(FeeBizAuditRequest request)
public async Task<DataResult> AuditAsync(BizAuditRequest request)
{
if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || request.Items.Count == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
@ -93,7 +104,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("BusinessAudit")]
public async Task<DataResult> AuditBusinessAsync(FeeBizAuditRequest request)
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request)
{
if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || request.Items.Count == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);

@ -1286,3 +1286,31 @@
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.
2024-06-17 08:43:35.2790 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-17 08:43:35.3400 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-17 08:43:35.3400 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-17 08:43:35.3731 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-17 08:43:35.3873 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-17 08:43:35.3873 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-17 08:43:35.4157 Info Configuration initialized.
2024-06-17 08:47:02.0473 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-17 08:47:02.1167 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-17 08:47:02.1447 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-17 08:47:02.1659 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-17 08:47:02.1659 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-17 08:47:02.1843 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-17 08:47:02.1962 Info Configuration initialized.
2024-06-17 08:56:56.6823 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-17 08:56:56.7658 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-17 08:56:56.7848 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-17 08:56:56.8201 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-17 08:56:56.8396 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-17 08:56:56.8495 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-17 08:56:56.8495 Info Configuration initialized.
2024-06-17 09:17:55.2583 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-17 09:17:55.3247 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-17 09:17:55.3247 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-17 09:17:55.3526 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-17 09:17:55.3526 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-17 09:17:55.3734 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-17 09:17:55.3869 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-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>
<History>True|2024-06-17T01:20:35.0804494Z||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;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