示例#1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, DailyexamineEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 public ActionResult SaveForm(string keyValue, DailyexamineEntity entity)
 {
     try
     {
         entity.IsOver  = 0;
         entity.IsSaved = 0;
         dailyexaminebll.SaveForm(keyValue, entity);
         return(Success("操作成功。"));
     }
     catch (Exception)
     {
         return(Error("操作失败。"));
     }
 }
示例#3
0
        public object ApproveForm()
        {
            try
            {
                string   res      = HttpContext.Current.Request["json"];
                dynamic  dy       = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string   userid   = dy.userid;
                string   keyValue = dy.data.keyvalue;
                Operator curUser  = ERCHTMS.Code.OperatorProvider.Provider.Current();

                AptitudeinvestigateauditEntity aentity = new AptitudeinvestigateauditEntity
                {
                    AUDITRESULT   = dy.data.auditresult,
                    AUDITTIME     = Convert.ToDateTime(dy.data.audittime),
                    AUDITPEOPLE   = dy.data.auditpeople,
                    AUDITPEOPLEID = dy.data.auditpeopleid,
                    AUDITDEPTID   = dy.data.auditdeptid,
                    AUDITDEPT     = dy.data.auditdept,
                    AUDITOPINION  = dy.data.auditopinion,
                    AUDITSIGNIMG  = dy.data.auditsignimg
                };
                string state = string.Empty;

                string moduleName = "日常考核";

                DailyexamineEntity entity = dailyexaminebll.GetEntity(keyValue);
                /// <param name="currUser">当前登录人</param>
                /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
                /// <param name="moduleName">模块名称</param>
                /// <param name="createdeptid">创建人部门ID</param>
                ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, entity.CreateUserDeptId);


                #region                                                                                                                                 //审核信息表
                AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
                aidEntity.AUDITRESULT   = aentity.AUDITRESULT;                                                                                          //通过
                aidEntity.AUDITTIME     = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间
                aidEntity.AUDITPEOPLE   = aentity.AUDITPEOPLE;                                                                                          //审核人员姓名
                aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID;                                                                                        //审核人员id
                aidEntity.APTITUDEID    = keyValue;                                                                                                     //关联的业务ID
                aidEntity.AUDITDEPTID   = aentity.AUDITDEPTID;                                                                                          //审核部门id
                aidEntity.AUDITDEPT     = aentity.AUDITDEPT;                                                                                            //审核部门
                aidEntity.AUDITOPINION  = aentity.AUDITOPINION;                                                                                         //审核意见
                aidEntity.FlowId        = entity.FlowID;
                aidEntity.AUDITSIGNIMG  = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace(new DataItemDetailBLL().GetItemValue("imgUrl"), "");

                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files.Count > 0)
                {
                    for (int i = 0; i < files.AllKeys.Length; i++)
                    {
                        HttpPostedFile file           = files[i];
                        string         fileOverName   = System.IO.Path.GetFileName(file.FileName);
                        string         fileName       = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
                        string         FileEextension = Path.GetExtension(file.FileName);
                        //if (fileName == aidEntity.ID)
                        //{
                        string dir         = new DataItemDetailBLL().GetItemValue("imgPath") + "\\Resource\\sign";
                        string newFileName = fileName + FileEextension;
                        string newFilePath = dir + "\\" + newFileName;
                        file.SaveAs(newFilePath);
                        aidEntity.AUDITSIGNIMG = "/Resource/sign/" + fileOverName;
                        break;
                        //}
                    }
                }
                aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
                #endregion

                #region  //保存日常考核
                //审核通过
                if (aentity.AUDITRESULT == "0")
                {
                    //0表示流程未完成,1表示流程结束
                    if (null != mpcEntity)
                    {
                        entity.FlowDept     = mpcEntity.CHECKDEPTID;
                        entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                        entity.FlowRole     = mpcEntity.CHECKROLEID;
                        entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                        entity.IsSaved      = 1;
                        entity.FlowID       = mpcEntity.ID;
                        entity.IsOver       = 0;
                        entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                    }
                    else
                    {
                        entity.FlowDept     = "";
                        entity.FlowDeptName = "";
                        entity.FlowRole     = "";
                        entity.FlowRoleName = "";
                        entity.IsSaved      = 1;
                        entity.IsOver       = 1;
                        entity.FlowName     = "";
                    }
                }
                else //审核不通过
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.FlowID       = "";
                    entity.IsOver       = 0; //处于登记阶段
                    entity.IsSaved      = 0; //是否完成状态赋值为未完成
                    entity.FlowName     = "";
                }
                //更新日常考核基本状态信息
                dailyexaminebll.SaveForm(keyValue, entity);
                #endregion

                #region    //审核不通过
                if (aentity.AUDITRESULT == "1")
                {
                    //添加历史记录
                    HistorydailyexamineEntity hsentity = new HistorydailyexamineEntity();
                    hsentity.CreateUserId       = entity.CreateUserId;
                    hsentity.CreateUserDeptCode = entity.CreateUserDeptCode;
                    hsentity.CreateUserOrgCode  = entity.CreateUserOrgCode;
                    hsentity.CreateDate         = entity.CreateDate;
                    hsentity.CreateUserName     = entity.CreateUserName;
                    hsentity.CreateUserDeptId   = entity.CreateUserDeptId;
                    hsentity.ModifyDate         = entity.ModifyDate;
                    hsentity.ModifyUserId       = entity.ModifyUserId;
                    hsentity.ModifyUserName     = entity.ModifyUserName;
                    hsentity.ExamineCode        = entity.ExamineCode;
                    hsentity.ExamineDept        = entity.ExamineDept;
                    hsentity.ExamineDeptId      = entity.ExamineDeptId;
                    hsentity.ExamineToDeptId    = entity.ExamineToDeptId;
                    hsentity.ExamineToDept      = entity.ExamineToDept;
                    hsentity.ExamineType        = entity.ExamineType; //关联ID
                    hsentity.ExamineMoney       = Convert.ToDouble(entity.ExamineMoney);
                    hsentity.ExaminePerson      = entity.ExaminePerson;
                    hsentity.ExaminePersonId    = entity.ExaminePersonId; //关联ID
                    hsentity.ExamineTime        = entity.ExamineTime;
                    hsentity.ExamineContent     = entity.ExamineContent;
                    hsentity.ExamineBasis       = entity.ExamineBasis;
                    hsentity.Remark             = entity.Remark;
                    hsentity.ContractId         = entity.Id;//关联ID
                    hsentity.IsSaved            = 2;
                    hsentity.IsOver             = entity.IsOver;
                    hsentity.FlowDeptName       = entity.FlowDeptName;
                    hsentity.FlowDept           = entity.FlowDept;
                    hsentity.FlowRoleName       = entity.FlowRoleName;
                    hsentity.FlowRole           = entity.FlowRole;
                    hsentity.FlowName           = entity.FlowName;
                    hsentity.Id = "";

                    historydailyexaminebll.SaveForm(hsentity.Id, hsentity);

                    //获取当前业务对象的所有审核记录
                    var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                    //批量更新审核记录关联ID
                    foreach (AptitudeinvestigateauditEntity mode in shlist)
                    {
                        mode.APTITUDEID = hsentity.Id; //对应新的ID
                        aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                    }
                    //批量更新附件记录关联ID
                    var flist = fileinfobll.GetImageListByObject(keyValue);
                    foreach (FileInfoEntity fmode in flist)
                    {
                        fmode.RecId = hsentity.Id; //对应新的ID
                        fileinfobll.SaveForm("", fmode);
                    }
                }
                #endregion

                return(new { Code = 0, Count = 0, Info = "保存成功" });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }
示例#4
0
        public object SubmitForm()
        {
            try
            {
                string  res      = HttpContext.Current.Request["json"];;
                dynamic dy       = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  keyValue = res.Contains("keyvalue") ? dy.data.keyvalue : "";
                string  userid   = dy.userid;
                string  fileid   = res.Contains("fileid") ? dy.data.fileid : "";

                Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

                DailyexamineEntity entity = new DailyexamineEntity
                {
                    Id              = keyValue,
                    ExamineCode     = dy.data.examinecode,
                    ExamineDept     = dy.data.examinedept,
                    ExamineDeptId   = dy.data.examinedeptid,
                    ExamineType     = dy.data.examinetype,
                    ExamineMoney    = Convert.ToDouble(dy.data.examinemoney),
                    ExaminePerson   = dy.data.examineperson,
                    ExaminePersonId = dy.data.examinepersonid,
                    ExamineTime     = Convert.ToDateTime(dy.data.examinetime),
                    ExamineBasis    = dy.data.examinebasis,
                    Remark          = dy.data.remark,
                    IsSaved         = 1,
                    IsOver          = 0,
                    ExamineContent  = dy.data.examinecontent,
                    ExamineToDept   = dy.data.examinetodept,
                    ExamineToDeptId = dy.data.examinetodeptid
                };
                string state = string.Empty;

                string moduleName = "日常考核";
                string flowid     = string.Empty;
                /// <param name="currUser">当前登录人</param>
                /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
                /// <param name="moduleName">模块名称</param>
                /// <param name="outengineerid">工程Id</param>
                ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, curUser.DeptId);

                List <ManyPowerCheckEntity> powerList  = new ManyPowerCheckBLL().GetListBySerialNum(curUser.OrganizeCode, moduleName);
                List <ManyPowerCheckEntity> checkPower = new List <ManyPowerCheckEntity>();
                //先查出执行部门编码
                for (int i = 0; i < powerList.Count; i++)
                {
                    if (powerList[i].CHECKDEPTCODE == "-3" || powerList[i].CHECKDEPTID == "-3")
                    {
                        if (curUser.RoleName.Contains("班组") || curUser.RoleName.Contains("专业"))
                        {
                            var pDept = new DepartmentBLL().GetParentDeptBySpecialArgs(curUser.ParentId, "部门");
                            powerList[i].CHECKDEPTCODE = pDept.EnCode;
                            powerList[i].CHECKDEPTID   = pDept.DepartmentId;
                        }
                        else
                        {
                            powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntity(curUser.DeptId).EnCode;
                            powerList[i].CHECKDEPTID   = new DepartmentBLL().GetEntity(curUser.DeptId).DepartmentId;
                        }
                    }
                }
                //登录人是否有审核权限--有审核权限直接审核通过
                for (int i = 0; i < powerList.Count; i++)
                {
                    if (powerList[i].CHECKDEPTID == curUser.DeptId)
                    {
                        var rolelist = curUser.RoleName.Split(',');
                        for (int j = 0; j < rolelist.Length; j++)
                        {
                            if (powerList[i].CHECKROLENAME.Contains(rolelist[j]))
                            {
                                checkPower.Add(powerList[i]);
                                break;
                            }
                        }
                    }
                }
                if (checkPower.Count > 0)
                {
                    ManyPowerCheckEntity check = checkPower.Last();//当前

                    for (int i = 0; i < powerList.Count; i++)
                    {
                        if (check.ID == powerList[i].ID)
                        {
                            flowid = powerList[i].ID;
                        }
                    }
                }
                //if (curUser.RoleName.Contains("公司级用户"))
                //{
                //    mpcEntity = null;
                //}
                if (null != mpcEntity)
                {
                    //保存日常考核
                    entity.FlowDept     = mpcEntity.CHECKDEPTID;
                    entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                    entity.FlowRole     = mpcEntity.CHECKROLEID;
                    entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                    entity.IsSaved      = 1; //标记已经从登记到审核阶段
                    entity.IsOver       = 0; //流程未完成,1表示完成
                    entity.FlowID       = mpcEntity.ID;
                    entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                }
                else  //为空则表示已经完成流程
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.IsSaved      = 1; //标记已经从登记到审核阶段
                    entity.IsOver       = 1; //流程未完成,1表示完成
                    entity.FlowName     = "";
                    entity.FlowID       = flowid;
                }

                HttpFileCollection files = HttpContext.Current.Request.Files;
                keyValue = string.IsNullOrEmpty(keyValue) ? Guid.NewGuid().ToString() : keyValue;
                if (!string.IsNullOrEmpty(fileid))
                {
                    DeleteFile(fileid);
                }
                string path = string.Empty;
                UploadifyFile(keyValue, files, ref path);

                dailyexaminebll.SaveForm(keyValue, entity);

                //添加审核记录
                if (state == "1")
                {
                    //审核信息表
                    AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
                    aidEntity.AUDITRESULT   = "0"; //通过
                    aidEntity.AUDITTIME     = DateTime.Now;
                    aidEntity.AUDITPEOPLE   = curUser.UserName;
                    aidEntity.AUDITPEOPLEID = curUser.UserId;
                    aidEntity.APTITUDEID    = entity.Id; //关联的业务ID
                    aidEntity.AUDITOPINION  = "";        //审核意见
                    aidEntity.AUDITSIGNIMG  = curUser.SignImg;
                    aidEntity.FlowId        = flowid;
                    aidEntity.AUDITDEPTID   = curUser.DeptId;
                    aidEntity.AUDITDEPT     = curUser.DeptName;
                    aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
                }

                return(new { Code = 0, Count = 0, Info = "保存成功" });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }
示例#5
0
        public ActionResult ApporveForm(string keyValue, AptitudeinvestigateauditEntity aentity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string state = string.Empty;

            string moduleName = "日常考核";

            DailyexamineEntity entity = dailyexaminebll.GetEntity(keyValue);
            /// <param name="currUser">当前登录人</param>
            /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
            /// <param name="moduleName">模块名称</param>
            /// <param name="createdeptid">创建人部门ID</param>
            ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, entity.CreateUserDeptId);


            #region                                                                                                                                 //审核信息表
            AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
            aidEntity.AUDITRESULT   = aentity.AUDITRESULT;                                                                                          //通过
            aidEntity.AUDITTIME     = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间
            aidEntity.AUDITPEOPLE   = aentity.AUDITPEOPLE;                                                                                          //审核人员姓名
            aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID;                                                                                        //审核人员id
            aidEntity.APTITUDEID    = keyValue;                                                                                                     //关联的业务ID
            aidEntity.AUDITDEPTID   = aentity.AUDITDEPTID;                                                                                          //审核部门id
            aidEntity.AUDITDEPT     = aentity.AUDITDEPT;                                                                                            //审核部门
            aidEntity.AUDITOPINION  = aentity.AUDITOPINION;                                                                                         //审核意见
            aidEntity.FlowId        = entity.FlowID;
            aidEntity.AUDITSIGNIMG  = HttpUtility.UrlDecode(aidEntity.AUDITSIGNIMG);
            aidEntity.AUDITSIGNIMG  = string.IsNullOrWhiteSpace(aentity.AUDITSIGNIMG) ? "" : aentity.AUDITSIGNIMG.ToString().Replace("../..", "");
            if (null != mpcEntity)
            {
                aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号
            }
            else
            {
                aidEntity.REMARK = "7";
            }
            aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
            #endregion

            #region  //保存日常考核
            //审核通过
            if (aentity.AUDITRESULT == "0")
            {
                //0表示流程未完成,1表示流程结束
                if (null != mpcEntity)
                {
                    entity.FlowDept     = mpcEntity.CHECKDEPTID;
                    entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                    entity.FlowRole     = mpcEntity.CHECKROLEID;
                    entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                    entity.IsSaved      = 1;
                    entity.IsOver       = 0;
                    entity.FlowID       = mpcEntity.ID;
                    entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                }
                else
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.IsSaved      = 1;
                    entity.IsOver       = 1;
                    entity.FlowName     = "";
                }
            }
            else //审核不通过
            {
                entity.FlowDept     = "";
                entity.FlowDeptName = "";
                entity.FlowRole     = "";
                entity.FlowRoleName = "";
                entity.IsOver       = 0; //处于登记阶段
                entity.IsSaved      = 0; //是否完成状态赋值为未完成
                entity.FlowName     = "";
                entity.FlowID       = "";
            }
            //更新日常考核基本状态信息
            dailyexaminebll.SaveForm(keyValue, entity);
            #endregion

            #region    //审核不通过
            if (aentity.AUDITRESULT == "1")
            {
                //添加历史记录
                HistorydailyexamineEntity hsentity = new HistorydailyexamineEntity();
                hsentity.CreateUserId       = entity.CreateUserId;
                hsentity.CreateUserDeptCode = entity.CreateUserDeptCode;
                hsentity.CreateUserOrgCode  = entity.CreateUserOrgCode;
                hsentity.CreateDate         = entity.CreateDate;
                hsentity.CreateUserName     = entity.CreateUserName;
                hsentity.CreateUserDeptId   = entity.CreateUserDeptId;
                hsentity.ModifyDate         = entity.ModifyDate;
                hsentity.ModifyUserId       = entity.ModifyUserId;
                hsentity.ModifyUserName     = entity.ModifyUserName;
                hsentity.ExamineCode        = entity.ExamineCode;
                hsentity.ExamineDept        = entity.ExamineDept;
                hsentity.ExamineDeptId      = entity.ExamineDeptId;
                hsentity.ExamineToDeptId    = entity.ExamineToDeptId;
                hsentity.ExamineToDept      = entity.ExamineToDept;
                hsentity.ExamineType        = entity.ExamineType; //关联ID
                hsentity.ExamineMoney       = entity.ExamineMoney;
                hsentity.ExaminePerson      = entity.ExaminePerson;
                hsentity.ExaminePersonId    = entity.ExaminePersonId; //关联ID
                hsentity.ExamineTime        = entity.ExamineTime;
                hsentity.ExamineContent     = entity.ExamineContent;
                hsentity.ExamineBasis       = entity.ExamineBasis;
                hsentity.Remark             = entity.Remark;
                hsentity.ContractId         = entity.Id;//关联ID
                hsentity.IsSaved            = 2;
                hsentity.IsOver             = entity.IsOver;
                hsentity.FlowDeptName       = entity.FlowDeptName;
                hsentity.FlowDept           = entity.FlowDept;
                hsentity.FlowRoleName       = entity.FlowRoleName;
                hsentity.FlowRole           = entity.FlowRole;
                hsentity.FlowName           = entity.FlowName;
                hsentity.Project            = entity.Project;
                hsentity.ProjectId          = entity.ProjectId;
                hsentity.Id = "";

                historydailyexaminebll.SaveForm(hsentity.Id, hsentity);

                //获取当前业务对象的所有审核记录
                var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                //批量更新审核记录关联ID
                foreach (AptitudeinvestigateauditEntity mode in shlist)
                {
                    mode.APTITUDEID = hsentity.Id; //对应新的ID
                    aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                }
                //批量更新附件记录关联ID
                var flist = fileinfobll.GetImageListByObject(keyValue);
                foreach (FileInfoEntity fmode in flist)
                {
                    fmode.RecId = hsentity.Id; //对应新的ID
                    fileinfobll.SaveForm("", fmode);
                }
            }
            #endregion

            return(Success("操作成功!"));
        }
示例#6
0
        public ActionResult SubmitForm(string keyValue, DailyexamineEntity entity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string state = string.Empty;

            string moduleName = "日常考核";

            /// <param name="currUser">当前登录人</param>
            /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
            /// <param name="moduleName">模块名称</param>
            /// <param name="outengineerid">工程Id</param>
            ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, curUser.DeptId);

            string flowid = string.Empty;
            List <ManyPowerCheckEntity> powerList  = new ManyPowerCheckBLL().GetListBySerialNum(curUser.OrganizeCode, moduleName);
            List <ManyPowerCheckEntity> checkPower = new List <ManyPowerCheckEntity>();

            //先查出执行部门编码
            for (int i = 0; i < powerList.Count; i++)
            {
                if (powerList[i].CHECKDEPTCODE == "-3" || powerList[i].CHECKDEPTID == "-3")
                {
                    if (curUser.RoleName.Contains("班组") || curUser.RoleName.Contains("专业"))
                    {
                        var pDept = new DepartmentBLL().GetParentDeptBySpecialArgs(curUser.ParentId, "部门");
                        powerList[i].CHECKDEPTCODE = pDept.EnCode;
                        powerList[i].CHECKDEPTID   = pDept.DepartmentId;
                    }
                    else
                    {
                        powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntity(curUser.DeptId).EnCode;
                        powerList[i].CHECKDEPTID   = new DepartmentBLL().GetEntity(curUser.DeptId).DepartmentId;
                    }
                }
            }
            //登录人是否有审核权限--有审核权限直接审核通过
            for (int i = 0; i < powerList.Count; i++)
            {
                if (powerList[i].CHECKDEPTID == curUser.DeptId)
                {
                    var rolelist = curUser.RoleName.Split(',');
                    for (int j = 0; j < rolelist.Length; j++)
                    {
                        if (powerList[i].CHECKROLENAME.Contains(rolelist[j]))
                        {
                            checkPower.Add(powerList[i]);
                            break;
                        }
                    }
                }
            }
            if (checkPower.Count > 0)
            {
                ManyPowerCheckEntity check = checkPower.Last();//当前

                for (int i = 0; i < powerList.Count; i++)
                {
                    if (check.ID == powerList[i].ID)
                    {
                        flowid = powerList[i].ID;
                    }
                }
            }
            //if (curUser.RoleName.Contains("公司级用户"))
            //{
            //    mpcEntity = null;
            //}
            if (null != mpcEntity)
            {
                //保存三措两案记录
                entity.FlowDept     = mpcEntity.CHECKDEPTID;
                entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                entity.FlowRole     = mpcEntity.CHECKROLEID;
                entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                entity.IsSaved      = 1; //标记已经从登记到审核阶段
                entity.IsOver       = 0; //流程未完成,1表示完成
                entity.FlowID       = mpcEntity.ID;
                entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
            }
            else  //为空则表示已经完成流程
            {
                entity.FlowDept     = "";
                entity.FlowDeptName = "";
                entity.FlowRole     = "";
                entity.FlowRoleName = "";
                entity.IsSaved      = 1; //标记已经从登记到审核阶段
                entity.IsOver       = 1; //流程未完成,1表示完成
                entity.FlowName     = "";
                entity.FlowID       = flowid;
            }
            dailyexaminebll.SaveForm(keyValue, entity);

            //添加审核记录
            if (state == "1")
            {
                //审核信息表
                AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
                aidEntity.AUDITRESULT   = "0"; //通过
                aidEntity.AUDITTIME     = DateTime.Now;
                aidEntity.AUDITPEOPLE   = curUser.UserName;
                aidEntity.AUDITPEOPLEID = curUser.UserId;
                aidEntity.APTITUDEID    = entity.Id; //关联的业务ID
                aidEntity.AUDITOPINION  = "";        //审核意见
                aidEntity.AUDITSIGNIMG  = curUser.SignImg;
                aidEntity.FlowId        = flowid;
                if (null != mpcEntity)
                {
                    aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号
                }
                else
                {
                    aidEntity.REMARK = "7";
                }
                aidEntity.AUDITDEPTID = curUser.DeptId;
                aidEntity.AUDITDEPT   = curUser.DeptName;
                aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
            }

            return(Success("操作成功!"));
        }
示例#7
0
        public object SubmitForm()
        {
            try
            {
                string  res      = HttpContext.Current.Request["json"];;
                dynamic dy       = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  keyValue = res.Contains("keyvalue") ? dy.data.keyvalue : "";
                string  userid   = dy.userid;
                string  fileid   = res.Contains("fileid") ? dy.data.fileid : "";

                Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

                DailyexamineEntity entity = new DailyexamineEntity
                {
                    Id              = keyValue,
                    ExamineCode     = dy.data.examinecode,
                    ExamineDept     = dy.data.examinedept,
                    ExamineDeptId   = dy.data.examinedeptid,
                    ExamineType     = dy.data.examinetype,
                    ExamineMoney    = Convert.ToDouble(dy.data.examinemoney),
                    ExaminePerson   = dy.data.examineperson,
                    ExaminePersonId = dy.data.examinepersonid,
                    ExamineTime     = Convert.ToDateTime(dy.data.examinetime),
                    ExamineBasis    = dy.data.examinebasis,
                    Remark          = dy.data.remark,
                    IsSaved         = 1,
                    IsOver          = 0,
                    ExamineContent  = dy.data.examinecontent,
                    ExamineToDept   = dy.data.examinetodept,
                    ExamineToDeptId = dy.data.examinetodeptid
                };
                string state = string.Empty;

                string moduleName = "日常考核";

                /// <param name="currUser">当前登录人</param>
                /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
                /// <param name="moduleName">模块名称</param>
                /// <param name="outengineerid">工程Id</param>
                ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, curUser.DeptId);

                if (curUser.RoleName.Contains("公司级用户"))
                {
                    mpcEntity = null;
                }
                if (null != mpcEntity)
                {
                    //保存日常考核
                    entity.FlowDept     = mpcEntity.CHECKDEPTID;
                    entity.FlowDeptName = mpcEntity.CHECKDEPTNAME;
                    entity.FlowRole     = mpcEntity.CHECKROLEID;
                    entity.FlowRoleName = mpcEntity.CHECKROLENAME;
                    entity.IsSaved      = 1; //标记已经从登记到审核阶段
                    entity.IsOver       = 0; //流程未完成,1表示完成
                    entity.FlowName     = mpcEntity.CHECKDEPTNAME + "审核中";
                }
                else  //为空则表示已经完成流程
                {
                    entity.FlowDept     = "";
                    entity.FlowDeptName = "";
                    entity.FlowRole     = "";
                    entity.FlowRoleName = "";
                    entity.IsSaved      = 1; //标记已经从登记到审核阶段
                    entity.IsOver       = 1; //流程未完成,1表示完成
                    entity.FlowName     = "";
                }

                HttpFileCollection files = HttpContext.Current.Request.Files;
                keyValue = string.IsNullOrEmpty(keyValue) ? Guid.NewGuid().ToString() : keyValue;
                if (!string.IsNullOrEmpty(fileid))
                {
                    DeleteFile(fileid);
                }
                string path = string.Empty;
                UploadifyFile(keyValue, files, ref path);

                dailyexaminebll.SaveForm(keyValue, entity);

                //添加审核记录
                if (state == "1")
                {
                    //审核信息表
                    AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
                    aidEntity.AUDITRESULT   = "0"; //通过
                    aidEntity.AUDITTIME     = DateTime.Now;
                    aidEntity.AUDITPEOPLE   = curUser.UserName;
                    aidEntity.AUDITPEOPLEID = curUser.UserId;
                    aidEntity.APTITUDEID    = entity.Id; //关联的业务ID
                    aidEntity.AUDITOPINION  = "";        //审核意见
                    aidEntity.AUDITSIGNIMG  = curUser.SignImg;
                    if (null != mpcEntity)
                    {
                        aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号
                    }
                    else
                    {
                        aidEntity.REMARK = "7";
                    }
                    aidEntity.AUDITDEPTID = curUser.DeptId;
                    aidEntity.AUDITDEPT   = curUser.DeptName;
                    aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
                }

                return(new { Code = 0, Count = 0, Info = "保存成功" });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }