From 458ebe47c925abf820978c1dee900d6c032ae32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZR20090193-=E9=99=88=E6=95=AC=E5=8B=87?= Date: Wed, 21 Feb 2024 14:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 16 +++++++- .../DS.WMS.Core/Flow/Dtos/FlowTemplateRes.cs | 18 +++++--- .../Interface/IClientFlowTemplateService.cs | 7 ++++ .../Flow/Method/ClientFlowTemplateService.cs | 41 +++++++++++-------- .../DS.WMS.Core/System/Dtos/SysOrgRes.cs | 7 +++- .../ClientFlowTemplateController.cs | 25 ++++++++++- 6 files changed, 86 insertions(+), 28 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index fbc865b8..96671922 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -23,6 +23,14 @@ public static class MultiLanguageConst /// [Description("更新成功")] public const string DataUpdateSuccess = "Data_Update_Success"; + + /// + /// 删除成功 + /// + [Description("删除成功")] + public const string DataDelSuccess = "Data_Del_Success"; + + /// /// 更新失败 /// @@ -69,7 +77,11 @@ public static class MultiLanguageConst public const string IllegalRequest = "Illegal_Request"; #region 工作流相关 - + + [Description("工作流实例存在引用的流程模板不能删除")] + public const string FlowTemplateDelExistImport = "FlowTemplate_Del_Exist_Import"; + [Description("引入的流程模板不存在")] + public const string FlowTemplateImportNotExist = "FlowTemplate_Import_NotExist"; /// /// 只能修改【草稿】和【驳回】状态的流程 /// @@ -78,7 +90,7 @@ public static class MultiLanguageConst /// /// 该流程模板已不存在,请重新设计流程 /// - [Description("该流程模板已不存在,请重新设计流程")] + [Description("该流程模板不存在")] public const string FlowTemplateNotExist = "FlowTemplate_NotExist"; /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateRes.cs b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateRes.cs index cf450189..fd5303d4 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateRes.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Dtos/FlowTemplateRes.cs @@ -11,22 +11,24 @@ public class FlowTemplateRes /// 主键Id /// public long Id { get; set; } + /// /// 模板名称 /// public string Name { get; set; } - + /// /// 模块Id /// public long PermissionId { get; set; } - - + + /// /// 模块名称 /// public string PermissionName { get; set; } + /// ///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源 /// @@ -41,13 +43,17 @@ public class FlowTemplateRes /// 排序 /// public int? OrderNo { get; set; } = 100; - + /// /// 状态 /// public StatusEnum? Status { get; set; } = StatusEnum.Enable; - - + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + /// /// 备注 /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowTemplateService.cs b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowTemplateService.cs index 0dfe0fa4..2191626d 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowTemplateService.cs @@ -34,6 +34,13 @@ public interface IClientFlowTemplateService /// DataResult ImportFlowTemplate(string id); + /// + /// 删除模板 + /// + /// + /// + DataResult DelFlowTemplate(string id); + /// /// 获取模板列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs index 05bab47d..631e0005 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowTemplateService.cs @@ -49,17 +49,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService { if (req.Id == 0) { - var isExist = db.Queryable().Where(x => x.Name == req.Name).First(); - if (isExist != null) - { - return DataResult.Failed("流程模板名称已存在!"); - } - - var data = req.Adapt(); - - var entity = db.Insertable(data).ExecuteReturnEntity(); - - return DataResult.Successed("添加成功!", entity.Id); + return DataResult.Failed("非法请求!",MultiLanguageConst.IllegalRequest); } else { @@ -68,7 +58,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService info = req.Adapt(info); db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); - return DataResult.Successed("更新成功!"); + return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess); } } @@ -78,7 +68,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService .Where(a => a.Id == long.Parse(id)) .Select() .First(); - return DataResult.Success(data); + return DataResult.Success(data,MultiLanguageConst.DataQuerySuccess); } public DataResult ImportFlowTemplate(string id) @@ -86,20 +76,37 @@ public class ClientFlowTemplateService : IClientFlowTemplateService var info = db.Queryable().Where(x => x.Id == long.Parse(id)).First(); if (info == null) { - return DataResult.Failed("流程模板不存在!"); + return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateImportNotExist); } var data = info.Adapt(); db.Insertable(info).ExecuteCommand(); - return DataResult.Successed("引入成功!"); + return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess); + } + + public DataResult DelFlowTemplate(string id) + { + var info = db.Queryable().Where(x => x.Id == long.Parse(id)).First(); + if (info == null) + { + return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateNotExist); + } + + if (db.Queryable().Where(x=>x.TemplateId == long.Parse(id)).Any()) + { + return DataResult.Failed("工作流实例存在引用的流程模板不能删除!",MultiLanguageConst.FlowTemplateDelExistImport); + } + + db.Deleteable(info).ExecuteCommand(); + return DataResult.Successed("删除成功!",MultiLanguageConst.DataDelSuccess); } public DataResult> GetFlowTemplateList(PageRequest request) { //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = db.Queryable() - // .LeftJoin((a, b) => a.PermissionId == b.Id) + var data = db.Queryable().Where(a=>a.Status == StatusEnum.Enable) + .LeftJoin((a, b) => a.PermissionId == b.Id) .Select() .Where(whereList).ToQueryPage(request.PageCondition); return data; diff --git a/ds-wms-service/DS.WMS.Core/System/Dtos/SysOrgRes.cs b/ds-wms-service/DS.WMS.Core/System/Dtos/SysOrgRes.cs index 863fa7eb..da750af7 100644 --- a/ds-wms-service/DS.WMS.Core/System/Dtos/SysOrgRes.cs +++ b/ds-wms-service/DS.WMS.Core/System/Dtos/SysOrgRes.cs @@ -20,7 +20,7 @@ public class SysOrgRes /// public string OrgName { get; set; } - /// + /// /// Desc:负责人 /// Default: /// Nullable:True @@ -36,7 +36,10 @@ public class SysOrgRes /// public int? OrderNo { get; set; } = 100; - + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } /// /// 是否部门标识 /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowTemplateController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowTemplateController.cs index c4b84ac1..d477a77c 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowTemplateController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowTemplateController.cs @@ -58,7 +58,30 @@ public class ClientFlowTemplateController : ApiController var res = _invokeService.GetClientFlowTemplateInfo(id); return res; } - + /// + /// 导入模板 + /// + /// + /// + [HttpGet] + [Route("ImportFlowTemplate")] + public DataResult ImportFlowTemplate([FromQuery] string id) + { + var res = _invokeService.ImportFlowTemplate(id); + return res; + } + /// + /// 删除模板 + /// + /// + /// + [HttpGet] + [Route("DelFlowTemplate")] + public DataResult DelFlowTemplate([FromQuery] string id) + { + var res = _invokeService.DelFlowTemplate(id); + return res; + } /// /// 获取模板列表