You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.8 KiB
C#
81 lines
2.8 KiB
C#
using DS.Module.Core;
|
|
using DS.Module.Core.Extensions;
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
using DS.WMS.Core.Flow.Entity;
|
|
using DS.WMS.Core.Flow.Interface;
|
|
using DS.WMS.Core.Sys.Entity;
|
|
using Mapster;
|
|
|
|
namespace DS.WMS.Core.Flow.Method;
|
|
|
|
/// <summary>
|
|
/// 工作流模板
|
|
/// </summary>
|
|
public class ClientFlowTemplateService : ServiceBase, IClientFlowTemplateService
|
|
{
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
/// <param name="serviceProvider"></param>
|
|
public ClientFlowTemplateService(IServiceProvider serviceProvider) : base(serviceProvider)
|
|
{
|
|
}
|
|
|
|
public DataResult<List<FlowTemplateRes>> GetListByPage(PageRequest request)
|
|
{
|
|
//序列化查询条件
|
|
var whereList = request.GetConditionalModels(Db);
|
|
var data = TenantDb.Queryable<FlowTemplate>()
|
|
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id, "shippingweb8_dev.sys_permission")
|
|
.Select<FlowTemplateRes>()
|
|
.Where(whereList).ToQueryPage(request.PageCondition);
|
|
return data;
|
|
}
|
|
|
|
public DataResult EditClientFlowTemplate(FlowTemplateReq req)
|
|
{
|
|
if (req.Id == 0)
|
|
{
|
|
var isExist = TenantDb.Queryable<FlowTemplate>().Where(x => x.Name == req.Name).First();
|
|
if (isExist != null)
|
|
return DataResult.Failed("流程模板名称已存在!");
|
|
|
|
var data = req.Adapt<FlowTemplate>();
|
|
var entity = TenantDb.Insertable(data).ExecuteReturnEntity();
|
|
return DataResult.Successed("添加成功!", entity.Id);
|
|
}
|
|
else
|
|
{
|
|
var info = TenantDb.Queryable<FlowTemplate>().Where(x => x.Id == req.Id).First();
|
|
TenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
return DataResult.Successed("更新成功!");
|
|
}
|
|
}
|
|
|
|
public DataResult<FlowTemplateRes> GetClientFlowTemplateInfo(string id)
|
|
{
|
|
var data = TenantDb.Queryable<FlowTemplate>()
|
|
.Where(a => a.Id == long.Parse(id))
|
|
.Select<FlowTemplateRes>()
|
|
.First();
|
|
|
|
return DataResult<FlowTemplateRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
}
|
|
|
|
public DataResult DelFlowTemplate(string id)
|
|
{
|
|
var info = TenantDb.Queryable<FlowTemplate>().Where(x => x.Id == long.Parse(id)).First();
|
|
if (info == null)
|
|
{
|
|
return DataResult.Failed("流程模板不存在!", MultiLanguageConst.FlowTemplateNotExist);
|
|
}
|
|
|
|
if (TenantDb.Queryable<FlowInstance>().Where(x => x.TemplateId == long.Parse(id)).Any())
|
|
{
|
|
return DataResult.Failed("工作流实例存在引用的流程模板不能删除!", MultiLanguageConst.FlowTemplateDelExistImport);
|
|
}
|
|
|
|
TenantDb.Deleteable(info).ExecuteCommand();
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
}
|
|
} |