tijian_tieying/web/dccdc/Controllers/WXspxxController.cs

399 lines
14 KiB
C#
Raw Permalink Normal View History

2025-02-20 12:14:39 +08:00
using dccdc.BLL;
using dccdc.code;
using dccdc.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace dccdc.Controllers
{
public class WXspxxController : Controller
{
// GET: WXspxx
public ActionResult Index()
{
return View();
}
[AllowAnonymous]
// 获取办公设备及房屋设备 --申请列表
public string getsqbgfwsbPage(string key, string username)
{
var user = new ERPUserBll().login(username, "");
user.ksid = new ERPBuMenBll().GetAllList(user.Department)[0].ID;
//String[] qx = user.ZhiWei.Split(',');
string[] qx = new string[] { "科室领导", "分管领导", "财务领导", "中心主任" };
string ksidstr = ContextUtils.getChildrenKsid(user.ksid);
List<String> list = ContextUtils.getChildrenZT(qx);
string str = "";
if (list != null && list.Count > 0)
{
str = " AND (";
for (int i = 0; i < list.Count; i++)
{
if (i != 0)
{
str += " OR";
}
if ("1" == list[i])
{
str += " (KSID = " + user.ksid + " AND ZT =1)";
}
else if ("2" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =2)";
}
else if ("3" == list[i])
{
str += " (ZT =3)";
}
else if ("4" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =4)";
}
}
str += ")";
}
var bll = new SbjfwwhBLL();
List<JfSjfwwxgl> ctList = bll.getspJfSjfwwxglxx(ksidstr, str, 1, 1000);
int count = bll.countspsbjfwwh(ksidstr, str);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = ctList });
}
[AllowAnonymous]
// 获取公务接待 --申请列表
public string getsqgwjdPage(string key, string username)
{
var user = new ERPUserBll().login(username, "");
user.ksid = new ERPBuMenBll().GetAllList(user.Department)[0].ID;
//String[] qx = user.ZhiWei.Split(',');
string[] qx = new string[] { "科室领导", "分管领导", "财务领导", "中心主任" };
string ksidstr = ContextUtils.getChildrenKsid(user.ksid);
List<String> list = ContextUtils.getChildrenZT(qx);
string str = "";
if (list != null && list.Count > 0)
{
str = " AND (";
for (int i = 0; i < list.Count; i++)
{
if (i != 0)
{
str += " OR";
}
if ("1" == list[i])
{
str += " (KSID = " + user.ksid + " AND ZT =1)";
}
else if ("2" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =2)";
}
else if ("3" == list[i])
{
str += " (ZT =3)";
}
else if ("4" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =4)";
}
}
str += ")";
}
var bll = new JfGwjdglBll();
List<JfGwjdgl> ctList = bll.getspJfGwjdgl(ksidstr, str, 1, 1000);
int count = bll.countspJfGwjdgl(ksidstr, str);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = ctList });
}
[AllowAnonymous]
// 获取借款单 --申请列表
public string getsqjkdPage(string key, string username)
{
var user = new ERPUserBll().login(username, "");
user.ksid = new ERPBuMenBll().GetAllList(user.Department)[0].ID;
//String[] qx = user.ZhiWei.Split(',');
string[] qx = new string[] { "科室领导", "分管领导", "财务领导", "中心主任" };
string ksidstr = ContextUtils.getChildrenKsid(user.ksid);
List<String> list = ContextUtils.getChildrenZT(qx);
string str = "";
if (list != null && list.Count > 0)
{
str = " AND (";
for (int i = 0; i < list.Count; i++)
{
if (i != 0)
{
str += " OR";
}
if ("1" == list[i])
{
str += " (KSID = " + user.ksid + " AND ZT =1)";
}
else if ("2" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =2)";
}
else if ("3" == list[i])
{
str += " (ZT =3)";
}
else if ("4" == list[i])
{
str += " (KSID IN " + ksidstr + " AND ZT =4)";
}
}
str += ")";
}
var bll = new JfJkxxBll();
List<JfJkxx> models = bll.getspJfJkxx(ksidstr, str, 1, 1000);
int count = bll.countspJfJkxx(ksidstr, str);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = count, Rows = models });
}
[AllowAnonymous]
public string getsqbgfwsbone(String id)
{
var bll = new dccdc.BLL.SbjfwwhBLL();
JfSjfwwxgl info = new JfSjfwwxgl();
info.id = Convert.ToInt32(id);
info = bll.getJfSjfwwxglxxOne(info);
List<JfSjfwwxgl> list = new List<JfSjfwwxgl>();
list.Add(info);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Rows = list });
}
[AllowAnonymous]
public string getsqgwjdone(String id)
{
var bll = new dccdc.BLL.JfGwjdglBll();
JfGwjdgl info = new JfGwjdgl();
info.id = Convert.ToInt32(id);
info = bll.getJfGwjdglOne(info);
List<JfGwjdgl> list = new List<JfGwjdgl>();
list.Add(info);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Rows = list });
}
[AllowAnonymous]
public string getsqjkdone(String id)
{
var bll = new dccdc.BLL.JfJkxxBll();
JfJkxx info = new JfJkxx();
info.id = Convert.ToInt32(id);
info = bll.getJfJkxxOne(info);
List<JfJkxx> list = new List<JfJkxx>();
list.Add(info);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Rows = list });
}
//办公设备及房屋设备审批--保存
//--id 意见 是否同意 审批领导 登陆人
[AllowAnonymous]
public string savebgfwsbsp(string id, string yj, string ty, string username)
{
var user = new ERPUserBll().login(username, "");
var bll = new BLL.SbjfwwhBLL();
dccdc.Models.JfSjfwwxgl model = new dccdc.Models.JfSjfwwxgl();
model.id = Convert.ToInt32(id);
JfSjfwwxgl info = bll.getJfSjfwwxglxxOne(model);
if ("1" == info.zt)
{
if (ty == "1")
{
info.zt = "2";
}
else
{
info.zt = "1";
}
info.ksldsprq = DateTime.Now;
info.ksldspyj = yj;
}
else if("2" == info.zt)
{
if (ty == "1")
{
info.zt = "4";
}
else
{
info.zt = "1";
}
info.fgldsprq = DateTime.Now;
info.fgldspyj = yj;
}else if ("4" == info.zt)
{
if (ty == "1")
{
info.zt = "5";
}
else
{
info.zt = "1";
}
info.zxldsprq = DateTime.Now;
info.zxldspyj = yj;
}
var modelinfo = new sqshModel();
modelinfo.type = "房屋及设备维护"; //添加 查询与添加一致就行
modelinfo.sqid = Convert.ToInt32(info.id);
modelinfo.spr = user.TrueName;
modelinfo.sptime = DateTime.Now;
modelinfo.spnr = yj;
modelinfo.zt = (ty == "1") ? "通过" : "不通过";
new BLL.sqshBll().Add(modelinfo);
bool f = bll.updJfSjfwwxglxx(info);
if (f)
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "修改成功" });
else
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "修改失败" });
}
//公务接待审批--保存
//--id 意见 是否同意 审批领导 登陆人
[AllowAnonymous]
public string savegwjdsp(string id, string yj, string ty, string username)
{
var user = new ERPUserBll().login(username, "");
var bll = new BLL.JfGwjdglBll();
dccdc.Models.JfGwjdgl model = new dccdc.Models.JfGwjdgl();
model.id = Convert.ToInt32(id);
JfGwjdgl info = bll.getJfGwjdglOne(model);
if ("1" == info.zt)
{
if (ty == "1")
{
info.zt = "4";
}
else
{
info.zt = "1";
}
info.bgsspsj = DateTime.Now;
info.bgsspyj = yj;
}
else if ("4" == info.zt)
{
if (ty == "1")
{
info.zt = "5";
}
else
{
info.zt = "1";
}
info.zxldspsj = DateTime.Now;
info.zxldspyj = yj;
}
var modelinfo = new sqshModel();
modelinfo.type = "公务接待管理"; //添加 查询与添加一致就行
modelinfo.sqid = Convert.ToInt32(info.id);
modelinfo.spr = user.TrueName;
modelinfo.sptime = DateTime.Now;
modelinfo.spnr = yj;
modelinfo.zt = (ty == "1") ? "通过" : "不通过";
new BLL.sqshBll().Add(modelinfo);
bool f = bll.updJfGwjdgl(info);
if (f)
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "修改成功" });
else
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "修改失败" });
}
//借款单审批--保存
//--id 意见 是否同意 审批领导 登陆人
[AllowAnonymous]
public string savejkdsp(string id, string yj, string ty, string username)
{
var user = new ERPUserBll().login(username, "");
var bll = new BLL.JfJkxxBll();
dccdc.Models.JfJkxx model = new dccdc.Models.JfJkxx();
model.id = Convert.ToInt32(id);
JfJkxx info = bll.getJfJkxxOne(model);
if ("1" == info.zt)//科室领导审批
{
if (ty == "1")
{
info.zt = "2";
}else
{
info.zt = "1";
}
info.ksldspsj = DateTime.Now;
info.ksldspyj = yj;
}
else if ("2" == info.zt)//分管领导审批
{
if (ty == "1")
{
info.zt = "3";
}
else
{
info.zt = "1";
}
info.fgldspsj = DateTime.Now;
info.fgldspyj = yj;
}
else if ("3" == info.zt)//财务领导审批
{
if (ty == "1")
{
info.zt = "4";
}
else
{
info.zt = "1";
}
info.cwfzspsj = DateTime.Now;
info.cwfzspyj = yj;
}
else if ("4" == info.zt)//中心领导审批
{
if (ty == "1")
{
info.zt = "5";
}
else
{
info.zt = "1";
}
info.zxldspsj = DateTime.Now;
info.zxldspyj = yj;
}
var modelinfo = new sqshModel();
modelinfo.type = "借款信息"; //添加 查询与添加一致就行
modelinfo.sqid = Convert.ToInt32(info.id);
modelinfo.spr = user.TrueName;
modelinfo.sptime = DateTime.Now;
modelinfo.spnr = yj;
modelinfo.zt = (ty == "1") ? "通过" : "不通过";
new BLL.sqshBll().Add(modelinfo);
bool f = bll.updJfJkxx(info);
if (f)
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "修改成功" });
else
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "修改失败" });
}
}
}