Example #1
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);
          }