示例#1
0
        /// <summary>
        /// 根据启动类型自动创建系统作业,但缺省了方案ID,不成功时返回null
        /// </summary>
        /// <param name="starttype"></param>
        /// <returns></returns>
        public static QcJob Get_CreatQuickJob(string starttype)
        {
            QcTask task = QcTask.Get_CreatQuickTask();

            if (task != null)
            {
                QcJob chekjob = QcJob.GetJob(task).Where(t => t["启动类型"] == starttype).FirstOrDefault();
                if (chekjob == null)
                {
                    QcJob job = new QcJob(task);
                    job.Name     = string.Format("我的 {0} 快速作业", starttype);
                    job["启动类型"]  = starttype;
                    job["作业员"]   = QcUser.User.UserID;
                    job["作业优先级"] = "1";
                    job["作业状态"]  = "未启动";
                    job["作业描述"]  = "该作业为系统自动分配的快速作业";
                    job["备注"]    = "#*9999*#";
                    job.Update();
                    return(job);
                }
                else
                {
                    return(chekjob);
                }
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        public string GetNextCode()
        {
            string prefix = DbHelper.GetDateTime().ToString("yyyy-MM-dd") + "-";

            return(QcCode.GetNextNumber(prefix,
                                        QcTask.GetTask("任务编号 like '" + prefix + "%'"),
                                        11, 3, "000"
                                        ));
        }
示例#3
0
        /// <summary>
        /// 系统获取或创建内置系统任务
        /// </summary>
        /// <returns></returns>
        public static QcTask Get_CreatQuickTask()
        {
            QcProject prj = QcProject.GetProjects("项目通知单号='#*9999*#'").FirstOrDefault();

            if (prj == null)
            {
                prj           = new QcProject();
                prj["项目名称"]   = "系统内置快速项目";
                prj["项目通知单号"] = "#*9999*#";//特殊项目处理
                prj["项目负责人"]  = "sys";
                prj["承担部门"]   = "sys";
                prj["项目来源"]   = "其它";
                prj["项目类型"]   = "其它";
                prj["创建人"]    = "1";
                if (prj.Update())
                {
                    QcTask task = new QcTask(prj);
                    task.Name      = "系统内置快速任务";
                    task["任务描述"]   = "内置任务不可删除";
                    task["任务通知单号"] = "#*9999*#";//特殊项目处理
                    task["任务负责人"]  = "sys";
                    task["创建人"]    = "sys";
                    task["任务优先级"]  = "1";
                    task["任务状态"]   = "未启动";
                    task.Update();
                    return(task);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                QcTask task = QcTask.GetTask(prj).FirstOrDefault();
                if (task != null)
                {
                    return(task);
                }
                else
                {
                    task           = new QcTask(prj);
                    task.Name      = "系统内置快速项目";
                    task["任务描述"]   = "内置任务不可删除";
                    task["任务通知单号"] = "#*9999*#";//特殊项目处理
                    task["任务负责人"]  = "sys";
                    task["创建人"]    = "sys";
                    task["任务优先级"]  = "1";
                    task["任务状态"]   = "未启动";
                    task.Update();
                    return(task);
                }
            }
        }
示例#4
0
 public QcTask GetParent()
 {
     if (Parent != null)
     {
         return(Parent);
     }
     else
     {
         return(QcTask.GetTask("任务编号='" + this["任务编号"] + "'").FirstOrDefault());
     }
 }
示例#5
0
        public static bool Regsister(string username, string password, string name, string sex, DateTime birthday, string tel, string part, DateTime worktime, string address, string content, string status = "注册")
        {
            if (QcUser.Users.Any(t => t.UserName == username || t.姓名 == name))
            {
                return(false);
            }
            QcUser user = new QcUser();

            user.UserName  = username;
            user.部门        = part;
            user.姓名        = name;
            user["用户密码"]   = password;
            user["性别"]     = sex;
            user["出生日期"]   = birthday.ToQcDateString();
            user["参加工作时间"] = worktime.ToQcDateString();
            user["联系电话"]   = tel;
            user["通讯地址"]   = address;
            user["备注"]     = content;
            user.UserID    = QcUser.GetNextCode();
            user["状态"]     = status;
            //user["状态"] = "启用";
            bool ret = user.Update();

            if (ret)
            {
                user.AddRole("项目负责人");
                user.AddRole("任务负责人");
                user.AddRole("作业员");
            }
            //if (QcProject.GetProjects("").Any(t => t.Name == "快速项目") == false)
            //{
            //    QcProject prj = new QcProject();
            //    prj["项目名称"] = "快速项目";
            //    prj["项目负责人"] = "sys";
            //    prj["承担部门"] = "临时";
            //    prj["项目来源"] = "其它";
            //    prj["项目类型"] = "其它";
            //    prj["创建人"] = "sys";
            //    if (prj.Update())
            //    {
            //        QcTask task = new QcTask(prj);
            //        task.Name = "快速任务";
            //        task["任务负责人"] = "sys";
            //        task["创建人"] = "sys";
            //        task["任务优先级"] = "1";
            //        task["任务状态"] = "未启动";
            //        task.Update();
            //    }
            //}
            QcTask.Get_CreatQuickTask();
            QcMsgPoster.PostMeassage(user.Code, user.tablename, user.CodeField, NodeChangeType.Create);
            return(ret);
        }
示例#6
0
        public static List <QcJob> GetJob(QcTask task)
        {
            var pls = DbHelper.Query("Select * from " + TableName + " where 任务编号='" + task.Code + "'");

            if (pls == null)
            {
                return(null);
            }
            return((from p in pls select new QcJob(p)
            {
                Parent = task
            }).ToList());
        }
示例#7
0
        /// <summary>
        /// 根据名称,类型,方案创建作业,不成功时返回null
        /// </summary>
        /// <param name="jobname"></param>
        /// <param name="starttype"></param>
        /// <param name="chkprjid"></param>
        /// <returns></returns>
        public static QcJob CreatQuickJob(string jobname, string starttype, string productlevelcode, string producttypecode, string chkprjid)
        {
            QcTask task = QcTask.Get_CreatQuickTask();

            if (task != null)
            {
                QcJob job = new QcJob(task);
                job.Name      = jobname;
                job["启动类型"]   = starttype;
                job["作业员"]    = QcUser.User.UserID;
                job["产品级别编码"] = productlevelcode;
                job["产品类别编码"] = producttypecode;
                job["方案ID"]   = chkprjid;
                job["作业优先级"]  = "1";
                job["作业状态"]   = "未启动";
                job["修改日期"]   = DateTime.Now.ToString();
                job.Update();
                return(job);
            }
            else
            {
                return(null);
            }
        }
示例#8
0
 public void SetParent(QcTask task)
 {
     Parent = task;
 }
示例#9
0
 public QcJob(QcTask parent) : base(null, TableName)
 {
     Parent = parent;
 }