public ActionResult Leave(string keyValue, string state)
        {
            OutsourcingprojectEntity pro = outsourcingprojectbll.GetEntity(keyValue);

            //单位离场时,该单位下的人员全部离场
            if (state == "1")
            {
                pro.OUTORIN   = state;
                pro.LEAVETIME = DateTime.Now;
                var userList = new UserBLL().GetList().Where(x => x.DepartmentId == pro.OUTPROJECTID).ToList();
                if (userList.Count > 0)
                {
                    for (int i = 0; i < userList.Count; i++)
                    {
                        userList[i].DepartureTime = DateTime.Now;
                        userList[i].IsPresence    = "0";
                        new UserBLL().SaveForm(userList[i].UserId, userList[i]);
                    }
                }
            }
            else
            {
                pro.OUTORIN   = state;
                pro.LEAVETIME = null;
            }
            //pro.OUTORIN = state;
            //pro.LEAVETIME = DateTime.Now;
            outsourcingprojectbll.SaveForm(keyValue, pro);
            return(Success("操作成功。"));
        }
Пример #2
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, OutsourcingprojectEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, OutprojectblacklistEntity entity)
        {
            var rep = DbFactory.Base().BeginTrans();

            try
            {
                Repository <OutsourcingprojectEntity> ourProject = new Repository <OutsourcingprojectEntity>(DbFactory.Base());
                OutsourcingprojectEntity projectEntity           = ourProject.FindList(string.Format("select * from epg_outsourcingproject  t where t.OUTPROJECTID='{0}'", entity.OUTPROJECTID)).ToList().FirstOrDefault();
                if (entity.STATE == "0")
                {
                    entity.INBLACKLISTTIME       = DateTime.Now;
                    projectEntity.BLACKLISTSTATE = "1";
                }
                else if (entity.STATE == "1")
                {
                    entity.OUTBLACKLISTTIME      = DateTime.Now;
                    projectEntity.BLACKLISTSTATE = "0";
                }
                if (!string.IsNullOrEmpty(keyValue))
                {
                    entity.Modify(keyValue);
                    rep.Update <OutprojectblacklistEntity>(entity);
                }
                else
                {
                    entity.Create();
                    rep.Insert <OutprojectblacklistEntity>(entity);
                }
                rep.Update <OutsourcingprojectEntity>(projectEntity);
                rep.Commit();
            }
            catch (System.Exception)
            {
                rep.Rollback();
            }
        }
 public ActionResult SaveForm(string keyValue, OutsourcingprojectEntity entity)
 {
     outsourcingprojectbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
Пример #5
0
        private void ExportDataByCode(string keyValue, string tempPath, string fileName)
        {
            var    userInfo   = OperatorProvider.Provider.Current(); //获取当前用户
            string strDocPath = Server.MapPath(tempPath);

            Aspose.Words.Document doc     = new Aspose.Words.Document(strDocPath);
            DocumentBuilder       builder = new DocumentBuilder(doc);
            DataSet   ds    = new DataSet();
            DataTable dtPro = new DataTable("project");

            dtPro.Columns.Add("EngineerName");   //外包工程名称
            dtPro.Columns.Add("OUTPROJECTNAME"); //承包单位名称
            dtPro.Columns.Add("OrgName");        //电厂名称
            dtPro.Columns.Add("Reason");         //申请理由
            dtPro.Columns.Add("AUDITSIGNIMG1");  //承包商单位负责人

            dtPro.Columns.Add("AUDITOPINION1");  //部门负责人意见
            dtPro.Columns.Add("AUDITSIGNIMG2");  //部门负责人签名
            dtPro.Columns.Add("DATE1");          //部门审核时间

            dtPro.Columns.Add("AUDITOPINION2");  //生技部负责人意见
            dtPro.Columns.Add("AUDITSIGNIMG3");  //生技部负责人签名
            dtPro.Columns.Add("DATE2");          //生技部审核时间

            dtPro.Columns.Add("AUDITOPINION3");  //安环部负责人意见
            dtPro.Columns.Add("AUDITSIGNIMG4");  //安环部负责人签名
            dtPro.Columns.Add("DATE3");          //安环部审核时间

            HttpResponse resp = System.Web.HttpContext.Current.Response;

            var sc = SafetyCollectbll.GetEntity(keyValue);


            DataRow row = dtPro.NewRow();

            if (sc != null)
            {
                OutsouringengineerEntity eng = outsouringengineerbll.GetEntity(sc.EngineerId);
                OutsourcingprojectEntity pro = outProjectbll.GetOutProjectInfo(eng.OUTPROJECTID);

                row["EngineerName"]   = eng.ENGINEERNAME;
                row["OUTPROJECTNAME"] = pro.OUTSOURCINGNAME;
                row["OrgName"]        = userInfo.OrganizeName;
                row["Reason"]         = sc.Reason;
                row["AUDITSIGNIMG1"]  = eng.UnitSuper;
                //审核记录
                List <AptitudeinvestigateauditEntity> list = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                #region 通用版本审核记录
                var i = 0;
                foreach (AptitudeinvestigateauditEntity entity in list)
                {
                    i++;
                    if (i == 1)
                    {
                        if (string.IsNullOrWhiteSpace(entity.AUDITSIGNIMG))
                        {
                            row["AUDITSIGNIMG2"] = Server.MapPath("~/content/Images/no_1.png");
                        }
                        else
                        {
                            var filepath = Server.MapPath("~/") + entity.AUDITSIGNIMG.ToString().Replace("../../", "").ToString();
                            if (System.IO.File.Exists(filepath))
                            {
                                row["AUDITSIGNIMG2"] = filepath;
                            }
                            else
                            {
                                row["AUDITSIGNIMG2"] = Server.MapPath("~/content/Images/no_1.png");
                            }
                        }
                        builder.MoveToMergeField("AUDITSIGNIMG2");
                        builder.InsertImage(row["AUDITSIGNIMG2"].ToString(), 80, 35);
                        row["AUDITOPINION1"] = !string.IsNullOrEmpty(entity.AUDITOPINION) ? entity.AUDITOPINION.ToString() : "";
                        row["DATE1"]         = entity.AUDITTIME.Value.ToString("yyyy年MM月dd日");
                    }
                    if (i == 2)
                    {
                        if (string.IsNullOrWhiteSpace(entity.AUDITSIGNIMG))
                        {
                            row["AUDITSIGNIMG3"] = Server.MapPath("~/content/Images/no_1.png");
                        }
                        else
                        {
                            var filepath = Server.MapPath("~/") + entity.AUDITSIGNIMG.ToString().Replace("../../", "").ToString();
                            if (System.IO.File.Exists(filepath))
                            {
                                row["AUDITSIGNIMG3"] = filepath;
                            }
                            else
                            {
                                row["AUDITSIGNIMG3"] = Server.MapPath("~/content/Images/no_1.png");
                            }
                        }
                        builder.MoveToMergeField("AUDITSIGNIMG3");
                        builder.InsertImage(row["AUDITSIGNIMG3"].ToString(), 80, 35);
                        row["AUDITOPINION2"] = !string.IsNullOrEmpty(entity.AUDITOPINION) ? entity.AUDITOPINION.ToString() : "";
                        row["DATE2"]         = entity.AUDITTIME.Value.ToString("yyyy年MM月dd日");
                    }
                    if (i == 3)
                    {
                        if (string.IsNullOrWhiteSpace(entity.AUDITSIGNIMG))
                        {
                            row["AUDITSIGNIMG4"] = Server.MapPath("~/content/Images/no_1.png");
                        }
                        else
                        {
                            var filepath = Server.MapPath("~/") + entity.AUDITSIGNIMG.ToString().Replace("../../", "").ToString();
                            if (System.IO.File.Exists(filepath))
                            {
                                row["AUDITSIGNIMG4"] = filepath;
                            }
                            else
                            {
                                row["AUDITSIGNIMG4"] = Server.MapPath("~/content/Images/no_1.png");
                            }
                        }
                        builder.MoveToMergeField("AUDITSIGNIMG4");
                        builder.InsertImage(row["AUDITSIGNIMG4"].ToString(), 80, 35);
                        row["AUDITOPINION3"] = !string.IsNullOrEmpty(entity.AUDITOPINION) ? entity.AUDITOPINION.ToString() : "";
                        row["DATE3"]         = entity.AUDITTIME.Value.ToString("yyyy年MM月dd日");
                    }
                }
                #endregion
            }

            dtPro.Rows.Add(row);
            doc.MailMerge.Execute(dtPro);
            doc.MailMerge.DeleteFields();
            doc.Save(resp, Server.UrlEncode(fileName), Aspose.Words.ContentDisposition.Attachment, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Doc));
        }
        private void ExportDataByCode(string keyValue, string tempPath, string fileName)
        {
            var userInfo = OperatorProvider.Provider.Current();  //获取当前用户
            string strDocPath = Server.MapPath(tempPath);
            Aspose.Words.Document doc = new Aspose.Words.Document(strDocPath);
            DataSet ds = new DataSet();
            DataTable dtPro = new DataTable("project");
            dtPro.Columns.Add("untilname");//单位名称
            dtPro.Columns.Add("legalperson");//法人代表
            dtPro.Columns.Add("projectname");//工程名称
            dtPro.Columns.Add("nowtime");
            dtPro.Columns.Add("itemopinion");
            dtPro.Columns.Add("itemhead");  //项目负责人
            dtPro.Columns.Add("techhead"); //生成技术负责人
            dtPro.Columns.Add("safehead"); //安全监督负责人

            dtPro.Columns.Add("contractperiod");//合同期限
            dtPro.Columns.Add("dutydept");//项目管理部门
            dtPro.Columns.Add("applyperson");//制表人
            dtPro.Columns.Add("applytime");//制表时间
            dtPro.Columns.Add("outhead"); 
            
            DataTable dt = new DataTable("people");
            dt.Columns.Add("no");
            dt.Columns.Add("name");
            dt.Columns.Add("sex");
            dt.Columns.Add("idcard");
            dt.Columns.Add("worktype");
            dt.Columns.Add("health");
            dt.Columns.Add("workyear");
            dt.Columns.Add("education");
            dt.Columns.Add("birthday");
            dt.Columns.Add("cardno");

            HttpResponse resp = System.Web.HttpContext.Current.Response;

            PeopleReviewEntity p = peoplereviewbll.GetEntity(keyValue);

            OutsouringengineerEntity eng = Outsouringengineernll.GetEntity(p.OUTENGINEERID);
            OutsourcingprojectEntity pro = Outsourcingprojectbll.GetOutProjectInfo(eng.OUTPROJECTID);

            DataRow row = dtPro.NewRow();
            var comList = new CompactBLL().GetComoactTimeByProjectId(eng.ID);
            if (comList.Rows.Count > 0)
            {
                var startTime = string.Empty;
                DateTime r = new DateTime();
                if (DateTime.TryParse(comList.Rows[0]["mintime"].ToString(), out r))
                {
                    startTime = r.ToString("yyyy年MM月dd日");
                }
                var endTime = string.Empty;
                DateTime e= new DateTime();
                if (DateTime.TryParse(comList.Rows[0]["maxtime"].ToString(), out e))
                {
                    endTime = e.ToString("yyyy年MM月dd日");
                }
                row["contractperiod"] = startTime + "至" + endTime;
            }
            row["untilname"] = pro.OUTSOURCINGNAME;
            row["legalperson"] = pro.LEGALREP;

            row["projectname"] = eng.ENGINEERNAME;
            row["nowtime"] = DateTime.Now.ToString("yyyy-MM-dd");
            row["dutydept"] = eng.ENGINEERLETDEPT;
            row["applyperson"] = p.CREATEUSERNAME;
            row["applytime"] = p.CREATEDATE.Value.ToString("yyyy年MM月dd日");
            var sendDeptid = eng.ENGINEERLETDEPTID;
            List<AptitudeinvestigateauditEntity> list = auditbll.GetAuditList(keyValue).OrderByDescending(x => x.AUDITTIME).ToList();
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (sendDeptid == list[i].AUDITDEPTID)
                    {
                        var person = new UserBLL().GetEntity(list[i].AUDITPEOPLEID);
                        if (person != null)
                        {
                            //if (person.RoleName.Contains("负责人"))
                            //{
                                row["itemopinion"] = list[i].AUDITOPINION;
                                row["itemhead"] = list[i].AUDITPEOPLE;
                            //}
                        }
                    }
                    if (eng.OUTPROJECTID == list[i].AUDITDEPTID)
                    {
                        var person = new UserBLL().GetEntity(list[i].AUDITPEOPLEID);
                        if (person != null)
                        {
                            if (person.RoleName.Contains("负责人"))
                            {
                                row["outhead"] = list[i].AUDITPEOPLE;
                            }
                        }
                    }
                    string val = new DataItemDetailBLL().GetItemValue(userInfo.OrganizeCode);

                    if (!string.IsNullOrEmpty(val))
                    {
                        var deptList = val.Split(',');
                        if (deptList.Length > 1)
                        {
                            if (list[i].AUDITDEPTID.ToString() == deptList[0])
                            {
                                row["techhead"] = list[i].AUDITPEOPLE;
                            }
                            if (list[i].AUDITDEPTID == deptList[1])
                            {
                                row["safehead"] = list[i].AUDITPEOPLE;
                            }
                        }
                    }
                }
            }
            dtPro.Rows.Add(row);
            List<AptitudeinvestigatepeopleEntity> PeopleList = new AptitudeinvestigatepeopleBLL().GetList("").Where(x => x.PEOPLEREVIEWID == keyValue).ToList();
            if (PeopleList.Count > 0)
            {
                for (int i = 0; i < PeopleList.Count; i++)
                {
                    DataRow dtrow = dt.NewRow();
                    dtrow["no"] = (i + 1);
                    dtrow["name"] = PeopleList[i].REALNAME;
                    dtrow["sex"] = PeopleList[i].GENDER;
                    dtrow["idcard"] = PeopleList[i].IDENTIFYID;
                    dtrow["worktype"] = PeopleList[i].WORKOFTYPE;
                    dtrow["health"] = PeopleList[i].STATEOFHEALTH;
                    dtrow["workyear"] = PeopleList[i].WORKYEAR;
                    dtrow["education"] = PeopleList[i].DEGREESID;
                    dtrow["birthday"] = PeopleList[i].BIRTHDAY == null ? "" : PeopleList[i].BIRTHDAY.Value.ToString("yyyy-MM-dd");
                    string queryJson = Newtonsoft.Json.JsonConvert.SerializeObject(new
                    {
                        UserId = PeopleList[i].ID
                    });
                    var cardlist = new CertificateinspectorsBLL().GetList(queryJson).ToList();
                    for (int j = 0; j < cardlist.Count; j++)
                    {
                        dtrow["cardno"] += cardlist[j].CREDENTIALSCODE + ",";
                    }
                    if (dtrow["cardno"].ToString().Length > 0) {
                        dtrow["cardno"] = dtrow["cardno"].ToString().Substring(0, dtrow["cardno"].ToString().Length - 1);
                    }
                    dt.Rows.Add(dtrow);
                }
            }
            ds.Tables.Add(dt);
            ds.Tables.Add(dtPro);
            doc.MailMerge.Execute(dtPro);
            doc.MailMerge.ExecuteWithRegions(dt);
            doc.MailMerge.DeleteFields();
            doc.Save(resp, Server.UrlEncode(fileName), ContentDisposition.Attachment, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Doc));
        }
        public void ExportReport(string keyValue)
        {
            try
            {
                var userInfo = OperatorProvider.Provider.Current();  //获取当前用户
                string strDocPath = Server.MapPath("~/Resource/ExcelTemplate/人员资质审批表华润版本.doc");
                string fileName = "相关方施工人员进厂申请表_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                Aspose.Words.Document doc = new Aspose.Words.Document(strDocPath);
                DocumentBuilder builder = new DocumentBuilder(doc);
                DataSet ds = new DataSet();
                DataTable dtPro = new DataTable("project");
                dtPro.Columns.Add("createdate");//申请时间
                dtPro.Columns.Add("outsourcingproject");//单位名称
                dtPro.Columns.Add("outsouringengineer");//工程名称
                dtPro.Columns.Add("predicttime");//计划工期
                dtPro.Columns.Add("engineerdirector");//施工负责人
                dtPro.Columns.Add("workpeoplecount");  //施工人数
                dtPro.Columns.Add("engineerletdeptid"); //用工部门
                dtPro.Columns.Add("linkman"); //联系人

                dtPro.Columns.Add("ygauditidea");//用工部门审核意见
                dtPro.Columns.Add("ygauditdate");//用工部门审核时间
                dtPro.Columns.Add("ehsauditidea");//EHS部审核意见
                dtPro.Columns.Add("ehsauditdate");//EHS部审核时间
                dtPro.Columns.Add("bgsauditidea");//办公室审核意见
                dtPro.Columns.Add("bgsauditdate");//办公室审核时间

                HttpResponse resp = System.Web.HttpContext.Current.Response;

                PeopleReviewEntity p = peoplereviewbll.GetEntity(keyValue);

                OutsouringengineerEntity eng = Outsouringengineernll.GetEntity(p.OUTENGINEERID);
                OutsourcingprojectEntity pro = Outsourcingprojectbll.GetOutProjectInfo(eng.OUTPROJECTID);

                DataRow row = dtPro.NewRow();
                row["createdate"] =Convert.ToDateTime(p.CREATEDATE).ToString("yyyy年MM月dd日");
                row["outsourcingproject"] = pro.OUTSOURCINGNAME;
                row["outsouringengineer"] = eng.ENGINEERNAME;
                row["predicttime"] = eng.PREDICTTIME;
                row["engineerdirector"] = eng.ENGINEERDIRECTOR;
                row["engineerletdeptid"] = eng.ENGINEERLETDEPT;
                row["linkman"] = pro.LINKMAN;
                row["workpeoplecount"] = aptitudeinvestigatepeoplebll.GetList("").Where(t => t.PEOPLEREVIEWID == keyValue).Count();
                List<AptitudeinvestigateauditEntity> list = auditbll.GetAuditList(keyValue).OrderByDescending(x => x.AUDITTIME).ToList();
                string pic = Server.MapPath("~/content/Images/no_1.png");//默认图片
                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        var filepath = list[i].AUDITSIGNIMG == null ? "" : (Server.MapPath("~/") + list[i].AUDITSIGNIMG.ToString().Replace("../../", "").ToString()).Replace(@"\/", "/").ToString();
                        var stime = Convert.ToDateTime(list[i].AUDITTIME);
                        if (i == 0)
                        {
                            row["ygauditidea"] = list[i].AUDITOPINION;
                            //zauditusername = list[i].AuditUserName;
                            builder.MoveToMergeField("ygauditusername");
                            row["ygauditdate"] = stime.ToString("yyyy年MM月dd日");
                        }
                        else if (i == 1)
                        {
                            row["ehsauditidea"] = list[i].AUDITOPINION;
                            //sauditusername = list[i].AuditUserName;
                            builder.MoveToMergeField("ehsauditusername");
                            row["ehsauditdate"] = stime.ToString("yyyy年MM月dd日");
                        }
                        else if (i == 2)
                        {
                            row["bgsauditidea"] = list[i].AUDITOPINION;
                            //aauditusername = list[i].AuditUserName;
                            builder.MoveToMergeField("bgsauditusername");
                            row["bgsauditdate"] = stime.ToString("yyyy年MM月dd日");

                        }

                        if (!System.IO.File.Exists(filepath))
                        {
                            filepath = pic;
                        }
                        builder.InsertImage(filepath, 80, 35);
                    }
                }
                dtPro.Rows.Add(row);
                doc.MailMerge.Execute(dtPro);
                doc.MailMerge.DeleteFields();
                doc.Save(resp, Server.UrlEncode(fileName), ContentDisposition.Attachment, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Doc));
            }
            catch (Exception ex)
            {
                throw;
            }
        }