Example #1
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)));
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
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");
        }
Example #5
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);
        }
Example #6
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());
        }
Example #7
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());
        }
Example #8
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)));
        }
Example #9
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 }));
        }
Example #10
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);
                }
            }
        }
Example #11
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)));//
        }
Example #12
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)));
        }
Example #13
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);
        }
Example #14
0
        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()));
        }
Example #15
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));
        }
Example #16
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("");
            }
        }
Example #17
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);
          }