//按日统计产品完成 public ActionResult TongJiByMonth() { int bmID = Convert.ToInt32(Request["bmID"]); DateTime dt = Convert.ToDateTime(Request["monthExcel"]); DateTime dtStr = new DateTime(dt.Year, dt.Month, 1); var temp = T_SCCJService.LoadEntities(x => x.BuMenid == bmID && x.Wtime == dt && x.Del_f == 0).DefaultIfEmpty().ToList(); var temp2 = T_SCCJService.LoadEntities(x => x.BuMenid == bmID && x.Wtime >= dtStr && x.Wtime <= dt && x.Del_f == 0).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { var groupData = temp.GroupBy(x => x.ProductNameId).ToList(); List <MonthAnfYearTJclass> lmaf = new List <MonthAnfYearTJclass>(); int num = 0; long id = 0; foreach (var a in groupData) { var s = a.DefaultIfEmpty(); foreach (var b in s) { if (b.ProductNameId != id) { id = b.ProductNameId; num = num == 0 ? 1 : 0; } MonthAnfYearTJclass may = new MonthAnfYearTJclass(); may.BuMenid = b.BumenInfoSet.Name; may.ProductGGId = b.T_ChanPinName2.MyTexts + "——" + b.T_ChanPinName.MyTexts + "——" + num; may.ProductJB = b.T_ChanPinName1.MyTexts; may.TrueCLNum = b.JiaCiPinNum + b.JiaFeiPinNum + b.JiaHeGePinNum + b.JiaYiDengPinNum + b.JiaYouDengPinNum + b.YiCiPinNum + b.YiFeiPinNum + b.YiHeGePinNum + b.YiYiDengPinNum + b.YiYouDengPinNum; var data = temp2.Where(x => x.ProductNameId == b.ProductNameId && x.ProductGGId == b.ProductGGId && x.ProductJB == b.ProductJB).ToList(); may.SumTrueCL = data.Sum(x => x.JiaCiPinNum) + data.Sum(x => x.JiaFeiPinNum) + data.Sum(x => x.JiaHeGePinNum) + data.Sum(x => x.JiaYiDengPinNum) + data.Sum(x => x.JiaYouDengPinNum) + data.Sum(x => x.YiCiPinNum) + data.Sum(x => x.YiFeiPinNum) + data.Sum(x => x.YiHeGePinNum) + data.Sum(x => x.YiYiDengPinNum) + data.Sum(x => x.YiYouDengPinNum); may.ZhengPinDayNum = b.JiaYouDengPinNum + b.JiaYiDengPinNum + b.JiaHeGePinNum + b.YiYiDengPinNum + b.YiYouDengPinNum + b.YiHeGePinNum; may.ZhengPinMonthNum = data.Sum(x => x.JiaYouDengPinNum) + data.Sum(x => x.JiaYiDengPinNum) + data.Sum(x => x.JiaHeGePinNum) + data.Sum(x => x.YiYouDengPinNum) + data.Sum(x => x.YiYiDengPinNum) + data.Sum(x => x.YiHeGePinNum); may.CiPinDayNum = b.JiaCiPinNum + b.YiCiPinNum; may.CiPinMonthNum = data.Sum(x => x.JiaCiPinNum) + data.Sum(x => x.YiCiPinNum); may.JiaZhengPinNum = b.JiaHeGePinNum + b.JiaYiDengPinNum + b.JiaYouDengPinNum; may.JiaCiPinNum = b.JiaCiPinNum; may.YiZhengPinNum = b.YiHeGePinNum + b.YiYiDengPinNum + b.YiYouDengPinNum; may.YiCiPinNum = b.YiCiPinNum; if (may.SumTrueCL == 0 && may.TrueCLNum == 0 && may.ZhengPinDayNum == 0 && may.ZhengPinMonthNum == 0 && may.CiPinDayNum == 0 && may.CiPinMonthNum == 0 && may.JiaZhengPinNum == 0 && may.JiaCiPinNum == 0 && may.YiZhengPinNum == 0 && may.YiCiPinNum == 0) { continue; } else { lmaf.Add(may); } } } return(Json(lmaf, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }
//删除单据数据 public ActionResult DelSccjInfo() { long id = Convert.ToInt64(Request["id"]); var temp = T_SCCJService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (temp != null) { temp.Del_f = 1; T_SCCJService.EditEntity(temp); return(Json(new { ret = "ok", msg = "操作成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "no", msg = "数据库中无此条数据" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult BuChongSpaceInfo() { var dtEnd = Convert.ToDateTime(Request["buChongEndDateTime"]); var dtStart = Convert.ToDateTime(Request["buChongStartDateTime"]); for (DateTime dt = dtStart; dt < dtEnd; dt = dt.AddDays(1)) { var dtAdd = dt.AddDays(1); var temp = T_SCCJService.LoadEntities(x => x.Wtime == dt).DefaultIfEmpty().ToList(); var temp1 = T_SCCJService.LoadEntities(x => x.Wtime == dtAdd).DefaultIfEmpty().ToList(); foreach (var a in temp) { if (temp1 != null && temp1[0] != null) { var data = temp1.Where(x => x.ProductNameId == a.ProductNameId && x.ProductGGId == a.ProductGGId && x.ProductJB == a.ProductJB).FirstOrDefault(); if (data != null) { continue; } } T_SCCJ tsc = new T_SCCJ(); tsc.Wtime = dtAdd; tsc.BuMenid = a.BuMenid; tsc.ProductNameId = a.ProductNameId; tsc.ProductGGId = a.ProductGGId; tsc.ProductJB = a.ProductJB; tsc.JiaYouDengPinNum = 0; tsc.JiaYiDengPinNum = 0; tsc.JiaHeGePinNum = 0; tsc.JiaCiPinNum = 0; tsc.JiaFeiPinNum = 0; tsc.YiYouDengPinNum = 0; tsc.YiYiDengPinNum = 0; tsc.YiHeGePinNum = 0; tsc.YiCiPinNum = 0; tsc.YiFeiPinNum = 0; tsc.Del_f = 0; T_SCCJService.AddEntity(tsc); } } return(Json("ok", JsonRequestBehavior.AllowGet)); }
//获取要修改的数据 public ActionResult GetEditInfo() { long id = Convert.ToInt64(Request["id"]); var temp = T_SCCJService.LoadEntities(x => x.ID == id).FirstOrDefault(); editInfo ei = new editInfo(); ei.ID = temp.ID; ei.Wtime = temp.Wtime; ei.BuMenid = temp.BuMenid; ei.ProductNameId = temp.ProductNameId; ei.ProductGGId = temp.ProductGGId; ei.ProductJB = temp.ProductJB; ei.JiaCiPinNum = temp.JiaCiPinNum; ei.JiaHeGePinNum = temp.JiaHeGePinNum; ei.JiaYiDengPinNum = temp.JiaYiDengPinNum; ei.JiaYouDengPinNum = temp.JiaYouDengPinNum; ei.JiaFeiPinNum = temp.JiaFeiPinNum; ei.YiCiPinNum = temp.YiCiPinNum; ei.YiHeGePinNum = temp.YiHeGePinNum; ei.YiYiDengPinNum = temp.YiYiDengPinNum; ei.YiYouDengPinNum = temp.YiYouDengPinNum; ei.YiFeiPinNum = temp.YiFeiPinNum; return(Json(ei, JsonRequestBehavior.AllowGet)); }
public ActionResult TongJiByDay() { int bmID = Convert.ToInt32(Request["bmID"]); DateTime dt = Convert.ToDateTime(Request["dayExcel"]); DateTime dtStr = new DateTime(dt.Year, dt.Month, 1); var temp = T_SCCJService.LoadEntities(x => x.BuMenid == bmID && x.Wtime == dt && x.Del_f == 0).DefaultIfEmpty().ToList(); var temp2 = T_SCCJService.LoadEntities(x => x.BuMenid == bmID && x.Wtime >= dtStr && x.Wtime <= dt && x.Del_f == 0).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { var groupData = temp.GroupBy(x => x.ProductNameId).ToList(); List <DayTJclass> ldt = new List <DayTJclass>(); int num = 0; long id = 0; foreach (var a in groupData) { var s = a.DefaultIfEmpty(); foreach (var b in s) { if (b.ProductNameId != id) { id = b.ProductNameId; num = num == 0 ? 1 : 0; } DayTJclass dtj = new DayTJclass(); dtj.ProductGGId = b.T_ChanPinName2.MyTexts + "——" + b.T_ChanPinName.MyTexts + "——" + num; dtj.ProductJB = b.T_ChanPinName1.MyTexts; dtj.YSDayNum = b.JiaCiPinNum + b.JiaFeiPinNum + b.JiaHeGePinNum + b.JiaYiDengPinNum + b.JiaYouDengPinNum + b.YiCiPinNum + b.YiFeiPinNum + b.YiHeGePinNum + b.YiYiDengPinNum + b.YiYouDengPinNum; var data = temp2.Where(x => x.ProductNameId == b.ProductNameId && x.ProductGGId == b.ProductGGId && x.ProductJB == b.ProductJB).ToList(); dtj.YSMonthNum = data.Sum(x => x.JiaCiPinNum) + data.Sum(x => x.JiaFeiPinNum) + data.Sum(x => x.JiaHeGePinNum) + data.Sum(x => x.JiaYiDengPinNum) + data.Sum(x => x.JiaYouDengPinNum) + data.Sum(x => x.YiCiPinNum) + data.Sum(x => x.YiFeiPinNum) + data.Sum(x => x.YiHeGePinNum) + data.Sum(x => x.YiYiDengPinNum) + data.Sum(x => x.YiYouDengPinNum); dtj.JiaBanDayNum = b.JiaCiPinNum + b.JiaFeiPinNum + b.JiaHeGePinNum + b.JiaYiDengPinNum + b.JiaYouDengPinNum; dtj.JiaBanMonthNum = data.Sum(x => x.JiaCiPinNum) + data.Sum(x => x.JiaFeiPinNum) + data.Sum(x => x.JiaHeGePinNum) + data.Sum(x => x.JiaYiDengPinNum) + data.Sum(x => x.JiaYouDengPinNum); dtj.YiBanDayNum = b.YiCiPinNum + b.YiFeiPinNum + b.YiHeGePinNum + b.YiYiDengPinNum + b.YiYouDengPinNum; dtj.YiBanMonthNum = data.Sum(x => x.YiCiPinNum) + data.Sum(x => x.YiFeiPinNum) + data.Sum(x => x.YiHeGePinNum) + data.Sum(x => x.YiYiDengPinNum) + data.Sum(x => x.YiYouDengPinNum); dtj.JiaYouDayNum = b.JiaYouDengPinNum; dtj.JiaYouMonthNum = data.Sum(x => x.JiaYouDengPinNum); dtj.JiaYiDayNum = b.JiaYiDengPinNum; dtj.JiaYiMonthNum = data.Sum(x => x.JiaYiDengPinNum); dtj.JiaHeDayNum = b.JiaHeGePinNum; dtj.JiaHeMonthNum = data.Sum(x => x.JiaHeGePinNum); dtj.JiaCiDayNum = b.JiaCiPinNum; dtj.JiaCiMonthNum = data.Sum(x => x.JiaCiPinNum); dtj.JiaFeiDayNum = b.JiaFeiPinNum; dtj.JiaFeiMonthNum = data.Sum(x => x.JiaFeiPinNum); dtj.YiYouDayNum = b.YiYouDengPinNum; dtj.YiYouMonthNum = data.Sum(x => x.YiYouDengPinNum); dtj.YiYiDayNum = b.YiYiDengPinNum; dtj.YiYiMonthNum = data.Sum(x => x.YiYiDengPinNum); dtj.YiHeDayNum = b.YiHeGePinNum; dtj.YiHeMonthNum = data.Sum(x => x.YiHeGePinNum); dtj.YiCiDayNum = b.YiCiPinNum; dtj.YiCiMonthNum = data.Sum(x => x.YiCiPinNum); dtj.YiFeiDayNum = b.YiFeiPinNum; dtj.YiFeiMonthNum = data.Sum(x => x.YiFeiPinNum); ldt.Add(dtj); } } return(Json(ldt, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }