软测单独项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

800 lines
33 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FangYar.Common;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Data;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// CarApplyHandler 的摘要说明
/// </summary>
public class CarApplyHandler : IHttpHandler
{
private FangYar.BLL.TBL_SYS_CARAPPLY bll = new FangYar.BLL.TBL_SYS_CARAPPLY();
private FangYar.BLL.TBL_SYS_CAR car_bll = new FangYar.BLL.TBL_SYS_CAR();
public void ProcessRequest(HttpContext context)
{
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "用车申请操作请求", "");
context.Response.ContentType = "text/plain";
string action = context.Request.Params["Action"];
string returnstr = "";
switch (action)
{
case "List":
returnstr = GetList(context);
break;
case "UseList":
returnstr = GetUseList(context);
break;
case "GetUseListHomePage":
returnstr = GetUseListHomePage(context);
break;
case "Add":
returnstr = Add(context);
break;
case "getWaitList":
returnstr = getWaitList(context);
break;
case "editWait":
returnstr = editWait(context);
break;
case "AppList":
returnstr = AppList(context);
break;
case "ReturnCar":
returnstr = ReturnCar(context);
break;
case "ApprovalRegression":
returnstr = ApprovalRegression(context);
break;
case "getCarApply":
returnstr = getCarApply(context);
break;
case "homeApplySta":
returnstr = homeApplySta(context);
break;
case "homeApplyStaAll":
returnstr = homeApplyStaAll(context);
break;
}
context.Response.Write(returnstr);
}
//查询
//查询
private string GetUseList(HttpContext context)
{
string returnstr = "";
try
{
string uid = context.Request.Params["uid"];
string keyword = context.Request.Params["keywords"];
string treeID = context.Request.Params["treeID"];
string OrgList = context.Request.Params["OrgList"];
string id = context.Request.Params["id"];
string Orgid = context.Request.Params["OrgId"];
string page = context.Request.Params["page"];
string limit = context.Request.Params["limit"];
string startTime = context.Request.Params["startTime"];
string endTime = context.Request.Params["endTime"];
string is_content = context.Request.Params["is_content"];
string selDeptId = context.Request.Params["selDeptId"];
//登录账号所属部门
string DeptID = context.Request.Params["DeptID"] + "";
//是否管理员账号
string IsAdmin = context.Request.Params["IsAdmin"] + "";
int pageIndex = 1;
int pageSize = 10;
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
string where = " carid in ( SELECT id FROM tbl_sys_car WHERE ";
if (!string.IsNullOrEmpty(treeID))
{
Orgid = treeID;
}
if (is_content == "1")
{
where += " ( find_in_set(org_id, cids) ) ";
}
else
{
where += " ( ORG_ID = '" + Orgid + "' or DEPT_ID = '" + Orgid + "') ";
}
if (!string.IsNullOrWhiteSpace(selDeptId))
{
where += " and ORG_ID='" + Orgid + "' and DEPT_ID='" + selDeptId + "' ";
}
//判断是否管理员账号,如果不是管理员则只查询本部门数据
if (IsAdmin != "1")
{
if (!string.IsNullOrWhiteSpace(DeptID))
{
where += " and ORG_ID='" + Orgid + "' and DEPT_ID='" + DeptID + "' ";
}
}
where += " ) ";
string pOrgID = Orgid;
if (!string.IsNullOrEmpty(startTime))
{
if (!startTime.Contains("请选择"))
{
where += " and STARTTIME >= date_format('" + startTime + "','%Y-%m-%d %H:%i:%s')";
}
}
if (!string.IsNullOrEmpty(endTime))
{
if (!endTime.Contains("请选择"))
{
where += " and STARTTIME <= date_format('" + endTime + "','%Y-%m-%d %H:%i:%s')";
}
}
if (!string.IsNullOrEmpty(keyword))
{
where += " and ( USERNAME like '%" + keyword + "%' or USERPHONE like '%" + keyword + "%' or CARNUM like '%" + keyword + "%' )";
}
if (!string.IsNullOrEmpty(id))
{
where += " and ( ID ='" + id + "' )";
}
// where += " and t.state = '1'";
returnstr = "{\"code\":0,\"msg\":\"\",";
int count = bll.GetRecordCount(where, pOrgID);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
DataTable dt = bll.QueryTable(pageIndex, pageSize, where, " starttime desc ", pOrgID);
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "查询异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "查询");
return returnstr;
}
/// <summary>
/// 查询1
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string GetList(HttpContext context)
{
string returnstr = "";
try
{
string uid = context.Request.Params["uid"];
string keyword = context.Request.Params["keywords"];
//string treeID = context.Request.Params["treeID"];
//string type = context.Request.Params["type"];
string id = context.Request.Params["id"];
string page = context.Request.Params["page"];
string limit = context.Request.Params["limit"];
int pageIndex = 1;
int pageSize = 10;
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
string where = " (USERID = '" + uid + "' or USERID = 'u_" + uid + "') ";
if (!string.IsNullOrEmpty(keyword))
{
where += " and ( USERNAME like '%" + keyword + "%' or USERPHONE like '%" + keyword + "%' or CARNUM like '%" + keyword + "%' )";
}
if (!string.IsNullOrEmpty(id))
{
where += " and ( ID ='" + id + "' )";
}
where += "order by starttime desc";
returnstr = "{\"code\":0,\"msg\":\"\",";
int count = bll.GetRecordCount(where);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
DataTable dt = bll.QueryTable(pageIndex, pageSize, where, "");
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "查询1异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "查询1");
return returnstr;
}
//添加
private string Add(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string userid = context.Request.Params["userid"];//申请人ID
string username = context.Request.Params["username"];//申请人姓名
string userphone = context.Request.Params["userphone"];//申请人电话
string carid = context.Request.Params["carid"];//车辆号牌
string userman = context.Request.Params["userman"];//用车人
string dept = context.Request.Params["dept"];//单位
string ridenum = context.Request.Params["ridenum"];//乘车时间
string ridemans = context.Request.Params["ridemans"];////乘车人员
string ridepurpose = context.Request.Params["ridepurpose"];//用车目的
string startpoint = context.Request.Params["startpoint"];//起点
string destination = context.Request.Params["destination"];//目的地
string starttime = context.Request.Params["starttime"]; //其实时间
string finishtime = context.Request.Params["finishtime"]; //结束时间
string app_pplId = context.Request.Params["app_pplId"];//审批人员
//申请用车
FangYar.Model.TBL_SYS_CARAPPLY model = new Model.TBL_SYS_CARAPPLY();
model.ID = Guid.NewGuid().ToString("N");
model.USERID = userid;
model.USERNAME = username;
model.USERPHONE = userphone;
model.CARID = carid;
FangYar.BLL.TBL_SYS_CAR car_bll = new BLL.TBL_SYS_CAR();
FangYar.Model.TBL_SYS_CAR car_model = car_bll.GetModel(carid);
model.CARNUM = "";
if (car_model != null)
{
model.CARNUM = car_model.CAR_NUM;
}
model.CARNUM = car_model.CAR_NUM;
model.USERMAN = userman;
//获取申请人信息
FangYar.BLL.TBL.SysEmpBLL emp_bll = new BLL.TBL.SysEmpBLL();
FangYar.Model.TBL.TBL_SYS_EMP_Model empmodel = emp_bll.GetModelByID(userid);
model.DEPT = dept;
//if (car_model != null)
//{
// model.DEPT = empmodel.DEPT_ID;
//}
model.TYPE = "";
if (!string.IsNullOrEmpty(ridenum))
{
model.RIDENUM = Int32.Parse(ridenum);
}
else
{
model.RIDENUM = 1;
}
model.RIDEMANS = ridemans;
model.RIDEPURPOSE = ridepurpose;
model.STARTPOINT = startpoint;
model.DESTINATION = destination;
model.STARTTIME = DateTime.Parse(starttime);
model.FINISHTIME = DateTime.Parse(finishtime);
model.STATE = "0";
model.EXTENDCODE2 = "";
if (bll.Add(model))
{
//添加到流程中
//{"data":[{"ppl_Id":"cscj01","ppl_Name":"昌吉支队测试账号01"}]}
JObject jObj = JObject.Parse(app_pplId);
var datas = jObj["data"];
int i = 1;
bool result = false;
FangYar.BLL.OA_WAITPROCESSED wbll = new BLL.OA_WAITPROCESSED();
foreach (var data in datas)
{
JObject jObj2 = JObject.Parse(data.ToString());
string ppl_Id = jObj2["ppl_Id"].ToString();
string ppl_Name = jObj2["ppl_Name"].ToString();
FangYar.Model.OA_WAITPROCESSED wmodel = new FangYar.Model.OA_WAITPROCESSED();
wmodel.ID = Guid.NewGuid().ToString("N");
wmodel.TASK_ID = model.ID;
wmodel.TASK_TYPE = "carApply";
wmodel.PPL_ID = ppl_Id;
wmodel.PPL_NAME = ppl_Name;
wmodel.R_TIME = DateTime.Now.ToString();
wmodel.SORT = i;
wmodel.APPLE_ID = userid;
wmodel.APPLE_NAME = username;
string state = "0";
if (i == 1)
{
state = "1";
}
wmodel.STATE = state;
result = wbll.Add(wmodel);
if (i == 1)
{
FangYar.BLL.TBL.SysUsersBLL ubll = new BLL.TBL.SysUsersBLL();
Model.TBL.TBL_SYS_USERS_Model usersModel = ubll.CheckLoginByUserID(ppl_Id);
//cwsService.CwsClient cws = new cwsService.CwsClient();
//cws.yqMessageSend(usersModel.USERS_MOBILE, ppl_Name, "用车", "待审批");
}
i++;
if (result)
{
car_model.ISAPPLY = "1";
bool result_car = car_bll.Update(car_model);
if (result_car)
{
msg = "添加成功!";
code = 1;
}
else
{
return returnstr = "{\"msg\":\"添加失败!\",\"code\":-1}";
}
}
else
{
return returnstr = "{\"msg\":\"添加失败!\",\"code\":-1}";
}
}
msg = "添加成功!";
code = 1;
}
else { msg = "添加失败!"; }
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "添加异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "用车申请操作请求", "添加");
return returnstr;
}
/// <summary>
/// 流转信息
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string getWaitList(HttpContext context)
{
string returnstr = "";
try
{
string taskid = context.Request.Params["id"];//tsakID
int count = 0;
string strWhere = "";
//TASK_ID
//申请用车流转信息
//select* from WORKFLOWTASK t where instanceid = '" + leaveId + "' order by sort
FangYar.BLL.OA_WAITPROCESSED waitbll = new BLL.OA_WAITPROCESSED();
strWhere = " TASK_ID='" + taskid + "' order by SORT asc";
returnstr += "{\"code\":1,\"msg\":\"error\",";
count = waitbll.GetRecordCount(strWhere);
if (count == 0)
{
FangYar.BLL.OA_ALREADYPROCESSED alreadybll = new BLL.OA_ALREADYPROCESSED();
count = alreadybll.GetRecordCount(strWhere);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
List<FangYar.Model.OA_ALREADYPROCESSED> list = alreadybll.GetModelList(strWhere);
returnstr += FangYar.Common.JsonHelper.ToJson(list);
}
}
else
{
returnstr += "\"count\":" + count + ",\"data\":";
List<FangYar.Model.OA_WAITPROCESSED> list = waitbll.GetModelList(strWhere);
returnstr += FangYar.Common.JsonHelper.ToJson(list);
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "流转信息异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "流转信息");
return returnstr;
}
//车辆申请审批
private string editWait(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
string usercode = "";
try
{
string leaveId = context.Request.Params["leaveId"];
string waitId = context.Request.Params["waitId"];
string state = context.Request.Params["state"];
string sort = context.Request.Params["sort"];
string aOpinion = context.Request.Params["a_opinion"];
string isOver = context.Request.Params["isOver"];
FangYar.Model.OA_WAITPROCESSED model = new Model.OA_WAITPROCESSED();
model.ID = waitId;
model.TASK_ID = leaveId;
model.STATE = state;
model.SORT = Convert.ToInt32(sort);
model.A_OPINION = aOpinion;
usercode = bll.editWait(model, isOver);
if (!string.IsNullOrEmpty(usercode))
{
msg = "审批成功!";
code = 1;
//cwsService.CwsClient cws = new cwsService.CwsClient();
FangYar.BLL.TBL.SysUsersBLL ubll = new BLL.TBL.SysUsersBLL();
Model.TBL.TBL_SYS_USERS_Model usersModel = ubll.CheckLoginByUserID(usercode);
string org3 = "已审批";
//发送给下一位待办人
if (state == "2" && isOver == "0") org3 = "待审批";
//cws.yqMessageSend(usersModel.USERS_MOBILE, usersModel.USERS_NAME, "用车", org3);
}
else { msg = "审批失败!"; }
}
catch (Exception e)
{
msg = "审批失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "车辆申请审批异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":\"" + code + "\",\"usercode\":\"" + usercode + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用车申请操作请求", "车辆申请审批");
return returnstr;
}
//APP查询
private string AppList(HttpContext context)
{
string returnstr = "";
try
{
string id = context.Request.Params["id"];
string where = "1=1";
if (!string.IsNullOrEmpty(id))
{
where += " and ( ID ='" + id + "' )";
}
returnstr = "{\"code\":0,\"msg\":\"\",";
int count = bll.GetRecordCount(where);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
Model.TBL_SYS_CARAPPLY mcarapply = bll.GetModel(id);
returnstr += FangYar.Common.JsonHelper.ToJson(mcarapply);
//获取流转信息
try
{
int count3 = 0, count2 = 0;
string strWhere = "";
//申请用车
FangYar.BLL.OA_WAITPROCESSED waitbll = new BLL.OA_WAITPROCESSED();
strWhere = " TASK_ID='" + id + "' order by SORT asc";
count3 = waitbll.GetRecordCount(strWhere);
if (count3 == 0)
{
FangYar.BLL.OA_ALREADYPROCESSED alreadybll = new BLL.OA_ALREADYPROCESSED();
count2 = alreadybll.GetRecordCount(strWhere);
returnstr += ",\"data2\":";
if (count2 == 0)
{
returnstr += "[]";
}
else
{
List<FangYar.Model.OA_ALREADYPROCESSED> list = alreadybll.GetModelList(strWhere);
returnstr += FangYar.Common.JsonHelper.ToJson(list);
}
}
else
{
returnstr += ",\"data2\":";
List<FangYar.Model.OA_WAITPROCESSED> list = waitbll.GetModelList(strWhere);
returnstr += FangYar.Common.JsonHelper.ToJson(list);
}
}
catch
{
returnstr = ",\"data2\":[]";
}
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "APP查询异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "APP查询");
return returnstr;
}
//还车申请
private string ReturnCar(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
string usercode = "";
try
{
string Id = context.Request.Params["Id"];
//请假表
FangYar.Model.TBL_SYS_CARAPPLY model = new Model.TBL_SYS_CARAPPLY();
model.ID = Id;
usercode = bll.ReturnCar(model);
if (!string.IsNullOrEmpty(usercode))
{
msg = "申请成功!";
code = 1;
}
else { msg = "申请失败!"; }
}
catch (Exception e)
{
msg = "申请失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "还车申请异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":\"" + code + "\",\"usercode\":\"" + usercode + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用车申请操作请求", "还车申请");
return returnstr;
}
//还车审批
private string ApprovalRegression(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
try
{
string TASK_ID = context.Request.Params["TASK_ID"];
string waitId = context.Request.Params["waitId"];
string state = context.Request.Params["state"];
//待办表
FangYar.Model.OA_WAITPROCESSED model = new Model.OA_WAITPROCESSED();
model.ID = waitId;
model.TASK_ID = TASK_ID;
model.STATE = state;
if (bll.ApprovalRegression(model))
{
msg = "审批成功!";
code = 1;
}
else { msg = "审批失败!"; }
}
catch (Exception e)
{
msg = "审批失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "还车审批异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用车申请操作请求", "还车审批");
return returnstr;
}
//获取用车信息、流转记录
private string getCarApply(HttpContext context)
{
string returnstr = "";
try
{
string id = context.Request.Params["id"];
returnstr = "{\"code\":0,\"msg\":\"\",\"applyData\":";
List<DataTable> data = bll.getCarApply(id);
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
returnstr += ",\"waitData\":";
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"leaveData\":[],\"waitData\":[] }";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "获取用车信息、流转记录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "获取用车信息、流转记录");
return returnstr;
}
//首页用车七天统计
private string homeApplySta(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
string data = "";
string strWhere = " ";
try
{
string ORG_ID = context.Request.Params["Org_Id"];
if (!string.IsNullOrEmpty(ORG_ID))
{
code = 1;
strWhere += " ORG_ID='" + ORG_ID + "'";
DataTable dt = bll.homeApplySta(strWhere);
data = FangYar.Common.JsonHelper.ToJson(dt);
}
}
catch (Exception e)
{
msg = "获取失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "首页用车七天统计异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "首页用车七天统计");
return returnstr;
}
//首页用车七天统计
private string homeApplyStaAll(HttpContext context)
{
string returnstr = "";
int code = -1;
string msg = "";
string data = "";
string strWhere = " ";
try
{
string ORG_ID = context.Request.Params["Org_Id"];
if (!string.IsNullOrEmpty(ORG_ID))
{
code = 1;
strWhere += " org_id in (select o.org_id from fire_org o,(select get_Org_child_list('" + ORG_ID + "') cids ) s where o.type = '0' and find_in_set(o.org_id,cids) ) ";
DataTable dt = bll.homeApplySta(strWhere);
data = FangYar.Common.JsonHelper.ToJson(dt);
}
}
catch (Exception e)
{
msg = "获取失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "首页用车七天统计异常:" + e);
}
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "首页用车七天统计");
return returnstr;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string GetUseListHomePage(HttpContext context)
{
string returnstr = "";
try
{
string Orgid = context.Request.Params["OrgId"];
string is_content = context.Request.Params["is_content"];
string where = " carid in ( SELECT id FROM tbl_sys_car WHERE ";
if (is_content == "0")
{
where += " ( ORG_ID = '" + Orgid + "' or DEPT_ID = '" + Orgid + "') )";
}
else
{
where += " org_id in (select o.org_id from fire_org o,(select get_Org_child_list('" + Orgid + "') cids ) s where o.type = '0' and find_in_set(o.org_id,cids) ) )";
}
where += " AND date_format(STARTTIME , '%Y-%m-%d' ) >= date_format('" + DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd") + "', '%Y-%m-%d')";
where += " AND date_format(STARTTIME , '%Y-%m-%d' ) <= date_format('" + DateTime.Now.ToString("yyyy-MM-dd") + "', '%Y-%m-%d')";
//where += " and state = '1'";
where += " order by STARTTIME desc";
returnstr = "{\"code\":0,\"msg\":\"\",";
int count = bll.GetRecordCount(where);
returnstr += "\"count\":" + count + ",\"data\":";
if (count == 0)
{
returnstr += "[]";
}
else
{
DataTable dt = bll.GetUseListHomePage(where);
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
}
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用车申请操作请求", "查询异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用车申请操作请求", "查询");
return returnstr;
}
public bool IsReusable
{
get
{
return false;
}
}
}
}