Exemplo n.º 1
0
        //菜单栏的提示任务个数
        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()));
        }
Exemplo n.º 2
0
        public ActionResult LsTaskHistoryDetail(string wfe_id)
        {
            EquipArchiManagment Em = new EquipArchiManagment();
            UI_MISSION          mi = new UI_MISSION();

            List <UI_MISSION> t = CWFEngine.GetHistoryMissions(int.Parse(wfe_id));

            mi = (UI_MISSION)t.ElementAt(1);
            Dictionary <string, object> mi_params = mi.Miss_Params;
            string cj_name      = mi.Miss_Params["Cj_Name"].ToString();
            string tempjob_name = mi.Miss_Params["Job_Name"].ToString();


            ViewBag.wfe_id = wfe_id;
            A6dot2dot2InfoModal infoModal = new A6dot2dot2InfoModal();

            infoModal.tempjob_name = tempjob_name;
            infoModal.cj_name      = cj_name;
            infoModal.wfe_id       = wfe_id;
            EquipManagment EM = new EquipManagment();

            infoModal.All_Zz = EM.getZzs_ofCj(Convert.ToInt32(cj_name));

            return(View(infoModal));
        }
Exemplo n.º 3
0
        public string JdcConfirm_submitsignal(string json1)
        {
            try
            {
                JObject item     = (JObject)JsonConvert.DeserializeObject(json1);
                string  flowname = item["Flow_Name"].ToString();
                //create new flow A13.1
                createA13dot1(flowname);

                //paras
                Dictionary <string, string> signal = new Dictionary <string, string>();
                signal["JdcConfirm_done"] = item["JdcConfirm_done"].ToString();
                UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(flowname), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
                signal["Th_CheckMen"] = miss.Miss_Params["Th_CheckMen"].ToString() + "," + miss.Miss_Params["DongZyMan"].ToString() + "," + miss.Miss_Params["DianZyMan"].ToString() + "," + miss.Miss_Params["YiZyMan"].ToString() + "," + (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                //record
                Dictionary <string, string> record = new Dictionary <string, string>();
                record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                record["time"]     = DateTime.Now.ToString();
                //submit
                CWFEngine.SubmitSignal(Convert.ToInt32(flowname), signal, record);
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A7dot1dot1/Index");
        }
Exemplo n.º 4
0
        public string GetDSRemind()
        {
            List <Timer_Jobs> Tjs         = js.GetDSRemind();
            List <string>     Remind_list = new List <string>();

            for (int i = 0; i < Tjs.Count; i++)
            {
                //TriggerTiming TT = new TriggerTiming();
                //TT.FromString(Tjs[i].corn_express);
                //TT.RefreshNextTiming(DateTime.Now);
                //DateTime next_dt = TT.NextTiming.Value;
                UI_MISSION u          = CWFEngine.GetActiveMission <Person_Info>(Tjs[i].workflow_ID, null, false);
                string     work_name  = u.WE_Name;
                string     event_desc = u.WE_Event_Desc;
                string     event_name = work_name + ":" + event_desc;
                Remind_list.Add(event_name);
            }
            string Remind_Str = "定时任务提醒!!!请按时完成以下流程:";

            for (int i = 0; i < Remind_list.Count; i++)
            {
                Remind_Str += Remind_list[i] + "、";
            }

            return(Remind_Str);
        }
Exemplo n.º 5
0
        // GET: /A7dot1dot1/机动处确认
        public ActionResult JdcConfirm(string wfe_id)
        {
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);

            ViewBag.currentMiss = miss;
            return(View(getWFDetail_Model(wfe_id)));
        }
Exemplo n.º 6
0
        public void testCallBack(int timer_id, string user_params)
        {
            JObject       item       = (JObject)JsonConvert.DeserializeObject(user_params);
            int           eneity_id  = Convert.ToInt32(item["entity_id"]);
            string        event_name = item["event_name"].ToString();
            DSEventDetail ds         = new DSEventDetail();
            DateTime      now        = DateTime.Now;

            ds.year      = now.Year;
            ds.month     = now.Month;
            ds.day       = now.Day;
            ds.week      = WeekOfMonth(now, 1);
            ds.state     = 0;
            ds.entity_id = eneity_id;
            //List<UI_MISSION> AllHistoryMiss = CWFEngine.GetHistoryMissions(eneity_id);
            UI_MISSION u          = CWFEngine.GetActiveMission <Person_Info>(eneity_id, null, false);
            string     work_name  = u.WE_Name;
            string     event_desc = u.WE_Event_Desc;

            ds.event_name = work_name + ":" + event_desc;

            Timer_Jobs tj = js.GetTimerJob(timer_id);

            ds.DSTime_Desc = tj.STR_RES_2;
            //if (dm.getdetailbyE_id(eneity_id) == null)
            dm.AddDsEvent(ds);
        }
Exemplo n.º 7
0
        public ActionResult ZzSubmit(string wfe_id)
        {
            UI_MISSION mi = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
            Dictionary <string, object> mi_params = mi.Miss_Params;
            int Zz_id = Eam.getEa_idbyname(mi.Miss_Params["Zz_Name"].ToString());

            ViewBag.Zz_id   = Zz_id;
            ViewBag.Zz_name = mi.Miss_Params["Zz_Name"].ToString();
            ViewBag.wfe_id  = wfe_id;
            return(View());
        }
Exemplo n.º 8
0
        public void CSA11dot2ZzSubmit(string param)
        {
            JObject    item       = (JObject)JsonConvert.DeserializeObject(param);
            int        entity_id  = Convert.ToInt32(item["Entity_id"]);
            UI_MISSION u          = CWFEngine.GetActiveMission <Person_Info>(entity_id, null, false);
            string     work_name  = u.WE_Name;
            string     event_desc = u.WE_Event_Desc;
            string     event_name = work_name + ":" + event_desc;

            dm.modifystate(entity_id, event_name);
        }
Exemplo n.º 9
0
        public ActionResult Approve(int wfe_id)
        {
            UI_MISSION mi  = CWFEngine.GetActiveMission <UserInfo>(wfe_id, ((IObjectContextAdapter)(new UserContext())).ObjectContext);
            string     str = mi.Miss_Params["application_person"].ToString();

            ViewBag.poster = str;
            str            = mi.Miss_Params["application_reason"].ToString();
            ViewBag.reason = str;
            ViewBag.wfid   = mi.WE_Entity_Id;
            return(View());
        }
Exemplo n.º 10
0
        public ActionResult GraphicData(string wfe_id)
        {
            int             cur_PersionID = (Session["User"] as EquipModel.Entities.Person_Info).Person_Id;
            PersonManagment pm            = new PersonManagment();

            EquipBLL.AdminManagment.PersonManagment.P_viewModal pv = pm.Get_PersonModal(cur_PersionID);
            ViewBag.user_specis = pv.Speciaty_Names;
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext, false);

            ViewBag.currentMiss = miss;
            return(View(getWFDetail_Model(wfe_id)));
        }
Exemplo n.º 11
0
        public string get_equip_info(string wfe_id)
        {
            WorkFlows wfsd    = new WorkFlows();
            Mission   db_miss = wfsd.GetWFEntityMissions(Convert.ToInt16(wfe_id)).Last();//获取该实体最后一个任务


            WorkFlow_Entity wfe = wfsd.GetWorkFlowEntity(Convert.ToInt16(wfe_id));
            //CWorkFlow wf = new CWorkFlow();
            WorkFlows  wfs = new WorkFlows();
            UI_MISSION ui  = new UI_MISSION();

            ui.WE_Entity_Ser = wfe.WE_Ser;
            ui.WE_Event_Desc = db_miss.Miss_Desc;
            ui.WE_Event_Name = db_miss.Event_Name;
            ui.WE_Name       = db_miss.Miss_Name;
            ui.Mission_Url   = "";                                               //历史任务的页面至空
            ui.Miss_Id       = db_miss.Miss_Id;
            List <Mission_Param> mis_pars = wfsd.GetMissParams(db_miss.Miss_Id); //获取当前任务参数

            foreach (var par in mis_pars)
            {
                CParam cp = new CParam();
                cp.type                     = par.Param_Type;
                cp.name                     = par.Param_Name;
                cp.value                    = par.Param_Value;
                cp.description              = par.Param_Desc;
                ui.Miss_Params[cp.name]     = cp.value;
                ui.Miss_ParamsDesc[cp.name] = cp.description;
            }
            List <EquipListModel> EquipList = Zz_Equips(ui.Miss_Params["Zz_Name"].ToString());
            List <object>         miss_obj  = new List <object>();
            int i = 1;

            foreach (var item in EquipList)
            {
                object m = new
                {
                    index           = i,
                    Equip_Id        = item.Equip_Id,
                    Equip_GyCode    = item.Equip_GyCode,
                    Equip_Code      = item.Equip_Code,
                    Equip_Type      = item.Equip_Type,
                    Equip_Specialty = item.Equip_Specialty,
                    Equip_ABCMark   = item.Equip_ABCMark
                };
                miss_obj.Add(m);
                i++;
            }

            string str = JsonConvert.SerializeObject(miss_obj);

            return("{" + "\"data\": " + str + "}");
        }
Exemplo n.º 12
0
        public JsonResult Read_THRecord(int WFE_ID)
        {
            List <TableModel> tb_list = new List <TableModel>();
            UI_MISSION        miss    = CWFEngine.GetActiveMission <Person_Info>(WFE_ID, ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
            //由于Th_ItemRecord等变量未于当前event关联, 导致我无法从当前任务中读取这些变量
            //所以我读取了上一条历史Mission, 这种方法效率较低, 应该将这些变量与之关联,并使用上面被注释的语句,更为妥当
            //UI_MISSION miss = CWFEngine.GetHistoryMissions(WFE_ID).Last();
            string th_record  = Convert.ToString(miss.Miss_Params["Th_ItemRecord"]);
            string th_problem = Convert.ToString(miss.Miss_Params["Th_ProblemRecords"]);
            string th_detail  = Convert.ToString(miss.Miss_Params["Th_WorkDetail"]);

            return(Json(new { th_record = th_record, th_problem = th_problem, th_detail = th_detail }));
        }
Exemplo n.º 13
0
        // GET: /A7dot1dot1/机动处确认
        public void createA13dot1(string from_wfe_id)
        {
            //create new flow A13.1
            UI_MISSION miss           = CWFEngine.GetActiveMission <Person_Info>(Convert.ToInt32(from_wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
            string     th_problem     = Convert.ToString(miss.Miss_Params["Th_ProblemRecords"]);
            JArray     j_Problem_data = JArray.Parse(th_problem);

            for (int i = 0; i < j_Problem_data.Count; i++)
            {
                JObject j_obj            = JObject.Parse(j_Problem_data[i].ToString());
                string  problem_catalogy = j_obj["problem_catalogy"].ToString();
                string  problem_detail   = j_obj["problem_detail"].ToString();
                //将7.1.1的串号赋给新产生的13.1的工作流
                WorkFlows          wfsd       = new WorkFlows();
                WorkFlow_Entity    wfecurrent = wfsd.GetWorkFlowEntity(Convert.ToInt32(from_wfe_id));
                UI_WorkFlow_Entity wfe        = CWFEngine.CreateAWFEntityByName("A13dot1", wfecurrent.WE_Ser);

                if (wfe != null)
                {
                    Dictionary <string, string> record = wfe.GetRecordItems();
                    record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record["time"]     = DateTime.Now.ToString();
                    wfe.Start(record);
                    int flow_id = wfe.EntityID;
                    Dictionary <string, string> signal1 = new Dictionary <string, string>();
                    signal1["start_done"] = "true";
                    CWFEngine.SubmitSignal(flow_id, signal1, record);
                    //paras
                    Dictionary <string, string> signal = new Dictionary <string, string>();
                    signal["ZzSubmit_done"]        = "true";
                    signal["Cj_Name"]              = miss.Miss_Params["Cj_Name"].ToString();
                    signal["Zz_Name"]              = miss.Miss_Params["Zz_Name"].ToString();
                    signal["Equip_GyCode"]         = miss.Miss_Params["Equip_GyCode"].ToString();
                    signal["Equip_Code"]           = miss.Miss_Params["Equip_Code"].ToString();
                    signal["Equip_Type"]           = miss.Miss_Params["Equip_Type"].ToString();
                    signal["Problem_Desc"]         = problem_detail;
                    signal["Problem_DescFilePath"] = "";
                    signal["Zy_Type"]              = problem_catalogy;
                    signal["Zy_SubType"]           = miss.Miss_Params["Zy_SubType"].ToString();
                    signal["Equip_ABCMark"]        = miss.Miss_Params["Equip_ABCMark"].ToString();
                    signal["Data_Src"]             = "特护记录";

                    //submit
                    //record
                    //record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                    record["time"] = DateTime.Now.ToString();
                    //submit
                    CWFEngine.SubmitSignal(flow_id, signal, record);
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取某一工作流实体的历史任务
        /// </summary>
        /// <param name="entity_id">工作流实体ID</param>
        /// <returns></returns>
        public static List <UI_MISSION> GetHistoryMissions(int entity_id)
        {
            List <UI_MISSION> his_miss = new List <UI_MISSION>();

            WorkFlows      wfs     = new WorkFlows();
            List <Mission> db_miss = wfs.GetWFEntityMissions(entity_id);

            WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(entity_id);
            //恢复工作流实体
            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
            wf.EntityID = wfe.WE_Id;
            wf.InstFromXmlNode(doc.DocumentElement);


            foreach (var mi in db_miss)
            {
                UI_MISSION ui_mi = new UI_MISSION();
                ui_mi.WE_Entity_Id  = entity_id;
                ui_mi.WE_Entity_Ser = wfe.WE_Ser;
                ui_mi.WE_Event_Desc = mi.Miss_Desc;
                ui_mi.WE_Event_Name = mi.Event_Name;
                ui_mi.WE_Name       = mi.Miss_Name;
                ui_mi.Mission_Url   = ""; //历史任务的页面至空
                ui_mi.Miss_Id       = mi.Miss_Id;

                List <Mission_Param> mis_pars = wfs.GetMissParams(mi.Miss_Id);
                foreach (var par in mis_pars)
                {
                    CParam cp = new CParam();
                    cp.type                          = par.Param_Type;
                    cp.name                          = par.Param_Name;
                    cp.value                         = par.Param_Value;
                    cp.description                   = par.Param_Desc;
                    ui_mi.Miss_Params[cp.name]       = cp.value;
                    ui_mi.Miss_ParamsAppRes[cp.name] = wf.paramstable[cp.name].linkEventsApp_res[ui_mi.WE_Event_Name];
                    ui_mi.Miss_ParamsDesc[cp.name]   = cp.description;//xwm modified
                }
                his_miss.Add(ui_mi);
            }
            return(his_miss);
        }
Exemplo n.º 15
0
        public ActionResult Design(string wfe_id)
        {
            //find cj zz namme
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);

            //miss.Miss_Params
            ViewBag.flag = 0;
            if (miss.Miss_Params["Cj_Name"].ToString() != "")
            {
                ViewBag.CjName = miss.Miss_Params["Cj_Name"].ToString();
                ViewBag.ZzName = miss.Miss_Params["Zz_Name"].ToString();
                ViewBag.flag   = 1;
            }


            //  ViewBag.CjName = "CCCJJJ";
            // ViewBag.ZzName = "ZZZZZZ";
            return(View(getSubmitModel(wfe_id)));//
        }
Exemplo n.º 16
0
        public ActionResult CaiGouConfirm(string wfe_id)
        {
            Dictionary <string, object> paras1 = new Dictionary <string, object>();

            paras1["Job_OrderState"] = null;

            UI_WFEntity_Info wfei = CWFEngine.GetWorkFlowEntityWithParams(Convert.ToInt32(wfe_id), paras1);

            ViewBag.Job_OrderState = paras1["Job_OrderState"].ToString();
            int             cur_PersionID = (Session["User"] as EquipModel.Entities.Person_Info).Person_Id;
            PersonManagment pm            = new PersonManagment();

            EquipBLL.AdminManagment.PersonManagment.P_viewModal pv = pm.Get_PersonModal(cur_PersionID);
            ViewBag.user_Role   = pv.Role_Names;
            ViewBag.user_Depart = pv.Department_Name;
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);

            ViewBag.currentMiss = miss;
            return(View(getWFDetail_Model(wfe_id)));
        }
Exemplo n.º 17
0
        //获得工作流实体的当前任务
        public static UI_MISSION GetActiveMission <T>(int entity_id, ObjectContext oc, bool bAuthCheck = true)
        {
            UI_MISSION miss = new UI_MISSION();

            WorkFlows wfs = new WorkFlows();

            WorkFlow_Entity wfe = wfs.GetWorkFlowEntity(entity_id);

            miss.WE_Entity_Id  = wfe.WE_Id;
            miss.WE_Name       = wfs.GetWorkFlowEntityName(wfe.WE_Id);
            miss.WE_Entity_Ser = wfe.WE_Ser;

            //恢复工作流实体
            CWorkFlow   wf  = new CWorkFlow();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
            wf.InstFromXmlNode(doc.DocumentElement);
            wf.EntityID = wfe.WE_Id;
            //权限验证
            if (bAuthCheck)
            {
                IEvent ev = wf.GetCurrentEvent();
                if (!ev.CheckAuthority <T>((Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                {
                    return(null);
                }
            }

            miss.WE_Event_Name = wf.GetCurrentEvent().name;
            miss.WE_Event_Desc = wf.GetCurrentEvent().description;
            miss.Mission_Url   = wf.CurrentEventLink();
            //读取参数的值
            foreach (var pa in wf.GetCurrentEvent().paramlist)
            {
                miss.Miss_Params[pa.Key]       = pa.Value.value;
                miss.Miss_ParamsAppRes[pa.Key] = wf.GetCurrentEvent().paramsApp_res[pa.Key];
            }

            return(miss);
        }
Exemplo n.º 18
0
        //获取当前任务列表

        /*public static List<UI_MISSION> GetActiveMissions<T>(ObjectContext oc, string Entity_name="ALL", bool bAuthCheck = true)
         * {
         *  List<UI_MISSION> missions = new List<UI_MISSION>();
         *
         *  WorkFlows wfs = new WorkFlows();
         *  List<WorkFlow_Entity> wfes = wfs.GetActiveWorkFlowEntities(Entity_name);
         *
         *  foreach(WorkFlow_Entity wfe in wfes)
         *  {
         *
         *
         *      UI_MISSION mi = new UI_MISSION();
         *      mi.WE_Entity_Id = wfe.WE_Id;
         *      mi.WE_Name = wfs.GetWorkFlowEntityName(wfe.WE_Id);
         *
         *      //恢复工作流实体
         *      CWorkFlow wf = new CWorkFlow();
         *      XmlDocument doc = new XmlDocument();
         *      doc.LoadXml(Encoding.Default.GetString(wfe.WE_Binary));
         *      wf.InstFromXmlNode(doc.DocumentElement);
         *      wf.EntityID = wfe.WE_Id;
         *      wf.EntitySerial = wfe.WE_Ser;
         *
         *      //if (wf.CurrentEventLink() == "")
         *      //    continue;
         *
         *      //权限验证
         *      if (bAuthCheck)
         *      {
         *          IEvent ev = wf.GetCurrentEvent();
         *          if (!ev.CheckAuthority<T>(authority_params, oc))
         *              continue;
         *      }
         *
         *
         *      mi.WE_Event_Name = wf.GetCurrentEvent().name;
         *      mi.WE_Event_Desc = wf.GetCurrentEvent().description;
         *      mi.Mission_Url = wf.CurrentEventLink();
         *      //读取参数的值
         *      foreach(var pa in wf.GetCurrentEvent().paramlist)
         *      {
         *          mi.Miss_Params[pa.Key] = pa.Value.value;
         *      }
         *
         *      missions.Add(mi);
         *  }
         *  return missions;
         * }*/
        public static List <UI_MISSION> GetActiveMissions <T>(ObjectContext oc, string Entity_name = "ALL", bool bAuthCheck = true)
        {
            List <UI_MISSION> missions = new List <UI_MISSION>();

            WorkFlows           wfs  = new WorkFlows();
            List <CURR_Mission> cMis = wfs.GetActiveMissionsOfEntity(Entity_name);

            foreach (CURR_Mission cm in cMis)
            {
                UI_MISSION mi = new UI_MISSION();
                mi.WE_Entity_Id = cm.WFE_ID;


                //if (wf.CurrentEventLink() == "")
                //    continue;

                //权限验证
                if (bAuthCheck)
                {
                    CAuthority author = new CAuthority();
                    author.auth_string = cm.Str_Authority;

                    //if (!author.CheckAuth<T>(new Dictionary<string, object>(), authority_params[HttpContext.Current.Session.SessionID], oc))
                    //    continue;
                    if (!author.CheckAuth <T>(new Dictionary <string, object>(), (Dictionary <string, object>)HttpContext.Current.Session[authority_params], oc))
                    {
                        continue;
                    }
                }


                mi.WE_Event_Name = cm.Miss_Name;
                mi.WE_Event_Desc = cm.Miss_Desc;
                mi.Mission_Url   = cm.Current_Action + @"/?wfe_id=" + mi.WE_Entity_Id;
                mi.WE_Event_Desc = cm.Miss_Desc;


                missions.Add(mi);
            }
            return(missions);
        }
Exemplo n.º 19
0
        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()));
        }
Exemplo n.º 20
0
        // GET: /A7dot1dot1/检修单位确认
        public ActionResult JxdwConfirm(string wfe_id)
        {
            int             cur_PersionID = (Session["User"] as EquipModel.Entities.Person_Info).Person_Id;
            PersonManagment pm            = new PersonManagment();

            EquipBLL.AdminManagment.PersonManagment.P_viewModal pv = pm.Get_PersonModal(cur_PersionID);
            ViewBag.user_specis = pv.Speciaty_Names;
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);

            ViewBag.currentMiss = miss;
            //由于DongZyConfirm_done 等变量未与该Event关联,所以无法获取, 故而我在下面模拟了这几个变量
            //同样的问题也会出现在JxdwConfirm_submitsignal函数中
            //WFDetail_Model dfm = getWFDetail_Model(wfe_id);
            //dfm.ALLHistoryMiss.Last().Miss_Params["DongZyConfirm_done"] = true.ToString();
            //dfm.ALLHistoryMiss.Last().Miss_Params["DongZyMan"] = "fhp";
            //dfm.ALLHistoryMiss.Last().Miss_Params["DianZyConfirm_done"] = false.ToString();
            //dfm.ALLHistoryMiss.Last().Miss_Params["DianZyMan"] = "";
            //dfm.ALLHistoryMiss.Last().Miss_Params["YiZyConfirm_done"] = false.ToString();
            //dfm.ALLHistoryMiss.Last().Miss_Params["YiZyMan"] = "";
            return(View(getWFDetail_Model(wfe_id)));
            //return View(dfm);
        }
Exemplo n.º 21
0
        public ActionResult Submit(string wfe_id)
        {
            EquipManagment EM = new EquipManagment();

            UI_MISSION mi = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
            Dictionary <string, object> mi_params = mi.Miss_Params;
            string                 cj_name        = mi.Miss_Params["Cj_Name"].ToString();
            string                 tempjob_name   = mi.Miss_Params["Job_Name"].ToString();
            A6dot2Managment        AM             = new A6dot2Managment();
            int                    i     = 1;
            List <A6dot2LsTaskTab> rList = AM.getLsTask(wfe_id);

            //string cj_name = "2";
            //string tempjob_name = "test";
            ViewBag.wfe_id = wfe_id;
            A6dot2dot2InfoModal infoModal = new A6dot2dot2InfoModal();

            infoModal.tempjob_name = tempjob_name;
            infoModal.cj_name      = cj_name;
            infoModal.wfe_id       = wfe_id;
            infoModal.All_Zz       = EM.getZzs_ofCj(Convert.ToInt32(cj_name));

            return(View(infoModal));
        }
Exemplo n.º 22
0
        public string Query_HistoryFlow(string time, string flow_id, string equip_gycode)//string json1)//,)
        {
            // JObject item = (JObject)JsonConvert.DeserializeObject(json1);
            List <object> r = new List <object>();

            if (time != "" || flow_id != "" || equip_gycode != "")
            {
                string Equip_GyCode = equip_gycode;
                string record_filter;

                if (time == "")
                {
                    record_filter = "1<>1";
                }
                else
                {
                    string[] strtime = time.Split(new char[] { '-' });
                    record_filter = "time >= '" + strtime[0] + "00:00:00'" + "and  time <= '" + strtime[1] + " 00:00:00'";
                }
                string Query_list = "distinct E.WE_Ser ,E.WE_Id,R.time  ";
                string Query_condition;
                if ((flow_id == "" && Equip_GyCode == ""))
                {
                    Query_condition = "";
                }
                else
                {
                    if (flow_id != "")
                    {
                        Query_condition = "E.W_Name like '%" + flow_id + "%'";
                        if (equip_gycode != "")
                        {
                            Query_condition = Query_condition + "  and P.Equip_Code like '%" + Equip_GyCode + "%'";
                        }
                    }
                    else
                    {
                        Query_condition = "P.Equip_Code like'%" + Equip_GyCode + "%'";
                    }
                }

                System.Data.DataTable dt = CWFEngine.QueryAllInformation(Query_list, Query_condition, record_filter);



                for (var i = 0; i < dt.Rows.Count; i++)
                {
                    UI_MISSION lastMi  = CWFEngine.GetHistoryMissions(Convert.ToInt32(dt.Rows[i].ItemArray[1])).Last();
                    int        Miss_Id = lastMi.Miss_Id;
                    IDictionary <string, string> rr = CWFEngine.GetMissionRecordInfo(Miss_Id);
                    string userName = "";
                    string missTime = "";
                    if (r.Count > 0)
                    {
                        userName = rr["username"];
                        missTime = rr["time"];
                    }

                    object o = new
                    {
                        index        = i,
                        Flow_Name    = "<a  onclick=\"DispalsySide('" + dt.Rows[i].ItemArray[0].ToString() + "')\"> " + dt.Rows[i].ItemArray[0].ToString() + "</a>",
                        Mission_Name = CWFEngine.GetWorkFlowEntiy(Convert.ToInt32(dt.Rows[i].ItemArray[1]), true).description,
                        Mission_Time = userName,
                        Mission_User = missTime
                    };
                    r.Add(o);
                }
            }
            string str = JsonConvert.SerializeObject(r);

            return("{" + "\"data\": " + str + "}");
        }
Exemplo n.º 23
0
        public string A8ActiveList(string WorkFlow_Name)
        {
            string username = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;


            string          WE_Status       = "0";
            string          query_list      = "distinct E.WE_Ser, E.WE_Id, R.username";
            string          query_condition = "E.W_Name='" + WorkFlow_Name + "' and E.WE_Status='" + WE_Status + "' and R.username is not null";
            string          record_filter   = "username is not null";
            DataTable       dt     = CWFEngine.QueryAllInformation(query_list, query_condition, record_filter);
            List <Gxqmodel> Gmlist = new List <Gxqmodel>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Gxqmodel Gm = new Gxqmodel();
                Gm.WE_Id  = Convert.ToInt16(dt.Rows[i]["WE_Id"]);
                Gm.WE_Ser = dt.Rows[i]["WE_Ser"].ToString();
                Gmlist.Add(Gm);
            }
            List <A8Model>    Hm  = new List <A8Model>();
            ERPInfoManagement erp = new ERPInfoManagement();

            foreach (var item in Gmlist)
            {
                A8Model h = new A8Model();

                Dictionary <string, object> paras = new Dictionary <string, object>();
                paras["Equip_GyCode"] = null;
                paras["Job_Order"]    = null; //通过工单找通知单号
                paras["Zz_Name"]      = null;
                paras["Job_Name"]     = null; //计划名称

                UI_WFEntity_Info wfei = CWFEngine.GetWorkFlowEntityWithParams(item.WE_Id, paras);
                h.zz_name   = paras["Zz_Name"].ToString();
                h.sb_gycode = paras["Equip_GyCode"].ToString();
                h.job_order = paras["Job_Order"].ToString();
                h.plan_name = paras["Job_Name"].ToString();
                GD_InfoModal res = erp.getGD_Modal_GDId(paras["Job_Order"].ToString());
                if (res != null)
                {
                    h.notice_order = res.GD_Notice_Id;
                }
                h.gd_state = "检修中";
                WorkFlows wfsd          = new WorkFlows();
                Mission   db_missA8dot2 = wfsd.GetWFEntityMissions(item.WE_Id).Last();
                //写if而不写else if是因为13.1和8.2是断开的,跳转8.2仍满足db_miss.Miss_Desc == "专业团队审核"
                if (db_missA8dot2.Miss_Desc == "检修单位按计划建立工单,完善工序、组件")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "检修计划提报")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "现场工程师审核工单")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "专业团队审1")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "可靠性工程师审1")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "机动处计划科审2")
                {
                    if (res != null)
                    {
                        h.gd_state = res.GD_State;
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "物资处采购,填写到货时间")
                {
                    h.gd_state = "物资采购中";
                }
                else if (db_missA8dot2.Miss_Desc == "物资处确认到货并通知检修单位")
                {
                    h.gd_state = "物资已到货";
                }
                else if (db_missA8dot2.Miss_Desc == "检修单位上传检修方案" || db_missA8dot2.Miss_Desc == "专业团队审批" || db_missA8dot2.Miss_Desc == "检修单位填写检修内容及关键工序,关联作业指导书" || db_missA8dot2.Miss_Desc == "可靠性工程师审批")
                {
                    h.gd_state = "检修方案制定与审判";
                }
                else if (db_missA8dot2.Miss_Desc == "现场工程师确认是否可实施计划")
                {
                    UI_MISSION           ui       = new UI_MISSION();
                    List <Mission_Param> mis_pars = wfsd.GetMissParams(db_missA8dot2.Miss_Id);//获取当前任务参数
                    foreach (var par in mis_pars)
                    {
                        CParam cp = new CParam();
                        ui.Miss_Params[cp.name] = cp.value;
                    }
                    if (ui.Miss_Params["ZzConfirmPlan_Result"].ToString() == "是")
                    {
                        h.gd_state = "检修计划实施中";
                    }
                    else if (ui.Miss_Params["ZzConfirmPlan_Result"].ToString() == "否")
                    {
                        h.gd_state = "检修计划延期";
                    }
                }
                else if (db_missA8dot2.Miss_Desc == "检修单位确认施工完毕,上传交工资料")
                {
                    h.gd_state = "处理完成";
                }
                h.Data_Src = "待定";
                h.detail   = "待定";
                Hm.Add(h);
            }
            List <object> or = new List <object>();

            for (int i = 0; i < Hm.Count; i++)
            {
                object o = new
                {
                    index        = i + 1,
                    equip_gycode = Hm[i].sb_gycode,
                    job_order    = Hm[i].job_order,
                    notice_order = Hm[i].notice_order,
                    gd_state     = Hm[i].gd_state,
                    datasrc      = Hm[i].Data_Src,
                    detail       = Hm[i].detail,
                    zzname       = Hm[i].zz_name,
                    planname     = Hm[i].plan_name
                };
                or.Add(o);
            }
            string str = JsonConvert.SerializeObject(or);

            return("{" + "\"data\": " + str + "}");
        }
Exemplo n.º 24
0
        //获得系统所有的工作流定义
        public static List <UI_MissParam> GetMissionParams(int entity_id, int missId)
        {
            UI_MISSION          miss = null;
            List <UI_MISSION>   m;
            List <UI_MissParam> Listmp = new List <UI_MissParam>();

            m = CWFEngine.GetHistoryMissions(entity_id);
            foreach (var item in m)
            {
                if (item.Miss_Id != missId)
                {
                    continue;
                }
                else
                {
                    miss = item; break;
                }
            }

            foreach (var item in miss.Miss_ParamsAppRes)
            {
                if (miss.Miss_ParamsAppRes[item.Key] != "App_hidden")
                {
                    UI_MissParam mp = new UI_MissParam();
                    mp.Param_Desc  = miss.Miss_ParamsDesc[item.Key].ToString();
                    mp.Param_Value = miss.Miss_Params[item.Key].ToString();
                    if (mp.Param_Desc.IndexOf("附件") > -1)
                    {
                        mp.Param_isFile = 1;
                        if (mp.Param_Desc.IndexOf("附件") > -1 && mp.Param_Value != "")
                        {
                            string[] savedFileName     = mp.Param_Value.Split(new char[] { '$' });
                            string   saveExistFilename = Path.Combine("/Upload", savedFileName[1]);
                            mp.Param_SavedFilePath  = savedFileName[0];
                            mp.Param_UploadFilePath = saveExistFilename;
                        }
                    }
                    else
                    {
                        mp.Param_isFile         = 0;
                        mp.Param_SavedFilePath  = "";
                        mp.Param_UploadFilePath = "";
                    }

                    Listmp.Add(mp);
                }
            }
            return(Listmp);


            /*   m=wfs.GetMissParams(missId);
             * foreach(var item in m)
             * {
             *     UI_MissParam m1 = new UI_MissParam();
             *     m1.Param_Name=item.Param_Name;
             *     m1.Param_Value=item.Param_Value;
             *     m1.Param_Type=item.Param_Type;
             *     m1.Param_Desc=item.Param_Desc;
             *     m1.Param_AppRes = wf.paramstable[item.Param_Name].linkEventsApp_res[event_Name];
             *
             *     missParams.Add(m1);
             * }
             * return missParams;*/
        }
Exemplo n.º 25
0
        public string getdcllist(string jobName, string time, string depts, string wfe_ids)
        {
            string        run_results  = wfe_ids.TrimStart('[').TrimEnd(']');
            List <string> run_enity_id = new List <string>();
            List <int>    wfe_id       = new List <int>();

            if (run_results.Contains(','))
            {
                run_enity_id = run_results.Split(new char[] { ',' }).ToList();
            }
            else
            {
                run_enity_id.Add(run_results);
            }
            for (int i = 0; i < run_enity_id.Count(); i++)
            {
                wfe_id.Add(Convert.ToInt16(run_enity_id[i]));
            }


            // string WorkFlow_Name = "A5dot1";
            List <LSA5Model> Am = new List <LSA5Model>();
            // List<UI_MISSION> miss;
            List <object> or = new List <object>();

            //miss = CWFEngine.GetActiveMissions<Person_Info>(((IObjectContextAdapter)(new EquipWebContext())).ObjectContext, WorkFlow_Name, true);
            foreach (var item in wfe_id)
            {
                LSA5Model o = new LSA5Model();
                Dictionary <string, object> paras = new Dictionary <string, object>();
                paras["Zz_Name"] = null;
                UI_WFEntity_Info wfei   = CWFEngine.GetWorkFlowEntityWithParams(item, paras);
                UI_MISSION       lastMi = CWFEngine.GetHistoryMissions(item).Last();

                int Miss_Id = lastMi.Miss_Id;
                IDictionary <string, string> r = CWFEngine.GetMissionRecordInfo(Miss_Id);
                if (r.Count > 0)
                {
                    //o.userName = r["username"];
                    o.missTime = r["time"];
                }
                else
                {
                    // o.userName = "";
                    o.missTime = "";
                }
                //if (item.Mission_Url.Contains("dot"))
                //    o.miss_url = item.Mission_Url;
                //else
                //    o.miss_url = "";
                o.wfe_serial = wfei.serial;
                o.zz_name    = paras["Zz_Name"].ToString();
                o.miss_url   = "/LSA5dot2/ZzSubmit/?wfe_id=" + item.ToString();
                Am.Add(o);
            }
            for (int i = 0; i < Am.Count; i++)
            {
                object o = new
                {
                    wfe_serial = Am[i].wfe_serial,
                    zz_Name    = Am[i].zz_name,
                    job_name   = jobName,
                    time       = time,
                    missTime   = Am[i].missTime,
                    depts      = depts,
                    miss_url   = Am[i].miss_url
                };
                or.Add(o);
            }
            string str = JsonConvert.SerializeObject(or);

            return("{" + "\"data\": " + str + "}");
        }
Exemplo n.º 26
0
          public ActionResult DSZzSubmit(string wfe_id)
          {
              submitmodel sm = new submitmodel();
              ViewBag.curtime = DateTime.Now;
              ViewBag.curuser = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
              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("可靠性工程师"))
                  sm.kkxgcs = 1;
              if (pv.Role_Names.Contains("检维修人员"))
                  sm.jwxry = 1;
              ERPInfoManagement erp = new ERPInfoManagement();
              EquipArchiManagment em = new EquipArchiManagment();
              UI_MISSION mi = CWFEngine.GetActiveMission<Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);
              Dictionary<string, object> mi_params = mi.Miss_Params;
              ViewBag.Pqname = mi.Miss_Params["Pqname"].ToString();
              string ea_code = em.getEa_codebyname(mi.Miss_Params["Pqname"].ToString());
              ViewBag.timesNonPlanStop=erp.getNoticesYx_1(mi.Miss_Params["Pqname"].ToString());
              ViewBag.scoreDeductFaultIntensity = (erp.getNoticesYx_1(mi.Miss_Params["Pqname"].ToString()) * 50) + (erp.getNoticeYx_2(mi.Miss_Params["Pqname"].ToString()) * 30) + (erp.getNoticeYx_3(mi.Miss_Params["Pqname"].ToString()) * 20) + (erp.getNoticeYx_4(mi.Miss_Params["Pqname"].ToString()) * 5);
              ViewBag.rateFaultMaintenance = erp.getFaultRation(mi.Miss_Params["Pqname"].ToString());
              ViewBag.MTBF = erp.getNonFaultInterVal(mi.Miss_Params["Pqname"].ToString());
              ViewBag.rateEquipUse = erp.DeliverRatio(mi.Miss_Params["Pqname"].ToString());
              ViewBag.rateBigUnitFault = erp.bigEquipsRatio(mi.Miss_Params["Pqname"].ToString());
              ViewBag.wfe_id = wfe_id;
              TablesManagment tm = new TablesManagment();
              EquipManagment Em = new EquipManagment();
              List<EANummodel> E = Em.getequipnum_byarchi();
              List<Equip_Archi> AllCj_List = Em.GetAllCj();

              List<WebApp.Controllers.A5dot1Controller.NameandNum> cj = new List<WebApp.Controllers.A5dot1Controller.NameandNum>();
              List<WebApp.Controllers.A5dot1Controller.NameandNum> pq = new List<WebApp.Controllers.A5dot1Controller.NameandNum>();




              for (int i = 0; i < AllCj_List.Count; i++)
              {
                  int count = 0;
                  WebApp.Controllers.A5dot1Controller.NameandNum temp1 = new WebApp.Controllers.A5dot1Controller.NameandNum();
                  temp1.name = AllCj_List[i].EA_Name;
                  for (int j = 0; j < E.Count; j++)
                  {
                      if (AllCj_List[i].EA_Id == Em.getEA_parentid(E[j].EA_Id))
                          count += E[j].Equip_Num;
                  }
                  temp1.Equip_Num = count;
                  cj.Add(temp1);
                  count = 0;
              }
            
              WebApp.Controllers.A5dot1Controller.NameandNum temp = new WebApp.Controllers.A5dot1Controller.NameandNum();
              temp.name = mi.Miss_Params["Pqname"].ToString();
              List<Pq_Zz_map> Pq_Zz_map = Em.GetZzsofPq(mi.Miss_Params["Pqname"].ToString());
              int count1 = 0;
              for (int j = 0; j < Pq_Zz_map.Count; j++)
              {
                 
                  for (int z = 0; z < E.Count; z++)
                  {
                      if (Pq_Zz_map[j].Zz_Name == Em.getEa_namebyid(E[z].EA_Id))
                          count1 += E[z].Equip_Num;
                  }
              }
              temp.Equip_Num = count1;
              pq.Add(temp);

              double pq_bwh = 0.00;
              for (int i = 0; i < pq.Count; i++)
              {
                  List<A5dot1Tab1> pq_list = tm.get_pq_bwh(pq[i].name, pq[i].Equip_Num);
                  double pq_bxhcount = 0;
                  int wzg_count = 0;
                  if (pq_list.Count > 0)
                  {
                      pq_bxhcount = 0;
                      wzg_count = 0;
                      string sbcode_temp = pq_list[0].sbCode;
                      for (int j = 0; j < pq_list.Count; j++)
                      {
                          pq_list = tm.get_cj_bwh(cj[i].name, cj[i].Equip_Num);
                          if (pq_list[j].temp1 == null)
                          {
                              List<A5dot1Tab1> cj_bycode = tm.GetAll1_bycode(pq_list[j].sbCode);
                              for (int k = 0; k < cj_bycode.Count; k++)
                              {
                                  if (cj_bycode[k].isRectified == 0)
                                  {
                                      wzg_count++;
                                  }
                                  tm.modifytemp1_byid(cj_bycode[k].Id, "已合并");

                              }
                              if (wzg_count > 0)
                              {
                                  pq_bxhcount++;
                              }
                              wzg_count = 0;
                          }

                          // cjbwh.Add(f);
                      }
                  }

                  for (int n = 0; n < pq_list.Count; n++)
                  {
                      tm.modifytemp1_byid(pq_list[n].Id, null);
                  }
                  pq_bwh=Math.Round(((double)pq_bxhcount / pq[i].Equip_Num), 6);
              }
              ViewBag.Pq_bwh = (1-pq_bwh)*100;
              return View(sm);
          }
Exemplo n.º 27
0
        public string OutputExcel(string wfe_id)
        {
            UI_MISSION miss = CWFEngine.GetActiveMission <Person_Info>(int.Parse(wfe_id), ((IObjectContextAdapter)(new EquipWebContext())).ObjectContext);

            try
            {
                string th_record  = Convert.ToString(miss.Miss_Params["Th_ItemRecord"]);
                string th_problem = Convert.ToString(miss.Miss_Params["Th_ProblemRecords"]);
                string th_detail  = Convert.ToString(miss.Miss_Params["Th_WorkDetail"]);

                string work_detail = th_detail;

                JArray j_Problem_data = JArray.Parse(th_problem);

                JArray j_Thjl_data = JArray.Parse(th_record);

                // Console.WriteLine(work_detail);


                // 创建Excel 文档

                HSSFWorkbook wk = new HSSFWorkbook();

                ISheet tb = wk.CreateSheet("sheet1");

                //设置单元的宽度
                tb.SetColumnWidth(0, 25 * 256);
                tb.SetColumnWidth(1, 20 * 256);
                tb.SetColumnWidth(2, 20 * 256);
                tb.SetColumnWidth(3, 45 * 256);


                //合并标题头,该方法的参数次序是:开始行号,结束行号,开始列号,结束列号。
                tb.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(0, 0, 0, 3));

                IRow head = tb.CreateRow(0);

                head.Height = 20 * 30;
                ICell      head_first_cell = head.CreateCell(0);
                ICellStyle cellStyle_head  = wk.CreateCellStyle();

                //对齐
                cellStyle_head.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
                // 边框

                /*
                 * cellStyle_head.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_head.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_head.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_head.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
                 * */

                // 字体
                IFont font = wk.CreateFont();
                font.FontName           = "微软雅黑";
                font.Boldweight         = 8;
                font.FontHeightInPoints = 16;
                cellStyle_head.SetFont(font);

                head_first_cell.CellStyle                     = head.CreateCell(1).CellStyle
                                                              = head.CreateCell(2).CellStyle
                                                              = head.CreateCell(3).CellStyle
                                                              = cellStyle_head;


                head_first_cell.SetCellValue("Ⅰ催化气压机特护记录");
                tb.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(1, 1, 0, 3));

                IRow row1 = tb.CreateRow(1);
                row1.Height = 20 * 20;

                ICell row1_last = row1.CreateCell(0);



                ICellStyle cellStyle_row1 = wk.CreateCellStyle();
                cellStyle_row1.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Right;

                /*
                 * cellStyle_row1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_row1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_row1.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
                 * cellStyle_row1.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
                 * */
                row1_last.CellStyle = row1.CreateCell(1).CellStyle = row1.CreateCell(2).CellStyle = row1.CreateCell(3).CellStyle = cellStyle_row1;
                row1_last.SetCellValue("JD04-JD01");;

                IRow table_head = tb.CreateRow(2);

                ICellStyle cellStyle_normal = wk.CreateCellStyle();

                cellStyle_normal.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
                cellStyle_normal.BorderLeft   = NPOI.SS.UserModel.BorderStyle.Thin;
                cellStyle_normal.BorderRight  = NPOI.SS.UserModel.BorderStyle.Thin;
                cellStyle_normal.BorderTop    = NPOI.SS.UserModel.BorderStyle.Thin;

                ICell table_head_name = table_head.CreateCell(0);
                table_head_name.CellStyle = cellStyle_normal;
                table_head_name.SetCellValue("项目");

                ICell table_head_standrad = table_head.CreateCell(1);
                table_head_standrad.CellStyle = cellStyle_normal;
                table_head_standrad.SetCellValue("设计值");

                ICell table_head_exact = table_head.CreateCell(2);
                table_head_exact.CellStyle = cellStyle_normal;
                table_head_exact.SetCellValue("实测值");

                ICell table_head_thjl = table_head.CreateCell(3);
                table_head_thjl.CellStyle = cellStyle_normal;
                table_head_thjl.SetCellValue("特护记录");



                ICellStyle thjl_record_cellStyle = wk.CreateCellStyle();

                thjl_record_cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
                thjl_record_cellStyle.BorderLeft   = NPOI.SS.UserModel.BorderStyle.Thin;
                thjl_record_cellStyle.BorderRight  = NPOI.SS.UserModel.BorderStyle.Thin;
                thjl_record_cellStyle.BorderTop    = NPOI.SS.UserModel.BorderStyle.Thin;
                //水平对齐
                thjl_record_cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
                //垂直对齐
                thjl_record_cellStyle.VerticalAlignment = VerticalAlignment.Top;
                //自动换行
                thjl_record_cellStyle.WrapText = true;


                int row_index = 3;

                for (int i = 0; i < j_Thjl_data.Count; i++)
                {
                    JObject j_obj = JObject.Parse(j_Thjl_data[i].ToString());


                    IRow  thjl_row  = tb.CreateRow(row_index);
                    ICell thjl_name = thjl_row.CreateCell(0);
                    thjl_name.CellStyle = cellStyle_normal;
                    thjl_name.SetCellValue(j_obj["name"].ToString());

                    ICell thjl_standard_value = thjl_row.CreateCell(1);
                    thjl_standard_value.CellStyle = cellStyle_normal;
                    thjl_standard_value.SetCellValue(j_obj["standard_value"].ToString());

                    ICell thjl_exact_value = thjl_row.CreateCell(2);
                    thjl_exact_value.CellStyle = cellStyle_normal;
                    thjl_exact_value.SetCellValue(j_obj["exact_value"].ToString());

                    thjl_row.CreateCell(3).CellStyle = thjl_record_cellStyle;

                    row_index++;
                }

                tb.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(3, row_index - 1, 3, 3));

                ICell thjl_record = tb.GetRow(3).CreateCell(3);
                thjl_record.CellStyle = thjl_record_cellStyle;


                String thjl_detail = "工作要点: " + "\r\n" + work_detail + "\r\n" + "\r\n" + "\r\n";
                thjl_detail = thjl_detail + "设备问题: " + "\r\n";
                for (int i = 0; i < j_Problem_data.Count; i++)
                {
                    JObject j_obj = JObject.Parse(j_Problem_data[i].ToString());
                    Console.WriteLine(j_obj["problem_catalogy"].ToString());
                    Console.WriteLine(j_obj["problem_detail"].ToString());
                    thjl_detail = thjl_detail + (i + 1) + ". " + "问题分类: " +
                                  j_obj["problem_catalogy"].ToString() + " ; 问题描述: " + j_obj["problem_detail"].ToString() + "\r\n";
                }

                thjl_record.SetCellValue(thjl_detail);


                IRow last_row = tb.CreateRow(row_index);
                last_row.CreateCell(0).SetCellValue("检查时间:");
                last_row.CreateCell(1).SetCellValue(miss.Miss_Params["Th_CheckTime"].ToString());
                last_row.CreateCell(2).SetCellValue("检查人:");
                last_row.CreateCell(3).SetCellValue(miss.Miss_Params["Th_CheckMen"].ToString());


                string path = Server.MapPath("~/Upload//特护记录表.xls");
                using (FileStream fs = System.IO.File.OpenWrite(path)) //打开一个xls文件,如果没有则自行创建,如果存在myxls.xls文件则在创建是不要打开该文件!
                {
                    wk.Write(fs);                                      //向打开的这个xls文件中写入mySheet表并保存。
                    Console.WriteLine("提示:创建成功!");
                }
                return(Path.Combine("/Upload", "特护记录表.xls"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return("");
            }
        }
Exemplo n.º 28
0
        public string JdcConfirm_submitsignal(string json1)
        {
            JObject                     item     = (JObject)JsonConvert.DeserializeObject(json1);
            string                      flowname = item["Flow_Name"].ToString();
            A6dot2Managment             WM       = new A6dot2Managment();
            FileItem                    file     = new FileItem();
            int                         Equip_Id = 0;
            Dictionary <string, string> signal   = new Dictionary <string, string>();

            //new input paras
            signal["JdcConfirm_Result"] = item["JdcConfirm_Result"].ToString();
            signal["JdcSupplement"]     = item["JdcSupplement"].ToString();
            //上传到File_Info

            if (signal["JdcConfirm_Result"] == "通过")
            {
                //向File_Info里写文件信息
                WorkFlows      wfsd    = new WorkFlows();
                List <Mission> db_miss = wfsd.GetWFEntityMissions(Convert.ToInt32(flowname));//获取该实体的所有任务
                for (int i = 0; i < db_miss.Count; i++)
                {
                    if (db_miss[i].Miss_Desc == "可靠性工程师修改再上传")
                    {
                        UI_MISSION ui_mi = new UI_MISSION();
                        ui_mi.WE_Entity_Id  = Convert.ToInt32(flowname);
                        ui_mi.WE_Event_Desc = db_miss[i].Miss_Desc;
                        ui_mi.WE_Event_Name = db_miss[i].Event_Name;
                        ui_mi.WE_Name       = db_miss[i].Miss_Name;
                        ui_mi.Mission_Url   = ""; //历史任务的页面至空
                        ui_mi.Miss_Id       = db_miss[i].Miss_Id;


                        List <Mission_Param> mis_pars = wfsd.GetMissParams(db_miss[i].Miss_Id);//获取当前任务参数
                        foreach (var par in mis_pars)
                        {
                            CParam cp = new CParam();
                            cp.type                    = par.Param_Type;
                            cp.name                    = par.Param_Name;
                            cp.value                   = par.Param_Value;
                            cp.description             = par.Param_Desc;
                            ui_mi.Miss_Params[cp.name] = cp.value;
                            // ui_mi.Miss_ParamsAppRes[cp.name] = wf.paramstable[cp.name].linkEventsApp_res[ui_mi.WE_Event_Name];
                            ui_mi.Miss_ParamsDesc[cp.name] = cp.description;//xwm modified
                        }
                        Equip_Id = WM.GetEquipIdBySbCode(ui_mi.Miss_Params["Equip_Code"].ToString());
                        string[] File_AllName = ui_mi.Miss_Params["ModifyOperInstruc"].ToString().Split(new char[] { '$' });
                        file.fileName        = File_AllName[0];
                        file.fileNamePresent = File_AllName[1];
                        file.ext             = Path.GetExtension(ui_mi.Miss_Params["ModifyOperInstruc"].ToString());
                        file.updateTime      = DateTime.Now.ToString();
                        file.Mission_Id      = db_miss[i].Miss_Id;
                        file.WfEntity_Id     = Convert.ToInt32(flowname);
                        //file.Self_Catalog_Catalog_Id = 28;
                        file.path = @"/Upload/A3dot3";
                        bool res = WM.AddNewFile(28, file);
                        break;
                    }
                }
                //通过上传时间找到刚才上传到File_Info的文件的File_Id
                int File_Id = WM.GetFileIdByUpdateTime(Convert.ToDateTime(file.updateTime));
                //调用File.cs里的AttachtoEuip使连接表产生数据,让设备与操作规程勾连,需要用到Equip_Id和File_Id
                bool les = WM.AttachtoEuipAndFile(File_Id, Equip_Id);
            }
            Dictionary <string, string> record = new Dictionary <string, string>();

            record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
            record["time"]     = DateTime.Now.ToString();
            CWFEngine.SubmitSignal(Convert.ToInt32(flowname), signal, record);
            return("/A6dot1/Index");
        }