//添加流程 public InterfaceRet Add(string data) { _ret.Clear(); WorkFlow workFlow = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkFlow>(data); workFlow.flowType = WorkFlowType.EndWork; WorkFlowCfg cfg = new DBWorkFlowCfg().Find(workFlow.flowType, workFlow.flowIdentify); if (cfg != null) { if (cfg.withPlanID == 0) { _dbWorkFlow.FillPlanID(workFlow, cfg.timeBoundary_left, cfg.timeBoundary_right); } } _dbWorkFlow.Add(workFlow); return(_ret); }
//添加流程列表 public InterfaceRet AddFlows(string data) { List <WorkFlow> workFlows = Newtonsoft.Json.JsonConvert.DeserializeObject <List <WorkFlow> >(data); foreach (WorkFlow workFlow in workFlows) { workFlow.flowType = WorkFlowType.EndWork; WorkFlowCfg cfg = new DBWorkFlowCfg().Find(workFlow.flowType, workFlow.flowIdentify); if (cfg != null) { if (cfg.withPlanID == 0) { _dbWorkFlow.FillPlanID(workFlow, cfg.timeBoundary_left, cfg.timeBoundary_right); } } _dbWorkFlow.Add(workFlow); } return(_ret);; }
//检测指定计划的流程是否通过验证 protected Boolean CheckWorkFlows(string flowType, string workShopID, string tmid, string planID, List <WorkFlow> flows) { List <WorkFlowCfg> cfgs = new List <WorkFlowCfg>(); DBWorkFlowCfg _dbWorkFlowCfg = new DBWorkFlowCfg(); _dbWorkFlowCfg.Query(flowType, workShopID, cfgs); if (string.IsNullOrEmpty(planID)) { _dbWorkFlow.Query(flowType, tmid, DateTime.Now, flows); } else { _dbWorkFlow.Query(flowType, tmid, planID, flows); } WorkFlow flow; foreach (WorkFlowCfg cfg in cfgs) { if (cfg.necessary == 1) { if (FindFlow(flowType, cfg.flowIdentify, flows) == null) { flow = new WorkFlow(); flow.flowIdentify = cfg.flowIdentify; flow.flowType = cfg.flowType; flow.flowName = cfg.flowName; if (string.IsNullOrEmpty(cfg.lackFlowHint)) { flow.description = "流程缺失"; } else { flow.description = cfg.lackFlowHint; } flow.success = 2; flows.Add(flow); //没有必需流程 } } } foreach (WorkFlow workFlow in flows) { workFlow.flowName = FindFlowName(workFlow.flowIdentify, cfgs); } foreach (WorkFlow workFlow in flows) { //流程未通过 if (workFlow.success != 0) { return(false); } } return(true); }