//菜单栏的提示任务个数 public JsonResult task_mission() { IObjectContextAdapter IOca = new EquipWebContext(); List <UI_MISSION> miss = CWFEngine.GetActiveMissions <Person_Info>(IOca.ObjectContext); List <Object> Url_List = new List <object>(); List <Object> urlobj = new List <object>(); foreach (UI_MISSION item in miss)//本模块的作用是:将MISS_Url中截取前面的字段;例如“/A4dot4/Zzsubmit?wef=123”截取“A4dot4”,并存入数组str。注:这些MISS_Url就是待处理任务的跳转路径,故与本模块待处理任务个数提示可以关联 { UI_MISSION mi = CWFEngine.GetHistoryMissions(item.WE_Entity_Id).Last(); string MISS_Url = item.Mission_Url; string[] s = MISS_Url.Split(new char[] { '/' }); string str = s[1]; Url_List.Add(str); } //判断数组str中的相同元素的个数,并将结果转为json格式,返回前台 var vs = from string p in Url_List group p by p into g select new { g, num = g.Count() }; foreach (var v in vs) { object m = new { url_name = v.g.Key, url_count = v.num }; urlobj.Add(m); } return(Json(urlobj.ToArray())); }
//适用流程A6.2 //获取超期未换油信息 //public List<OilInfo> getOilInfo_Overdue(string curDate) //{ // try // { // using (var db = new EquipWebContext()) // { // var oilInfoList = db.Database.SqlQuery<OilInfo>("select * from oilInfo where oil_NextDate <'" + curDate + "'"); // List<OilInfo> r = oilInfoList.ToList<OilInfo>(); // return r; // } // } // catch (Exception) // { return null; } //} //适用于KPI计算 public List <Notice> getNoticeInfos_ByNoticeType(string Pq_code, string Notice_type, string Notice_state, string Notice_OverCondition = "") { try { using (var db = new EquipWebContext()) { string lastDate = DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "16"; string nextDate = DateTime.Now.ToString("yyyyMM") + "15"; List <Notice> r; //string sql = "select * from Notice where Notice_Type='" + Notice_type + "' and Notice_state!='" + Notice_state + "' and Notice_CR_Date>='" + lastDate + "' and Notice_CR_Date<='" + nextDate + "' and Notice_PlanGroup in(select rtrim(ltrim(cName)) collate Chinese_PRC_CI_AS from Pq_Zz_map where Pq_Name = '" + Pq_code + "')"; if (Notice_OverCondition == "") { r = db.Database.SqlQuery <Notice>("select * from Notice where Notice_Type='" + Notice_type + "' and Notice_state!='" + Notice_state + "' and Notice_CR_Date>='" + lastDate + "' and Notice_CR_Date<='" + nextDate + "' and Notice_PlanGroup in (select rtrim(ltrim(Zz_Code)) collate Chinese_PRC_CI_AS from Pq_Zz_map where Pq_Name = '" + Pq_code + "')").ToList <Notice>(); } else { r = db.Database.SqlQuery <Notice>("select * from Notice where Notice_Type='" + Notice_type + "' and Notice_state!='" + Notice_state + "' and Notice_OverConditon='" + Notice_OverCondition + "' and Notice_CR_Date>='" + lastDate + "' and Notice_CR_Date<='" + nextDate + "' and Notice_PlanGroup in (select rtrim(ltrim(Zz_Code)) collate Chinese_PRC_CI_AS from Pq_Zz_map where Pq_Name='" + Pq_code + "' )").ToList <Notice>(); } return(r); } } catch (Exception) { return(null); } }
//全厂统计 Pq_Code=ALL public List <Notice> getNoticeInfos_BigEquip(string Pq_code, string Notice_type, string Notice_state, string Notice_OverCondition) { try { using (var db = new EquipWebContext()) { string lastDate = DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "16000000"; string nextDate = DateTime.Now.ToString("yyyyMM") + "15235959"; List <Notice> r; //string asd = "select * from Notice where Notice_Type +'" + Notice_type + "' and Notice_State!='" + Notice_state + "' and Notice_FaultStart+Notice_FaultStartTime>='" + lastDate + "' and Notice_FaultEnd+Notice_FaultEndTime<='" + nextDate + "' and Notice_OverConditon='" + Notice_OverCondition + "' and Notice_EquipCode in (select rtrim(ltrim(Equip_Code)) collate Chinese_PRC_CI_AS from Pq_EC_map where Pq_Name='" + Pq_code + "')"; if (Pq_code == "ALL") { r = db.Database.SqlQuery <Notice>("select * from Notice where Notice_Type ='" + Notice_type + "' and Notice_State!='" + Notice_state + "' and Notice_FaultStart+Notice_FaultStartTime>='" + lastDate + "' and Notice_FaultEnd+Notice_FaultEndTime<='" + nextDate + "' and Notice_OverConditon='" + Notice_OverCondition + "' and Notice_EquipCode in (select rtrim(ltrim(Equip_Code)) collate Chinese_PRC_CI_AS from Pq_EC_map)").ToList <Notice>(); } else { r = db.Database.SqlQuery <Notice>("select * from Notice where Notice_Type ='" + Notice_type + "' and Notice_State!='" + Notice_state + "' and Notice_FaultStart+Notice_FaultStartTime>='" + lastDate + "' and Notice_FaultEnd+Notice_FaultEndTime<='" + nextDate + "' and Notice_OverConditon='" + Notice_OverCondition + "' and Notice_EquipCode in (select rtrim(ltrim(Equip_Code)) collate Chinese_PRC_CI_AS from Pq_EC_map where Pq_Name='" + Pq_code + "')").ToList <Notice>(); } return(r); } } catch (Exception) { return(null); } }
public GongDan getGD_Notice_info(string gd_Notice_Id) { try { using (var db = new EquipWebContext()) { var GongdanList = db.Database.SqlQuery <GongDan>("select * from GongDan where GD_NoticeId ='" + gd_Notice_Id + "'"); List <GongDan> r = GongdanList.ToList <GongDan>(); return(r.ElementAt(0)); } } catch (Exception) { return(null); } }
public List <OilInfo> getOilInfo_Overdue(string curDate) { try { using (var db = new EquipWebContext()) { var oilInfoList = db.Database.SqlQuery <OilInfo>("select * from oilInfo where oil_NextDate <'" + curDate + "'"); List <OilInfo> r = oilInfoList.ToList <OilInfo>(); return(r); } } catch (Exception) { return(null); } }
/// <summary> /// 删除功能,只需修改状态为2,2表示改行数据舍弃 /// </summary> /// <param name="Notice_Id"></param> /// <returns></returns> public string RemoveNoticeState(string Notice_Id) { using (var db = new EquipWebContext()) { try { var modifynotice = db.Notice_Infos.SqlQuery("select * from Notice_Info where Notice_ID='" + Notice_Id + "'").First(); modifynotice.Notice_A13dot1State = 2; db.SaveChanges(); return("成功"); } catch { return("出错!"); } } }
public JsonResult ListMission() { IObjectContextAdapter IOca = new EquipWebContext(); List <UI_MISSION> miss = CWFEngine.GetActiveMissions <Person_Info>(IOca.ObjectContext); List <Object> miss_obj = new List <object>(); foreach (UI_MISSION item in miss) { UI_MISSION mi = CWFEngine.GetHistoryMissions(item.WE_Entity_Id).Last(); IDictionary <string, string> record = CWFEngine.GetMissionRecordInfo(mi.Miss_Id); DateTime dt = DateTime.Parse(!record.ContainsKey("time") ? DateTime.Now.ToString() : record["time"]); TimeSpan ts = DateTime.Now - dt; string time_last = ""; if (ts.TotalDays > 1) { time_last += (((int)ts.TotalDays).ToString() + "天之前"); } else if (ts.TotalHours > 1) { time_last += (((int)ts.TotalHours).ToString() + "小时之前"); } else { time_last += (((int)ts.TotalMinutes).ToString() + "分钟之前"); } object o = new { WF_ICON = "fa fa-flash text-text-aqua", MISS_Url = item.Mission_Url, WF_Name = CWFEngine.GetWorkFlowEntiy(item.WE_Entity_Id, true).description, MISS_Name = item.WE_Event_Desc, TIME_Last = time_last }; miss_obj.Add(o); } return(Json(miss_obj.ToArray())); }
public int geBigEquip_Num(string Pq_code) { try { using (var db = new EquipWebContext()) { int r = 0; if (Pq_code == "ALL") { r = db.Database.SqlQuery <Notice>("select * from Pq_EC_map").Count(); } else { r = db.Database.SqlQuery <Notice>("select * from Pq_EC_map where Pq_Name='" + Pq_code + "'").Count(); } return(r); } } catch (Exception) { return(-1); } }
public JsonResult ListProcess() { List <UI_WFEntity_Info> start_entities = CWFEngine.GetWFEntityByHistoryStatus(t => t.Record_Info.Count(q => q.Re_Name == "username" && q.Re_Value == "cb") > 0); List <object> proc_list = new List <object>(); IObjectContextAdapter IOca = new EquipWebContext(); foreach (var en in start_entities) { string startUser = CWFEngine.GetMissionRecordInfo(CWFEngine.GetHistoryMissions(en.EntityID).First().Miss_Id)["username"]; if (startUser != (Session["User"] as Person_Info).Person_Name) { continue; } int total = CWFEngine.GetWorkFlowAvgSteps(en.name); int curr = CWFEngine.GetWFEntityFinishSteps(en.EntityID); if (total == 0) { total = 5; } if (curr == 0) { curr = 1; } object o = new { WF_Name = en.description, MISS_Name = CWFEngine.GetActiveMission <Person_Info>(en.EntityID, IOca.ObjectContext).WE_Event_Desc, MISS_Present = (double)curr / (double)total * 100 }; proc_list.Add(o); } return(Json(proc_list.ToArray())); }
//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); } }