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 0c9a3526..44b43845 100644
--- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
@@ -335,6 +335,16 @@ namespace DS.Module.Core
///
[Description("整票应付确认")]
BILL_PAY_AUDIT = 605,
+ ///
+ /// 锁单审核
+ ///
+ [Description("锁单审核")]
+ BILL_LOCK_AUDIT = 606,
+ ///
+ /// 账单发送
+ ///
+ [Description("账单发送")]
+ BILL_SENDING = 607,
#endregion
#region 申请相关审核
@@ -413,6 +423,11 @@ namespace DS.Module.Core
[Description("整票应付驳回")]
BILL_PAY_REJECTED = -605,
///
+ /// 锁单审核驳回
+ ///
+ [Description("锁单审核驳回")]
+ BILL_LOCK_REJECTED = -606,
+ ///
/// 付费申请驳回
///
[Description("付费申请驳回")]
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 bc4324a7..798ec5d5 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
@@ -102,8 +102,9 @@ public interface IFeeRecordService
/// 业务ID
/// 业务类型
/// 任务类型
+ /// 是否使用事务
///
- Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType);
+ Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType, bool useTransaction = true);
///
/// 撤销整票审批
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 0657e197..7de8c1a1 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs
@@ -880,8 +880,9 @@ namespace DS.WMS.Core.Fee.Method
/// 业务ID
/// 业务类型
/// 任务类型
+ /// 是否使用事务
///
- public async Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType)
+ public async Task SubmitBillAuditAsync(long bid, BusinessType type, TaskBaseTypeEnum taskType, bool useTransaction = true)
{
var entity = await TenantDb.Queryable().Where(x => x.BusinessId == bid && x.BusinessType == type)
.Select(x => new BusinessFeeStatus
@@ -919,7 +920,8 @@ namespace DS.WMS.Core.Fee.Method
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordIsAuditing));
DataResult result;
- await TenantDb.Ado.BeginTranAsync();
+ if (useTransaction)
+ await TenantDb.Ado.BeginTranAsync();
try
{
if (await billService.HasAuthorizedAsync())
@@ -987,12 +989,14 @@ namespace DS.WMS.Core.Fee.Method
}).ExecuteCommandAsync();
}
- await TenantDb.Ado.CommitTranAsync();
+ if (useTransaction)
+ await TenantDb.Ado.CommitTranAsync();
return DataResult.Success;
}
catch (Exception ex)
{
- await TenantDb.Ado.RollbackTranAsync();
+ if (useTransaction)
+ await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs
index e3b7aaa4..dadadef4 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BusinessFeeStatus.cs
@@ -92,7 +92,7 @@ namespace DS.WMS.Core.Op.Entity
///
/// Desc:业务锁定人
///
- [SugarColumn(ColumnDescription = "业务锁定人", IsNullable = true, Length =100)]
+ [SugarColumn(ColumnDescription = "业务锁定人", IsNullable = true, Length = 100)]
public string BusinessLockingUserName { get; set; }
///
/// 业务锁定时间
@@ -148,8 +148,21 @@ namespace DS.WMS.Core.Op.Entity
///
/// 费用解锁时间
///
- [SqlSugar.SugarColumn(ColumnDescription = "费用解锁时间", IsNullable = true)]
+ [SugarColumn(ColumnDescription = "费用解锁时间", IsNullable = true)]
public DateTime FeeUnLockingTime { get; set; }
+
+ ///
+ /// 整单利润
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public decimal ProfitMargin { get; set; }
+
+ ///
+ /// 委托编号
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string? CustomerNo { get; set; }
+
///
/// 业务初始化费用状态
///
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 6ef6bd22..27468325 100644
--- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs
@@ -1,9 +1,14 @@
using DS.Module.Core;
using DS.WMS.Core.Fee.Entity;
+using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
+using Masuit.Tools.Systems;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Method
{
@@ -12,12 +17,16 @@ namespace DS.WMS.Core.TaskInteraction.Method
///
public class FeeBillTaskService : TaskService, IFeeBillTaskService
{
+ readonly IFeeRecordService feeService;
+ readonly ILogger logger;
///
/// 初始化
///
///
public FeeBillTaskService(IServiceProvider provider) : base(provider)
{
+ feeService = provider.GetRequiredService();
+ logger = provider.GetRequiredService>();
}
///
@@ -43,14 +52,18 @@ namespace DS.WMS.Core.TaskInteraction.Method
return;
var biz = await TenantDb.Queryable().Where(x => x.BusinessId == callback.BusinessId && x.BusinessType == callback.BusinessType)
- .Select(x => new BusinessFeeStatus
- {
- Id = x.Id,
- BusinessId = x.BusinessId,
- BusinessType = x.BusinessType,
- BillAuditStatus = x.BillAuditStatus,
- BillFeeStatusTime = x.BillFeeStatusTime
- }).FirstAsync();
+ .InnerJoin((x, s) => x.BusinessId == s.Id)
+ .Select((x, s) => new BusinessFeeStatus
+ {
+ CustomerNo = s.CustomerNo,
+ Id = x.Id,
+ BusinessId = x.BusinessId,
+ BusinessType = x.BusinessType,
+ BillAuditStatus = x.BillAuditStatus,
+ BillFeeStatusTime = x.BillFeeStatusTime,
+ ProfitMargin = SqlFunc.Subqueryable().Where(f => f.BusinessId == x.BusinessId && f.BusinessType == x.BusinessType && f.FeeType == FeeType.Receivable).Sum(f => f.Amount)
+ - SqlFunc.Subqueryable().Where(f => f.BusinessId == x.BusinessId && f.BusinessType == x.BusinessType && f.FeeType == FeeType.Payable).Sum(f => f.Amount)
+ }).FirstAsync();
if (biz == null)
return;
@@ -64,6 +77,9 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (callback.FlowStatus == FlowStatusEnum.Approve)
{
biz.BillAuditStatus = BillAuditStatus.RecvPassed;
+ //生成应付确认任务
+ await feeService.SubmitBillAuditAsync(callback.BusinessId, callback.BusinessType.GetValueOrDefault(),
+ TaskBaseTypeEnum.BILL_PAY_AUDIT, false);
}
else if (callback.FlowStatus == FlowStatusEnum.Reject)
{
@@ -127,6 +143,37 @@ namespace DS.WMS.Core.TaskInteraction.Method
await ex.LogAsync(Db);
throw;
}
+
+
+ if (biz.ProfitMargin > 0)
+ {
+ biz.IsFeeLocking = true;
+ biz.FeeLockingTime = dtNow;
+ biz.FeeLockingUserId = userId;
+ biz.FeeLockingUserName = User.UserName;
+
+ await TenantDb.Updateable(biz).UpdateColumns(x => new
+ {
+ x.IsFeeLocking,
+ x.FeeLockingTime,
+ x.FeeLockingUserId,
+ x.FeeLockingUserName
+ }).ExecuteCommandAsync();
+ }
+ else //如果为非正利润则生成锁单任务
+ {
+ var result = await CreateTaskAsync(new TaskCreationRequest
+ {
+ BusinessId = biz.BusinessId,
+ BusinessType = biz.BusinessType,
+ TaskTypeName = TaskBaseTypeEnum.BILL_LOCK_AUDIT.ToString(),
+ TaskTitle = $"【{TaskBaseTypeEnum.BILL_LOCK_AUDIT.GetDescription()}】{biz.CustomerNo}",
+ });
+ if (!result.Succeeded)
+ logger.LogError($"生成【{TaskBaseTypeEnum.BILL_LOCK_AUDIT.GetDescription()}】任务失败:" + result.Message);
+ }
+
+
}
}
}
diff --git a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
index 42b6bb40..48698100 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
+++ b/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<_PublishTargetUrl>D:\Publish\DS8\FeeApi
- True|2024-11-04T03:26:53.4821041Z||;True|2024-11-04T11:19:48.8467193+08:00||;True|2024-11-04T11:01:39.9398452+08:00||;True|2024-11-04T10:30:55.0743204+08:00||;True|2024-11-02T21:17:44.8575190+08:00||;True|2024-11-02T20:54:29.9931812+08:00||;True|2024-11-02T20:39:20.4100370+08:00||;True|2024-11-02T18:33:41.0724285+08:00||;True|2024-11-02T18:21:55.8561639+08:00||;True|2024-11-02T17:36:24.3401782+08:00||;True|2024-11-02T16:38:03.0054105+08:00||;True|2024-11-02T16:26:26.1698304+08:00||;True|2024-11-02T16:15:20.2872358+08:00||;True|2024-11-02T15:19:14.9663838+08:00||;True|2024-11-02T14:39:47.8808708+08:00||;False|2024-11-02T14:22:04.2841792+08:00||;True|2024-11-02T11:50:48.2452805+08:00||;True|2024-10-29T18:52:12.7978878+08:00||;True|2024-10-29T10:27:49.1623527+08:00||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;
+ True|2024-11-04T07:21:49.7395112Z||;True|2024-11-04T11:26:53.4821041+08:00||;True|2024-11-04T11:19:48.8467193+08:00||;True|2024-11-04T11:01:39.9398452+08:00||;True|2024-11-04T10:30:55.0743204+08:00||;True|2024-11-02T21:17:44.8575190+08:00||;True|2024-11-02T20:54:29.9931812+08:00||;True|2024-11-02T20:39:20.4100370+08:00||;True|2024-11-02T18:33:41.0724285+08:00||;True|2024-11-02T18:21:55.8561639+08:00||;True|2024-11-02T17:36:24.3401782+08:00||;True|2024-11-02T16:38:03.0054105+08:00||;True|2024-11-02T16:26:26.1698304+08:00||;True|2024-11-02T16:15:20.2872358+08:00||;True|2024-11-02T15:19:14.9663838+08:00||;True|2024-11-02T14:39:47.8808708+08:00||;False|2024-11-02T14:22:04.2841792+08:00||;True|2024-11-02T11:50:48.2452805+08:00||;True|2024-10-29T18:52:12.7978878+08:00||;True|2024-10-29T10:27:49.1623527+08:00||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;
\ No newline at end of file