//删除日报基础信息 public ActionResult delDayExcel() { long id = Convert.ToInt64(Request["id"]); int state = Convert.ToInt32(Request["state"]); if (state == 0) { var temp = T_jgzztjbService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (temp != null) { temp.del_f = false; T_jgzztjbService.EditEntity(temp); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "no", msg = "数据库中无此条数据" }, JsonRequestBehavior.AllowGet)); } } else { var temp = T_jxzztjbService.LoadEntities(x => x.ID == id).FirstOrDefault(); if (temp != null) { temp.del_f = false; T_jxzztjbService.EditEntity(temp); return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = "no", msg = "数据库中无此条数据" }, JsonRequestBehavior.AllowGet)); } } }
//获取要修改的数据 public ActionResult GetEditInfo() { long id = Convert.ToInt64(Request["id"]); int sd = Convert.ToInt32(Request["state"]); if (sd == 0) { var temp = T_jxzztjbService.LoadEntities(x => x.ID == id).FirstOrDefault(); jxInfo ji = new jxInfo(); ji.ID = temp.ID; ji.Addtime = temp.Addtime; ji.Wtime = temp.Wtime; ji.ImgName_ID = temp.ImgName_ID; ji.UPslt_ID = temp.UPslt_ID; ji.Seb_number_ID = temp.Seb_number_ID; ji.ImgNumber = temp.ImgNumber; ji.Iint = temp.Iint; ji.Slt_kg = temp.Slt_kg; ji.Slt_hege = temp.Slt_hege; ji.Slt_hegeNo = temp.Slt_hegeNo; ji.Slt_Feipin = temp.Slt_Feipin; ji.Slt_BFB = temp.Slt_BFB; ji.StupTime = temp.StupTime; ji.OverTime = temp.OverTime; ji.ThisHaveTime = temp.ThisHaveTime; ji.HaveTime = temp.HaveTime; ji.UpBumen_id = temp.UpBumen_id; ji.del = temp.del_f; ji.RestYesOrNo = temp.RestYesOrNo; ji.WorkHours = temp.WorkHours; ji.LjName = temp.Seb_Number.Ttext; return(Json(ji, JsonRequestBehavior.AllowGet)); } else { var temp = T_jgzztjbService.LoadEntities(x => x.ID == id).FirstOrDefault(); jgInfo ji = new jgInfo(); ji.ID = temp.ID; ji.Addtime = temp.Addtime; ji.Wtime = temp.Wtime; ji.ImgName_ID = temp.ImgName_ID; ji.UPslt_ID = temp.UPslt_ID; ji.ImgNumber = temp.ImgNumber; ji.Iint = temp.Iint; ji.Slt_kg = temp.Slt_kg; ji.Slt_hege = temp.Slt_hege; ji.Slt_hegeNo = temp.Slt_hegeNo; ji.Slt_Feipin = temp.Slt_Feipin; ji.Slt_BFB = temp.Slt_BFB; ji.StupTime = temp.StupTime; ji.OverTime = temp.OverTime; ji.ThisHaveTime = temp.ThisHaveTime; ji.HaveTime = temp.HaveTime; ji.UpBumen_id = temp.UpBumen_id; ji.del = temp.del_f; ji.RestYesOrNo = temp.RestYesOrNo; ji.WorkHours = temp.WorkHours; return(Json(ji, JsonRequestBehavior.AllowGet)); } }
//创建机加车间日报表信息 public ActionResult addDayBb(T_jxzztjb tjjb) { tjjb.Addtime = DateTime.Now; tjjb.del_f = true; bool state = false; if (tjjb.ImgName_ID == 0) { var Imgstr_name = Request["ImgName_ID"]; var temp = Seb_NumberService.LoadEntities(x => x.Ttext == Imgstr_name && x.Items == 1).FirstOrDefault(); if (temp != null) { tjjb.ImgName_ID = temp.ID; } else { Seb_Number sb = new Seb_Number(); sb.Items = 1; sb.Ttext = Imgstr_name; var rtmp = Seb_NumberService.AddEntity(sb); tjjb.ImgName_ID = rtmp.ID; state = true; } } if (tjjb.ID > 0) { T_jxzztjbService.EditEntity(tjjb); } else { T_jxzztjbService.AddEntity(tjjb); } return(Json(new { ret = "ok", state = state }, JsonRequestBehavior.AllowGet)); }
//获取日报信息 public ActionResult Getdata() { int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1; int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 25; int toalcount = 0; int totalcount2 = 0; IQueryable <T_jxzztjb> Tdata = T_jxzztjbService.LoadPageEntities(pageIndex, pageSize, out toalcount, x => x.del_f == true, x => x.Wtime, false).DefaultIfEmpty(); List <jsxtCls> tList = new List <jsxtCls>(); if (Tdata.ToList() != null && Tdata.ToList()[0] != null) { foreach (var a in Tdata) { jsxtCls jc = new jsxtCls(); jc.ID = a.ID; jc.Addtime = a.Addtime; jc.Wtime = a.Wtime; jc.ImgName_ID = a.Seb_Number1.Ttext; jc.UPslt_ID = a.User_Person_slt.UserInfo.PerSonName; jc.Seb_number_ID = a.Seb_Number.Ttext; jc.ImgNumber = a.ImgNumber; jc.Iint = a.Iint; jc.Slt_kg = a.Slt_kg; jc.Slt_BFB = a.Slt_BFB; jc.Slt_Feipin = a.Slt_Feipin; jc.Slt_hege = a.Slt_hege; jc.Slt_hegeNo = a.Slt_hegeNo; jc.StupTime = a.StupTime; jc.OverTime = a.OverTime; jc.ThisHaveTime = a.ThisHaveTime; jc.HaveTime = a.HaveTime; jc.WorkHours = a.WorkHours; jc.UpBumen_id = a.BumenInfoSet.Name; jc.RestYesOrNo = a.RestYesOrNo; jc.Wage_slt = a.User_Person_slt.Wage_slt; jc.HoursWage = a.User_Person_slt.HoursWage; jc.Job_Name = a.User_Person_slt.Job_Name; jc.SumHoursWage = jc.WorkHours * jc.HoursWage; jc.SuoShuCJ = "机加车间"; tList.Add(jc); } } IQueryable <T_jgzztjb> Tdata2 = T_jgzztjbService.LoadPageEntities(pageIndex, pageSize, out totalcount2, x => x.del_f == true, x => x.Wtime, false).DefaultIfEmpty(); if (Tdata2.ToList() != null && Tdata2.ToList()[0] != null) { foreach (var a in Tdata2) { jsxtCls jc = new jsxtCls(); jc.ID = a.ID; jc.Addtime = a.Addtime; jc.Wtime = a.Wtime; jc.ImgName_ID = a.Seb_Number.Ttext; jc.UPslt_ID = a.User_Person_slt.UserInfo.PerSonName; jc.ImgNumber = a.ImgNumber; jc.Iint = a.Iint; jc.Slt_kg = a.Slt_kg; jc.Slt_BFB = a.Slt_BFB; jc.Slt_Feipin = a.Slt_Feipin; jc.Slt_hege = a.Slt_hege; jc.Slt_hegeNo = a.Slt_hegeNo; jc.StupTime = a.StupTime; jc.OverTime = a.OverTime; jc.ThisHaveTime = a.ThisHaveTime; jc.HaveTime = a.HaveTime; jc.WorkHours = a.WorkHours; jc.UpBumen_id = a.BumenInfoSet.Name; jc.RestYesOrNo = a.RestYesOrNo; jc.Wage_slt = a.User_Person_slt.Wage_slt; jc.HoursWage = a.User_Person_slt.HoursWage; jc.Job_Name = a.User_Person_slt.Job_Name; jc.SumHoursWage = jc.WorkHours * jc.HoursWage; jc.SuoShuCJ = "结构车间"; tList.Add(jc); } } tList = tList.OrderByDescending(x => x.Wtime).ToList(); return(Json(new { rows = tList, total = toalcount + totalcount2 }, JsonRequestBehavior.AllowGet)); }
//获取统计数据 public ActionResult GetStatisticsInfo() { var bolID = Request["bolID"] == null?0: Convert.ToInt32(Request["bolID"]); if (bolID != 0) { int bumenID = Request["bmID"] == null ? 0 : Convert.ToInt32(Request["bmID"]); #region 个人日统计表 if (bolID == 9) { DateTime excelDate = Convert.ToDateTime(Request["excelDate"]); if (bumenID == 26) { var temp = T_jxzztjbService.LoadEntities(x => x.Wtime == excelDate && x.del_f == true).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { List <jsxtCls> tList = new List <jsxtCls>(); foreach (var a in temp) { jsxtCls jc = new jsxtCls(); jc.ID = a.ID; jc.Addtime = a.Addtime; jc.Wtime = a.Wtime; jc.ImgName_ID = a.Seb_Number1.Ttext; jc.UPslt_ID = a.User_Person_slt.UserInfo.PerSonName; jc.Seb_number_ID = a.Seb_Number.Ttext; jc.ImgNumber = a.ImgNumber; jc.Iint = a.Iint; jc.Slt_kg = a.Slt_kg; jc.Slt_BFB = a.Slt_BFB; jc.Slt_Feipin = a.Slt_Feipin; jc.Slt_hege = a.Slt_hege; jc.Slt_hegeNo = a.Slt_hegeNo; jc.StupTime = a.StupTime; jc.OverTime = a.OverTime; jc.ThisHaveTime = a.ThisHaveTime; jc.HaveTime = a.HaveTime; jc.WorkHours = a.WorkHours; jc.UpBumen_id = a.BumenInfoSet.Name; jc.RestYesOrNo = a.RestYesOrNo; jc.Wage_slt = a.User_Person_slt.Wage_slt; jc.HoursWage = a.User_Person_slt.HoursWage; jc.Job_Name = a.User_Person_slt.Job_Name; jc.SumHoursWage = jc.WorkHours * jc.HoursWage; tList.Add(jc); } return(Json(tList, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } else { var temp = T_jgzztjbService.LoadEntities(x => x.Wtime == excelDate && x.del_f == true).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { List <jsxtCls> tList = new List <jsxtCls>(); foreach (var a in temp) { jsxtCls jc = new jsxtCls(); jc.ID = a.ID; jc.Addtime = a.Addtime; jc.Wtime = a.Wtime; jc.ImgName_ID = a.Seb_Number.Ttext; jc.UPslt_ID = a.User_Person_slt.UserInfo.PerSonName; jc.ImgNumber = a.ImgNumber; jc.Iint = a.Iint; jc.Slt_kg = a.Slt_kg; jc.Slt_BFB = a.Slt_BFB; jc.Slt_Feipin = a.Slt_Feipin; jc.Slt_hege = a.Slt_hege; jc.Slt_hegeNo = a.Slt_hegeNo; jc.StupTime = a.StupTime; jc.OverTime = a.OverTime; jc.ThisHaveTime = a.ThisHaveTime; jc.HaveTime = a.HaveTime; jc.WorkHours = a.WorkHours; jc.UpBumen_id = a.BumenInfoSet.Name; jc.RestYesOrNo = a.RestYesOrNo; jc.Wage_slt = a.User_Person_slt.Wage_slt; jc.HoursWage = a.User_Person_slt.HoursWage; jc.Job_Name = a.User_Person_slt.Job_Name; jc.SumHoursWage = jc.WorkHours * jc.HoursWage; tList.Add(jc); } return(Json(tList, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } } #endregion else { DateTime dtStart = Convert.ToDateTime(Request["monthExcel"]); DateTime dtEnd = dtStart.AddMonths(1).AddDays(-1 * (dtStart.Day)); #region 个人月报表 if (bolID == 10) { var monthCount = DateTime.DaysInMonth(dtStart.Year, dtStart.Month); if (bumenID == 26) { var temp = T_jxzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.del_f == true).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { var tdata = temp.GroupBy(x => x.UPslt_ID).Select(x => new GRmouth { ID = x.First().UPslt_ID, UPslt_ID = x.First().User_Person_slt.UserInfo.PerSonName, Iint = x.Sum(g => g.Iint), Slt_kg = x.Sum(g => g.Slt_kg), Slt_Feipin = x.Sum(g => g.Slt_Feipin), Slt_hege = x.Sum(g => g.Slt_hege), Slt_hegeNo = x.Sum(g => g.Slt_hegeNo), ThisHaveTime = x.Sum(g => g.ThisHaveTime), HaveTime = x.Sum(g => g.HaveTime), Wage_slt = x.First().User_Person_slt.Wage_slt, Job_Name = x.First().User_Person_slt.Job_Name, RestYesOrNo = monthCount - temp.Where(g => g.UPslt_ID == x.First().UPslt_ID).GroupBy(z => new { z.UPslt_ID, z.Wtime }).Count() + x.Sum(k => k.RestYesOrNo == 0 ? 0.5 : 0), HoursWage = x.First().User_Person_slt.HoursWage, SumHoursWage = x.Sum(g => g.WorkHours * g.User_Person_slt.HoursWage), WorkHours = x.Sum(g => g.WorkHours) }); return(Json(tdata, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } else { var temp = T_jgzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.del_f == true).DefaultIfEmpty().ToList(); if (temp != null && temp[0] != null) { var tdata = temp.GroupBy(x => x.UPslt_ID).Select(x => new GRmouth { ID = x.First().UPslt_ID, UPslt_ID = x.First().User_Person_slt.UserInfo.PerSonName, Iint = x.Sum(g => g.Iint), Slt_kg = x.Sum(g => g.Slt_kg), Slt_Feipin = x.Sum(g => g.Slt_Feipin), Slt_hege = x.Sum(g => g.Slt_hege), Slt_hegeNo = x.Sum(g => g.Slt_hegeNo), ThisHaveTime = x.Sum(g => g.ThisHaveTime), HaveTime = x.Sum(g => g.HaveTime), Wage_slt = x.First().User_Person_slt.Wage_slt, Job_Name = x.First().User_Person_slt.Job_Name, RestYesOrNo = monthCount - temp.Where(g => g.UPslt_ID == x.First().UPslt_ID).GroupBy(z => new { z.UPslt_ID, z.Wtime }).Count() + x.Sum(k => k.RestYesOrNo == 0?0.5:0), HoursWage = x.First().User_Person_slt.HoursWage, SumHoursWage = x.Sum(g => g.WorkHours * g.User_Person_slt.HoursWage), WorkHours = x.Sum(g => g.WorkHours) }); return(Json(tdata, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } } #endregion #region 车间月统计表 else if (bolID == 11)//车间月汇报表 { var temp = T_jxzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.UpBumen_id == bumenID && x.del_f == true).DefaultIfEmpty().ToList(); var temp2 = T_jgzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.UpBumen_id == bumenID && x.del_f == true).DefaultIfEmpty().ToList(); List <CJExcel> tList = new List <CJExcel>(); if (temp != null && temp[0] != null) { foreach (var a in temp) { CJExcel cje = new CJExcel(); cje.WorkTime = a.Wtime; cje.PersonName = a.User_Person_slt.UserInfo.PerSonName; cje.WorkType = a.User_Person_slt.Job_Name; cje.HoursWage = a.User_Person_slt.HoursWage; cje.UpBumen = a.BumenInfoSet.Name; cje.WorkInfo = a.Seb_Number1.Ttext; cje.WorkHours = a.WorkHours; cje.SumMoney = cje.WorkHours * cje.HoursWage; tList.Add(cje); } } if (temp2 != null && temp2[0] != null) { foreach (var a in temp2) { CJExcel cje = new CJExcel(); cje.WorkTime = a.Wtime; cje.PersonName = a.User_Person_slt.UserInfo.PerSonName; cje.WorkType = a.User_Person_slt.Job_Name; cje.HoursWage = a.User_Person_slt.HoursWage; cje.UpBumen = a.BumenInfoSet.Name; cje.WorkInfo = a.Seb_Number.Ttext; cje.WorkHours = a.WorkHours; cje.SumMoney = cje.WorkHours * cje.HoursWage; tList.Add(cje); } } tList = tList.OrderBy(x => x.WorkTime).ToList(); return(Json(tList, JsonRequestBehavior.AllowGet)); } #endregion #region 公司月统计表 else if (bolID == 12)//公司月总结表 { var temp = T_jxzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.del_f == true).DefaultIfEmpty().ToList(); var temp2 = T_jgzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.del_f == true).DefaultIfEmpty().ToList(); List <GSExcel> temp1 = new List <GSExcel>(); if (temp != null && temp[0] != null) { temp1 = temp.GroupBy(x => x.UpBumen_id).Select(x => new GSExcel { UpBumen = x.First().BumenInfoSet.Name, SumHours = x.Sum(g => g.WorkHours), SumMoney = x.Sum(g => g.User_Person_slt.HoursWage * g.WorkHours) }).ToList(); } List <GSExcel> temp3 = new List <GSExcel>(); if (temp2 != null && temp2[0] != null) { temp3 = temp2.GroupBy(x => x.UpBumen_id).Select(x => new GSExcel { UpBumen = x.First().BumenInfoSet.Name, SumHours = x.Sum(g => g.WorkHours), SumMoney = x.Sum(g => g.User_Person_slt.HoursWage * g.WorkHours) }).ToList(); } temp1.AddRange(temp3); return(Json(temp1, JsonRequestBehavior.AllowGet)); } #endregion #region 轨枕月统计表 else if (bolID == 13)//轨枕月总结表 { int id = 0; if (bumenID == 41) { id = 26; var temp = T_jxzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.UpBumen_id == bumenID && x.User_Person_slt.UserInfo.BuMenID == id && x.del_f == true).DefaultIfEmpty().ToList(); List <GZXExcel> temp1 = new List <GZXExcel>(); if (temp != null && temp[0] != null) { temp1 = temp.GroupBy(x => x.Seb_Number1.Ttext).Select(x => new GZXExcel { UpBumen = x.Key, SumHours = x.Sum(g => g.WorkHours), SumMoney = x.Sum(g => g.WorkHours * g.User_Person_slt.HoursWage) }).ToList(); return(Json(temp1, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } else { id = 43; var temp2 = T_jgzztjbService.LoadEntities(x => x.Wtime >= dtStart && x.Wtime <= dtEnd && x.UpBumen_id == bumenID && x.User_Person_slt.UserInfo.BuMenID == id && x.del_f == true).DefaultIfEmpty().ToList(); List <GZXExcel> temp3 = new List <GZXExcel>(); if (temp2 != null && temp2[0] != null) { temp3 = temp2.GroupBy(x => x.Seb_Number.Ttext).Select(x => new GZXExcel { UpBumen = x.Key, SumHours = x.Sum(g => g.WorkHours), SumMoney = x.Sum(g => g.WorkHours * g.User_Person_slt.HoursWage) }).ToList(); return(Json(temp3, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); } } #endregion else { return(Json(null, JsonRequestBehavior.AllowGet)); } } } else { ActionResult ar = Getdata(); return(ar); } }