Ejemplo n.º 1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, LifthoistcertEntity entity)
 {
     try
     {
         var dbentity = this.GetEntity(keyValue);
         if (dbentity == null)
         {
             //说明是新增
             entity.ID = keyValue;
             service.SaveForm(string.Empty, entity);
         }
         else
         {
             //说明是修改
             service.SaveForm(keyValue, entity);
         }
         //如果为1,说明是直接提交,则需要走审核
         if (entity.AUDITSTATE == 1)
         {
             this.ApplyCheck(keyValue);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        public object Audit()
        {
            try
            {
                string res = HttpContext.Current.Request["json"];
                var    dy  = JsonConvert.DeserializeAnonymousType(res, new
                {
                    userid = string.Empty,
                    data   = new
                    {
                        id          = string.Empty,
                        pagetype    = string.Empty,
                        auditEntity = new LifthoistauditrecordEntity(),
                        entity      = new LifthoistcertEntity()
                    }
                });
                //获取用户Id
                string userId = dy.userid;
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    return(new { code = -1, info = "请求失败,请登录!" });
                }
                if (dy.data == null)
                {
                    return(new { code = -1, info = "请求失败,data参数为空!" });
                }
                LifthoistauditrecordEntity auditEntity = JsonConvert.DeserializeObject <LifthoistauditrecordEntity>(JsonConvert.SerializeObject(dy.data.auditEntity));
                if (dy.data.pagetype == "1")
                {
                    LifthoistcertEntity certEntity = null;
                    if (dy.data.entity != null)
                    {
                        certEntity = JsonConvert.DeserializeObject <LifthoistcertEntity>(JsonConvert.SerializeObject(dy.data.entity));
                        //负责人签字
                        certEntity.CHARGEPERSONSIGN = UploadifyFile(certEntity.ID + "3", "chargerersonsign", HttpContext.Current.Request.Files);
                        //吊装区域内人员签字
                        certEntity.HOISTAREAPERSONSIGNS = UploadifyFile(certEntity.ID + "4", "hoistareapersonsigns", HttpContext.Current.Request.Files);
                    }
                    lifthoistcertbll.ApplyCheck(dy.data.id, certEntity, auditEntity);
                }
                else
                {
                    if (!string.IsNullOrEmpty(auditEntity.AUDITSIGNIMG))
                    {
                        string strurl = new DataItemDetailBLL().GetItemValue("imgUrl");
                        auditEntity.AUDITSIGNIMG = auditEntity.AUDITSIGNIMG.Replace(strurl, "../../");
                    }
                    lifthoistjobbll.ApplyCheck(dy.data.id, auditEntity);
                }

                return(new { code = 0, info = "操作成功" });
            }
            catch (Exception ex)
            {
                return(new { code = -1, info = ex.Message });
            }
        }
Ejemplo n.º 3
0
        public ActionResult GetCertFlow(string keyValue)
        {
            LifthoistcertEntity entity = lifthoistcertbll.GetEntity(keyValue);
            string modulename          = "(起重吊装准吊证)审核";

            var josnData = lifthoistjobbll.GetFlow(entity.ID, modulename);

            return(Content(josnData.ToJson()));
        }
Ejemplo n.º 4
0
 public ActionResult AuditCertSubmit(string keyValue, LifthoistcertEntity entity, LifthoistauditrecordEntity auditEntity)
 {
     try
     {
         lifthoistcertbll.ApplyCheck(keyValue, entity, auditEntity);
     }
     catch (Exception ex)
     {
         return(Error("审核出错,错误信息:" + ex.Message));
     }
     return(Success("提交成功。"));
 }
Ejemplo n.º 5
0
 public ActionResult SaveCertForm(string keyValue, string jsonData)
 {
     try
     {
         LifthoistcertEntity entity = JsonConvert.DeserializeObject <LifthoistcertEntity>(jsonData);
         lifthoistcertbll.SaveForm(keyValue, entity);
     }
     catch (Exception ex)
     {
         return(Error("保存出错,错误信息:" + ex.Message));
     }
     return(Success("操作成功。"));
 }
Ejemplo n.º 6
0
 public object SaveForm()
 {
     try
     {
         string             res   = HttpContext.Current.Request["json"];
         HttpFileCollection files = HttpContext.Current.Request.Files;
         var dy = JsonConvert.DeserializeAnonymousType(res, new
         {
             userid = string.Empty,
             data   = new LifthoistViewModel()
         });
         //获取用户Id
         string userId = dy.userid;
         OperatorProvider.AppUserId = userId;  //设置当前用户
         Operator curUser = OperatorProvider.Provider.Current();
         if (null == curUser)
         {
             return(new { code = -1, info = "请求失败,请登录!" });
         }
         if (dy.data == null)
         {
             return(new { code = -1, info = "请求失败,data参数为空!" });
         }
         //如果ID为空,则重新生成一个
         if (string.IsNullOrEmpty(dy.data.id))
         {
             dy.data.id        = Guid.NewGuid().ToString();
             dy.data.fazlfiles = Guid.NewGuid().ToString();
         }
         else
         {
             dy.data.fazlfiles = lifthoistjobbll.GetEntity(dy.data.id) == null?Guid.NewGuid().ToString() : lifthoistjobbll.GetEntity(dy.data.id).FAZLFILES;  //方案资料附件关联ID
         }
         //删除文件
         if (!string.IsNullOrEmpty(dy.data.deletefileids))
         {
             DeleteFile(dy.data.deletefileids);
         }
         if (dy.data.pagetype == "1")
         {
             //起吊证
             LifthoistcertEntity certEntity = JsonConvert.DeserializeObject <LifthoistcertEntity>(JsonConvert.SerializeObject(dy.data));
             lifthoistcertbll.SaveForm(certEntity.ID, certEntity);
             //上传人员资料、设备资料
             UploadifyFile(certEntity.ID + "1", "persondata", files);
             UploadifyFile(certEntity.ID + "2", "driverdata", files);
         }
         else
         {
             //起重吊装作业
             LifthoistjobEntity jobEntity = JsonConvert.DeserializeObject <LifthoistjobEntity>(JsonConvert.SerializeObject(dy.data));
             lifthoistjobbll.SaveForm(jobEntity.ID, jobEntity);
             //上传起吊方案
             UploadifyFile(jobEntity.ID, "liftscheme", files);
             UploadifyFile(jobEntity.FAZLFILES, "liftfazl", files);
             highriskrecordbll.RemoveFormByWorkId(dy.data.id);
             if (dy.data.riskrecord != null)
             {
                 var num = 0;
                 foreach (var item in dy.data.riskrecord)
                 {
                     item.CreateDate = DateTime.Now.AddSeconds(-num);
                     item.WorkId     = dy.data.id;
                     highriskrecordbll.SaveForm("", item);
                     num++;
                 }
             }
             lifthoistpersonbll.RemoveFormByWorkId(dy.data.id);
             if (dy.data.lifthoistperson != null)
             {
                 var num = 0;
                 for (int i = 0; i < dy.data.lifthoistperson.Count; i++)
                 {
                     var item = dy.data.lifthoistperson[i];
                     item.CreateDate = DateTime.Now.AddSeconds(-num);
                     item.RecId      = dy.data.id;
                     item.Id         = Guid.NewGuid().ToString();
                     lifthoistpersonbll.SaveForm(item.Id, item);
                     UploadifyFile(item.Id, "pic_" + i, files);//上传人员信息附件
                     if (item.lifthoistpersonfile != null)
                     {
                         foreach (var personfile in item.lifthoistpersonfile)
                         {
                             var fileinfo = fileInfoBLL.GetEntity(personfile.fileid);
                             fileinfo.RecId = item.Id;
                             fileInfoBLL.SaveForm(personfile.fileid, fileinfo);
                         }
                     }
                     num++;
                 }
             }
         }
         return(new { code = 0, info = "操作成功" });
     }
     catch (Exception ex)
     {
         return(new { code = -1, info = ex.Message });
     }
 }
Ejemplo n.º 7
0
        public object GetForm([FromBody] JObject json)
        {
            try
            {
                string res = json.Value <string>("json");
                var    dy  = JsonConvert.DeserializeAnonymousType(res, new
                {
                    userid = string.Empty,
                    data   = new LifthoistViewModel()
                });
                //获取用户Id
                string userId = dy.userid;
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    return(new { code = -1, info = "请求失败,请登录!" });
                }
                if (dy.data == null)
                {
                    return(new { code = -1, info = "请求失败,data参数为空!" });
                }
                LifthoistViewModel retData = new LifthoistViewModel();
                string[]           pops    = null;
                if (dy.data.pagetype == "1")
                {
                    #region 凭吊证详情处理
                    //需要排的除段
                    pops = new string[] { "deletefileids", "qualitytype", "guardianid", "guardianname", "hoistcontent", "liftschemes" };
                    LifthoistcertEntity certEntity = lifthoistcertbll.GetEntity(dy.data.id);
                    if (certEntity == null)
                    {
                        throw new ArgumentException("无法找到当前业务信息,请检查参数是否有误!");
                    }
                    retData = JsonConvert.DeserializeObject <LifthoistViewModel>(JsonConvert.SerializeObject(certEntity));
                    //取人员资料
                    DataTable persondatas = fileInfoBLL.GetFiles(certEntity.ID + "1");
                    if (persondatas != null && persondatas.Rows.Count > 0)
                    {
                        retData.persondatas = new List <Photo>();
                        foreach (DataRow item in persondatas.Rows)
                        {
                            Photo p = new Photo();
                            p.fileid   = item[0].ToString();
                            p.filename = item[1].ToString();
                            p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1);
                            retData.persondatas.Add(p);
                        }
                    }
                    //取设备资料
                    DataTable driverdatas = fileInfoBLL.GetFiles(certEntity.ID + "2");
                    if (driverdatas != null && driverdatas.Rows.Count > 0)
                    {
                        retData.driverdatas = new List <Photo>();
                        foreach (DataRow item in driverdatas.Rows)
                        {
                            Photo p = new Photo();
                            p.fileid   = item[0].ToString();
                            p.filename = item[1].ToString();
                            p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1);
                            retData.driverdatas.Add(p);
                        }
                    }
                    string[] signs = null;
                    string   urls  = string.Empty;
                    //处理签字
                    if (!string.IsNullOrEmpty(retData.chargepersonsign))
                    {
                        signs = retData.chargepersonsign.Split(',');
                        urls  = string.Empty;
                        foreach (var s in signs)
                        {
                            if (!string.IsNullOrEmpty(s))
                            {
                                if (s.Contains("http://"))
                                {
                                    urls += "," + s;
                                }
                                else
                                {
                                    urls += "," + dataitemdetailbll.GetItemValue("imgUrl") + s.Substring(1);
                                }
                            }
                        }
                        if (!string.IsNullOrEmpty(urls))
                        {
                            retData.chargepersonsign = urls.Substring(1);
                        }
                    }
                    if (!string.IsNullOrEmpty(retData.hoistareapersonsigns))
                    {
                        signs = retData.hoistareapersonsigns.Split(',');
                        urls  = string.Empty;
                        foreach (var s in signs)
                        {
                            if (!string.IsNullOrEmpty(s))
                            {
                                if (s.Contains("http://"))
                                {
                                    urls += "," + s;
                                }
                                else
                                {
                                    urls += "," + dataitemdetailbll.GetItemValue("imgUrl") + s.Substring(1);
                                }
                            }
                        }
                        if (!string.IsNullOrEmpty(urls))
                        {
                            retData.hoistareapersonsigns = urls.Substring(1);
                        }
                    }
                    //安全措施
                    var safetys = lifthoistsafetybll.GetList(string.Format("LIFTHOISTCERTID = '{0}'", certEntity.ID));
                    if (safetys != null)
                    {
                        retData.safetys = safetys.ToList();
                    }
                    #endregion
                }
                else
                {
                    #region 起重吊装作业详情处理
                    //需要排的除段
                    pops = new string[] { "lifthoistjobid", "deletefileids", "drivername", "drivernumber", "fulltimename", "fulltimenumber", "persondatas", "driverdatas", "safetys", "chargepersonsign", "hoistareapersonnames", "hoistareapersonids", "hoistareapersonsigns" };
                    LifthoistjobEntity jobEntity = lifthoistjobbll.GetEntity(dy.data.id);
                    if (jobEntity == null)
                    {
                        throw new ArgumentException("无法找到当前业务信息,请检查参数是否有误!");
                    }
                    retData = JsonConvert.DeserializeObject <LifthoistViewModel>(JsonConvert.SerializeObject(jobEntity));
                    //取起吊方案
                    DataTable liftschemes = fileInfoBLL.GetFiles(jobEntity.ID);
                    if (liftschemes != null && liftschemes.Rows.Count > 0)
                    {
                        retData.liftschemes = new List <Photo>();
                        foreach (DataRow item in liftschemes.Rows)
                        {
                            Photo p = new Photo();
                            p.fileid   = item[0].ToString();
                            p.filename = item[1].ToString();
                            p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1);
                            retData.liftschemes.Add(p);
                        }
                    }

                    DataTable liftfazls = fileInfoBLL.GetFiles(jobEntity.FAZLFILES);
                    if (liftfazls != null && liftfazls.Rows.Count > 0)
                    {
                        retData.liftfazls = new List <Photo>();
                        foreach (DataRow item in liftfazls.Rows)
                        {
                            Photo p = new Photo();
                            p.fileid   = item[0].ToString();
                            p.filename = item[1].ToString();
                            p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1);
                            retData.liftfazls.Add(p);
                        }
                    }
                    #endregion

                    #region 流程
                    string modulename = string.Empty;
                    if (jobEntity.QUALITYTYPE == "0")
                    {
                        modulename = "(起重吊装作业30T以下)审核";
                    }
                    else
                    {
                        modulename = "(起重吊装作业30T以上)审核";
                    }
                    var nodelist = lifthoistjobbll.GetAppFlowList(jobEntity.ID, modulename);
                    retData.CheckFlow = nodelist;
                    #endregion
                }
                //审核记录
                var records = lifthoistauditrecordbll.GetList(dy.data.id);
                if (records != null)
                {
                    string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");
                    foreach (var item in records)
                    {
                        item.AUDITSIGNIMG = item.AUDITSIGNIMG.Replace("../../", webUrl + "/");
                    }
                    retData.auditrecords = records.ToList();
                }
                //作业安全风险分析
                var riskrecord = highriskrecordbll.GetList(dy.data.id).ToList();
                if (riskrecord != null)
                {
                    retData.riskrecord = riskrecord.ToList();
                }
                //起重吊装人员信息
                var lifthoistperson = lifthoistpersonbll.GetRelateList(dy.data.id).ToList();
                if (lifthoistperson != null)
                {
                    foreach (var item in lifthoistperson)
                    {
                        DataTable liftfazls = fileInfoBLL.GetFiles(item.Id);
                        if (liftfazls != null && liftfazls.Rows.Count > 0)
                        {
                            List <Photo> files = new List <Photo>();
                            foreach (DataRow rowitem in liftfazls.Rows)
                            {
                                Photo p = new Photo();
                                p.fileid   = rowitem[0].ToString();
                                p.filename = rowitem[1].ToString();
                                p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + rowitem[2].ToString().Substring(1);
                                files.Add(p);
                            }
                            item.lifthoistpersonfile = files;
                        }
                        //var liftfazls = fileInfoBLL.GetFileList(item.Id);
                        //foreach (var file in liftfazls)
                        //{
                        //    file.FilePath = dataitemdetailbll.GetItemValue("imgUrl") + file.FilePath.Substring(1);
                        //}
                    }
                    retData.lifthoistperson = lifthoistperson.ToList();
                }
                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    ContractResolver = new LowercaseContractResolver(null, pops, false),
                    DateFormatString = "yyyy-MM-dd HH:mm", //格式化日期
                };
                string retDataJson = JsonConvert.SerializeObject(retData, Formatting.Indented, settings);
                return(new { code = 0, info = string.Empty, data = JObject.Parse(retDataJson) });
            }
            catch (Exception ex)
            {
                return(new { code = -1, info = ex.Message });
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 凭吊证审核
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="auditEntity">审核实体</param>
        public void ApplyCheck(string keyValue, LifthoistcertEntity entity = null, LifthoistauditrecordEntity auditEntity = null)
        {
            Operator            currUser   = ERCHTMS.Code.OperatorProvider.Provider.Current();
            LifthoistcertEntity certEntity = this.GetEntity(keyValue);

            if (certEntity == null)
            {
                throw new ArgumentException("无法找到当前业务信息,请确认业务ID是否有误!");
            }
            ManyPowerCheckEntity mpcEntity = null;

            //如果外部传入的实体不为null,则说明是负责人操作
            if (entity != null)
            {
                certEntity.CHARGEPERSONNAME     = entity.CHARGEPERSONNAME;
                certEntity.CHARGEPERSONID       = entity.CHARGEPERSONID;
                certEntity.CHARGEPERSONSIGN     = entity.CHARGEPERSONSIGN;
                certEntity.HOISTAREAPERSONNAMES = entity.HOISTAREAPERSONNAMES;
                certEntity.HOISTAREAPERSONIDS   = entity.HOISTAREAPERSONIDS;
                certEntity.HOISTAREAPERSONSIGNS = entity.HOISTAREAPERSONSIGNS;
                certEntity.safetys = entity.safetys;
            }
            if (auditEntity != null)
            {
                //把当前业务流程节点赋值到审核记录中
                auditEntity.FLOWID = certEntity.FLOWID;
            }
            string moduleName = "(起重吊装准吊证)审核";

            mpcEntity = peopleReviwservice.CheckAuditForNextByOutsourcing(currUser, moduleName, certEntity.CONSTRUCTIONUNITID, certEntity.FLOWID, false, true);
            if (auditEntity != null && auditEntity.AUDITSTATE == 0)
            {
                certEntity.AUDITSTATE   = 0;
                certEntity.FLOWID       = string.Empty;
                certEntity.FLOWNAME     = currUser.UserName + "审核/批不同意";
                certEntity.FLOWDEPTID   = currUser.DeptId;
                certEntity.FLOWDEPTNAME = currUser.DeptName;
                certEntity.FLOWROLEID   = currUser.RoleId;
                certEntity.FLOWROLENAME = currUser.RoleName;
            }
            else
            {
                if (mpcEntity != null)
                {
                    certEntity.AUDITSTATE   = 1;
                    certEntity.FLOWID       = mpcEntity.ID;
                    certEntity.FLOWNAME     = mpcEntity.FLOWNAME;
                    certEntity.FLOWDEPTID   = mpcEntity.CHECKDEPTID;
                    certEntity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                    certEntity.FLOWROLEID   = mpcEntity.CHECKROLEID;
                    certEntity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                }
                else
                {
                    certEntity.AUDITSTATE = 2;
                    certEntity.FLOWNAME   = "已完结";
                }
            }
            //处理实体,更新到数据库
            service.ApplyCheck(certEntity, auditEntity);
        }