270 lines
10 KiB
C#
270 lines
10 KiB
C#
using dccdc.BLL;
|
|
using dccdc.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using static dccdc.Controllers.DictionariesController;
|
|
|
|
namespace dccdc.Controllers
|
|
{
|
|
public class SanZhongYiDaController : Controller
|
|
{
|
|
|
|
#region 加班用餐申请
|
|
public ActionResult jbyc_sqView()
|
|
{
|
|
return View();
|
|
}
|
|
public JsonResult getjbyc_sqPage(int page, int pagesize, string key)
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
string where = " sqrid=" + user.ID;
|
|
var bll = new BLL.jbyc_sqBll();
|
|
int count = bll.getCountLevel(where);
|
|
var models = bll.getPageLevel(page, pagesize, where);
|
|
return Json(new { Total = count, Rows = models });
|
|
}
|
|
|
|
public ActionResult jbyc_sqMessage(string id)
|
|
{
|
|
ViewData["ztD"] = new SelectList(new List<Droplist>
|
|
{ new Droplist { Value = "1", Title = "等待科室领导审批" },
|
|
new Droplist { Value = "2", Title = "等待分管领导审批" },
|
|
new Droplist { Value = "3", Title = "等待中心领导审批" },
|
|
new Droplist { Value = "4", Title = "审核完成" },
|
|
new Droplist { Value = "-1", Title = "科室领导驳回" },
|
|
new Droplist { Value = "-2", Title = "分管领导驳回" },
|
|
new Droplist { Value = "-3", Title = "中心领导驳回" }
|
|
}, "Value", "Title");
|
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
var bll = new BLL.jbyc_sqBll();
|
|
var model = bll.GetAllList(id).First();
|
|
return View(model);
|
|
}
|
|
else
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
jbyc_sqModel model = new jbyc_sqModel();
|
|
model.sqr = user.TrueName;
|
|
model.sqdh = "后台生成";
|
|
model.ksmc = user.Department;
|
|
return View(model);
|
|
}
|
|
}
|
|
|
|
public JsonResult savejbycsq(string id, string jbsy, string jbrq, string jbsj, string rs, string bz,string ycbz)
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
var bll = new BLL.jbyc_sqBll();
|
|
if (id == "" || id == "0")
|
|
return Json(bll.jbyc_sqSave(id, user.ksid, user.Department, user.ID, user.TrueName, jbsy, jbrq, jbsj, rs, bz,ycbz));
|
|
else
|
|
return Json(bll.jbycSave2(id, user.ksid, user.Department, user.ID, user.TrueName, jbsy, jbrq, jbsj, rs, bz, ycbz));
|
|
}
|
|
|
|
public JsonResult deletejbyc(string id)
|
|
{
|
|
if (string.IsNullOrEmpty(id))
|
|
return Json(null);
|
|
return Json(new BLL.jbyc_sqBll().delete(id));
|
|
}
|
|
#endregion
|
|
|
|
/*
|
|
#region 加班用餐审批
|
|
public ActionResult jbyc_spView()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public JsonResult getjbycspPage(int page, int pagesize, string key)
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
List<string> zws = getZW2();
|
|
//非职务人员
|
|
if (zws.Count == 0)
|
|
return Json(null);
|
|
string where = " 1=2 ";
|
|
foreach (string zw in zws)
|
|
{
|
|
switch (zw)
|
|
{
|
|
case "1": where += " or (zt=1 and ksid=" + user.ksid + ") "; break;
|
|
case "2": where += " or (zt=2 and ksid in " + getChildrenKsid(user.ksid) + ") "; break;
|
|
case "3": where += " or (zt=3 and ksid in " + getChildrenKsid(user.ksid) + ") "; break;
|
|
}
|
|
}
|
|
|
|
var bll = new BLL.jbyc_sqBll();
|
|
int count = bll.getCountLevel(where);
|
|
var models = bll.getPageLevel(page, pagesize, where);
|
|
return Json(new { Total = count, Rows = models });
|
|
}
|
|
|
|
public ActionResult jbyc_spMessage(string id)
|
|
{
|
|
ViewData["ztD"] = new SelectList(new List<Droplist>
|
|
{ new Droplist { Value = "1", Title = "等待科室领导审批" },
|
|
new Droplist { Value = "2", Title = "等待分管领导审批" },
|
|
new Droplist { Value = "3", Title = "等待中心领导审批" },
|
|
new Droplist { Value = "4", Title = "审核完成" },
|
|
new Droplist { Value = "-1", Title = "科室领导驳回" },
|
|
new Droplist { Value = "-2", Title = "分管领导驳回" },
|
|
new Droplist { Value = "-3", Title = "中心领导驳回" }
|
|
}, "Value", "Title");
|
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
var bll = new BLL.jbyc_sqBll();
|
|
var model = bll.GetAllList(id).First();
|
|
ViewBag.zw = getZWOne(model.zt.ToString());
|
|
return View(model);
|
|
}
|
|
else
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
jbyc_sqModel model = new jbyc_sqModel();
|
|
model.sqr = user.TrueName;
|
|
model.sqdh = "后台生成";
|
|
model.ksmc = user.Department;
|
|
return View(model);
|
|
}
|
|
}
|
|
|
|
public JsonResult savejbycsp(string id, string yj, string ty)
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
var bll = new BLL.jbyc_sqBll();
|
|
|
|
var model = new sqshModel();
|
|
model.type = "加班用餐审批"; //添加 查询与添加一致就行
|
|
model.sqid = Convert.ToInt32(id);
|
|
model.spr = user.TrueName;
|
|
model.sptime = DateTime.Now;
|
|
model.spnr = yj;
|
|
model.zt = (ty == "1") ? "通过" : "不通过";
|
|
new BLL.sqshBll().Add(model);
|
|
|
|
return Json(bll.opjbycSp(id, user.TrueName, yj, (ty == "1") ? true : false));
|
|
}
|
|
#endregion
|
|
|
|
#region 加班用餐审核查询
|
|
public ActionResult jbyc_spSelectView()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public JsonResult getjbycspSelectPage(int page, int pagesize, string sqdh,string zt,string sqsj,string jbsj)
|
|
{
|
|
string where = "1=1";
|
|
if (sqdh != null && sqdh != "")
|
|
{
|
|
where += " and sqdh=" + sqdh;
|
|
}
|
|
if (zt != null && zt != "")
|
|
{
|
|
where += " and zt=" + zt;
|
|
}
|
|
if (sqsj != null && sqsj != "")
|
|
{
|
|
where += " and sqsj between '" + sqsj + " 00:00:00.000 " + "' and '" + sqsj + " 23:59:59.999" + "'";
|
|
}
|
|
if (jbsj != null && jbsj != "")
|
|
{
|
|
where += " and jbrq between '" + jbsj + " 00:00:00.000 " + "' and '" + jbsj + " 23:59:59.999" + "'";
|
|
}
|
|
var bll = new BLL.jbyc_sqBll();
|
|
int count = bll.getCountLevel(where);
|
|
var models = bll.getPageLevel(page, pagesize, where);
|
|
return Json(new { Total = count, Rows = models });
|
|
}
|
|
|
|
public ActionResult jbyc_spSelectMessage(string id)
|
|
{
|
|
ViewData["ztD"] = new SelectList(new List<Droplist>
|
|
{ new Droplist { Value = "1", Title = "等待科室领导审批" },
|
|
new Droplist { Value = "2", Title = "等待分管领导审批" },
|
|
new Droplist { Value = "3", Title = "等待中心领导审批" },
|
|
new Droplist { Value = "4", Title = "审核完成" },
|
|
new Droplist { Value = "-1", Title = "科室领导驳回" },
|
|
new Droplist { Value = "-2", Title = "分管领导驳回" },
|
|
new Droplist { Value = "-3", Title = "中心领导驳回" }
|
|
}, "Value", "Title");
|
|
|
|
var bll2 = new BLL.sqwzcgBll();
|
|
var model2 = bll2.GetAllList(id).First();
|
|
ViewBag.zw = getZWOne(model2.zt.ToString());
|
|
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
var bll = new BLL.jbyc_sqBll();
|
|
var model = bll.GetAllList(id).First();
|
|
return View(model);
|
|
}
|
|
else
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
jbyc_sqModel model = new jbyc_sqModel();
|
|
model.sqr = user.TrueName;
|
|
model.sqdh = "后台生成";
|
|
model.ksmc = user.Department;
|
|
return View(model);
|
|
}
|
|
}
|
|
#endregion
|
|
*/
|
|
|
|
//科室领导 分管领导 中心领导 备案人 内审员
|
|
private string getZW(string current)
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
string[] zws = user.ZhiWei.Split(',');
|
|
//string[] zws = new string[] { "科室领导", "分管领导", "中心主任", "备案人", "内审员" };
|
|
List<string> zwss = new List<string>();
|
|
if (zws.Contains("科室领导") && current == "1")
|
|
return "1";
|
|
if (zws.Contains("分管领导") && current == "2")
|
|
return "2";
|
|
if (zws.Contains("内审员") && current == "3")
|
|
return "3";
|
|
if (zws.Contains("备案人") && current == "4")
|
|
return "4";
|
|
if (zws.Contains("中心主任") && current == "5")
|
|
return "5";
|
|
return "";
|
|
}
|
|
|
|
private List<string> getZW1()
|
|
{
|
|
var user = Session["loginUser"] as Models.ERPUser;
|
|
string[] zws = user.ZhiWei.Split(',');
|
|
//string[] zws = new string[] { "科室领导", "分管领导", "中心主任", "备案人", "内审员" };
|
|
List<string> zwss = new List<string>();
|
|
if (zws.Contains("科室领导"))
|
|
zwss.Add("1");
|
|
if (zws.Contains("分管领导"))
|
|
zwss.Add("2");
|
|
if (zws.Contains("内审员"))
|
|
zwss.Add("3");
|
|
if (zws.Contains("备案人"))
|
|
zwss.Add("4");
|
|
if (zws.Contains("中心主任"))
|
|
zwss.Add("5");
|
|
return zwss;
|
|
}
|
|
//得到所有子科室id
|
|
private string getChildrenKsid(int ksid)
|
|
{
|
|
var bll = new BLL.ERPBuMenBll();
|
|
List<string> result = bll.GetAllChildren(ksid.ToString());
|
|
string result2 = string.Join(",", result);
|
|
return " (" + result2 + ")";
|
|
}
|
|
|
|
}
|
|
} |