diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
index 6b13b1f9..ee26a220 100644
--- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
+++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs
@@ -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("无法从配置中获取任务接收人,请检查是否设置了订单的操作/客服/单证等人员,或联系管理员检查配置")]
diff --git a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs
index c238114b..e3c42d33 100644
--- a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs
@@ -194,9 +194,9 @@ namespace DS.Module.Core
PaySubmitted = 3,
///
- /// 应付审核通过
+ /// 整票审核通过
///
- [Description("应付审核通过")]
+ [Description("整票审核通过")]
PayPassed = 4,
///
diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
index 80748bd2..385e604b 100644
--- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
@@ -326,10 +326,15 @@ namespace DS.Module.Core
[Description("费用删除")]
FEE_DELETE_AUDIT = 603,
///
- /// 费用整票审核
+ /// 整票应收确认
///
- [Description("费用整票审核")]
- FEE_BUSINESS_AUDIT = 604,
+ [Description("整票应收确认")]
+ BILL_RECV_AUDIT = 604,
+ ///
+ /// 整票应付确认
+ ///
+ [Description("整票应付确认")]
+ BILL_PAY_AUDIT = 605,
#endregion
#region 申请相关审核
@@ -398,10 +403,15 @@ namespace DS.Module.Core
[Description("费用删除驳回")]
FEE_DELETE_REJECTED = -603,
///
- /// 费用整票审核驳回
+ /// 整票应收驳回
+ ///
+ [Description("整票应收驳回")]
+ BILL_RECV_REJECTED = -604,
+ ///
+ /// 整票应付驳回
///
- [Description("费用整票审核驳回")]
- FEE_BUSINESS_REJECTED = -604,
+ [Description("整票应付驳回")]
+ BILL_PAY_REJECTED = -605,
///
/// 付费申请驳回
///
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs
index 088ac8f5..b099006a 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeAuditService.cs
@@ -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
///
/// 整票审核
///
- ///
- Task AuditBusinessAsync(BizAuditRequest request);
+ /// 审核请求
+ ///
+ Task AuditBillAsync(TaskAuditRequest request);
///
/// 设置业务费用锁定状态
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
index e87fb968..bc4324a7 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
@@ -101,16 +101,18 @@ public interface IFeeRecordService
///
/// 业务ID
/// 业务类型
+ /// 任务类型
///
- Task SubmitBusinessAuditAsync(long bid, BusinessType type);
+ Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType);
///
/// 撤销整票审批
///
/// 业务ID
/// 业务类型
+ /// 任务类型
///
- Task WithdrawBusinessAsync(long bid, BusinessType type);
+ Task WithdrawBillAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType);
///
/// 回写业务表费用状态
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
index 96f052aa..9315e0dd 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
@@ -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 billService;
///
/// 初始化
@@ -44,6 +48,7 @@ namespace DS.WMS.Core.Fee.Method
flowService = serviceProvider.GetRequiredService();
feeService = serviceProvider.GetRequiredService();
taskService = serviceProvider.GetRequiredService();
+ billService = new Lazy(serviceProvider.GetRequiredService());
}
///
@@ -68,8 +73,8 @@ namespace DS.WMS.Core.Fee.Method
if (flows.Count == 0)
return DataResult>.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.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().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().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
.InnerJoin((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;
///
/// 整票审核
///
- /// 审批请求
+ /// 审核请求
///
- public async Task AuditBusinessAsync(BizAuditRequest request)
+ public async Task 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().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().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().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));
+ }
}
///
@@ -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().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()
- // .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()
+ // .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;
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs
index a9ab5862..785dbce9 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs
@@ -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
///
/// 业务ID
/// 业务类型
+ /// 任务类型
///
- public async Task SubmitBusinessAuditAsync(long bid, BusinessType type)
+ public async Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType)
{
var entity = await TenantDb.Queryable().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().Where(x => x.Id == bid).Select(x => new
- {
- x.CustomerNo,
- }).FirstAsync();
- bizNo = order?.CustomerNo;
+ bizNo = await TenantDb.Queryable().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().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType)
- .SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
+ await TenantDb.Updateable().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
///
/// 业务ID
/// 业务类型
+ /// 任务类型
///
- public async Task WithdrawBusinessAsync(long bid, BusinessType type)
+ public async Task WithdrawBillAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType)
{
var entity = await TenantDb.Queryable().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
diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Dtos/TaskRequest.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Dtos/TaskRequest.cs
index 63e8ea13..43c33030 100644
--- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Dtos/TaskRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Dtos/TaskRequest.cs
@@ -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
{
diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs
index 5d22fb35..8453a18a 100644
--- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs
@@ -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 CreateMultipleTaskAsync(TaskCreationRequest request, bool useTransaction = true)
+ {
+ return Task.FromResult(DataResult.Failed("不支持批量提交整票审核任务"));
+ }
}
}
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs
index 0e729eb7..895c2db0 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs
@@ -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
///
///
[HttpPost, Route("BusinessAudit")]
- public async Task AuditBusinessAsync(BizAuditRequest request)
+ public async Task 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);
}
///
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
index faae8c49..ca1a28b8 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
@@ -229,12 +229,12 @@ namespace DS.WMS.FeeApi.Controllers
/// 业务ID和类型
///
[HttpPost, Route("ApplyBusinessAudit")]
- public async Task ApplyBusinessAuditAsync([FromBody] IdModel model)
+ public async Task ApplyBillAuditAsync([FromBody] IdModel 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);
}
///
@@ -243,12 +243,12 @@ namespace DS.WMS.FeeApi.Controllers
/// 业务ID和类型
///
[HttpPost, Route("WithdrawBusiness")]
- public async Task WithdrawBusinessAsync([FromBody] IdModel model)
+ public async Task WithdrawBillAsync([FromBody] IdModel 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);
}
///