示例#1
0
            /// <summary>
            /// 新建工作
            /// 返回工作编号
            /// </summary>
            /// <param name="name">工作流水号名称</param>
            /// <returns></returns>
            public int NewWork(string name)
            {
                //添加工作
                Run.MODEL runNew = Run.NewDataModel();
                runNew.Name.set(name);
                runNew.FlowId.set(this.Id);
                runNew.ParentId.set(0);
                runNew.BeginUser.set(WX.Public.CurUser.UserID);
                runNew.StepNo.set(1);
                runNew.Deal_Flag.set(DealFlag.NotReceived);
                runNew.BeginTime.set_DateTime_Now();
                int newRunId = runNew.Insert(true);

                if (newRunId == 0)
                {
                    return(0);
                }
                //添加步骤状态
                WX.Public.CurUser.LoadUserModel(false);
                string sSql = String.Format("insert into FL_RunProcess(RunId,StepNo,ParentNo,UserId,WorkTime,DeliverTime,Deal_Flag,OP_Flag,Comment) "
                                            + " values({0},{1},0,'{2}',GetDate(),NULL,{3},{4},'{5}')"
                                            , newRunId, 1, WX.Public.CurUser.UserID, runNew.Deal_Flag.ToInt32(), 1, String.Format("主办人:{0},{1}第1步,{2}", WX.Public.CurUser.UserModel.RealName, this.Name, DateTime.Now));
                int iR = ULCode.QDA.XSql.Execute(sSql);

                if (iR == 0)
                {
                    //步骤状态添加失败
                    runNew.Delete();
                    return(-1);
                }
                else
                {
                    return(newRunId);
                }
            }
示例#2
0
 /// <summary>
 /// 退出提示
 /// </summary>
 /// <param name="curRun">当前工作</param>
 /// <returns></returns>
 public string GetOutMsg(Run.MODEL curRun)
 {
     if (this.Condition_Out.isEmpty)
     {
         return(null);
     }
     else
     {
         string[] arr = this.Condition_Out.ToString().Split('|');
         return(arr[2]);
     }
 }
示例#3
0
 /// <summary>
 /// 退出条件
 /// </summary>
 /// <param name="curRun">当前工作</param>
 /// <returns></returns>
 public bool GetOutAccess(Run.MODEL curRun)
 {
     if (this.Condition_Out.isEmpty)
     {
         return(true);
     }
     else
     {
         string sSql = this.GetConditionSql(this.Condition_Out.ToString(), curRun);
         return(ULCode.QDA.XSql.IsHasRow("select 1 where " + sSql));
     }
 }
示例#4
0
            /// <summary>
            /// 自动获取经办人列表
            /// 返回字符串格式:UserId,RealName|UserId,RealName|..
            /// </summary>
            /// <returns></returns>
            public string GetAllOpList(Run.MODEL curRun)
            {
                string con_deptList = this.Priv_DeptList.isEmpty ? String.Empty : " and Cast(B.ID as varchar) in (" + this.Priv_DeptList.ToString() + ")";
                string con_userList = this.Priv_UserList.isEmpty ? String.Empty : " and '" + (this.Priv_UserList.ToString()) + "' like '%'+Cast(A.UserId as char(36))+'%'";
                string con_dutyList = this.Priv_DutyList.isEmpty ? String.Empty : " and Cast(DutyId as varchar) in (" + (this.Priv_DutyList.ToString()) + ")";
                string sSql         = string.Format("select A.UserId from TU_Employees A "
                                                    + " inner join TE_Departments B on A.DepartmentID=B.ID "
                                                    + " inner join TE_Duties C on A.dutyid=C.id"
                                                    + " where 1=1" + con_deptList + con_dutyList + con_userList
                                                    , curRun.Id, this.StepNo);

                return(ULCode.QDA.XSql.GetXDataTable(sSql).ToColValueList());
            }
示例#5
0
            /// <summary>
            /// 获取下一站点列表
            /// 返回字符串格式: StepNum,PrcsName,IsCanEnter|StepNum,PrcsName,IsCanEnter|..
            /// </summary>
            /// <returns></returns>
            public string GetNextPots(Run.MODEL curRun)
            {
                StringBuilder sb = new StringBuilder();

                if (!this.IsLastStep())
                {
                    this.LoadNextProcessList(false);
                    foreach (Process.MODEL prcs in this.NextProcessList)
                    {
                        bool flag = prcs.GetInAccess(curRun);
                        if (sb.Length > 0)
                        {
                            sb.Append("|");
                        }
                        sb.AppendFormat("{0},{1},{2}", prcs.StepNo, prcs.Name, flag);
                    }
                }
                else
                {
                    sb.AppendFormat("{0},{1},{2}", -1, "结束流程", "True");
                }
                return(sb.ToString());
            }
示例#6
0
            /// <summary>
            /// 获取条件形成的Sql语句
            /// </summary>
            /// <param name="inStr">条件字段字符串</param>
            /// <param name="curRun">当前工作</param>
            /// <returns></returns>
            private String GetConditionSql(string inStr, Run.MODEL curRun)
            {
                if (String.IsNullOrEmpty(inStr))
                {
                    return("1=1");
                }
                //Get FieldValues of FieldItemCollection
                FormFieldCollection datas = null;

                if (curRun != null)
                {
                    datas = curRun.GetDatas_FormFieldCollection();
                }
                string prcsin = inStr;

                //获取单个表达式集合,并逐个解析它
                string[] prcslist = prcsin.Split(new String[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                if (prcslist.Length != 3)
                {
                    return("1=1");
                }
                string[] wherelist = prcslist[0].Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < wherelist.Length; i++)
                {
                    wherelist[i] = GetConditionSql_ParserSingleExpression(wherelist[i], datas);
                }
                //获取整体表达式字符串
                string sqlstr = prcslist[1];

                //生成整体表达式
                for (int i = 0; i < wherelist.Length; i++)
                {
                    sqlstr = sqlstr.Replace("[" + (i + 1) + "]", wherelist[i]);
                }

                return(sqlstr);
            }
示例#7
0
            /// <summary>
            /// 自动获取经办人列表
            /// 返回字符串格式:UserId,RealName|UserId,RealName|..
            /// </summary>
            /// <returns></returns>
            public string GetAutoOpList(Run.MODEL curRun)
            {
                string sSql = "";

                switch (Auto_Type_AutoSelOpType)
                {
                case AutoSelOpType.None:
                    return(null);

                case AutoSelOpType.AutoSelBeginner:
                    sSql = String.Format("Select Cast(UserId as char(36))+','+RealName from TU_Employees where UserId='{0}'", curRun.BeginUser);
                    return(ULCode.QDA.XSql.GetData(sSql).ToString());

                case AutoSelOpType.AutoSelMyHost:          //本部门主管
                    sSql = String.Format("select top 1 Cast(D.UserID as char(36))+','+D.RealName from FL_RunProcess A"
                                         + " inner join TU_Employees B On A.UserID=B.UserID"
                                         + " inner join TE_Departments C on B.DepartmentID=C.ID"
                                         + " inner join TU_Employees D on C.Host=D.UserID"
                                         + " where A.RunId={0} and A.StepNo={1}", curRun.Id, this.Auto_BaseUnit);
                    return(ULCode.QDA.XSql.GetData(sSql).ToString());

                case AutoSelOpType.AutoSelMyAssistant:     //本部门助理
                    sSql = String.Format("select Cast(D.UserID as char(36)),D.RealName from FL_RunProcess A"
                                         + " inner join TU_Employees B On A.UserID=B.UserID"
                                         + " inner join TE_Departments C on B.DepartmentID=C.ID"
                                         + " inner join TU_Employees D on C.Assistants like '%'+cast(D.UserID as char(36))+'%'"
                                         + " where A.RunId={0} and A.StepNo={1}", curRun.Id, this.Auto_BaseUnit);
                    return(ULCode.QDA.XSql.GetXDataTable(sSql).ToCellValueList(",", "|"));

                case AutoSelOpType.AutoSelUpHost:          //上级部门领导
                    sSql = String.Format("select top 1 Cast(D.UserID as char(36))+','+D.RealName from FL_RunProcess A"
                                         + " inner join TU_Employees B On A.UserID=B.UserID"
                                         + " inner join TE_Departments C on B.DepartmentID=C.ID"
                                         + " inner join TU_Employees D on C.UpHost=D.UserID"
                                         + " where A.RunId={0} and A.StepNo={1}", curRun.Id, this.Auto_BaseUnit);
                    return(ULCode.QDA.XSql.GetData(sSql).ToString());

                case AutoSelOpType.AutoSelUpLeader:        //上级部门分管领导
                    sSql = String.Format("select Cast(D.UserID as char(36))+','+D.RealName from FL_RunProcess A"
                                         + " inner join TU_Employees B On A.UserID=B.UserID"
                                         + " inner join TE_Departments C on B.DepartmentID=C.ID"
                                         + " inner join TU_Employees D on C.UpSubHosts like '%'+cast(D.UserID as char(36))+'%'"
                                         + " where A.RunId={0} and A.StepNo={1}", curRun.Id, this.Auto_BaseUnit);
                    return(ULCode.QDA.XSql.GetXDataTable(sSql).ToCellValueList(",", "|"));

                case AutoSelOpType.AutoSelTopHost:         //最高级部门领导
                    sSql = "select Cast(A.UserID as char(36)),A.RealName from TU_Employees A "
                           + " inner join TE_Departments B on Cast(B.host as char(36))+','+B.Assistants like '%'+Cast(A.UserId as char(36))+'%'"
                           + " where B.parentId=0";
                    return(ULCode.QDA.XSql.GetXDataTable(sSql).ToCellValueList(",", "|"));

                case AutoSelOpType.AutoSelOpsInMyDept:      //本部门符合条件的所有人员
                    string con_deptList = this.Priv_DeptList.isEmpty ? String.Empty : " and Cast(B.ID as varchar) in (" + this.Priv_DeptList.ToString() + ")";
                    string con_userList = this.Priv_UserList.isEmpty ? String.Empty : " and '" + (this.Priv_UserList.ToString()) + "' like '%'+Cast(A.UserId as char(36))+'%'";
                    string con_dutyList = this.Priv_DutyList.isEmpty ? String.Empty : " and Cast(DutyId as varchar) in (" + (this.Priv_DutyList.ToString()) + ")";
                    sSql = string.Format("select A.UserId,A.RealName from TU_Employees A "
                                         + " inner join TE_Departments B on A.DepartmentID=B.ID "
                                         + " inner join TE_Duties C on A.dutyid=C.id"
                                         + " where 1=1" + con_deptList + con_dutyList + con_userList
                                         + "  and B.Id in (select B.DepartmentID from FL_RunProcess A"
                                         + "     inner join TU_Employees B On A.UserID=B.UserID "
                                         + "     where A.RunId={0} and A.StepNo={1})", curRun.Id, this.StepNo);
                    return(ULCode.QDA.XSql.GetXDataTable(sSql).ToCellValueList(",", "|"));

                case AutoSelOpType.AutoSelOpsInTopDept:     //一级部门符合条件的所有人员
                    string con_deptList1 = this.Priv_DeptList.isEmpty ? String.Empty : " and Cast(B.ID as varchar) in (" + this.Priv_DeptList.ToString() + ")";
                    string con_userList1 = this.Priv_UserList.isEmpty ? String.Empty : " and '" + (this.Priv_UserList.ToString()) + "' like '%'+Cast(A.UserId as char(36))+'%'";
                    string con_dutyList1 = this.Priv_DutyList.isEmpty ? String.Empty : " and Cast(DutyId as varchar) in (" + (this.Priv_DutyList.ToString()) + ")";
                    sSql = "select UserId,RealName from TU_Employees A "
                           + " inner join TE_Departments B on A.DepartmentID=B.ID "
                           + " inner join TE_Duties C on A.dutyid=C.id"
                           + " where 1=1" + con_deptList1 + con_dutyList1 + con_userList1
                           + "  and B.ParentId=0";
                    return(ULCode.QDA.XSql.GetXDataTable(sSql).ToCellValueList(",", "|"));

                case AutoSelOpType.AutoSelStepOp:
                    return(null);

                case AutoSelOpType.SelfByField:
                    return(null);

                case AutoSelOpType.SelfDefaultOp:
                    return(null);

                default:
                    return("");
                }
            }
示例#8
0
 /// <summary>
 /// 退出插件执行
 /// </summary>
 /// <param name="curRun"></param>
 /// <returns></returns>
 public int ExecOut(Run.MODEL curRun)
 {
     return(this.ExecutePlugs(this.Plug_Out.ToString()));
 }
示例#9
0
 /// <summary>
 /// 进入插件执行
 /// </summary>
 /// <param name="curRun"></param>
 /// <returns></returns>
 public int ExecIn(Run.MODEL curRun)
 {
     return(this.ExecutePlugs(this.Plug_In.ToString()));
 }