Beispiel #1
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void RemoveForm(string keyValue)
        {
            //开始事务
            var res = DbFactory.Base().BeginTrans();

            try
            {
                TechDisclosureEntity se = this.BaseRepository().FindEntity(keyValue);
                this.BaseRepository().Delete(keyValue);
                string    sql = string.Format(@"select t.id from EPG_TechDisclosure t where t.ProjectID='{0}' and t.status=3", se.PROJECTID);
                DataTable dt  = this.BaseRepository().FindTable(sql);
                if (dt == null || dt.Rows.Count <= 0)
                {
                    #region 更新工程流程状态
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", se.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.TECHNICALSTATUS = "0";
                    res.Update <StartappprocessstatusEntity>(startProecss);
                    res.Commit();
                    #endregion
                }
            }
            catch (System.Exception)
            {
                res.Rollback();
            }
        }
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, StartappprocessstatusEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, ProtocolEntity entity)
        {
            entity.ID = keyValue;
            //开始事务
            var res = DbFactory.Base().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    ProtocolEntity se = this.BaseRepository().FindEntity(keyValue);
                    if (se == null)
                    {
                        entity.Create();
                        res.Insert <ProtocolEntity>(entity);
                        //res.Commit();
                    }
                    else
                    {
                        entity.Modify(keyValue);
                        res.Update <ProtocolEntity>(entity);
                    }
                    #region 更新工程流程状态
                    //Repository<CompactEntity> repCompactEntity = new Repository<CompactEntity>(DbFactory.Base());
                    //List<CompactEntity> CompactList = repCompactEntity.FindList(string.Format("select * from EPG_Compact t where t.ProjectID='{0}'", entity.PROJECTID)).ToList();
                    //if (CompactList.Count > 0) {
                    //    CompactEntity Compact = CompactList.FirstOrDefault();
                    //    if (!string.IsNullOrEmpty(Compact.ID))
                    //    {

                    //    }
                    //}
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.PACTSTATUS = "1";
                    res.Update <StartappprocessstatusEntity>(startProecss);
                    res.Commit();
                    #endregion
                }
                else
                {
                    entity.Create();
                    res.Insert <ProtocolEntity>(entity);
                    res.Commit();
                }
            }
            catch (System.Exception)
            {
                res.Rollback();
                throw;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, SchemeMeasureEntity entity)
        {
            entity.ID = keyValue;
            //开始事务
            var res = DbFactory.Base().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    SchemeMeasureEntity se = this.BaseRepository().FindEntity(keyValue);
                    if (se == null)
                    {
                        entity.Create();
                        res.Insert <SchemeMeasureEntity>(entity);
                    }
                    else
                    {
                        entity.Modify(keyValue);
                        res.Update <SchemeMeasureEntity>(entity);
                    }
                }
                else
                {
                    entity.Create();
                    res.Insert <SchemeMeasureEntity>(entity);
                }

                #region 更新工程流程状态
                //完成状态下更新
                if (entity.ISOVER == "1" && entity.PROJECTID != "" && entity.PROJECTID != null)
                {
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.THREETWOSTATUS = "1";
                    res.Update <StartappprocessstatusEntity>(startProecss);
                }
                #endregion
                res.Commit();
            }
            catch (System.Exception)
            {
                res.Rollback();
            }
        }
Beispiel #5
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, CompactEntity entity)
        {
            entity.ID = keyValue;

            int count = 0;
            //开始事务
            var res = DbFactory.Base().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    CompactEntity se = this.BaseRepository().FindEntity(keyValue);
                    if (se == null)
                    {
                        entity.Create();
                        count = res.Insert <CompactEntity>(entity);
                        //res.Commit();
                    }
                    else
                    {
                        entity.Modify(keyValue);
                        count = res.Update <CompactEntity>(entity);
                    }
                    #region 更新工程流程状态
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.COMPACTSTATUS = "1";
                    res.Update <StartappprocessstatusEntity>(startProecss);
                    res.Commit();
                    #endregion
                }
                else
                {
                    entity.Create();
                    count = res.Insert <CompactEntity>(entity);
                    res.Commit();
                }
            }
            catch (System.Exception)
            {
                res.Rollback();
            }
        }
Beispiel #6
0
        /// <summary>
        /// 审核表单
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        /// <param name="aentity"></param>
        public void ApporveForm(string keyValue, TechDisclosureEntity entity, AptitudeinvestigateauditEntity aentity)
        {
            Operator curUser  = ERCHTMS.Code.OperatorProvider.Provider.Current();
            var      smEntity = GetEntity(keyValue);

            try
            {
                string state      = string.Empty;
                string moduleName = "";
                if (string.IsNullOrWhiteSpace(smEntity.PROJECTID))
                {
                    moduleName = "安全技术交底(手输工程)";
                    if (smEntity.ENGINEERLEVEL == "001")
                    {
                        moduleName += "_一级风险";
                    }
                    else if (smEntity.ENGINEERLEVEL == "002")
                    {
                        moduleName += "_二级风险";
                    }
                    else if (smEntity.ENGINEERLEVEL == "003")
                    {
                        moduleName += "_三级风险";
                    }
                }
                else
                {
                    moduleName = "安全技术交底(选择工程)";
                    if (smEntity.ENGINEERLEVEL == "001")
                    {
                        moduleName += "_一级风险";
                    }
                    else if (smEntity.ENGINEERLEVEL == "002")
                    {
                        moduleName += "_二级风险";
                    }
                    else if (smEntity.ENGINEERLEVEL == "003")
                    {
                        moduleName += "_三级风险";
                    }
                }

                string outengineerid           = smEntity.PROJECTID;
                ManyPowerCheckEntity mpcEntity = peoplereviewservice.CheckAuditPower(curUser, out state, moduleName, outengineerid, false, smEntity.FLOWID);


                #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        = smEntity.FLOWID;
                aentity.AUDITSIGNIMG    = HttpUtility.UrlDecode(aentity.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";
                }
                aptitudeinvestigateauditservice.SaveForm(aidEntity.ID, aidEntity);
                #endregion

                #region  //保存安全技术交底

                //审核通过
                if (aentity.AUDITRESULT == "0")
                {
                    //0表示流程未完成,1表示流程结束
                    if (null != mpcEntity)
                    {
                        smEntity.STATUS = 1;
                        smEntity.FLOWID = mpcEntity.ID;
                    }
                    else
                    {
                        smEntity.STATUS = 3;
                        smEntity.FLOWID = "";
                    }
                }
                else //审核不通过
                {
                    smEntity.ISSUBMIT = 0;
                    smEntity.STATUS   = 0;
                    smEntity.FLOWID   = "";
                }

                #endregion

                #region    //审核不通过
                if (aentity.AUDITRESULT == "1")
                {
                    //添加历史记录
                    HistoryTechDisclosureEntity hsentity = new HistoryTechDisclosureEntity();
                    hsentity       = JsonConvert.DeserializeObject <HistoryTechDisclosureEntity>(JsonConvert.SerializeObject(smEntity));
                    hsentity.ID    = "";
                    hsentity.RecId = smEntity.ID;
                    historytechdisclosureservice.SaveForm(hsentity.ID, hsentity);

                    //获取当前业务对象的所有审核记录
                    var shlist = aptitudeinvestigateauditservice.GetAuditList(keyValue);
                    //批量更新审核记录关联ID
                    foreach (AptitudeinvestigateauditEntity mode in shlist)
                    {
                        mode.APTITUDEID = hsentity.ID; //对应新的ID
                        aptitudeinvestigateauditservice.SaveForm(mode.ID, mode);
                    }
                    //批量更新附件记录关联ID
                    var flist = fileinfoservice.GetImageListByObject(keyValue);
                    foreach (FileInfoEntity fmode in flist)
                    {
                        fmode.RecId = hsentity.ID; //对应新的ID
                        fileinfoservice.SaveForm("", fmode);
                    }
                }
                #endregion
                //更新安全技术交底基本状态信息
                smEntity.Modify(keyValue);
                this.BaseRepository().Update(smEntity);
                #region 更新工程流程状态
                if (smEntity.STATUS == 3 && smEntity.PROJECTID != "" && smEntity.PROJECTID != null)
                {
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", smEntity.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.TECHNICALSTATUS = "1";
                    var res = DbFactory.Base().BeginTrans();
                    res.Update <StartappprocessstatusEntity>(startProecss);
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TechDisclosureEntity entity)
        {
            entity.ID = keyValue;
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();
            //开始事务
            var res = DbFactory.Base().BeginTrans();

            try
            {
                //处理手机端交底名称
                if (string.IsNullOrWhiteSpace(entity.DISCLOSURENAME))
                {
                    DataTable dt  = GetNameByPorjectId(entity.PROJECTID, entity.DISCLOSURETYPE);
                    var       num = dt.Rows.Count;
                    var       no  = string.Empty;
                    switch (num.ToString().Length)
                    {
                    case 1:
                        no = "00" + (num + 1);
                        break;

                    case 2:
                        no = "0" + (num + 1);
                        break;

                    case 3:
                        no = (num + 1).ToString();
                        break;

                    default:
                        break;
                    }
                    //entity.DISCLOSURENAME = new OutsouringengineerService().GetEntity(entity.PROJECTID).ENGINEERNAME + entity.DISCLOSURETYPE + DateTime.Now.ToString("yyyyMMdd") + no;
                    entity.DISCLOSURENAME = entity.ENGINEERNAME + entity.DISCLOSURETYPE + DateTime.Now.ToString("yyyyMMdd") + no;
                }
                if (entity.ISSUBMIT == 0)
                {
                    entity.STATUS = 0;
                }
                else
                {
                    string modulename = "";
                    if (string.IsNullOrWhiteSpace(entity.PROJECTID))
                    {
                        modulename = "安全技术交底(手输工程)";
                        if (entity.ENGINEERLEVEL == "001")
                        {
                            modulename += "_一级风险";
                        }
                        else if (entity.ENGINEERLEVEL == "002")
                        {
                            modulename += "_二级风险";
                        }
                        else if (entity.ENGINEERLEVEL == "003")
                        {
                            modulename += "_三级风险";
                        }
                    }
                    else
                    {
                        modulename = "安全技术交底(选择工程)";
                        if (entity.ENGINEERLEVEL == "001")
                        {
                            modulename += "_一级风险";
                        }
                        else if (entity.ENGINEERLEVEL == "002")
                        {
                            modulename += "_二级风险";
                        }
                        else if (entity.ENGINEERLEVEL == "003")
                        {
                            modulename += "_三级风险";
                        }
                    }
                    string state = string.Empty;
                    ManyPowerCheckEntity mpcEntity = peoplereviewservice.CheckAuditPower(curUser, out state, modulename, entity.PROJECTID, false);
                    if (mpcEntity == null)
                    {
                        entity.STATUS = 3;
                    }
                    else
                    {
                        entity.STATUS = 1;
                        entity.FLOWID = mpcEntity.ID;
                    }
                }
                entity.DISCLOSUREMAJORNAME = null;
                entity.ENGINEERLEVELNAME   = null;
                entity.ENGINEERTYPENAME    = null;
                if (!string.IsNullOrEmpty(keyValue))
                {
                    TechDisclosureEntity se = this.BaseRepository().FindEntity(keyValue);
                    if (se == null)
                    {
                        entity.Create();
                        res.Insert <TechDisclosureEntity>(entity);
                    }
                    else
                    {
                        entity.Modify(keyValue);
                        res.Update <TechDisclosureEntity>(entity);
                    }
                }
                else
                {
                    entity.Create();
                    res.Insert <TechDisclosureEntity>(entity);
                }
                #region 更新工程流程状态
                if (entity.STATUS == 3 && entity.PROJECTID != "" && entity.PROJECTID != null)
                {
                    Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                    StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.PROJECTID)).ToList().FirstOrDefault();
                    startProecss.TECHNICALSTATUS = "1";
                    res.Update <StartappprocessstatusEntity>(startProecss);
                }
                #endregion
                res.Commit();
            }
            catch (System.Exception)
            {
                res.Rollback();
            }
        }
Beispiel #8
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, string type, ToolsEntity entity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();
            var      res     = DbFactory.Base().BeginTrans();

            try
            {
                List <ProjecttoolsEntity> list   = ProjecttoolsService.GetList(" and TOOLSID='" + keyValue + "'").ToList();
                List <string>             zylist = new List <string>();
                string zystr = "";
                foreach (var item in list.Select(t => t.TOOLTYPE).ToArray().Distinct().ToList())
                {
                    zylist = zylist.AsEnumerable().Union(DataItemDetailService.GetDataItemByDetailValue("ToolEquipmentType", item).FirstOrDefault().Description.Split(',')).ToList();
                }
                zystr = string.Join(",", zylist.Distinct().ToList());
                entity.SpecialtyType = zystr;
                #region 保存
                if (type == "1")          //保存
                {
                    entity.ISSAVED = "0"; //标记当前记录处于登记阶段
                    entity.ISOVER  = "0"; //流程未完成,1表示完成
                    entity.TOOLSID = keyValue;
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        ToolsEntity se = this.BaseRepository().FindEntity(keyValue);
                        if (se == null)
                        {
                            entity.Create();
                            res.Insert <ToolsEntity>(entity);
                        }
                        else
                        {
                            entity.Modify(keyValue);
                            res.Update <ToolsEntity>(entity);
                        }
                    }
                    else
                    {
                        entity.Create();
                        res.Insert <ToolsEntity>(entity);
                    }
                }
                #endregion
                #region 提交
                if (type == "2")//提交
                {
                    string state         = string.Empty;
                    string moduleName    = entity.EQUIPTYPE == "2" ? "特种设备工器具" : "设备工器具";
                    string outengineerid = entity.OUTENGINEERID;
                    Repository <OutsouringengineerEntity> ourEngineer = new Repository <OutsouringengineerEntity>(DbFactory.Base());
                    OutsouringengineerEntity engineerEntity           = ourEngineer.FindEntity(entity.OUTENGINEERID);
                    //currUser:当前登录人,state:是否有权限审核 1:能审核 0 :不能审核,moduleName:模块名称,outengineerid:工程Id
                    ManyPowerCheckEntity mpcEntity = peopleReview.CheckAuditPower(curUser, out state, moduleName, outengineerid, false);
                    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.FLOWNAME;
                    }
                    else  //为空则表示已经完成流程
                    {
                        entity.FLOWDEPT     = "";
                        entity.FLOWDEPTNAME = "";
                        entity.FLOWROLE     = "";
                        entity.FLOWROLENAME = "";
                        entity.ISSAVED      = "1"; //标记已经从登记到审核阶段
                        entity.ISOVER       = "1"; //流程未完成,1表示完成
                        entity.FLOWNAME     = "";
                        entity.FlowId       = "";
                        #region 更新工程流程状态
                        Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                        StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.OUTENGINEERID)).ToList().FirstOrDefault();
                        startProecss.EQUIPMENTTOOLSTATUS = "1";
                        res.Update <StartappprocessstatusEntity>(startProecss);
                        #endregion
                        #region  步设备
                        if (entity.EQUIPTYPE == "2")
                        {
                            new SpecialEquipmentService().SyncSpecificTools(entity.OUTENGINEERID, entity.OUTPROJECTID, entity.TOOLSID);
                        }
                        #endregion
                    }
                    entity.TOOLSID = keyValue;
                    if (!string.IsNullOrEmpty(keyValue))
                    {
                        ToolsEntity se = this.BaseRepository().FindEntity(keyValue);
                        if (se == null)
                        {
                            entity.Create();
                            res.Insert <ToolsEntity>(entity);
                        }
                        else
                        {
                            entity.Modify(keyValue);
                            res.Update <ToolsEntity>(entity);
                        }
                    }
                    else
                    {
                        entity.Create();
                        res.Insert <ToolsEntity>(entity);
                    }
                }
                #endregion
                res.Commit();
            }
            catch (Exception ex)
            {
                res.Rollback();
                throw ex;
            }
        }
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, string state, string auditid, SafetyEamestMoneyEntity entity, List <SafetyMoneyExamineEntity> list)
        {
            var res = DbFactory.Base().BeginTrans();

            try
            {
                Operator currUser = OperatorProvider.Provider.Current();
                entity.ID     = keyValue;
                entity.ISSEND = state;
                if (!string.IsNullOrEmpty(keyValue))
                {
                    SafetyEamestMoneyEntity se = this.BaseRepository().FindEntity(keyValue);
                    if (se == null)
                    {
                        entity.Create();
                        res.Insert <SafetyEamestMoneyEntity>(entity);
                    }
                    else
                    {
                        entity.Modify(keyValue);
                        res.Update <SafetyEamestMoneyEntity>(entity);
                    }
                }
                else
                {
                    entity.Create();
                    res.Insert <SafetyEamestMoneyEntity>(entity);
                }
                //1发送审核,0保存
                if (state == "1")
                {
                    Repository <OutsouringengineerEntity> repEng = new Repository <OutsouringengineerEntity>(DbFactory.Base());
                    OutsouringengineerEntity outeng = repEng.FindEntity(entity.PROJECTID);
                    var sendDeptid = outeng.ENGINEERLETDEPTID;

                    if (currUser.RoleName.Contains("公司级用户") || currUser.RoleName.Contains("厂级部门用户") ||
                        (sendDeptid == currUser.DeptId && currUser.RoleName.Contains("负责人")) ||
                        (sendDeptid == currUser.DeptId && currUser.RoleName.Contains("安全管理员")) || (sendDeptid == currUser.DeptId && currUser.RoleName.Contains("专工")))
                    {
                        AptitudeinvestigateauditEntity e = new AptitudeinvestigateauditEntity();
                        if (!string.IsNullOrEmpty(auditid))
                        {
                            e               = Aptitudeinvestigateaudit.GetEntity(auditid);
                            e.AUDITDEPT     = currUser.DeptId;
                            e.AUDITDEPT     = currUser.DeptName;
                            e.AUDITPEOPLE   = currUser.UserName;
                            e.AUDITPEOPLEID = currUser.UserId;
                            e.AUDITRESULT   = "0";
                        }
                        else
                        {
                            e.AUDITRESULT   = "0";
                            e.AUDITDEPT     = currUser.DeptId;
                            e.AUDITDEPT     = currUser.DeptName;
                            e.AUDITPEOPLE   = currUser.UserName;
                            e.AUDITPEOPLEID = currUser.UserId;
                            e.APTITUDEID    = entity.ID;
                            //Aptitudeinvestigateaudit.SaveForm(auditid, e);
                        }
                        Aptitudeinvestigateaudit.SaveForm(auditid, e);
                        Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                        StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", entity.PROJECTID)).ToList().FirstOrDefault();
                        startProecss.SECURITYSTATUS = "1";

                        startprocess.SaveForm(startProecss.ID, startProecss);
                    }
                    else
                    {
                        AptitudeinvestigateauditEntity e = new AptitudeinvestigateauditEntity();
                        if (!string.IsNullOrEmpty(auditid))
                        {
                            e               = Aptitudeinvestigateaudit.GetEntity(auditid);
                            e.AUDITDEPT     = currUser.DeptId;
                            e.AUDITDEPT     = currUser.DeptName;
                            e.AUDITPEOPLE   = currUser.UserName;
                            e.AUDITPEOPLEID = currUser.UserId;
                            e.AUDITRESULT   = "2";
                            Aptitudeinvestigateaudit.SaveForm(auditid, e);
                        }
                        else
                        {
                            e.AUDITRESULT   = "2";
                            e.AUDITDEPT     = currUser.DeptId;
                            e.AUDITDEPT     = currUser.DeptName;
                            e.AUDITPEOPLE   = currUser.UserName;
                            e.AUDITPEOPLEID = currUser.UserId;
                            e.APTITUDEID    = entity.ID;
                            Aptitudeinvestigateaudit.SaveForm(auditid, e);
                        }
                    }
                }
                //string sql = string.Format("delete epg_safetymoneyexamine t where t.safetymoneyid='{0}'", keyValue);
                //res.ExecuteBySql(sql);
                if (list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        list[i].Create();
                        list[i].ExamineDept     = currUser.DeptName;
                        list[i].ExamineDeptId   = currUser.DeptId;
                        list[i].ExamineToDept   = entity.DEPTNAME;
                        list[i].ExamineToDeptId = entity.DEPTID;
                    }
                    res.Insert <SafetyMoneyExamineEntity>(list);
                }
                res.Commit();
            }
            catch (System.Exception)
            {
                res.Rollback();
            }
        }
Beispiel #10
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <param name="moduleName">模块名称(值:设备工器具、特种设备工器具)</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, ToolsAuditEntity entity, string moduleName)
        {
            var      res     = DbFactory.Base().BeginTrans();
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            try
            {
                string state = string.Empty;

                string outengineerid = keyValue;


                #region  保存工器具
                Repository <ToolsEntity> repAudit = new Repository <ToolsEntity>(DbFactory.Base());
                ToolsEntity smEntity = repAudit.FindEntity(entity.TOOLSID);

                #region //审核信息表
                ToolsAuditEntity aidEntity = new ToolsAuditEntity();
                aidEntity.AUDITID       = Guid.NewGuid().ToString();
                aidEntity.AUDITRESULT   = entity.AUDITRESULT;   //通过
                aidEntity.AUDITTIME     = DateTime.Now;         //审核时间
                aidEntity.AUDITPEOPLE   = entity.AUDITPEOPLE;   //审核人员姓名
                aidEntity.AUDITPEOPLEID = entity.AUDITPEOPLEID; //审核人员id
                aidEntity.TOOLSID       = smEntity.TOOLSID;     //关联的业务ID
                aidEntity.AUDITDEPTID   = entity.AUDITDEPTID;   //审核部门id
                aidEntity.AUDITDEPT     = entity.AUDITDEPT;     //审核部门
                aidEntity.AUDITOPINION  = entity.AUDITOPINION;  //审核意见
                aidEntity.AUDITFILE     = entity.AUDITFILE;     //审核附件
                aidEntity.REMARK        = entity.REMARK;        //备注
                aidEntity.FlowId        = entity.FlowId;
                SaveFormToolAudit("", aidEntity);
                #endregion
                Boolean IsNextFlow = true; //判断是否走下一步流程; 当安全专工跟电气专工验收工器具时没有验收完所有工器具时会继续到专工验收
                Boolean IsPass     = true; //判断是否所有工器具都没有验收通过  false 为所有工器具都没有验收通过
                #region   审核通过
                if (entity.AUDITRESULT == "0")
                {
                    ManyPowerCheckEntity powerentity = new ManyPowerCheckService().GetEntity(entity.FlowId);
                    if (powerentity.FLOWNAME.Contains("验收"))
                    {
                        List <ProjecttoolsEntity> toollist = projecttoolsservice.GetList(" and toolsid ='" + smEntity.TOOLSID + "'").ToList();
                        if (toollist.Where(t => t.Status == null).Count() > 0) //判断是否有没有验收的数据
                        {
                            IsNextFlow = false;
                        }
                        else
                        {
                            if (toollist.Where(t => t.Status == "1").Count() == toollist.Count()) //判断验收不通过的数量是否等于工器具数量
                            {
                                IsPass = false;
                            }
                        }
                    }
                    if (IsNextFlow && IsPass)
                    {
                        ManyPowerCheckEntity mpcEntity = peopleReview.CheckAuditPower(curUser, out state, moduleName, outengineerid, false, entity.FlowId);
                        //0表示流程未完成,1表示流程结束
                        if (null != mpcEntity)
                        {
                            smEntity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                            smEntity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                            smEntity.FLOWROLE     = mpcEntity.CHECKROLEID;
                            smEntity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                            smEntity.ISSAVED      = "1";
                            smEntity.ISOVER       = "0";
                            smEntity.FlowId       = mpcEntity.ID;
                            smEntity.FLOWNAME     = mpcEntity.CHECKDEPTNAME + "审核中";
                        }
                        else
                        {
                            smEntity.FLOWDEPT     = "";
                            smEntity.FLOWDEPTNAME = "";
                            smEntity.FLOWROLE     = "";
                            smEntity.FLOWROLENAME = "";
                            smEntity.ISSAVED      = "1";
                            smEntity.ISOVER       = "1";
                            smEntity.FLOWNAME     = "";
                            #region 更新工程流程状态
                            Repository <StartappprocessstatusEntity> proecss = new Repository <StartappprocessstatusEntity>(DbFactory.Base());
                            StartappprocessstatusEntity startProecss         = proecss.FindList(string.Format("select * from epg_startappprocessstatus t where t.outengineerid='{0}'", smEntity.OUTENGINEERID)).ToList().FirstOrDefault();
                            startProecss.EQUIPMENTTOOLSTATUS = "1";
                            res.Update <StartappprocessstatusEntity>(startProecss);
                            #endregion
                            #region  步设备
                            if (moduleName == "特种设备工器具")
                            {
                                new SpecialEquipmentService().SyncSpecificTools(smEntity.OUTENGINEERID, smEntity.OUTPROJECTID, smEntity.TOOLSID);
                            }
                            #endregion
                        }
                    }
                }
                #endregion
                #region  审核不通过
                if (entity.AUDITRESULT == "1" || IsPass == false)
                {
                    smEntity.FLOWDEPT     = "";
                    smEntity.FLOWDEPTNAME = "";
                    smEntity.FLOWROLE     = "";
                    smEntity.FLOWROLENAME = "";
                    smEntity.ISSAVED      = "0"; //处于登记阶段
                    smEntity.ISOVER       = "0"; //是否完成状态赋值为未完成
                    smEntity.FLOWNAME     = "";
                    #region 审核不通过保存工器具历史数据
                    var str = JsonConvert.SerializeObject(smEntity);
                    HistoryToolsEntity histools = JsonConvert.DeserializeObject <HistoryToolsEntity>(str);
                    histools.ID      = Guid.NewGuid().ToString();
                    histools.TOOLSID = smEntity.TOOLSID;
                    res.Insert <HistoryToolsEntity>(histools);
                    //施工机具
                    Repository <ProjecttoolsEntity> protools      = new Repository <ProjecttoolsEntity>(DbFactory.Base());
                    List <ProjecttoolsEntity>       protools_list = protools.FindList(string.Format(@"select * from epg_projecttools t where t.toolsid='{0}'", smEntity.TOOLSID)).ToList();
                    res.ExecuteBySql(string.Format("update epg_projecttools set Status='',CHECKOPTION=''  where toolsid='{0}'", smEntity.TOOLSID));
                    if (protools_list.Count > 0)
                    {
                        var str_protools = JsonConvert.SerializeObject(protools_list);
                        List <HistoryProtoolsEntity> hisprolist = JsonConvert.DeserializeObject <List <HistoryProtoolsEntity> >(str_protools);
                        for (int i = 0; i < hisprolist.Count; i++)
                        {
                            hisprolist[i].ID = Guid.NewGuid().ToString();
                            //同步附件
                            var file1 = fileService.GetFiles(protools_list[i].PROJECTTOOLSID);
                            if (file1.Rows.Count > 0)
                            {
                                var key = hisprolist[i].ID;
                                foreach (DataRow item in file1.Rows)
                                {
                                    FileInfoEntity itemFile = new FileInfoEntity();
                                    itemFile.FileName = item["FileName"].ToString();
                                    itemFile.FilePath = item["filepath"].ToString();
                                    itemFile.FileSize = item["filesize"].ToString();
                                    itemFile.RecId    = key;
                                    fileService.SaveForm(itemFile.FileId, itemFile);
                                }
                            }
                            hisprolist[i].TOOLSID = histools.ID;
                        }
                        res.Insert <HistoryProtoolsEntity>(hisprolist);
                    }
                    //特种设备
                    Repository <SpecificToolsEntity> spetools      = new Repository <SpecificToolsEntity>(DbFactory.Base());
                    List <SpecificToolsEntity>       spetools_list = spetools.FindList(string.Format(@"select * from epg_specifictools t where t.toolsid='{0}'", smEntity.TOOLSID)).ToList();
                    if (spetools_list.Count > 0)
                    {
                        var str_spetools = JsonConvert.SerializeObject(spetools_list);
                        List <HistorySpecificToolsEntity> hisspelist = JsonConvert.DeserializeObject <List <HistorySpecificToolsEntity> >(str_spetools);
                        for (int i = 0; i < hisspelist.Count; i++)
                        {
                            hisspelist[i].SPECIFICTOOLSID = Guid.NewGuid().ToString();
                            hisspelist[i].TOOLSID         = histools.ID;
                            //同步附件
                            var file1 = fileService.GetFiles(spetools_list[i].REGISTERCARDFILE);
                            var file2 = fileService.GetFiles(spetools_list[i].QUALIFIED);
                            var file3 = fileService.GetFiles(spetools_list[i].CHECKREPORTFILE);
                            var file4 = fileService.GetFiles(spetools_list[i].SPECIFICTOOLSFILE);
                            if (file1.Rows.Count > 0)
                            {
                                hisspelist[i].REGISTERCARDFILE = Guid.NewGuid().ToString();
                                var key = hisspelist[i].REGISTERCARDFILE;
                                foreach (DataRow item in file1.Rows)
                                {
                                    FileInfoEntity itemFile = new FileInfoEntity();
                                    itemFile.FileName = item["FileName"].ToString();
                                    itemFile.FilePath = item["filepath"].ToString();
                                    itemFile.FileSize = item["filesize"].ToString();
                                    itemFile.RecId    = key;
                                    fileService.SaveForm(itemFile.FileId, itemFile);
                                }
                            }
                            if (file2.Rows.Count > 0)
                            {
                                hisspelist[i].QUALIFIED = Guid.NewGuid().ToString();
                                var key = hisspelist[i].QUALIFIED;
                                foreach (DataRow item in file2.Rows)
                                {
                                    FileInfoEntity itemFile = new FileInfoEntity();
                                    itemFile.FileName = item["FileName"].ToString();
                                    itemFile.FilePath = item["filepath"].ToString();
                                    itemFile.FileSize = item["filesize"].ToString();
                                    itemFile.RecId    = key;
                                    fileService.SaveForm(itemFile.FileId, itemFile);
                                }
                            }
                            if (file3.Rows.Count > 0)
                            {
                                hisspelist[i].CHECKREPORTFILE = Guid.NewGuid().ToString();
                                var key = hisspelist[i].CHECKREPORTFILE;
                                foreach (DataRow item in file3.Rows)
                                {
                                    FileInfoEntity itemFile = new FileInfoEntity();
                                    itemFile.FileName = item["FileName"].ToString();
                                    itemFile.FilePath = item["filepath"].ToString();
                                    itemFile.FileSize = item["filesize"].ToString();
                                    itemFile.RecId    = key;
                                    fileService.SaveForm(itemFile.FileId, itemFile);
                                }
                            }
                            if (file4.Rows.Count > 0)
                            {
                                hisspelist[i].SPECIFICTOOLSFILE = Guid.NewGuid().ToString();
                                var key = hisspelist[i].SPECIFICTOOLSFILE;
                                foreach (DataRow item in file4.Rows)
                                {
                                    FileInfoEntity itemFile = new FileInfoEntity();
                                    itemFile.FileName = item["FileName"].ToString();
                                    itemFile.FilePath = item["filepath"].ToString();
                                    itemFile.FileSize = item["filesize"].ToString();
                                    itemFile.RecId    = key;
                                    fileService.SaveForm(itemFile.FileId, itemFile);
                                }
                            }
                        }
                        res.Insert <HistorySpecificToolsEntity>(hisspelist);
                    }
                    //获取当前业务对象的所有审核记录
                    var shlist = GetAuditList(entity.TOOLSID);
                    //批量更新审核记录关联ID
                    foreach (ToolsAuditEntity mode in shlist)
                    {
                        mode.TOOLSID = histools.ID; //对应新的ID
                        //同步附件
                        var file = fileService.GetFiles(mode.AUDITFILE);
                        if (file.Rows.Count > 0)
                        {
                            var key = histools.ID;
                            foreach (DataRow item in file.Rows)
                            {
                                FileInfoEntity itemFile = new FileInfoEntity();
                                itemFile.FileName = item["FileName"].ToString();
                                itemFile.FilePath = item["filepath"].ToString();
                                itemFile.FileSize = item["filesize"].ToString();
                                itemFile.RecId    = key;
                                fileService.SaveForm(itemFile.FileId, itemFile);
                            }
                        }
                        res.Update <ToolsAuditEntity>(mode);
                    }
                    #endregion
                }
                res.Update <ToolsEntity>(smEntity);
                res.Commit();
                #endregion
                #endregion
            }
            catch (Exception ex)
            {
                res.Rollback();
            }
        }
Beispiel #11
0
 public ActionResult SaveForm(string keyValue, StartappprocessstatusEntity entity)
 {
     startappprocessstatusbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }