public Index_ModelforA5dot2Tab2 jdcSummy(DateTime time) { Index_ModelforA5dot2Tab2 jdcSummy = new Index_ModelforA5dot2Tab2(); jdcSummy.Am = new List <A5dot2Tab2>(); jdcSummy.Hm = new List <A5dot2Tab2>(); ViewBag.curtime = DateTime.Now.ToString(); ViewBag.curuser = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name; string yearandmonth = time.Year + "年" + time.Month; List <A5dot2Tab2> miss = Sx.jdcsum(yearandmonth); foreach (var item in miss) { A5dot2Tab2 a = new A5dot2Tab2(); a.cjName = item.cjName; a.zzName = item.zzName; a.sbGyCode = item.sbGyCode; a.sbCode = item.sbCode; a.problemDescription = item.problemDescription; a.Id = item.Id; jdcSummy.Am.Add(a); } return(jdcSummy); }
public Index_ModelforA5dot2Tab2 getRecordforIndex() { Index_ModelforA5dot2Tab2 record = new Index_ModelforA5dot2Tab2(); record.Am = new List <A5dot2Tab2>(); ViewBag.curtime = DateTime.Now.ToString(); ViewBag.curuser = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name; DateTime time = DateTime.Now; string yearandmonth = ""; if (time.Day > 15) { time = time.AddMonths(+1); yearandmonth = time.Year + "年" + time.Month; //record.title = time.Year.ToString() + "-" + time.AddMonths(1).Month.ToString() + "月" + "最脏十台机泵"; } else if (time.Day < 15) { yearandmonth = time.Year + "年" + time.Month; //record.title = time.Year.ToString() + "-" + time.Month.ToString() + "月" + "最脏十台机泵"; } record.title = "2016-8月最脏十台机泵"; List <A5dot2Tab2> miss = Sx.jdcsum("2016年8"); foreach (var item in miss) { A5dot2Tab2 a = new A5dot2Tab2(); //List<A5dot2Tab1> uncomplete = Sx.uncom(item.sbCode,time); a.cjName = item.cjName; a.zzName = item.zzName; a.sbGyCode = item.sbGyCode; a.sbCode = item.sbCode; a.sbType = item.sbType; a.nProblemsInCurMonth = item.nProblemsInCurMonth; a.nProblemsInCurYear = item.nProblemsInCurYear;//这台最脏设备累计未整改数 a.problemDescription = item.problemDescription; //string lastmonth = time.Year + "年" + (time.Month-1); //string lastmp = Sx.lastmonthproblem(lastmonth, item.sbCode); //if(lastmp!=null) //{ //string[] distiproblem = lastmp.Split(new char[] { '$' }); //for (int i = 0; i < distiproblem.Length;i++ ) //{ // if(distiproblem[i].Contains("(未整改)")) // { // string[] str = distiproblem[i].Split(new[] { "(未整改)" }, StringSplitOptions.None); // a.problemDescription= a.problemDescription+"$"+str[0] + "(上月未整改)"; // } //} //} a.Id = item.Id; record.Am.Add(a); } return(record); }
public bool ModifyA5dot2Tab2(A5dot2Tab2 nVal) { using (var db = base.NewDB()) { try { List <A5dot2Tab2> modifyA5dot2Tab2 = db.A5dot2Tab2.Where(a => a.sbCode == nVal.sbCode).ToList(); string[] yearandmonth = (nVal.yearMonthForStatistic).Split(new char[] { '年' }); int key = 0; for (int k = 0; k < modifyA5dot2Tab2.Count; k++) { string[] YandMfromDB = (modifyA5dot2Tab2[k].yearMonthForStatistic).Split(new char[] { '年' }); if (YandMfromDB[1] == yearandmonth[1] && YandMfromDB[0] == yearandmonth[0]) //年月一样 { modifyA5dot2Tab2[k].problemDescription = modifyA5dot2Tab2[k].problemDescription + "$" + nVal.problemDescription; modifyA5dot2Tab2[k].zyType = modifyA5dot2Tab2[k].zyType + "$" + nVal.zyType; modifyA5dot2Tab2[k].nProblemsInCurMonth++; modifyA5dot2Tab2[k].nProblemsInCurYear++; key = 1; } } if (key == 0) { db.A5dot2Tab2.Add(nVal);//年一样月不一样或年不一样月一样或年月不一样 } //string[] YandMfromDB = (modifyA5dot2Tab2.yearMonthForStatistic).Split(new char[] { '年' }); //if (YandMfromDB[1] == yearandmonth[1] && YandMfromDB[0] == yearandmonth[0]) //{ // modifyA5dot2Tab2.problemDescription = modifyA5dot2Tab2.problemDescription + "$" + nVal.problemDescription; // modifyA5dot2Tab2.zyType = modifyA5dot2Tab2.zyType + "$" + nVal.zyType; // modifyA5dot2Tab2.nProblemsInCurMonth++; // modifyA5dot2Tab2.nProblemsInCurYear++; //} //else if (YandMfromDB[1] != yearandmonth[1] && YandMfromDB[0] == yearandmonth[0]) //{ // db.A5dot2Tab2.Add(nVal); //} db.SaveChanges(); return(true); } catch { return(false); } } }
public bool AddA5dot2Tab2(A5dot2Tab2 nVal) { using (var db = base.NewDB()) { try { db.A5dot2Tab2.Add(nVal); db.SaveChanges(); return(true); } catch { return(false); } } }
public Index_ModelforA5dot2Tab2 getRecord_detailTab2(DateTime time) { Index_ModelforA5dot2Tab2 RecordforA5dot2Tab2 = new Index_ModelforA5dot2Tab2(); RecordforA5dot2Tab2.Am = new List <A5dot2Tab2>(); RecordforA5dot2Tab2.Hm = new List <A5dot2Tab2>(); ViewBag.curtime = DateTime.Now.ToString(); ViewBag.curuser = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name; string yearandmonth = time.Year + "年" + time.Month; List <A5dot2Tab2> miss = Sx.GetA5dot2Tab2ItemForPq(yearandmonth); foreach (var item in miss) { A5dot2Tab2 a = new A5dot2Tab2(); a.cjName = item.cjName; a.zzName = item.zzName; a.sbGyCode = item.sbGyCode; a.sbCode = item.sbCode; a.nProblemsInCurMonth = item.nProblemsInCurMonth; a.nProblemsInCurYear = Sx.GetnProblemsInYearItem(item.sbCode); a.Id = item.Id; RecordforA5dot2Tab2.Am.Add(a); } //List<A5dot2Tab1> miss = Sx.GetSxItem_detail(IntId); //foreach (var item in miss) //{ // A5dot2Tab1 a = new A5dot2Tab1(); // a.cjName = item.cjName; // a.zzName = item.zzName; // a.sbGyCode = item.sbGyCode; // a.sbCode = item.sbCode; // a.sbType = item.sbType; // a.zyType = item.zyType; // a.problemDescription = item.problemDescription; // a.temp1 = Convert.ToString(miss.IndexOf(item) + 1); // a.state = item.state; // a.Id = item.Id; // RecordforA5dot2.Am.Add(a); //} return(RecordforA5dot2Tab2); }
public bool ModifyA5dot2Tab2Item(A5dot2Tab2 add) { return(db_Sxgl.ModifyA5dot2Tab2(add)); }
public bool AddA5dot2Tab2Item(A5dot2Tab2 add) { return(db_Sxgl.AddA5dot2Tab2(add)); }
public JsonResult Pq_submitsignal(string json1) { JObject item = (JObject)JsonConvert.DeserializeObject(json1); A5dot2Tab1 new_5dot21 = new A5dot2Tab1(); new_5dot21.pqCheckTime = DateTime.Now; new_5dot21.pqUserName = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name; new_5dot21.isRectified = Convert.ToInt32(item["isRectified"]); new_5dot21.state = 1; if (Convert.ToInt32(item["isRectified"]) == 1) { //string[] str = (item["problemDescription"].ToString()).Split(new[] { "(未整改)" }, StringSplitOptions.None);//以字符串作为分割条件 new_5dot21.problemDescription = item["problemDescription"].ToString() + "(已整改)"; } if (Convert.ToInt32(item["isRectified"]) == 0) { new_5dot21.problemDescription = item["problemDescription"].ToString() + "(未整改)"; } new_5dot21.Id = Convert.ToInt32(item["A5dot2Tab1_id"].ToString()); string res = Sx.ModifySxItem(new_5dot21); int a_id = Convert.ToInt32(item["A5dot2Tab1_id"].ToString()); if (Sx.getAllbyid(a_id).temp3 != null) { int missId = Convert.ToInt32(Sx.getAllbyid(a_id).temp3); var t = CTimerManage.LoadTimerMission(missId); if (t != null) { t.status = TM_STATUS.TM_FINISH; t.Save(); CTimerManage.RemoveFromActiveList(t.ID); } } //接收返回的设备工艺号 A5dot2Tab2 new_5dot22 = new A5dot2Tab2(); List <A5dot2Tab2> IsExist = Sx.GetA5dot2Tab2Item(res); if (IsExist.Count == 0) { //传到表2若没有则添加一条数据,如果有则修改该条数据 DateTime i = DateTime.Now; string yearmonth = ""; if (i.Day >= 15) { yearmonth = i.Year.ToString() + "年" + i.AddMonths(1).Month.ToString(); } else { yearmonth = i.Year.ToString() + "年" + i.Month.ToString(); } new_5dot22.cjName = item["cjName"].ToString(); new_5dot22.zzName = item["zzName"].ToString(); new_5dot22.sbGyCode = item["sbGyCode"].ToString(); new_5dot22.sbCode = item["sbCode"].ToString(); new_5dot22.sbType = item["sbType"].ToString(); new_5dot22.zyType = item["zyType"].ToString(); if (Convert.ToInt32(item["isRectified"]) == 1) { new_5dot22.problemDescription = item["problemDescription"].ToString() + "(已整改)"; } if (Convert.ToInt32(item["isRectified"]) == 0) { new_5dot22.problemDescription = item["problemDescription"].ToString() + "(未整改)"; } new_5dot22.state = 1; new_5dot22.nProblemsInCurMonth = 1; new_5dot22.nProblemsInCurYear = 1; new_5dot22.isSetAsTop10Worst = 0; new_5dot22.yearMonthForStatistic = yearmonth; bool has = Sx.AddA5dot2Tab2Item(new_5dot22); } //修改该条数据 else { DateTime i = DateTime.Now; string yearmonth = ""; if (i.Day >= 15) { yearmonth = i.Year.ToString() + "年" + i.AddMonths(1).Month.ToString(); } else { yearmonth = i.Year.ToString() + "年" + i.Month.ToString(); } new_5dot22.cjName = item["cjName"].ToString(); new_5dot22.zzName = item["zzName"].ToString(); new_5dot22.sbGyCode = item["sbGyCode"].ToString(); new_5dot22.sbCode = item["sbCode"].ToString(); new_5dot22.sbType = item["sbType"].ToString(); if (Convert.ToInt32(item["isRectified"]) == 1) { new_5dot22.problemDescription = item["problemDescription"].ToString() + "(已整改)"; } if (Convert.ToInt32(item["isRectified"]) == 0) { new_5dot22.problemDescription = item["problemDescription"].ToString() + "(未整改)"; } new_5dot22.zyType = item["zyType"].ToString(); new_5dot22.sbCode = item["sbCode"].ToString(); new_5dot22.state = 1; new_5dot22.nProblemsInCurMonth = 1; new_5dot22.nProblemsInCurYear = 1; new_5dot22.isSetAsTop10Worst = 0; new_5dot22.yearMonthForStatistic = yearmonth; bool has = Sx.ModifyA5dot2Tab2Item(new_5dot22); } return(Json(new { result = res })); }