using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PMS.DBService.WorkFlow;
using PMS.EntityModels.WorkFlow;
using PMS.Interface.WorkFlow;
using PMS.BusinessModels.Problem;
using PMS.BusinessModels.MobileProblem;
using PMS.BusinessModels.Account;
namespace PMS.BusinessService.WorkFlow
{
///
/// 创 建 人:王海洋
/// 创建日期:2019-01-25
/// 功能描述:问题工作流服务
///
public class WorkFlowBLLService : IWorkFlow
{
//创建一个工作流数据库访问服务
WorkFlowService workFlowDbService = WorkFlowService.Instance();
///
/// 获取新问题的流程ID
///
/// 分类目录ID
/// 人员性质,1:本部人员,2:渠道人员,3: 操作员,4:医院管理员,5:卫计委管理员
/// 问题性质,1:Bug,2:咨询,3:需求,4:优化
/// 返回流程ID
public int? GetNewProblemWorkFlowID(int categoryID, int personProperty, int problemProperty)
{
/* 1.首先根据目录ID,获取正常流程表
* 2.根据人员性质与问题性质获取下一个目标ID
*/
if (problemProperty == 3 && (personProperty == 1 || personProperty == 2))
{//需求类问题(判断人员是否为项目人员,允许直接提交研发,技术支持也登记需求问题直接提交研发)
return workFlowDbService.GetNewRequirementWorkFlowID(categoryID, personProperty, problemProperty);
}
else
{//非需求类问题(按照正常流程进行)
return workFlowDbService.GetNewBugProblemWorkFlowID(categoryID, personProperty);
}
}
///
/// 获取提交问题的下一个工作流程ID
///
/// 分类目录ID
/// 人员性质
/// 问题ID
/// 返回流程ID
public int? GetSubmitProblemWorkFlowID(int personProperty, string problemId)
{
/*1.正常流程(当前人员性质与环节匹配)
*2.跨级流程(当前人员性质与环节不匹配,不应该在这个环节处理)
*/
int workflowId = workFlowDbService.GetSubmitNextWorkFlowID(personProperty, problemId);
if (workflowId > 0)
{//如果获取到下一个流程ID
return workflowId;
}
else
{//跨级处理(人员性质不是当前流程规则的人员为跨级处理)
workflowId = workFlowDbService.GetSubmitSkipNextWorkFlowID(personProperty, problemId);
return workflowId;
}
}
///
/// 回退问题(根据问题执行记录的过程进行回退,找到当前所属的环节进行回退)
/// 1.正常回退
/// 2.跨级回退(如果来源流程ID大于,当前流程ID,则表示跨级节点)
///
/// 问题ID
/// 回到的流程ID
public int? GetBackProblemWorkFlowID( string problemId)
{
return workFlowDbService.GetBackWorkFlowID(problemId);
}
#region 问题操作相关业务模型
///
/// 获取非提交回退类处理操作的进入流程Id
///
///
///
///
public int? GetDealWorkId(string problemId,int personProperty,string JobCode)
{
return workFlowDbService.GetDealWorkId(problemId, personProperty, JobCode);
}
///
/// 问题受理
///
///
///
public bool ProblemAccept(ProblemDealModel Model)
{
var result = workFlowDbService.ProblemAccept(Model);
return result == -1;
}
///
/// 问题回退
///
///
public bool ProblemRollBack(ProblemDealModel Model,out string ProcessId)
{
var result = workFlowDbService.ProblemRollBack(Model,out ProcessId);
return result == -1;
}
///
/// 问题终止
///
///
///
public bool ProblemBreak(ProblemDealModel Model, out string ProcessId)
{
var result = workFlowDbService.ProblemBreak(Model,out ProcessId);
return result == -1;
}
///
/// 问题指派
///
///
///
public bool ProblemAssgin(ProblemDealModel Model, out string ProcessId)
{
var result = workFlowDbService.ProblemAssgin(Model, out ProcessId);
return result == -1;
}
///
/// 问题提交
///
///
///
public bool ProblemSubmit(ProblemDealModel Model)
{
return workFlowDbService.ProblemSubmit(Model);
}
///
/// 问题处理
///
///
///
public bool ProblemDeal(ProblemDealModel Model, out string ProcessId)
{
var result = workFlowDbService.ProblemDeal(Model, out ProcessId);
return result == -1;
}
///
/// 问题完成
///
///
///
public bool ProblemSolution(ProblemDealModel Model, out string ProcessId,UserInfo user)
{
var result = workFlowDbService.ProblemSolution(Model, out ProcessId, user);
return result == -1;
}
///
/// 撤销完成/终止
///
///
///
///
public bool UndoProblem(string ProblemId, string PersonId)
{
var result = workFlowDbService.UndoProblem(ProblemId, PersonId);
return result;
}
///
/// 计算耗时
///
///
///
public Double PassTime(string ProblemID)
{
return workFlowDbService.PassTime(ProblemID);
}
///
/// 问题过程附件保存
///
///
///
public bool SaveProcessFile(ProcessFileModel Model)
{
var result = workFlowDbService.SaveProcessFile(Model);
return result >0;
}
#endregion
#region 其他操作
///
/// 验证问题
///
///
///
public bool AcceptancProblem(ProblemProcessModel model)
{
var result = workFlowDbService.AcceptancProblem(model);
return result ;
}
///
/// 更新版本号
///
///
///
public bool UpdateVersion(VersionManageModel model)
{
var result = workFlowDbService.UpdateVersion(model);
return result;
}
#endregion
}
}