Exemplo n.º 1
0
        public ActionResult GetFormJson(string keyValue)
        {
            OutsouringengineerBLL engneerBll = new OutsouringengineerBLL();
            var data = workMeetingbll.GetEntity(keyValue);

            if (data == null)
            {
                var loginUser = ERCHTMS.Code.OperatorProvider.Provider.Current();
                OutsouringengineerEntity eEntity = null;
                if (loginUser.isEpiboly == true)
                {
                    eEntity = engneerBll.GetEntity(loginUser.ProjectID);
                }
                data = new WorkMeetingEntity()
                {
                    MEETINGDATE = DateTime.Now
                };
                if (eEntity != null)
                {
                    data.ENGINEERID      = eEntity.ID;
                    data.ENGINEERNAME    = eEntity.ENGINEERNAME;
                    data.ENGINEERLEVEL   = eEntity.ENGINEERLEVEL;
                    data.ENGINEERTYPE    = eEntity.ENGINEERTYPE;
                    data.ENGINEERAREA    = eEntity.ENGINEERAREA;
                    data.ENGINEERLETDEPT = eEntity.ENGINEERLETDEPT;
                    data.ENGINEERCONTENT = eEntity.ENGINEERCONTENT;
                    data.ENGINEERCODE    = eEntity.ENGINEERCODE;
                    data.MEETINGNAME     = string.Format("{0}{1}开工会", DateTime.Now.ToString("yyyyMMdd"), data.ENGINEERNAME);
                }
            }
            var engneer = engneerBll.GetEntity(data.ENGINEERID);

            if (engneer != null)
            {
                data.OUTPROJECTNAME = new DepartmentBLL().GetEntity(engneer.OUTPROJECTID).FullName;
            }

            return(ToJsonResult(data));
        }
Exemplo n.º 2
0
        public ActionResult SubmitForm(string keyValue, SafetyCollectEntity entity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            string state = string.Empty;

            string flowid = string.Empty;

            string moduleName = "竣工安全验收";

            // <param name="state">是否有权限审核 1:能审核 0 :不能审核</param>
            ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, curUser.DeptId);

            //新增时会根据角色自动审核
            List <ManyPowerCheckEntity> powerList  = new ManyPowerCheckBLL().GetListBySerialNum(curUser.OrganizeCode, "竣工安全验收");
            List <ManyPowerCheckEntity> checkPower = new List <ManyPowerCheckEntity>();
            var outsouringengineer = outsouringengineerbll.GetEntity(entity.EngineerId);

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

                for (int i = 0; i < powerList.Count; i++)
                {
                    if (check.ID == powerList[i].ID)
                    {
                        flowid = powerList[i].ID;
                    }
                }
            }
            else
            {
                state     = "0";
                mpcEntity = powerList.First();
            }
            if (null != mpcEntity)
            {
                entity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                entity.FLOWROLE     = mpcEntity.CHECKROLEID;
                entity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                entity.ISSAVED      = "1"; //标记已经从登记到审核阶段
                entity.ISOVER       = "0"; //流程未完成,1表示完成
                //entity.FLOWNAME = entity.FLOWDEPTNAME + "审核中";
                if (mpcEntity.CHECKDEPTNAME == "执行部门" && mpcEntity.CHECKROLENAME == "负责人")
                {
                    entity.FLOWNAME = outsouringengineer.ENGINEERLETDEPT + "审批中";
                }
                else
                {
                    entity.FLOWNAME = mpcEntity.CHECKDEPTNAME + "审批中";
                }
                entity.FlowId = mpcEntity.ID;
            }
            else  //为空则表示已经完成流程
            {
                entity.FLOWDEPT     = "";
                entity.FLOWDEPTNAME = "";
                entity.FLOWROLE     = "";
                entity.FLOWROLENAME = "";
                entity.ISSAVED      = "1"; //标记已经从登记到审核阶段
                entity.ISOVER       = "1"; //流程未完成,1表示完成
                entity.FLOWNAME     = "";
                entity.FlowId       = flowid;
            }
            SafetyCollectbll.SaveForm(keyValue, entity);

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

                    //aidEntity.FlowId = mpcEntity.ID;
                }
                else
                {
                    aidEntity.REMARK = "7";
                }
                aidEntity.FlowId      = flowid;
                aidEntity.AUDITDEPTID = curUser.DeptId;
                aidEntity.AUDITDEPT   = curUser.DeptName;

                aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
            }

            return(Success("操作成功!"));
        }
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            try
            {
                var watch = CommonHelper.TimerStart();
                pagination.p_kid = "t.id";
                pagination.p_fields = @"t.outengineerid,e.engineername,e.engineerareaname as districtname,d.itemname engineertype,l.itemname engineerlevel,
                                       e.id eid,t.issaveorcommit,t.nextcheckrolename,
                                       p.outprojectid,t.isauditover,t.nextcheckdeptid,e.engineerarea,
                                       p.outsourcingname,e.engineerstate,
                                       t.createusername,
                                       t.createdate,t.createuserorgcode,t.flowid,
                                       t.createuserid,e.engineerletdept,e.engineerletdeptid,'' as approveuserids ";
                pagination.p_tablename = @" epg_aptitudeinvestigateinfo t
                                          left join epg_outsouringengineer e on e.id = t.outengineerid
                                          left join epg_outsourcingproject p on p.outprojectid = t.outprojectid
                                           left join base_department b on b.departmentid = t.outprojectid 
                                            left join ( select m.itemname,m.itemvalue from base_dataitem t
                                          left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='ProjectType') d on d.itemvalue=e.engineertype
                                          left join ( select m.itemname,m.itemvalue from base_dataitem t
                                          left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='ProjectLevel') l on l.itemvalue=e.engineerlevel
                                          left join ( select m.itemname,m.itemvalue from base_dataitem t
                                          left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='OutProjectState') s on s.itemvalue=e.engineerstate";
                pagination.sidx = "t.createdate";//排序字段
                pagination.sord = "desc";//排序方式
                Operator currUser = OperatorProvider.Provider.Current();
                string allrangedept = "";
                try
                {
                    allrangedept = dataitemdetailbll.GetDataItemByDetailCode("SBDept", "SBDeptId").FirstOrDefault().ItemValue;
                }
                catch (Exception)
                {

                }
                if (currUser.IsSystem)
                {
                    pagination.conditionJson = "  1=1 ";
                }
                else if (currUser.RoleName.Contains("省级"))
                {
                    pagination.conditionJson = string.Format(@" t.createuserorgcode  in (select encode from BASE_DEPARTMENT d
                        where d.deptcode like '{0}%' and d.nature = '厂级' and d.description is null)", currUser.NewDeptCode);
                }
                else if (currUser.RoleName.Contains("厂级部门用户") || currUser.RoleName.Contains("公司级用户") || allrangedept.Contains(currUser.DeptId))
                {
                    pagination.conditionJson = string.Format(" (t.issaveorcommit='1' or t.createuserid='{0}') ", currUser.UserId);
                }
                else if (currUser.RoleName.Contains("承包商级用户"))
                {
                    pagination.conditionJson = string.Format(" ( e.outprojectid ='{0}' or e.supervisorid='{0}' or t.createuserid='{1}') ", currUser.DeptId, currUser.UserId);
                }
                else
                {
                    var deptentity = departmentbll.GetEntity(currUser.DeptId);
                    while (deptentity.Nature == "班组" || deptentity.Nature == "专业")
                    {
                        deptentity = departmentbll.GetEntity(deptentity.ParentId);
                    }
                    pagination.conditionJson = string.Format(" (e.engineerletdeptid in (select departmentid from base_department where encode like '{0}%') and t.issaveorcommit='1' or t.createuserid='{1}') ", deptentity.EnCode, currUser.UserId);
                }
                //pagination.conditionJson += string.Format(" or t.createuserid='{0}' ", currUser.UserId);
                var data = aptitudeinvestigateinfobll.GetPageList(pagination, queryJson);
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    var engineerEntity = Outsouringengineernll.GetEntity(data.Rows[i]["outengineerid"].ToString());
                    var excutdept = departmentbll.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                    var outengineerdept = departmentbll.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                    var supervisordept = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentbll.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                    //获取下一步审核人
                    string str = manypowercheckbll.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["outengineerid"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString());
                    data.Rows[i]["approveuserids"] = str;
                }
                var jsonData = new
                {
                    rows = data,
                    total = pagination.total,
                    page = pagination.page,
                    records = pagination.records,
                    costtime = CommonHelper.TimerEnd(watch)
                };
                return ToJsonResult(jsonData);
            }
            catch (System.Exception ex)
            {
                return Error(ex.ToString());
            }

        }
Exemplo n.º 4
0
        public ActionResult GetIntromissionList(Pagination pagination, string queryJson)
        {
            pagination.p_kid       = "a.id";
            pagination.p_fields    = @"a.createuserid,a.createdate, a.applypeople,a.applytime,
                                    a.investigatestate,a.outengineerid,b.engineername,c.fullname,
                                    a.flowdeptname,a.flowdept,a.flowrolename,a.flowrole,a.flowname,a.flowid,
                                     b.engineerareaname as districtname,d.itemname engineertype,l.itemname engineerlevel,b.engineerletdept,b.engineerletdeptid,'' as approveuserids";
            pagination.p_tablename = @" epg_intromission a  
                                      left join epg_outsouringengineer b on a.outengineerid = b.id 
                                      left join base_department c on b.outprojectid=c.departmentid
                                      left join ( select m.itemname,m.itemvalue from base_dataitem t
                                      left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='ProjectType') d on d.itemvalue=b.engineertype
                                      left join ( select m.itemname,m.itemvalue from base_dataitem t
                                      left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='ProjectLevel') l on l.itemvalue=b.engineerlevel
                                      left join ( select m.itemname,m.itemvalue from base_dataitem t
                                      left join base_dataitemdetail m on m.itemid=t.itemid where t.itemcode='OutProjectState') s on s.itemvalue=b.engineerstate ";
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            string   role = user.RoleName;

            string allrangedept = "";

            try
            {
                allrangedept = dataitemdetailbll.GetDataItemByDetailCode("SBDept", "SBDeptId").FirstOrDefault().ItemValue;
            }
            catch (Exception)
            {
            }
            //公用下不显示登记
            pagination.conditionJson = "(( a.investigatestate !='0' and ";

            if (role.Contains("公司级用户") || role.Contains("厂级部门用户") || allrangedept.Contains(user.DeptId))
            {
                pagination.conditionJson += string.Format(" a.createuserorgcode  = '{0}'", user.OrganizeCode);
            }
            else if (role.Contains("承包商级用户"))
            {
                pagination.conditionJson += string.Format("( c.departmentid = '{0}' or b.supervisorid ='{0}')", user.DeptId);
            }
            else
            {
                var deptentity = departmentbll.GetEntity(user.DeptId);
                while (deptentity.Nature == "班组" || deptentity.Nature == "专业")
                {
                    deptentity = departmentbll.GetEntity(deptentity.ParentId);
                }
                pagination.conditionJson += string.Format(" b.engineerletdeptid in (select departmentid from base_department where encode like '{0}%')  ", deptentity.EnCode);

                // pagination.conditionJson += string.Format(" b.engineerletdeptid = '{0}'", user.DeptId);
            }
            pagination.conditionJson += string.Format(" )  or  (a.investigatestate ='0'  and a.createuserid = '{0}'))", user.UserId);


            var watch = CommonHelper.TimerStart();
            var data  = intromissionbll.GetIntromissionPageList(pagination, queryJson);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                var engineerEntity  = Outsouringengineernll.GetEntity(data.Rows[i]["outengineerid"].ToString());
                var excutdept       = departmentbll.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                var outengineerdept = departmentbll.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                var supervisordept  = string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentbll.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                //获取下一步审核人
                string str = manypowercheckbll.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["outengineerid"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["outengineerid"].ToString());
                data.Rows[i]["approveuserids"] = str;
            }

            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Exemplo n.º 5
0
        public object GetDetial([FromBody] JObject json)
        {
            try
            {
                string  res    = json.Value <string>("json");
                dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userid = dy.userid;
                string  id     = dy.data ?? "";
                //获取用户基本信息
                OperatorProvider.AppUserId = userid;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
                }

                var entity = workMeetingbll.GetEntity(id);
                if (entity != null)
                {
                    //外包单位
                    OutsouringengineerBLL engneerBll = new OutsouringengineerBLL();
                    var engneer = engneerBll.GetEntity(entity.ENGINEERID);
                    if (engneer != null)
                    {
                        entity.OUTPROJECTNAME = new DepartmentBLL().GetEntity(engneer.OUTPROJECTID).FullName;
                    }
                    if (!string.IsNullOrWhiteSpace(engneer.OUTPROJECTID))
                    {
                        var dept = deptbll.GetEntity(engneer.OUTPROJECTID);
                        entity.OUTPROJECTCODE = dept.EnCode;
                        entity.OUTPROJECTNAME = dept.FullName;
                    }
                    Dictionary <string, List <Photo> > files = new Dictionary <string, List <Photo> >();
                    //内容1附件
                    DataTable file = fileInfoBLL.GetFiles(entity.ID + "c1");
                    var       pC1  = new List <Photo>();
                    foreach (DataRow dr in file.Rows)
                    {
                        Photo p = new Photo();
                        p.id       = dr["fileid"].ToString();
                        p.filename = dr["filename"].ToString();
                        p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                        pC1.Add(p);
                    }
                    files.Add("c1", pC1);
                    //内容2附件
                    file = fileInfoBLL.GetFiles(entity.ID + "c2");
                    var pC2 = new List <Photo>();
                    foreach (DataRow dr in file.Rows)
                    {
                        Photo p = new Photo();
                        p.id       = dr["fileid"].ToString();
                        p.filename = dr["filename"].ToString();
                        p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                        pC2.Add(p);
                    }
                    files.Add("c2", pC2);
                    //内容3附件
                    file = fileInfoBLL.GetFiles(entity.ID + "c3");
                    var pC3 = new List <Photo>();
                    foreach (DataRow dr in file.Rows)
                    {
                        Photo p = new Photo();
                        p.id       = dr["fileid"].ToString();
                        p.filename = dr["filename"].ToString();
                        p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                        pC3.Add(p);
                    }
                    files.Add("c3", pC3);
                    //签名附件
                    file = fileInfoBLL.GetFiles(entity.ID);
                    var pList = new List <Photo>();
                    foreach (DataRow dr in file.Rows)
                    {
                        Photo p = new Photo();
                        p.id       = dr["fileid"].ToString();
                        p.filename = dr["filename"].ToString();
                        p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                        pList.Add(p);
                    }
                    files.Add("sign", pList);
                    entity.FILES = files;
                    //return json(new
                    //{
                    //    code = 0,
                    //    info = "获取数据成功",
                    //    count = 0,
                    //    data = entity
                    //}, new jsonserializersettings() { dateformatstring = "yyyy-mm-dd hh:mm:ss" });
                    JsonSerializerSettings settings = new JsonSerializerSettings
                    {
                        //ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                        DateFormatString = "yyyy-MM-dd HH:mm:ss", //格式化日期
                        //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                    };
                    return(new
                    {
                        code = 0,
                        info = "获取数据成功",
                        count = 0,
                        data = JObject.Parse(JsonConvert.SerializeObject(entity, Formatting.None, settings))
                    });
                }
                else
                {
                    return(new { code = -1, count = 0, info = "获取失败,记录不存在。", data = new object() });
                }
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = "获取失败,错误:" + ex.Message, data = new object() });
            }
        }
Exemplo n.º 6
0
        public object GetEngineerDetails([FromBody] JObject json)
        {
            string  res    = json.Value <string>("json");
            dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(res);
            string  userid = dy.userid;

            //获取用户基本信息
            OperatorProvider.AppUserId = userid;  //设置当前用户
            Operator curUser = OperatorProvider.Provider.Current();

            if (null == curUser)
            {
                return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
            }
            try
            {
                string id      = dy.data ?? "";
                var    disBll  = new DistrictBLL();
                var    didBll  = new DataItemDetailBLL();
                var    deptBll = new DepartmentBLL();
                var    data    = outsouringengineerbll.GetEntity(id);
                if (!string.IsNullOrWhiteSpace(data.ENGINEERAREA))
                {
                    var area = disBll.GetEntity(data.ENGINEERAREA);
                    if (area != null)
                    {
                        data.ENGINEERAREANAME = area.DistrictName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERTYPE))
                {
                    var listType = didBll.GetDataItem("ProjectType", data.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        data.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERLEVEL))
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", data.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        data.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.OUTPROJECTID))
                {
                    var dept = deptbll.GetEntity(data.OUTPROJECTID);
                    data.OUTPROJECTCODE = dept.EnCode;
                    data.OUTPROJECTNAME = dept.FullName;
                }
                //return Json(new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //}, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd HH:mm:ss" });

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    //ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm:ss", //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
                //return new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //};
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = "获取失败,错误:" + ex.Message, data = new object() });
            }
        }
Exemplo n.º 7
0
        public object GetList([FromBody] JObject json)
        {
            try
            {
                string  res                   = json.Value <string>("json");
                dynamic dy                    = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId                = dy.userid;
                long    pageIndex             = dy.data.pageindex;
                long    pageSize              = dy.data.pagesize;
                string  starttime             = dy.data.starttime;
                string  endtime               = dy.data.endtime;
                string  deptid                = dy.data.deptid;
                string  unitid                = dy.data.unitid;
                string  engineerid            = dy.data.engineerid;
                string  actiontype            = dy.data.actiontype;                                                         //0全部 1 我的
                string  disclosuremajor       = res.Contains("disclosuremajor") ? dy.data.disclosuremajor : "";             //所属专业
                string  disclosuremajordeptid = res.Contains("disclosuremajordeptid") ? dy.data.disclosuremajordeptid : ""; //交底部门
                //获取用户基本信息
                OperatorProvider.AppUserId = userId;                                                                        //设置当前用户
                Operator   currUser   = OperatorProvider.Provider.Current();
                Pagination pagination = new Pagination();
                pagination.page           = int.Parse(pageIndex.ToString());
                pagination.rows           = int.Parse(pageSize.ToString());
                pagination.p_kid          = "t.ID";
                pagination.p_fields       = @" r.id as engineerid,t.disclosurename,t.createusername,to_char(t.createdate, 'yyyy-MM-dd') as createdate,
                                           e.fullname,
                                           t.ENGINEERNAME,disclosuremajordept,d.itemname as disclosuremajor,
                                           t.disclosuretype,
                                           to_char(t.disclosuredate, 'yyyy-mm-dd') as disclosuredate,
                                           t.disclosurepersonnum,
                                           t.disclosureplace,
                                           t.disclosureperson,
                                           t.receiveperson,
                                           t.createuserid,'' as approveuserids,flowid,to_char(issubmit) as issubmit,to_char(status) as status ";
                pagination.p_tablename    = @" epg_techdisclosure t
                                          left join epg_outsouringengineer r
                                            on t.projectid = r.id
                                          left join base_department e
                                            on r.outprojectid = e.departmentid left join base_dataitemdetail d on t.disclosuremajor=d.itemvalue and d.itemid =(select itemid from base_dataitem where itemcode='BelongMajor')";
                pagination.sidx           = "t.createdate"; //排序字段
                pagination.sord           = "desc";         //排序方式
                pagination.conditionJson += "1=1";
                string role = currUser.RoleName;
                if (actiontype == "0")
                {
                    pagination.conditionJson = "((";

                    if (role.Contains("公司级用户") || role.Contains("厂级部门用户"))
                    {
                        pagination.conditionJson += string.Format(" t.CREATEUSERORGCODE  = '{0}'", currUser.OrganizeCode);
                    }
                    else
                    if (role.Contains("承包商级用户"))
                    {
                        pagination.conditionJson += string.Format(" e.departmentid = '{0}'", currUser.DeptId);
                    }
                    else
                    {
                        pagination.conditionJson += string.Format(" r.engineerletdeptid = '{0}'", currUser.DeptId);
                    }
                    pagination.conditionJson += " and t.issubmit=1) or t.projectid is null)";
                }
                else if (actiontype == "1")
                {
                    string strCondition = "";
                    strCondition = string.Format(" and t.createuserorgcode='{0}' and t.issubmit=1 and t.status=1 ", currUser.OrganizeCode);
                    DataTable dt = intromissionbll.GetDataTableBySql("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var engineerEntity  = outsouringengineerbll.GetEntity(dt.Rows[i]["engineerid"].ToString());
                        var excutdept       = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                        var outengineerdept = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                        var supervisordept  = engineerEntity == null ? "" : string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentbll.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                        //获取下一步审核人
                        string str = manypowercheckbll.GetApproveUserId(dt.Rows[i]["flowid"].ToString(), dt.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, dt.Rows[i]["engineerid"].ToString());
                        dt.Rows[i]["approveuserids"] = str;
                    }

                    string[] applyids = dt.Select(" approveuserids like '%" + currUser.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray();

                    pagination.conditionJson += string.Format(" and (t.id in ('{0}') {1}", string.Join("','", applyids), strCondition);
                    pagination.conditionJson += string.Format(" or (t.issubmit = '0' and t.createuserid ='{0}'))", currUser.UserId);
                }
                else if (actiontype == "2")
                {
                    string strCondition = "";
                    strCondition = string.Format(" and t.createuserorgcode='{0}' and t.issubmit=1 and t.status=1 ", currUser.OrganizeCode);
                    DataTable dt = intromissionbll.GetDataTableBySql("select " + pagination.p_kid + "," + pagination.p_fields + " from " + pagination.p_tablename + " where " + pagination.conditionJson + strCondition);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var engineerEntity  = outsouringengineerbll.GetEntity(dt.Rows[i]["engineerid"].ToString());
                        var excutdept       = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                        var outengineerdept = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                        var supervisordept  = engineerEntity == null ? "" : string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentbll.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                        //获取下一步审核人
                        string str = manypowercheckbll.GetApproveUserId(dt.Rows[i]["flowid"].ToString(), dt.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, dt.Rows[i]["engineerid"].ToString());
                        dt.Rows[i]["approveuserids"] = str;
                    }

                    string[] applyids = dt.Select(" approveuserids like '%" + currUser.UserId + "%'").AsEnumerable().Select(d => d.Field <string>("id")).ToArray();

                    pagination.conditionJson += string.Format(" and t.id in ('{0}') {1}", string.Join("','", applyids), strCondition);
                }

                string queryJson = Newtonsoft.Json.JsonConvert.SerializeObject(new
                {
                    sTime                 = starttime,
                    eTime                 = endtime,
                    outengineerid         = engineerid,
                    unitid                = unitid,
                    deptid                = deptid,
                    disclosuremajor       = disclosuremajor,
                    disclosuremajordeptid = disclosuremajordeptid
                });
                var data = techdisclosurebll.GetList(pagination, queryJson);
                return(new { code = 0, count = pagination.records, info = "获取数据成功", data = data });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }
Exemplo n.º 8
0
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            pagination.p_kid       = "t.ID";
            pagination.p_fields    = @" r.id as engineerid,e.fullname,t.ENGINEERNAME,t.DisclosureType,to_char(t.DisclosureDate,'yyyy-MM-dd') as DisclosureDate,disclosurename,disclosuremajordept,d.itemname as disclosuremajor,t.DisclosurePersonNum,t.DisclosurePlace,t.DisclosurePerson,t.ReceivePerson,t.CreateUserId,'' as approveuserids,flowid,issubmit,status ";
            pagination.p_tablename = @"EPG_TechDisclosure t left join EPG_OutSouringEngineer r 
on t.projectid=r.id left join base_department e on r.outprojectid=e.departmentid left join base_dataitemdetail d on t.disclosuremajor=d.itemvalue and d.itemid =(select itemid from base_dataitem where itemcode='BelongMajor')";
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            string   role = user.RoleName;

            pagination.conditionJson += "(";
            if (role.Contains("省级"))
            {
                pagination.conditionJson += string.Format(@" t.createuserorgcode  in (select encode
                from BASE_DEPARTMENT d
                        where d.deptcode like '{0}%' and d.nature = '厂级' and d.description is null)", user.NewDeptCode);
            }
            else if (role.Contains("公司级用户") || role.Contains("厂级部门用户"))
            {
                pagination.conditionJson += string.Format(" t.CREATEUSERORGCODE  = '{0}'", user.OrganizeCode);
            }
            else if (role.Contains("承包商级用户"))
            {
                pagination.conditionJson += string.Format(" (e.departmentid = '{0}' or r.supervisorid = '{0}' )", user.DeptId);
            }
            else
            {
                var deptentity = departmentbll.GetEntity(user.DeptId);
                while (deptentity.Nature == "班组" || deptentity.Nature == "专业")
                {
                    deptentity = departmentbll.GetEntity(deptentity.ParentId);
                }
                pagination.conditionJson += string.Format(" r.engineerletdeptid in (select departmentid from base_department where encode like '{0}%') ", deptentity.EnCode);
                //pagination.conditionJson = string.Format(" r.engineerletdeptid = '{0}'", user.DeptId);
            }
            pagination.conditionJson += " or t.projectid is null)";
            var watch = CommonHelper.TimerStart();
            var data  = techdisclosurebll.GetList(pagination, queryJson);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                if (data.Rows[i]["status"].ToString() == "1")
                {
                    var engineerEntity  = outsouringengineerbll.GetEntity(data.Rows[i]["engineerid"].ToString());
                    var excutdept       = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.ENGINEERLETDEPTID).DepartmentId;
                    var outengineerdept = engineerEntity == null ? "" : departmentbll.GetEntity(engineerEntity.OUTPROJECTID).DepartmentId;
                    var supervisordept  = engineerEntity == null ? "" : string.IsNullOrEmpty(engineerEntity.SupervisorId) ? "" : departmentbll.GetEntity(engineerEntity.SupervisorId).DepartmentId;
                    //获取下一步审核人
                    string str = manypowercheckbll.GetApproveUserId(data.Rows[i]["flowid"].ToString(), data.Rows[i]["id"].ToString(), "", "", excutdept, outengineerdept, "", "", "", supervisordept, data.Rows[i]["engineerid"].ToString());
                    data.Rows[i]["approveuserids"] = str;
                }
            }
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Exemplo n.º 9
0
        public object GetEntity([FromBody] JObject json)
        {
            try
            {
                string  res = json.Value <string>("json");
                dynamic dy  = JsonConvert.DeserializeObject <ExpandoObject>(res);
                //获取用户Id
                string userId = dy.userid;
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator curUser = OperatorProvider.Provider.Current();
                if (null == curUser)
                {
                    return(new { code = -1, count = 0, info = "请求失败,请登录!" });
                }
                string id = dy.data.ID;//ID
                SafetyActivityEntity entity = SafetyActivitybll.GetEntity(id);
                var     data    = outsouringengineerbll.GetEntity(entity.EngineerId);
                var     proData = outProjectbll.GetOutProjectInfo(data.OUTPROJECTID);
                dynamic obj     = new ExpandoObject();
                obj.Id                 = entity.ID;
                obj.CREATEUSERID       = entity.CREATEUSERID;
                obj.CREATEUSERDEPTCODE = entity.CREATEUSERDEPTCODE;
                obj.CREATEUSERORGCODE  = entity.CREATEUSERORGCODE;
                obj.CREATEDATE         = entity.CREATEDATE.Value.ToString("yyyy-MM-dd HH:mm");
                obj.CREATEUSERNAME     = entity.CREATEUSERNAME;
                obj.MODIFYDATE         = entity.MODIFYDATE;
                obj.MODIFYUSERID       = entity.MODIFYUSERID;
                obj.MODIFYUSERNAME     = entity.MODIFYUSERNAME;
                obj.EngineerId         = entity.EngineerId;
                obj.StartTime          = entity.StartTime.Value.ToString("yyyy-MM-dd HH:mm");
                obj.EndTime            = entity.EndTime.Value.ToString("yyyy-MM-dd HH:mm");
                obj.PeopleNum          = entity.PeopleNum;
                obj.PracticalPeopleNum = entity.PracticalPeopleNum;
                obj.Condition          = entity.Condition;
                obj.StudyRecord        = entity.StudyRecord;
                obj.StudyDetails       = entity.StudyDetails;
                obj.EngineerletDept    = data.ENGINEERLETDEPT;
                obj.OutsourcingName    = proData.OUTSOURCINGNAME;
                obj.OutprojectId       = data.OUTPROJECTID;
                obj.UnitSuper          = data.UnitSuper;
                obj.EngineerName       = data.ENGINEERNAME;


                IList <Photo> pList = new List <Photo>(); //附件
                DataTable     file  = fileInfoBLL.GetFiles(entity.ID + "01");
                foreach (DataRow dr in file.Rows)
                {
                    Photo p = new Photo();
                    p.id       = dr["fileid"].ToString();
                    p.filename = dr["filename"].ToString();
                    p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                    pList.Add(p);
                }
                obj.SafetyActivityFile = pList;

                IList <Photo> pList1 = new List <Photo>(); //附件
                DataTable     file1  = fileInfoBLL.GetFiles(entity.ID);
                foreach (DataRow dr in file1.Rows)
                {
                    Photo p = new Photo();
                    p.id       = dr["fileid"].ToString();
                    p.filename = dr["filename"].ToString();
                    p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
                    pList1.Add(p);
                }
                obj.SafetyActivityPic = pList1;

                return(new { Code = 0, Count = 1, Info = "获取数据成功", data = obj });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }