cjy 3 weeks ago
commit 3cfabb85cf

@ -617,7 +617,7 @@ public static class MultiLanguageConst
public const string BusinessStatusError = "Business_Status_Error";
[Description("当前业务的审批状态不正确")]
public const string BusinessAuditStatusError = "Business_AuditStatus_Error";
[Description("不支持业务类型:{0}")]
[Description("此操作不支持业务类型:{0}")]
public const string BusinessNotSupported = "Business_NotSupported";
[Description("提交数据中包含不在审批流程中的项")]
public const string NotInFlows = "NotIn_Flows";
@ -1541,6 +1541,8 @@ public static class MultiLanguageConst
public const string TaskStatusNotSupported = "Task_Status_Not_Supported";
[Description("非审核类任务不支持此操作")]
public const string TaskTypeNotSupported = "Task_Type_Not_Supported";
[Description("不支持的任务类型")]
public const string TaskNotSupported = "Task_Not_Supported";
[Description("当前任务状态不正确,无法提交审核")]
public const string TaskAuditStatusError = "Task_Audit_Status_Error";
[Description("无法从配置中获取任务接收人,请检查是否设置了订单的操作/客服/单证等人员,或联系管理员检查配置")]

@ -194,9 +194,9 @@ namespace DS.Module.Core
PaySubmitted = 3,
/// <summary>
/// 应付审核通过
/// 整票审核通过
/// </summary>
[Description("应付审核通过")]
[Description("整票审核通过")]
PayPassed = 4,
/// <summary>

@ -326,10 +326,15 @@ namespace DS.Module.Core
[Description("费用删除")]
FEE_DELETE_AUDIT = 603,
/// <summary>
/// 费用整票审核
/// 整票应收确认
/// </summary>
[Description("费用整票审核")]
FEE_BUSINESS_AUDIT = 604,
[Description("整票应收确认")]
BILL_RECV_AUDIT = 604,
/// <summary>
/// 整票应付确认
/// </summary>
[Description("整票应付确认")]
BILL_PAY_AUDIT = 605,
#endregion
#region 申请相关审核
@ -398,10 +403,15 @@ namespace DS.Module.Core
[Description("费用删除驳回")]
FEE_DELETE_REJECTED = -603,
/// <summary>
/// 费用整票审核驳回
/// 整票应收驳回
/// </summary>
[Description("整票应收驳回")]
BILL_RECV_REJECTED = -604,
/// <summary>
/// 整票应付驳回
/// </summary>
[Description("费用整票审核驳回")]
FEE_BUSINESS_REJECTED = -604,
[Description("整票应付驳回")]
BILL_PAY_REJECTED = -605,
/// <summary>
/// 付费申请驳回
/// </summary>

@ -2,6 +2,7 @@
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
namespace DS.WMS.Core.Fee.Interface
{
@ -66,8 +67,9 @@ namespace DS.WMS.Core.Fee.Interface
/// <summary>
/// 整票审核
/// </summary>
/// <param name="request"></param>
Task<DataResult> AuditBusinessAsync(BizAuditRequest request);
/// <param name="request">审核请求</param>
/// <returns></returns>
Task<DataResult> AuditBillAsync(TaskAuditRequest request);
/// <summary>
/// 设置业务费用锁定状态

@ -101,16 +101,18 @@ public interface IFeeRecordService
/// </summary>
/// <param name="bid">业务ID</param>
/// <param name="type">业务类型</param>
/// <param name="taskType">任务类型</param>
/// <returns></returns>
Task<DataResult> SubmitBusinessAuditAsync(long bid, BusinessType type);
Task<DataResult> SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType);
/// <summary>
/// 撤销整票审批
/// </summary>
/// <param name="bid">业务ID</param>
/// <param name="type">业务类型</param>
/// <param name="taskType">任务类型</param>
/// <returns></returns>
Task<DataResult> WithdrawBusinessAsync(long bid, BusinessType type);
Task<DataResult> WithdrawBillAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType);
/// <summary>
/// 回写业务表费用状态

@ -1,4 +1,5 @@
using DS.Module.Core;
using AngleSharp.Dom;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Code.Entity;
@ -13,8 +14,10 @@ using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
using Mapster;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using static iText.StyledXmlParser.Jsoup.Select.Evaluator;
namespace DS.WMS.Core.Fee.Method
{
@ -29,11 +32,12 @@ namespace DS.WMS.Core.Fee.Method
public static readonly FeeStatus[] AuditStatusArray = [FeeStatus.AuditSubmitted, FeeStatus.ApplyDeletion, FeeStatus.ApplyModification];
//一键审核支持的类型
static readonly TaskBaseTypeEnum[] AuditTypes = [TaskBaseTypeEnum.FEE_AUDIT, TaskBaseTypeEnum.FEE_MODIFY_AUDIT, TaskBaseTypeEnum.FEE_DELETE_AUDIT, TaskBaseTypeEnum.FEE_BUSINESS_AUDIT];
static readonly TaskBaseTypeEnum[] AuditTypes = [TaskBaseTypeEnum.FEE_AUDIT, TaskBaseTypeEnum.FEE_MODIFY_AUDIT, TaskBaseTypeEnum.FEE_DELETE_AUDIT, TaskBaseTypeEnum.BILL_RECV_AUDIT];
readonly IClientFlowInstanceService flowService;
readonly IFeeRecordService feeService;
readonly IFeeTaskService taskService;
readonly Lazy<IFeeBillTaskService> billService;
/// <summary>
/// 初始化
@ -44,6 +48,7 @@ namespace DS.WMS.Core.Fee.Method
flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>();
feeService = serviceProvider.GetRequiredService<IFeeRecordService>();
taskService = serviceProvider.GetRequiredService<IFeeTaskService>();
billService = new Lazy<IFeeBillTaskService>(serviceProvider.GetRequiredService<IFeeBillTaskService>());
}
/// <summary>
@ -68,8 +73,8 @@ namespace DS.WMS.Core.Fee.Method
if (flows.Count == 0)
return DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
ids1 = flows.Where(x => x.AuditType != TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).ToArray();
ids2 = flows.Where(x => x.AuditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).ToArray();
ids1 = flows.Where(x => x.AuditType != TaskBaseTypeEnum.BILL_RECV_AUDIT).Select(x => x.BusinessId).ToArray();
ids2 = flows.Where(x => x.AuditType == TaskBaseTypeEnum.BILL_RECV_AUDIT).Select(x => x.BusinessId).ToArray();
}
var queryList = CreateQuery(ids1, ids2);
@ -205,7 +210,7 @@ namespace DS.WMS.Core.Fee.Method
long[]? ids = null;
if (request.OtherQueryCondition)
{
ids = await GetCurrentFlowsQuery(TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).Distinct().ToArrayAsync();
ids = await GetCurrentFlowsQuery(TaskBaseTypeEnum.BILL_RECV_AUDIT).Select(x => x.BusinessId).Distinct().ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询
if (ids.Length == 0)
@ -372,8 +377,8 @@ namespace DS.WMS.Core.Fee.Method
if (flows.Count == 0)
return DataResult<PendingAuditFee>.Success(pendingAudit, MultiLanguageConst.DataQuerySuccess);
ids1 = flows.Where(x => x.AuditType != TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).ToArray();
ids2 = flows.Where(x => x.AuditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).ToArray();
ids1 = flows.Where(x => x.AuditType != TaskBaseTypeEnum.BILL_RECV_AUDIT).Select(x => x.BusinessId).ToArray();
ids2 = flows.Where(x => x.AuditType == TaskBaseTypeEnum.BILL_RECV_AUDIT).Select(x => x.BusinessId).ToArray();
}
var fees = await TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
@ -385,7 +390,7 @@ namespace DS.WMS.Core.Fee.Method
}).ToListAsync();
pendingAudit.IsPositiveProfit = fees.Where(x => x.FeeType == FeeType.Receivable).Sum(x => x.Amount * (x.ExchangeRate ?? 1))
- fees.Where(x => x.FeeType == FeeType.Payable).Sum(x => x.Amount * (x.ExchangeRate ?? 1)) > 0;
pendingAudit.IsBusinessAudit = await flowService.Exists(TaskBaseTypeEnum.FEE_BUSINESS_AUDIT, request.BusinessType, null, request.Id);
pendingAudit.IsBusinessAudit = await flowService.Exists(TaskBaseTypeEnum.BILL_RECV_AUDIT, request.BusinessType, null, request.Id);
var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
.InnerJoin<SeaExport>((f, s) => f.BusinessId == s.Id)
@ -683,55 +688,56 @@ namespace DS.WMS.Core.Fee.Method
return await AuditAsync(request.Result, request.Remark, recordIds);
}
const TaskBaseTypeEnum BIZ_TASK_TYPE = TaskBaseTypeEnum.FEE_BUSINESS_AUDIT;
/// <summary>
/// 整票审核
/// </summary>
/// <param name="request">审请求</param>
/// <param name="request">审请求</param>
/// <returns></returns>
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request)
public async Task<DataResult> AuditBillAsync(TaskAuditRequest request)
{
DataResult result;
bool hasAuthorized = await taskService.HasAuthorizedAsync();
var gpList = request.Items.GroupBy(x => x.BusinessType).ToList();
foreach (var gp in gpList)
DataResult result = DataResult.Success;
var entity = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => request.Ids.Contains(x.BusinessId) && x.BusinessType == request.BusinessType)
.Select(x => new BusinessFeeStatus
{
var ids = gp.Select(x => x.Id).ToArray();
var bizList = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => ids.Contains(x.BusinessId) && x.BusinessType == gp.Key)
.Select(x => new
{
x.Id,
x.BillAuditStatus,
}).ToListAsync();
Id = x.Id,
BillAuditStatus = x.BillAuditStatus,
BillFeeStatusTime = x.BillFeeStatusTime
}).FirstAsync();
if (bizList.Count == 0)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
if (entity == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
if (bizList.Any(x => x.BillAuditStatus != BillAuditStatus.RecvSubmitted && x.BillAuditStatus != BillAuditStatus.PaySubmitted))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessAuditStatusError));
if (request.TaskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.RecvSubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else if (request.TaskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else
{
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotSupported));
}
if (hasAuthorized)
await TenantDb.Ado.BeginTranAsync();
try
{
if (await taskService.HasAuthorizedAsync())
{
result = await taskService.AuditAsync(new TaskAuditRequest
{
Ids = ids,
Remark = request.Remark,
Result = request.Result,
TaskTypeName = BIZ_TASK_TYPE.ToString()
});
result = await taskService.AuditAsync(request);
if (!result.Succeeded)
return result;
}
else
{
var flows = await flowService.GetInstanceByBSIdAsync(BIZ_TASK_TYPE, gp.Key, ids);
var flows = await flowService.GetInstanceByBSIdAsync(request.TaskType, request.BusinessType, request.Ids);
if (flows.Count == 0)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
if (flows.Any(x => !x.MakerList.Contains(User.UserId)))
continue;
foreach (var flow in flows)
{
result = await flowService.AuditAsync(new FlowAuditInfo
@ -745,9 +751,38 @@ namespace DS.WMS.Core.Fee.Method
return result;
}
}
}
return DataResult.Success;
long userId = long.Parse(User.UserId);
entity.BillFeeStatusTime = DateTime.Now;
//变更状态为提交审核
if (request.TaskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
entity.BillAuditStatus = BillAuditStatus.RecvPassed;
else if (request.TaskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
entity.BillAuditStatus = BillAuditStatus.PayPassed;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.BillFeeStatusTime
}).ExecuteCommandAsync();
//修改关联费用状态为审核完成
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted)
.SetColumns(x => x.FeeStatus == FeeStatus.AuditPassed)
.SetColumns(x => x.AuditBy == userId)
.SetColumns(x => x.AuditOperator == User.UserName)
.SetColumns(x => x.AuditDate == entity.BillFeeStatusTime)
.ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return result;
}
catch (Exception ex)
{
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
}
/// <summary>
@ -775,7 +810,7 @@ namespace DS.WMS.Core.Fee.Method
var auditType = callback.AuditType;
FeeRecord? fee = null;
BusinessFeeStatus? biz = null;
if (auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT)
if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
biz = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType)
.Select(x => new BusinessFeeStatus
@ -904,32 +939,32 @@ namespace DS.WMS.Core.Fee.Method
}
break;
//case TaskBaseTypeEnum.FEE_BUSINESS_AUDIT:
// FeeStatus status = FeeStatus.RejectSubmission;
// if (callback.FlowStatus == FlowStatusEnum.Approve)
// {
// biz.BillAuditStatus = BillAuditStatus.AuditPassed;
// status = FeeStatus.AuditPassed;
// }
// else if (callback.FlowStatus == FlowStatusEnum.Reject)
// {
// biz.BillAuditStatus = BillAuditStatus.Rejected;
// }
// await TenantDb.Updateable(biz).UpdateColumns(x => new
// {
// x.BillAuditStatus
// }).ExecuteCommandAsync();
// await TenantDb.Updateable<FeeRecord>()
// .SetColumns(x => x.FeeStatus == status)
// .SetColumns(x => x.AuditBy == UserId)
// .SetColumns(x => x.AuditOperator == User.UserName)
// .SetColumns(x => x.AuditDate == dtNow)
// .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType &&
// x.FeeStatus != FeeStatus.PartialSettlement && x.FeeStatus != FeeStatus.SettlementCompleted).ExecuteCommandAsync();
// break;
//case TaskBaseTypeEnum.FEE_BUSINESS_AUDIT:
// FeeStatus status = FeeStatus.RejectSubmission;
// if (callback.FlowStatus == FlowStatusEnum.Approve)
// {
// biz.BillAuditStatus = BillAuditStatus.AuditPassed;
// status = FeeStatus.AuditPassed;
// }
// else if (callback.FlowStatus == FlowStatusEnum.Reject)
// {
// biz.BillAuditStatus = BillAuditStatus.Rejected;
// }
// await TenantDb.Updateable(biz).UpdateColumns(x => new
// {
// x.BillAuditStatus
// }).ExecuteCommandAsync();
// await TenantDb.Updateable<FeeRecord>()
// .SetColumns(x => x.FeeStatus == status)
// .SetColumns(x => x.AuditBy == UserId)
// .SetColumns(x => x.AuditOperator == User.UserName)
// .SetColumns(x => x.AuditDate == dtNow)
// .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType &&
// x.FeeStatus != FeeStatus.PartialSettlement && x.FeeStatus != FeeStatus.SettlementCompleted).ExecuteCommandAsync();
// break;
}
////驳回申请则逻辑删除关联工作流
@ -946,11 +981,11 @@ namespace DS.WMS.Core.Fee.Method
await TenantDb.Ado.CommitTranAsync();
if (auditType != TaskBaseTypeEnum.FEE_BUSINESS_AUDIT)
if (auditType != TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
await feeService.WriteBackStatusAsync(
auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessId : fee.BusinessId,
auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessType : fee.BusinessType);
auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT ? biz.BusinessId : fee.BusinessId,
auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT ? biz.BusinessType : fee.BusinessType);
}
return DataResult.Success;

@ -25,7 +25,6 @@ namespace DS.WMS.Core.Fee.Method
public class FeeRecordService : FeeServiceBase, IFeeRecordService
{
const int BATCH_SIZE = 300;
const TaskBaseTypeEnum BIZ_TASK_TYPE = TaskBaseTypeEnum.FEE_BUSINESS_AUDIT;
readonly IClientFlowInstanceService flowService;
readonly IFeeTaskService feeTaskService;
@ -876,15 +875,14 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="bid">业务ID</param>
/// <param name="type">业务类型</param>
/// <param name="taskType">任务类型</param>
/// <returns></returns>
public async Task<DataResult> SubmitBusinessAuditAsync(long bid, BusinessType type)
public async Task<DataResult> SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType)
{
var entity = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => x.BusinessId == bid && x.BusinessType == type)
.Select(x => new BusinessFeeStatus
{
Id = x.Id,
BusinessId = x.BusinessId,
BusinessType = x.BusinessType,
IsFeeLocking = x.IsFeeLocking,
BillAuditStatus = x.BillAuditStatus
}).FirstAsync();
@ -893,10 +891,23 @@ namespace DS.WMS.Core.Fee.Method
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessNotFound));
if (entity.IsFeeLocking.GetValueOrDefault())
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
if (entity.BillAuditStatus == BillAuditStatus.PayPassed || entity.BillAuditStatus == BillAuditStatus.PaySubmitted || entity.BillAuditStatus == BillAuditStatus.RecvSubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
if (await flowService.IsRunning(BIZ_TASK_TYPE, type, bid))
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.Pending && entity.BillAuditStatus != BillAuditStatus.RecvRejected)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.RecvPassed && entity.BillAuditStatus != BillAuditStatus.PayRejected)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else
{
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotSupported));
}
if (await flowService.IsRunning(taskType, type, bid))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordIsAuditing));
DataResult result;
@ -909,11 +920,7 @@ namespace DS.WMS.Core.Fee.Method
switch (type)
{
case BusinessType.OceanShippingExport:
var order = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == bid).Select(x => new
{
x.CustomerNo,
}).FirstAsync();
bizNo = order?.CustomerNo;
bizNo = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == bid).Select(x => x.CustomerNo).FirstAsync();
break;
}
@ -921,13 +928,13 @@ namespace DS.WMS.Core.Fee.Method
{
BusinessId = bid,
BusinessType = type,
TaskTypeName = BIZ_TASK_TYPE.ToString(),
TaskTitle = $"【{BIZ_TASK_TYPE.GetDescription()}】【{type.GetDescription()}】{bizNo}"
TaskTypeName = taskType.ToString(),
TaskTitle = $"【{taskType.GetDescription()}】【{type.GetDescription()}】{bizNo}"
}, false);
}
else
{
var template = await FindTemplateAsync(BIZ_TASK_TYPE);
var template = await FindTemplateAsync(taskType);
if (template == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
@ -946,18 +953,20 @@ namespace DS.WMS.Core.Fee.Method
return result;
//变更状态为提交审核
entity.BillAuditStatus = BillAuditStatus.RecvSubmitted;
entity.BillFeeStatusTime = DateTime.Now;
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
entity.BillAuditStatus = BillAuditStatus.RecvSubmitted;
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
entity.BillAuditStatus = BillAuditStatus.PaySubmitted;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.BillFeeStatusTime
x.BillAuditStatus
}).ExecuteCommandAsync();
//修改关联费用状态为提交审核
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType)
.SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType &&
(x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.Withdraw || x.FeeStatus == FeeStatus.RejectSubmission))
.SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return DataResult.Success;
@ -975,15 +984,14 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="bid">业务ID</param>
/// <param name="type">业务类型</param>
/// <param name="taskType">任务类型</param>
/// <returns></returns>
public async Task<DataResult> WithdrawBusinessAsync(long bid, BusinessType type)
public async Task<DataResult> WithdrawBillAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType)
{
var entity = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => x.BusinessId == bid && x.BusinessType == type)
.Select(x => new BusinessFeeStatus
{
Id = x.Id,
BusinessId = x.BusinessId,
BusinessType = x.BusinessType,
IsFeeLocking = x.IsFeeLocking,
BillAuditStatus = x.BillAuditStatus
}).FirstAsync();
@ -992,31 +1000,65 @@ namespace DS.WMS.Core.Fee.Method
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessNotFound));
if (entity.IsFeeLocking.GetValueOrDefault())
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
if (entity.BillAuditStatus != BillAuditStatus.RecvSubmitted && entity.BillAuditStatus != BillAuditStatus.PaySubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
DataResult result = DataResult.Success;
if (await billService.HasAuthorizedAsync())
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
await billService.WithdrawAsync(new TaskRequest
{
BusinessId = bid,
BusinessType = type,
TaskTypeName = BIZ_TASK_TYPE.ToString()
}, false);
if (entity.BillAuditStatus != BillAuditStatus.RecvSubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted)
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
}
else
{
//未在审批状态中
if (!await flowService.Exists(type: BIZ_TASK_TYPE, businessType: type, ids: [bid]))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.NotInAudit));
result = await flowService.WithdrawAsync(BIZ_TASK_TYPE, [bid], type);
if (!result.Succeeded)
return result;
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotSupported));
}
return result;
await TenantDb.Ado.BeginTranAsync();
try
{
DataResult result = DataResult.Success;
if (await billService.HasAuthorizedAsync())
{
await billService.WithdrawAsync(new TaskRequest
{
BusinessId = bid,
BusinessType = type,
TaskTypeName = taskType.ToString()
}, false);
}
else
{
//未在审批状态中
if (!await flowService.Exists(type: taskType, businessType: type, ids: [bid]))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.NotInAudit));
result = await flowService.WithdrawAsync(taskType, [bid], type);
if (!result.Succeeded)
return result;
}
//变更状态为提交审核
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
entity.BillAuditStatus = BillAuditStatus.Pending;
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
entity.BillAuditStatus = BillAuditStatus.RecvPassed;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus
}).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return result;
}
catch (Exception ex)
{
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
}
#endregion

@ -4,7 +4,6 @@ using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Method;
using Masuit.Tools.Systems;
using NPOI.POIFS.Properties;
namespace DS.WMS.Core.TaskInteraction.Dtos
{

@ -1,4 +1,6 @@
using DS.WMS.Core.TaskInteraction.Interface;
using DS.Module.Core;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
namespace DS.WMS.Core.TaskInteraction.Method
{
@ -15,6 +17,9 @@ namespace DS.WMS.Core.TaskInteraction.Method
{
}
public override Task<DataResult> CreateMultipleTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{
return Task.FromResult(DataResult.Failed("不支持批量提交整票审核任务"));
}
}
}

@ -3,6 +3,7 @@ using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.TaskInteraction.Dtos;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
@ -116,12 +117,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("BusinessAudit")]
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request)
public async Task<DataResult> AuditBillAsync(TaskAuditRequest request)
{
if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || request.Items.Count == 0)
if (request == null || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditBusinessAsync(request);
return await _auditService.AuditBillAsync(request);
}
/// <summary>

@ -229,12 +229,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="model">业务ID和类型</param>
/// <returns></returns>
[HttpPost, Route("ApplyBusinessAudit")]
public async Task<DataResult> ApplyBusinessAuditAsync([FromBody] IdModel model)
public async Task<DataResult> ApplyBillAuditAsync([FromBody] IdModel<TaskBaseTypeEnum> model)
{
if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _feeService.SubmitBusinessAuditAsync(bid, (BusinessType)model.BusinessType.Value);
return await _feeService.SubmitBillAuditAsync(bid, (BusinessType)model.BusinessType.Value, model.Value);
}
/// <summary>
@ -243,12 +243,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="model">业务ID和类型</param>
/// <returns></returns>
[HttpPost, Route("WithdrawBusiness")]
public async Task<DataResult> WithdrawBusinessAsync([FromBody] IdModel model)
public async Task<DataResult> WithdrawBillAsync([FromBody] IdModel<TaskBaseTypeEnum> model)
{
if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _feeService.SubmitBusinessAuditAsync(bid, (BusinessType)model.BusinessType.Value);
return await _feeService.WithdrawBillAsync(bid, (BusinessType)model.BusinessType.Value, model.Value);
}
/// <summary>

Loading…
Cancel
Save