public string DeleteInstance() { string groupId = Request.Querys("groupid"); if (!groupId.IsGuid(out Guid guid)) { return("组ID错误!"); } Business.FlowTask flowTask = new Business.FlowTask(); var groupTasks = flowTask.GetListByGroupId(guid); if (groupTasks.Count > 0) { flowTask.DeleteByGroupId(groupTasks.ToArray()); Business.Log.Add("删除了流程实例-" + groupTasks.First().Title, Newtonsoft.Json.JsonConvert.SerializeObject(groupTasks), Business.Log.Type.流程运行); } return("删除成功!"); }
/// <summary> /// 作废任务 /// </summary> /// <returns></returns> public string DeleteTask() { string deltaskid = Request.Querys("deltaskid"); if (!deltaskid.IsGuid(out Guid taskId)) { return("Id错误!"); } Business.FlowTask flowTask = new Business.FlowTask(); var taskModel = flowTask.Get(taskId); if (null == taskModel) { return("作废成功!"); } flowTask.DeleteByGroupId(taskModel.GroupId); var flowrunModel = new Business.Flow().GetFlowRunModel(taskModel.FlowId); if (null == flowrunModel) { return("作废成功!"); } var stepModel = flowrunModel.Steps.Find(p => p.Id == taskModel.StepId); if (null == stepModel) { return("作废成功!"); } var applibrary = new Business.AppLibrary().Get(stepModel.StepForm.Id); if (null != applibrary && applibrary.Code.IsGuid(out Guid formId)) { new Business.Form().DeleteFormData(formId, taskModel.InstanceId); } return("作废成功!"); }