예제 #1
0
        //zxh

        public string ListMission_zxh()
        {
            try
            {
                IObjectContextAdapter IOca = new EquipWebContext();

                List <UI_MISSION> miss = CWFEngine.GetActiveMissions <Person_Info>(IOca.ObjectContext);


                List <Object> miss_obj = new List <object>();
                string        userName = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name.ToString();
                foreach (UI_MISSION item in miss)
                {
                    MainMissionsModel mm = GetMainMissionsInfo(item.WE_Entity_Id);


                    Jobs   js      = new Jobs();
                    string endtime = "";
                    string lsh_xy  = "1";


                    if (js.GetDSnexttime(mm.jobname, item.WE_Entity_Id) != null)
                    {
                        if (js.GetDSnexttime(mm.jobname, item.WE_Entity_Id).PreTime == null)
                        {
                            string        end_corn = js.GetDSnexttime(mm.jobname, item.WE_Entity_Id).corn_express;
                            TriggerTiming TT       = new TriggerTiming();
                            TT.FromString(end_corn);
                            TT.RefreshNextTiming(DateTime.Now);
                            endtime = TT.NextTiming.ToString();
                        }
                        else
                        {
                            endtime = js.GetDSnexttime(mm.jobname, item.WE_Entity_Id).PreTime.ToString();
                        }
                    }


                    if (mm.Equip_GyCode == null || mm.Equip_GyCode == "")
                    {
                        lsh_xy = "0";
                    }
                    object o = new
                    {
                        WF_ICON    = "fa fa-flash text-text-aqua",
                        MISS_Url   = item.Mission_Url,
                        WF_Name    = mm.WF_Name,
                        MISS_Name  = item.WE_Event_Desc,
                        wfe_serial = mm.wfe_serial,
                        sbCode     = mm.Equip_GyCode,
                        time       = mm.time,
                        endtime    = endtime,
                        lsh_xy     = lsh_xy
                    };
                    EquipManagment em = new EquipManagment();
                    if (mm.WF_Name.Contains("定时KPI月报"))
                    {
                        if (userName == "龚海桥" && mm.WF_Name.Contains("联合一片区"))
                        {
                            miss_obj.Add(o);
                        }
                        else if (userName == "丁一刚" && mm.WF_Name.Contains("联合二片区"))
                        {
                            miss_obj.Add(o);
                        }
                        else if (userName == "邓杰" && (mm.WF_Name.Contains("联合三片区") || mm.WF_Name.Contains("化工片区")))
                        {
                            miss_obj.Add(o);
                        }
                        else if (userName == "杨书毅" && mm.WF_Name.Contains("联合四片区"))
                        {
                            miss_obj.Add(o);
                        }
                        else if (userName == "武文斌" && (mm.WF_Name.Contains("综合片区") || mm.WF_Name.Contains("系统片区")))
                        {
                            miss_obj.Add(o);
                        }
                    }
                    else
                    {
                        if (userName == "sa" || userName == "程聂")
                        {
                            miss_obj.Add(o);
                        }
                        else
                        {
                            if (lsh_xy == "1")
                            {
                                if (em.getEquip_ByGyCode(mm.Equip_GyCode).Equip_Specialty == "动")
                                {
                                    miss_obj.Add(o);
                                }
                            }
                            else
                            {
                                miss_obj.Add(o);
                            }
                        }
                    }
                }

                TablesManagment tm     = new TablesManagment();
                int             UserId = (Session["User"] as EquipModel.Entities.Person_Info).Person_Id;
                PersonManagment pm     = new PersonManagment();
                EquipBLL.AdminManagment.PersonManagment.P_viewModal pv = pm.Get_PersonModal(UserId);
                if (pv.Role_Names.Contains("可靠性工程师"))
                {
                    string             wfe_ser = "";
                    List <string>      cjname  = new List <string>();
                    List <Equip_Archi> EA      = pm.Get_Person_Cj(UserId);
                    foreach (var ea in EA)
                    {
                        cjname.Add(ea.EA_Name);
                    }
                    List <A5dot1Tab1> E = tm.Getdcl_listbyisZG(0, cjname);

                    for (int i = 0; i < E.Count; i++)
                    {
                        if (E[i].dataSource != null)
                        {
                            wfe_ser = E[i].dataSource;
                        }
                        object o = new
                        {
                            WF_ICON    = "fa fa-flash text-text-aqua",
                            MISS_Url   = "/A5dot1/Index",
                            WF_Name    = "设备完好",
                            MISS_Name  = "可靠性工程师确认整改",
                            wfe_serial = wfe_ser,
                            sbCode     = E[i].sbGyCode.ToString(),
                            time       = E[i].zzSubmitTime.ToString(),
                            endtime    = "",
                            lsh_xy     = 1
                        };
                        miss_obj.Add(o);
                    }
                    SxglManagment     Sx = new SxglManagment();
                    List <A5dot2Tab1> EE = Sx.GetSxItem(cjname);
                    foreach (var item in EE)
                    {
                        if (item.temp2 != null)
                        {
                            wfe_ser = item.temp2;
                        }
                        object o = new
                        {
                            WF_ICON    = "fa fa-flash text-text-aqua",
                            MISS_Url   = "/A5dot2/Index",
                            WF_Name    = "竖向问题",
                            MISS_Name  = "可靠性工程师确认整改",
                            wfe_serial = wfe_ser,
                            sbCode     = item.sbGyCode.ToString(),
                            time       = item.jxSubmitTime.ToString(),
                            endtime    = "",
                            lsh_xy     = 1
                        };
                        miss_obj.Add(o);
                    }
                }

                string str = JsonConvert.SerializeObject(miss_obj);
                return("{" + "\"data\": " + str + "}");
            }
            catch (Exception e)
            {
                return(null);
            }
        }