jianghaiqing 4 months ago
commit e5a12fd980

@ -25,4 +25,23 @@ public abstract class BaseTenantModel<TKey> : BaseModel<TKey>, ITenantId
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "租户名称", IsOnlyIgnoreUpdate = true,Length = 150)]
public string TenantName { get; set; }
}
/// <summary>
/// 租户实体基类
/// </summary>
/// <typeparam name="TKey"></typeparam>
public abstract class BaseTenantModelV2<TKey> : BaseModelV2<TKey>, ITenantId
{
/// <summary>
/// 租户Id
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public long TenantId { get; set; } = 0;
/// <summary>
/// 租户名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "租户名称", IsOnlyIgnoreUpdate = true, Length = 150)]
public string? TenantName { get; set; }
}

@ -259,5 +259,11 @@ namespace DS.Module.Core
/// </summary>
[Description("海运出口")]
SeaExport = 6,
/// <summary>
/// 海运出口退单
/// </summary>
[Description("海运出口退单")]
SeaExportReturn = 7
}
}

@ -231,10 +231,20 @@ namespace DS.Module.Core
[Description("放单")]
WAIT_CHECKOUT_BILL = 208,
/// <summary>
/// 退舱
/// </summary>
[Description("退舱")]
RETURN_CABIN = 401,
/// <summary>
/// 审单驳回
/// </summary>
[Description("审单驳回")]
ORDER_AUDIT_REJECTED = 401,
ORDER_AUDIT_REJECTED = 501,
/// <summary>
/// 退舱驳回
/// </summary>
[Description("退舱驳回")]
RETURN_CABIN_REJECTED = 502,
#endregion
#region 工作流--可选服务项目

@ -10,11 +10,11 @@
<PackageReference Include="AnyDiff" Version="1.0.99" />
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="CSRedisCore" Version="3.8.803" />
<PackageReference Include="DotNetCore.CAP" Version="8.0.0" />
<PackageReference Include="DotNetCore.CAP.InMemoryStorage" Version="8.0.0" />
<PackageReference Include="Enums.NET" Version="4.0.2" />
<PackageReference Include="Enums.NET" Version="5.0.0" />
<PackageReference Include="fasterflect" Version="3.0.0" />
<PackageReference Include="GZY.Quartz.MUI" Version="2.6.0" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.14" />
@ -22,18 +22,18 @@
<PackageReference Include="LanguageExt.Core" Version="4.4.7" />
<PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Masuit.Tools.Core" Version="2.6.8.8" />
<PackageReference Include="Masuit.Tools.Core" Version="2024.4.5" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="MediatR.Contracts" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.3" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.12" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.16" />
<PackageReference Include="MimeKit" Version="4.6.0" />
<PackageReference Include="MiniExcel" Version="1.31.3" />
<PackageReference Include="MiniExcel" Version="1.34.0" />
<PackageReference Include="NETCore.MailKit" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@ -41,13 +41,14 @@
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.8" />
<PackageReference Include="NPOI" Version="2.7.0" />
<PackageReference Include="Npoi.Mapper" Version="6.2.1" />
<PackageReference Include="RazorEngineCore" Version="2024.4.1" />
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
<PackageReference Include="Snowflake.Data" Version="2.2.0" />
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.136" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.5.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.166" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.7.0" />
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="UAParser" Version="3.1.47" />
</ItemGroup>

@ -66,6 +66,9 @@ namespace DS.WMS.Core.Application.Dtos
/// </summary>
public InvoiceCategory Category { get; set; }
/// <summary>
/// 发票类别名
/// </summary>
public string CategoryText => Category.GetDescription();
/// <summary>
@ -73,6 +76,11 @@ namespace DS.WMS.Core.Application.Dtos
/// </summary>
public string? AutualCustomerName { get; set; }
/// <summary>
/// 实际发票号
/// </summary>
public string? AcutalInvoiceNO { get; set; }
/// <summary>
/// 其他币别金额
/// </summary>
@ -127,11 +135,6 @@ namespace DS.WMS.Core.Application.Dtos
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 申请开票日期
/// </summary>
public DateTime ApplyDate => CreateTime.Date;
/// <summary>
/// 发票申请明细
/// </summary>

@ -62,9 +62,9 @@ namespace DS.WMS.Core.Fee.Entity
[SugarColumn(ColumnDescription = "费用英文名称", Length = 100, IsNullable = true)]
public string FeeEnName { get; set; }
/// <summary>
/// 费用对象
/// 费用对象名称
/// </summary>
[SugarColumn(ColumnDescription = "费用对象", Length = 100, IsNullable = true)]
[SugarColumn(ColumnDescription = "费用对象名称", Length = 100, IsNullable = true)]
public string CustomerName { get; set; }
/// <summary>
/// 费用对象编码

@ -15,14 +15,14 @@ namespace DS.WMS.Core.Fee.Interface
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<FeeAuditBusiness>>> GetListAsync(PageRequest request);
Task<DataResult<List<FeeAuditBusiness>>> GetListAsync(PageRequest<bool> request);
/// <summary>
/// 获取整票审核列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest request);
Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest<bool> request);
/// <summary>
/// 根据查询条件获取费用明细

@ -21,8 +21,6 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
public class FeeAuditService : FeeServiceBase, IFeeAuditService
{
const string Audit_Only = "AuditOnly";
/// <summary>
/// 待审核的状态值
/// </summary>
@ -49,10 +47,10 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult<List<FeeAuditBusiness>>> GetListAsync(PageRequest request)
public async Task<DataResult<List<FeeAuditBusiness>>> GetListAsync(PageRequest<bool> request)
{
List<FlowInstance> flowList = null;
if (string.Equals(request.OtherQueryCondition, Audit_Only))
if (request.OtherQueryCondition)
{
flowList = await GetCurrentFlowsQuery(AuditTypes)
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync();
@ -186,10 +184,10 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest request)
public async Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest<bool> request)
{
List<FlowInstance> flowList = null;
if (string.Equals(request.OtherQueryCondition, Audit_Only))
if (request.OtherQueryCondition)
{
flowList = await GetCurrentFlowsQuery([AuditType.FeeBusiness])
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync();

@ -1,3 +1,4 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.Flow.Dtos;
@ -19,31 +20,36 @@ public class FlowInstanceReq
/// 模板Id
/// </summary>
public long? TemplateId { get; set; }
/// <summary>
/// 客户自定义名称
/// </summary>
public string CustomName { get; set; }= "";
public string CustomName { get; set; }
/// <summary>
/// 模块Id
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 当前节点ID
/// </summary>
public string ActivityId { get; set; }= "";
public string ActivityId { get; set; }
/// <summary>
/// 当前节点类型0会签节点
/// </summary>
public int? ActivityType { get; set; }
/// <summary>
/// 当前节点名称
/// </summary>
public string ActivityName { get; set; }= "";
public string ActivityName { get; set; }
/// <summary>
/// 前一个ID
/// </summary>
public string PreviousId { get; set; }= "";
public string PreviousId { get; set; }
/// <summary>
/// 执行人
@ -53,7 +59,13 @@ public class FlowInstanceReq
/// <summary>
/// 工作流状态
/// </summary>
public int FlowStatus { get; set; } = 0;
public FlowStatusEnum FlowStatus { get; set; }
/// <summary>
/// 类型
/// </summary>
public AuditType? AuditType { get; set; }
/// <summary>
/// 中文视图名;设计方案时,提供中文字段的视图来源
/// </summary>
@ -67,7 +79,7 @@ public class FlowInstanceReq
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
public string? Note { get; set; }
}
/// <summary>

@ -1,3 +1,5 @@
using DS.Module.Core;
namespace DS.WMS.Core.Flow.Dtos;
/// <summary>
@ -51,7 +53,18 @@ public class FlowInstanceRes
/// <summary>
/// 工作流状态
/// </summary>
public int FlowStatus { get; set; }
public FlowStatusEnum FlowStatus { get; set; }
/// <summary>
/// 类型
/// </summary>
public AuditType? AuditType { get; set; }
/// <summary>
/// 类型名称
/// </summary>
public string? AuditTypeName { get; set; }
/// <summary>
/// 中文视图名;设计方案时,提供中文字段的视图来源
/// </summary>
@ -66,13 +79,5 @@ public class FlowInstanceRes
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 类型
/// </summary>
public string? AuditType { get; set; }
/// <summary>
/// 类型名称
/// </summary>
public string? AuditTypeName { get; set; }
public DateTime CreateTime { get; set; }
}

@ -15,9 +15,7 @@ public class FlowTemplateReq
/// <summary>
/// 模板名称
/// </summary>
public string Name { get; set; }
public string Name { get; set; }
/// <summary>
/// 模块Id
/// </summary>
@ -27,12 +25,10 @@ public class FlowTemplateReq
///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 流程内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 排序
/// </summary>
@ -40,11 +36,23 @@ public class FlowTemplateReq
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 执行人变更回调地址
/// </summary>
public string? MarkerNotifyURL { get; set; }
/// <summary>
/// 回调地址
/// </summary>
public string? CallbackURL { get; set; }
/// <summary>
/// 审批类型
/// </summary>
public AuditType? AuditType { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
public string? Note { get; set; }
}
/// <summary>

@ -49,6 +49,19 @@ public class FlowTemplateRes
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 执行人变更回调地址
/// </summary>
public string? MarkerNotifyURL { get; set; }
/// <summary>
/// 回调地址
/// </summary>
public string? CallbackURL { get; set; }
/// <summary>
/// 审批类型
/// </summary>
public AuditType? AuditType { get; set; }
/// <summary>
/// 创建时间
/// </summary>
@ -57,5 +70,5 @@ public class FlowTemplateRes
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
public string? Note { get; set; }
}

@ -8,8 +8,8 @@ namespace DS.WMS.Core.Flow.Entity;
/// <summary>
/// 工作流模板
/// </summary>
[SqlSugar.SugarTable("sys_flow_template")]
public class FlowTemplate : BaseModel<long>
[SugarTable("sys_flow_template")]
public class FlowTemplate : BaseTenantModelV2<long>
{
/// <summary>
/// 模板名称

@ -8,8 +8,8 @@ namespace DS.WMS.Core.Flow.Entity;
/// <summary>
/// 工作流模板-租户
/// </summary>
[SqlSugar.SugarTable("sys_flow_template_tenant")]
public class FlowTemplateTenant : BaseTenantModel<long>
[SugarTable("sys_flow_template_tenant")]
public class FlowTemplateTenant : BaseTenantModelV2<long>
{
/// <summary>
/// 模板名称
@ -43,7 +43,7 @@ public class FlowTemplateTenant : BaseTenantModel<long>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 执行人变更回调地址

@ -15,6 +15,10 @@ namespace DS.WMS.Core.Flow.Method;
/// </summary>
public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanceService
{
/// <summary>
/// ³õʼ»¯
/// </summary>
/// <param name="serviceProvider"></param>
public ClientFlowInstanceService(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
@ -47,7 +51,7 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc
var nextNode = wfruntime.NextNode;
var nextConditionNodeId = wfruntime.GetClientNextConditionNodeId(nextNode);
var nextConditionNodeId = wfruntime.GetNextConditionNodeId(nextNode);
var nextConditionNode = wfruntime.ChildNodes.Find(x => x.Id == nextConditionNodeId);
if (nextConditionNode == null)
return makerList;
@ -85,7 +89,7 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc
.WhereIF(businessType.HasValue, x => x.BusinessType == businessType.Value)
.WhereIF(types != null && types.Length > 0, x => types.Contains(x.Type));
var list = query.OrderBy(x => x.CreateTime).Select(x => new FlowInstance
var list = query.Select(x => new FlowInstance
{
Id = x.Id,
Content = x.Content,
@ -96,7 +100,7 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc
var list2 = list.Select(x => x.Adapt<FlowInstanceRes>()).ToList();
foreach (var item in list2)
{
item.AuditTypeName = item.AuditType?.ToEnum<AuditType>().GetDescription();
item.AuditTypeName = item.AuditType?.GetDescription();
}
return DataResult<List<FlowInstanceRes>>.Success(list2);

@ -60,10 +60,14 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
public DataResult<List<FlowInstanceRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = Db.Queryable<FlowInstance>().Where(a => (a.MakerList == "1" || a.MakerList.Contains(User.UserId)))
var whereList = request.GetConditionalModels(Db);
var data = Db.Queryable<FlowInstance>().Where(a => a.MakerList == "1" || a.MakerList.Contains(User.UserId))
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Select<FlowInstanceRes>()
.Select((a, b) => new FlowInstanceRes
{
CreateTime = a.CreateTime,
}, true)
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}

@ -1,5 +1,4 @@
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
@ -184,7 +183,7 @@ public class FlowRuntime
{
conditionNodes.Add(item);
}
}
}
return conditionNodes;
}
@ -229,354 +228,177 @@ public class FlowRuntime
/// </summary>
/// <param name="parent"></param>
/// <returns></returns>
public virtual string GetNextConditionNodeId(FlowChild parent)
public string GetNextConditionNodeId(FlowChild parent)
{
var conditionNodes = GetFlowConditions(parent);
var conditionId = string.Empty;
string? conditionId = null;
if (conditionNodes.Count == 1)
conditionId = conditionNodes[0].Id;
for (int i = 0; i < conditionNodes.Count; i++)
{
if (i == conditionNodes.Count - 1)
var conditions = conditionNodes[i].Conditions;
var conditionalCollections = new List<ConditionalCollections>();
if (conditions.LogicalOperator == "and")
{
// return ChildNodes.Where(x => x.Pid == conditionNodes[i].Id).First().Id;
conditionId = conditionNodes[i].Id;
}
else
{
var conditions = conditionNodes[i].Conditions;
var conditionalCollections = new List<ConditionalCollections>();
if (conditions.LogicalOperator == "and")
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
if (conditionList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = conditionList
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
{
foreach (var item1 in group.Conditions)
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
}
if (groupList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
}
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
else
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
if (conditionList.Count > 0)
if (conditionList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = conditionList
}
)
;
ConditionalList = conditionList
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
foreach (var item1 in group.Conditions)
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
if (groupList.Count > 0)
else
{
conditionalCollections.Add(new ConditionalCollections
foreach (var item1 in group.Conditions)
{
ConditionalList = groupList
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
)
;
}
}
var conditionalModels =
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
JsonConvert.SerializeObject(conditionalCollections));
// var info = db.Queryable<SysUser>().Where(x => x.Id == BusinessId).Where(conditionalModels)
// .First();
var info = db.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).First();
if (info.IsNotNull())
if (groupList.Count > 0)
{
conditionId = conditionNodes[i].Id;
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
}
}
}
return ChildNodes.Where(x => x.Pid == conditionId).First().Id;
}
public string? GetClientNextConditionNodeId(FlowChild parent)
{
var conditionNodes = GetFlowConditions(parent);
var conditionId = string.Empty;
for (int i = 0; i < conditionNodes.Count; i++)
{
if (i == conditionNodes.Count - 1)
{
// return ChildNodes.Where(x => x.Pid == conditionNodes[i].Id).First().Id;
conditionId = conditionNodes[i].Id;
}
else
{
var conditions = conditionNodes[i].Conditions;
var conditionalCollections = new List<ConditionalCollections>();
if (conditions.LogicalOperator == "and")
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
if (conditionList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = conditionList
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
{
foreach (var item1 in group.Conditions)
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
}
if (groupList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
}
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
else
if (conditionList.Count > 0)
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
conditionalCollections.Add(new ConditionalCollections
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item.Field,
ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
ConditionalList = conditionList
}
)
;
}
if (conditionList.Count > 0)
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
conditionalCollections.Add(new ConditionalCollections
foreach (var item1 in group.Conditions)
{
ConditionalList = conditionList
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
else
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
foreach (var item1 in group.Conditions)
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field,
ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
}
if (groupList.Count > 0)
if (groupList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
ConditionalList = groupList
}
)
;
}
}
var conditionalModels =
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
JsonConvert.SerializeObject(conditionalCollections));
// var info = db.Queryable<SysUser>().Where(x => x.Id == BusinessId).Where(conditionalModels)
// .First();
var info = tenantDb.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).First();
if (info.IsNotNull())
{
conditionId = conditionNodes[i].Id;
}
var conditionalModels = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(JsonConvert.SerializeObject(conditionalCollections));
if (conditionalModels.Count == 0) //跳过默认条件
continue;
ISqlSugarClient sugarClient = tenantDb ?? db;
var exists = sugarClient.Queryable<object>().AS(ColumnView).Where("Id=@Id", new { Id = BusinessId }).Where(conditionalModels).Any();
if (exists)
{
conditionId = conditionNodes[i].Id;
break;
}
}
return ChildNodes?.Find(x => x.Pid == conditionId)?.Id;
return ChildNodes.Where(x => x.Pid == conditionId).First().Id;
}
/// <summary>
/// 获取下一个节点
/// </summary>

@ -12,6 +12,9 @@ using SqlSugar;
namespace DS.WMS.Core.Info.Method;
/// <summary>
/// 客服银行服务
/// </summary>
public class ClientBankService : IClientBankService
{
private readonly IServiceProvider _serviceProvider;
@ -39,7 +42,7 @@ public class ClientBankService : IClientBankService
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var whereList = request.GetConditionalModels(db);
var data = tenantDb.Queryable<InfoClientBank>()
.Where(whereList)
.Select<ClientBankRes>().ToQueryPage(request.PageCondition);

@ -0,0 +1,23 @@
using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
namespace DS.WMS.Core.Op.Dtos.TaskInteraction
{
/// <summary>
/// 任务审核请求
/// </summary>
public class TaskAuditRequest : AuditRequest
{
/// <summary>
/// 任务类型名称
/// </summary>
public string TaskTypeName { get; set; } = TaskBaseTypeEnum.NOT_SPECIFIED.ToString();
/// <summary>
/// 任务类型
/// </summary>
[IgnoreDataMember]
public TaskBaseTypeEnum TaskType => string.IsNullOrEmpty(TaskTypeName) ? TaskBaseTypeEnum.NOT_SPECIFIED : Enum.Parse<TaskBaseTypeEnum>(TaskTypeName);
}
}

@ -12,7 +12,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
public interface ITaskService
{
/// <summary>
/// 获取关联业务的所有任务
/// 获取业务的任务信息
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
@ -48,7 +48,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult> AuditAsync(AuditRequest request);
Task<DataResult> AuditAsync(TaskAuditRequest request);
/// <summary>
/// 审批完成回调更新

@ -0,0 +1,13 @@
using RazorEngineCore;
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
internal class MailTemplate
{
public MailTemplate()
{
IRazorEngine razorEngine = new RazorEngine();
}
}
}

@ -1,6 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Helpers;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;
@ -26,6 +25,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public abstract class TaskService : ServiceBase, ITaskService
{
const long PERMISSION_ID = 1815294400855674880;
static readonly TaskBaseTypeEnum[] AuditTaskTypes = [TaskBaseTypeEnum.WAIT_ORDER_AUDIT, TaskBaseTypeEnum.RETURN_CABIN];
static readonly Dictionary<TaskBaseTypeEnum, AuditType> TypeMappings = new()
{
{ TaskBaseTypeEnum.WAIT_ORDER_AUDIT, AuditType.SeaExport },
{ TaskBaseTypeEnum.RETURN_CABIN, AuditType.SeaExportReturn }
};
/// <summary>
/// 任务管理服务
@ -71,7 +76,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
/// <summary>
/// 获取关联业务的所有任务
/// 获取业务的任务信息
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
@ -112,7 +117,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns>
public async Task<DataResult> SubmitAuditAsync(TaskRequest request)
{
var task = await GetQuery(request.BusinessId, request.BusinessType, TaskBaseTypeEnum.WAIT_ORDER_AUDIT).FirstAsync();
var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
if (task == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
@ -130,7 +135,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
BusinessId = request.BusinessId,
BusinessType = request.BusinessType,
TaskStatus = TaskStatusEnum.Create,
TaskTypeName = TaskBaseTypeEnum.WAIT_ORDER_AUDIT.ToString()
TaskTypeName = request.TaskTypeName
};
//重置任务为待处理
var result = await SetTaskStatusAsync(req, false);
@ -143,7 +148,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
return result2;
await TenantDb.Updateable<BusinessTask>().SetColumns(x => x.TaskStatus == TaskStatusEnum.Create)
.Where(x => x.BusinessId == request.BusinessId && x.BusinessType == request.BusinessType && x.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
.Where(x => x.BusinessId == request.BusinessId && x.BusinessType == request.BusinessType && x.TaskType == request.TaskType)
.ExecuteCommandAsync();
//记录日志
@ -167,10 +172,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult> AuditAsync(AuditRequest request)
public async Task<DataResult> AuditAsync(TaskAuditRequest request)
{
long id = request.Ids[0];
var task = await GetQuery(id, request.BusinessType.Value, TaskBaseTypeEnum.WAIT_ORDER_AUDIT).FirstAsync();
var task = await GetQuery(id, request.BusinessType.GetValueOrDefault(), request.TaskType).FirstAsync();
if (task == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
@ -255,7 +260,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
info.Main.RecvUserInfoList = await GetRecvUsers(request.BusinessId, request.BusinessType, request.TaskType);
if (info.Main.RecvUserInfoList == null || info.Main.RecvUserInfoList.Count == 0)
{
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
if (AuditTaskTypes.Contains(request.TaskType))
{
info.Main.RecvUserInfoList = await GetRecvUsers(long.Parse(User.UserId));
}
@ -307,8 +312,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
task.NextType = GetNextType(task);
await TenantDb.Insertable(task).ExecuteCommandAsync();
//待审核,需创建工作流
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
//审核任务需创建工作流
if (AuditTaskTypes.Contains(request.TaskType))
{
result = await CreateAndStartWorkflow(task);
if (!result.Succeeded)
@ -345,14 +350,15 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns>
protected internal async Task<DataResult> CreateAndStartWorkflow(BusinessTask task, bool changeMarker = true)
{
var template = await FindTemplateAsync(AuditType.SeaExport);
var auditType = TypeMappings[task.TaskType];
var template = await FindTemplateAsync(auditType);
if (template == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
var result = FlowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
{
BusinessId = task.BusinessId,
BusinessType = BusinessType.OceanShippingExport,
BusinessType = task.BusinessType,
TemplateId = template.Id
});
//创建并启动实例
@ -492,9 +498,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
var users = await GetRecvUsers(userId);
var dt = DateTime.Now;
var taskType = TypeMappings.Where(x => x.Value == callback.Type.GetValueOrDefault()).Select(x => x.Key).FirstOrDefault();
await ManagerService.SetTaskUserStatus(
callback.BusinessId,
TaskBaseTypeEnum.WAIT_ORDER_AUDIT,
taskType,
TaskStatusEnum.Complete,
//callback.Status == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending
dt,
@ -509,7 +516,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
CreateBy = userId,
CreateTime = dt,
TaskStatus = TaskStatusEnum.Complete,
TaskType = TaskBaseTypeEnum.WAIT_ORDER_AUDIT,
TaskType = taskType,
RecvUsers = users.Count > 0 ? users[0].RecvUserName : null
});
}
@ -524,11 +531,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
{
ArgumentNullException.ThrowIfNull(callback, nameof(callback));
var taskType = TypeMappings.Where(x => x.Value == callback.Type.GetValueOrDefault()).Select(x => x.Key).FirstOrDefault();
var req = new TaskUpdateRequest
{
BusinessId = callback.BusinessId,
BusinessType = callback.BusinessType.Value,
TaskTypeName = TaskBaseTypeEnum.WAIT_ORDER_AUDIT.ToString(),
TaskTypeName = taskType.ToString(),
TaskStatus = callback.FlowStatus == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending,
AutoCreateNext = false //审批完成后需根据业务需要自定义任务类型,因此设置为不自动创建下一任务
};
@ -541,13 +549,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (callback.FlowStatus == FlowStatusEnum.Reject)
{
//创建审单驳回任务以进行通知
var task = await GetQuery(callback.BusinessId, callback.BusinessType.Value, TaskBaseTypeEnum.WAIT_ORDER_AUDIT).FirstAsync();
var task = await GetQuery(callback.BusinessId, callback.BusinessType.Value, taskType).FirstAsync();
//创建驳回任务以进行通知
await CreateTaskAsync(new TaskCreationRequest
{
BusinessId = callback.BusinessId,
BusinessType = callback.BusinessType.GetValueOrDefault(),
TaskTypeName = TaskBaseTypeEnum.ORDER_AUDIT_REJECTED.ToString(),
TaskTypeName = (taskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT ?
TaskBaseTypeEnum.ORDER_AUDIT_REJECTED : TaskBaseTypeEnum.RETURN_CABIN_REJECTED).ToString(),
RecvUserIdList = [task.CreateBy] //通知任务发起人
});

@ -58,7 +58,8 @@ namespace DS.WMS.Core
/// <returns></returns>
protected internal async Task<FlowTemplateTenant> FindTemplateAsync(AuditType auditType)
{
return await Db.Queryable<FlowTemplateTenant>().FirstAsync(x => x.Status == StatusEnum.Enable && x.AuditType == auditType);
return await Db.Queryable<FlowTemplateTenant>().OrderByDescending(x => x.CreateTime).Take(1)
.FirstAsync(x => x.Status == StatusEnum.Enable && x.AuditType == auditType);
}
}
}

@ -29,7 +29,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<FeeAuditBusiness>>> ListAsync([FromBody] PageRequest request)
public async Task<DataResult<List<FeeAuditBusiness>>> ListAsync([FromBody] PageRequest<bool> request)
{
return await _auditService.GetListAsync(request);
}
@ -62,7 +62,7 @@ namespace DS.WMS.FeeApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetBizList")]
public async Task<DataResult<List<FeeAuditBusiness>>> BizListAsync([FromBody] PageRequest request)
public async Task<DataResult<List<FeeAuditBusiness>>> BizListAsync([FromBody] PageRequest<bool> request)
{
return await _auditService.GetBizListAsync(request);
}

File diff suppressed because it is too large Load Diff

@ -3,7 +3,6 @@ using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Op.Entity;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace DS.WMS.MainApi.Controllers;

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>

@ -6,7 +6,6 @@ using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using Mapster.Utils;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.OpApi.Controllers
@ -28,19 +27,21 @@ namespace DS.WMS.OpApi.Controllers
}
/// <summary>
/// 获取指定业务的关联任务
/// 获取业务的任务信息
/// </summary>
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="taskTypes">任务类型名称(可选)</param>
/// <param name="taskTypes">任务类型名称(支持多个,可选参数</param>
/// <returns></returns>
[HttpGet, Route("GetList")]
public async Task<DataResult<List<BusinessTaskDto>>> GetListAsync(
[FromQuery] long businessId,
[FromQuery] BusinessType businessType,
[FromQuery] params string[] taskTypes)
/// <remarks>/GetTasks?taskTypes=任务类型1&amp;taskTypes=任务类型2</remarks>
[HttpGet, Route("GetTasks")]
public async Task<DataResult<List<BusinessTaskDto>>> GetTasksAsync(
[FromQuery] long businessId, [FromQuery] BusinessType businessType, [FromQuery] params string[] taskTypes)
{
var types = taskTypes.Select(Enum<TaskBaseTypeEnum>.Parse).ToArray();
TaskBaseTypeEnum[]? types = null;
if (taskTypes?.Length > 0)
types = taskTypes.Select(Enum.Parse<TaskBaseTypeEnum>).ToArray();
return await taskService.GetTasks(businessId, businessType, types);
}
@ -52,7 +53,8 @@ namespace DS.WMS.OpApi.Controllers
/// <param name="businessType">业务类型</param>
/// <returns></returns>
[HttpGet, Route("GetLogs")]
public async Task<DataResult<List<BusinessTaskLog>>> GetLogsAsync([FromServices] ITaskLogService logService, [FromQuery] long businessId, [FromQuery] BusinessType businessType)
public async Task<DataResult<List<BusinessTaskLog>>> GetLogsAsync([FromServices] ITaskLogService logService,
[FromQuery] long businessId, [FromQuery] BusinessType businessType)
{
return await logService.ReadLogAsync(businessId, businessType);
}
@ -102,7 +104,7 @@ namespace DS.WMS.OpApi.Controllers
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async virtual Task<DataResult> AuditAsync([FromBody] AuditRequest request)
public async virtual Task<DataResult> AuditAsync([FromBody] TaskAuditRequest request)
{
return await taskService.AuditAsync(request);
}

Loading…
Cancel
Save