cjy 3 weeks ago
commit 3cfabb85cf

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

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

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

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

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

@ -1,4 +1,5 @@
using DS.Module.Core; using AngleSharp.Dom;
using DS.Module.Core;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Code.Entity; 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.Dtos;
using DS.WMS.Core.TaskInteraction.Interface; using DS.WMS.Core.TaskInteraction.Interface;
using Mapster; using Mapster;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
using static iText.StyledXmlParser.Jsoup.Select.Evaluator;
namespace DS.WMS.Core.Fee.Method 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]; 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 IClientFlowInstanceService flowService;
readonly IFeeRecordService feeService; readonly IFeeRecordService feeService;
readonly IFeeTaskService taskService; readonly IFeeTaskService taskService;
readonly Lazy<IFeeBillTaskService> billService;
/// <summary> /// <summary>
/// 初始化 /// 初始化
@ -44,6 +48,7 @@ namespace DS.WMS.Core.Fee.Method
flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>(); flowService = serviceProvider.GetRequiredService<IClientFlowInstanceService>();
feeService = serviceProvider.GetRequiredService<IFeeRecordService>(); feeService = serviceProvider.GetRequiredService<IFeeRecordService>();
taskService = serviceProvider.GetRequiredService<IFeeTaskService>(); taskService = serviceProvider.GetRequiredService<IFeeTaskService>();
billService = new Lazy<IFeeBillTaskService>(serviceProvider.GetRequiredService<IFeeBillTaskService>());
} }
/// <summary> /// <summary>
@ -68,8 +73,8 @@ namespace DS.WMS.Core.Fee.Method
if (flows.Count == 0) if (flows.Count == 0)
return DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess); return DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
ids1 = 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.FEE_BUSINESS_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); var queryList = CreateQuery(ids1, ids2);
@ -205,7 +210,7 @@ namespace DS.WMS.Core.Fee.Method
long[]? ids = null; long[]? ids = null;
if (request.OtherQueryCondition) 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) if (ids.Length == 0)
@ -372,8 +377,8 @@ namespace DS.WMS.Core.Fee.Method
if (flows.Count == 0) if (flows.Count == 0)
return DataResult<PendingAuditFee>.Success(pendingAudit, MultiLanguageConst.DataQuerySuccess); return DataResult<PendingAuditFee>.Success(pendingAudit, MultiLanguageConst.DataQuerySuccess);
ids1 = 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.FEE_BUSINESS_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) 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(); }).ToListAsync();
pendingAudit.IsPositiveProfit = fees.Where(x => x.FeeType == FeeType.Receivable).Sum(x => x.Amount * (x.ExchangeRate ?? 1)) 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; - 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) var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
.InnerJoin<SeaExport>((f, s) => f.BusinessId == s.Id) .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); return await AuditAsync(request.Result, request.Remark, recordIds);
} }
const TaskBaseTypeEnum BIZ_TASK_TYPE = TaskBaseTypeEnum.FEE_BUSINESS_AUDIT;
/// <summary> /// <summary>
/// 整票审核 /// 整票审核
/// </summary> /// </summary>
/// <param name="request">审请求</param> /// <param name="request">审请求</param>
/// <returns></returns> /// <returns></returns>
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request) public async Task<DataResult> AuditBillAsync(TaskAuditRequest request)
{ {
DataResult result; DataResult result = DataResult.Success;
bool hasAuthorized = await taskService.HasAuthorizedAsync(); var entity = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => request.Ids.Contains(x.BusinessId) && x.BusinessType == request.BusinessType)
var gpList = request.Items.GroupBy(x => x.BusinessType).ToList(); .Select(x => new BusinessFeeStatus
foreach (var gp in gpList)
{
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, Id = x.Id,
x.BillAuditStatus, BillAuditStatus = x.BillAuditStatus,
}).ToListAsync(); BillFeeStatusTime = x.BillFeeStatusTime
}).FirstAsync();
if (bizList.Count == 0) if (entity == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
if (bizList.Any(x => x.BillAuditStatus != BillAuditStatus.RecvSubmitted && x.BillAuditStatus != BillAuditStatus.PaySubmitted)) if (request.TaskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessAuditStatusError)); {
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
{ {
result = await taskService.AuditAsync(new TaskAuditRequest if (await taskService.HasAuthorizedAsync())
{ {
Ids = ids, result = await taskService.AuditAsync(request);
Remark = request.Remark,
Result = request.Result,
TaskTypeName = BIZ_TASK_TYPE.ToString()
});
if (!result.Succeeded) if (!result.Succeeded)
return result; return result;
} }
else 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) if (flows.Count == 0)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
if (flows.Any(x => !x.MakerList.Contains(User.UserId)))
continue;
foreach (var flow in flows) foreach (var flow in flows)
{ {
result = await flowService.AuditAsync(new FlowAuditInfo result = await flowService.AuditAsync(new FlowAuditInfo
@ -745,9 +751,38 @@ namespace DS.WMS.Core.Fee.Method
return result; 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> /// <summary>
@ -775,7 +810,7 @@ namespace DS.WMS.Core.Fee.Method
var auditType = callback.AuditType; var auditType = callback.AuditType;
FeeRecord? fee = null; FeeRecord? fee = null;
BusinessFeeStatus? biz = 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) biz = await TenantDb.Queryable<BusinessFeeStatus>().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType)
.Select(x => new BusinessFeeStatus .Select(x => new BusinessFeeStatus
@ -946,11 +981,11 @@ namespace DS.WMS.Core.Fee.Method
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
if (auditType != TaskBaseTypeEnum.FEE_BUSINESS_AUDIT) if (auditType != TaskBaseTypeEnum.BILL_RECV_AUDIT)
{ {
await feeService.WriteBackStatusAsync( await feeService.WriteBackStatusAsync(
auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessId : fee.BusinessId, auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT ? biz.BusinessId : fee.BusinessId,
auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessType : fee.BusinessType); auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT ? biz.BusinessType : fee.BusinessType);
} }
return DataResult.Success; return DataResult.Success;

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

@ -4,7 +4,6 @@ using DS.Module.Core;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Method; using DS.WMS.Core.TaskInteraction.Method;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
using NPOI.POIFS.Properties;
namespace DS.WMS.Core.TaskInteraction.Dtos 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 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.Dtos;
using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.TaskInteraction.Dtos;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers namespace DS.WMS.FeeApi.Controllers
@ -116,12 +117,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("BusinessAudit")] [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 DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditBusinessAsync(request); return await _auditService.AuditBillAsync(request);
} }
/// <summary> /// <summary>

@ -229,12 +229,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="model">业务ID和类型</param> /// <param name="model">业务ID和类型</param>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("ApplyBusinessAudit")] [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) if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); 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> /// <summary>
@ -243,12 +243,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="model">业务ID和类型</param> /// <param name="model">业务ID和类型</param>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("WithdrawBusiness")] [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) if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); 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> /// <summary>

Loading…
Cancel
Save