using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using Newtonsoft.Json; using System.Drawing; using System.IO; namespace FangYar.WebUI.ashx { /// /// CarHandler 的摘要说明 /// public class ZYCarHandler : IHttpHandler { private FangYar.BLL.TBL_SYS_CAR bll = new FangYar.BLL.TBL_SYS_CAR(); FangYar.BLL.TBL_CARACCESS cabll = new BLL.TBL_CARACCESS(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "CarList": returnstr = GetCarList(context); break; case "Add": returnstr = AddCar(context); break; case "Edit": returnstr = EditOrgEmp(context); break; case "Del": returnstr = DelCar(context); break; case "GetTree": returnstr = GetTree(context); break; case "CarLocationList": returnstr = CarLocationList(context); break; case "View": returnstr = View(context); break; case "GetCarAccessList": returnstr = GetCarAccessList(context); break; case "ViewAccess": returnstr = ViewAccess(context); break; case "GetCarWeek": returnstr = GetCarWeek(context); break; case "GetAppCarList": returnstr = GetAppCarList(context); break; case "GetCarListByIMEI": returnstr = GetCarListByIMEI(context); break; case "carAccessSta": returnstr = carAccessSta(context); break; case "homeCarStaAll": returnstr = homeCarStaAll(context); break; } context.Response.Write(returnstr); } ////机构-部门树 //private string GetOrgDeptTree(HttpContext context) //{ // string returnstr = ""; // try // { // string orgId = context.Request.Params["OrgId"]; // returnstr = "{\"code\":0,\"msg\":\"\",\"data\":"; // DataTable data = bll.getOrgTree(orgId); // returnstr += FangYar.Common.JsonHelper.ToJson(data); // returnstr += "}"; // } // catch // { // returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; // } // return returnstr; //} //查询 private string GetCarList(HttpContext context) { string returnstr = ""; try { string OrgId = context.Request.Params["OrgId"] + ""; string OrgList = context.Request.Params["OrgList"] + ""; string keyword = context.Request.Params["keywords"] + ""; string treeID = context.Request.Params["treeID"] + ""; string type = context.Request.Params["type"] + ""; string page = context.Request.Params["page"] + ""; string limit = context.Request.Params["limit"] + ""; string bclass = context.Request.Params["class"] + ""; int pageIndex = 1; int pageSize = 10; if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } string where = "1=1"; if (!string.IsNullOrEmpty(treeID) && treeID != OrgId) { if (type == "dept") { where += " and dept_id ='" + treeID + "' "; } else { where += " and ORG_ID = '" + treeID + "'"; } } //if (!string.IsNullOrEmpty(OrgId)) //{ // where += " and ORG_ID = '" + OrgId + "'"; //} else { string[] OrgArray = OrgList.Split(','); string OrgListString = ""; for (int i = 0; i < OrgArray.Length; i++) { if (i == 0) { OrgListString = "'" + OrgArray[i] + "'"; } else { OrgListString += ",'" + OrgArray[i] + "'"; } } where = " ORG_ID in (" + OrgListString + ") "; } if (!string.IsNullOrEmpty(bclass)) { where += " and CLASS = '" + bclass + "'"; } if (!string.IsNullOrEmpty(keyword)) { if (where != null) { where += " and "; } where += "( CAR_NUM like '%" + keyword + "%' or CAR_NAME like '%" + keyword + "%')"; } if (where != null) { where += " and "; } where += " (is_del != '1' or is_del is null)"; returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { List list = bll.QueryList(pageIndex, pageSize, where, ""); returnstr += FangYar.Common.JsonHelper.ToJson(list); } returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //添加 private string AddCar(HttpContext context) { string returnstr = ""; int code = -1; string msg = ""; try { string car_name = context.Request.Params["car_name"];//车辆名称 string car_no = context.Request.Params["car_no"];//车辆编号 string org_id = context.Request.Params["org_id"]; //上机消防机关 string dept_id = context.Request.Params["dept_id"]; //本机消防机关 string car_num = context.Request.Params["car_num"];//车辆号牌 string car_code = context.Request.Params["car_code"];//车辆登记代号 string frame_num = context.Request.Params["frame_num"];//车架号 string engine_no = context.Request.Params["engine_no"];//发动机号 string trademark = context.Request.Params["trademark"];//商标 string gbcode = context.Request.Params["gbcode"];//国标代码 string factory = context.Request.Params["factory"];//出厂厂家 string liableman = context.Request.Params["liableman"]; //责任人名称 string region = context.Request.Params["region"]; //所属辖区 string isrun = context.Request.Params["isrun"];//是否运行 string bigclass = context.Request.Params["class"];//大类型 string type = context.Request.Params["type"];//小类型 string watwernum = context.Request.Params["watwernum"];//载水量 string drypowder = context.Request.Params["drypowder"];//载干粉量 string heightboardingcar = context.Request.Params["heightboardingcar"]; //登高车工作高度 string frothamount = context.Request.Params["frothamount"]; //泡沫量 string frothamounta = context.Request.Params["frothamounta"];//类泡沫量 string frothamountb = context.Request.Params["frothamountb"];//类泡沫量 string frothamountmulti = context.Request.Params["frothamountmulti"];//多功能泡沫量 string liquidlevel = context.Request.Params["liquidlevel"];//液位 string pressure = context.Request.Params["pressure"];//压力 string telnum = context.Request.Params["telnum"];//电话 //员工表 FangYar.Model.TBL_SYS_CAR model = new Model.TBL_SYS_CAR(); model.ID = Guid.NewGuid().ToString("N"); model.CAR_NAME = car_name; model.CAR_NO = car_no; model.ORG_ID = org_id; ; model.DEPT_ID = dept_id; model.CAR_NUM = car_num; model.CAR_CODE = car_code; model.FRAME_NUM = frame_num; model.ENGINE_NO = engine_no; model.TRADEMARK = trademark; model.GB_CODE = gbcode; model.FACTORY = factory; model.LIABLEMAN = liableman; model.REGION = region; model.ISRUN = isrun; model.CLASS = bigclass; model.TYPE = type; if (!string.IsNullOrEmpty(watwernum)) { model.WATERNUM = Convert.ToDecimal(watwernum); } if (!string.IsNullOrEmpty(drypowder)) { model.DRYPOWDER = Convert.ToDecimal(drypowder); } if (!string.IsNullOrEmpty(heightboardingcar)) { model.HEIGHTBOARDINGCAR = Convert.ToDecimal(heightboardingcar); } if (!string.IsNullOrEmpty(frothamount)) { model.FROTHAMOUNT = Convert.ToDecimal(frothamount); } if (!string.IsNullOrEmpty(frothamounta)) { model.FROTHAMOUNTA = Convert.ToDecimal(frothamounta); } if (!string.IsNullOrEmpty(frothamountb)) { model.FROTHAMOUNTB = Convert.ToDecimal(frothamountb); } if (!string.IsNullOrEmpty(frothamountmulti)) { model.FROTHAMOUNTMULTI = Convert.ToDecimal(frothamountmulti); } if (!string.IsNullOrEmpty(liquidlevel)) { model.LIQUIDLEVEL = Convert.ToDecimal(liquidlevel); } if (!string.IsNullOrEmpty(pressure)) { model.PRESSURE = Convert.ToDecimal(pressure); } model.TELNUM = telnum; model.ISSTART = "0"; if (bll.Add(model)) { msg = "添加成功!"; code = 1; } else { msg = "添加失败!"; } } catch { msg = "添加失败!"; } returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}"; return returnstr; } //修改 private string EditOrgEmp(HttpContext context) { string returnstr = ""; int code = -1; string msg = ""; try { string id = context.Request.Params["id"]; string car_name = context.Request.Params["car_name"];//车辆名称 string car_no = context.Request.Params["car_no"];//车辆编号 string org_id = context.Request.Params["org_id"]; //上机消防机关 string dept_id = context.Request.Params["dept_id"]; //本机消防机关 string car_num = context.Request.Params["car_num"];//车辆号牌 string car_code = context.Request.Params["car_code"];//车辆登记代号 string frame_num = context.Request.Params["frame_num"];//车架号 string engine_no = context.Request.Params["engine_no"];//发动机号 string trademark = context.Request.Params["trademark"];//商标 string gbcode = context.Request.Params["gbcode"];//国标代码 string factory = context.Request.Params["factory"];//出厂厂家 string liableman = context.Request.Params["liableman"]; //责任人名称 string region = context.Request.Params["region"]; //所属辖区 string isrun = context.Request.Params["isrun"];//是否运行 string bigclass = context.Request.Params["class"];//大类型 string type = context.Request.Params["type"];//小类型 string watwernum = context.Request.Params["watwernum"];//载水量 string drypowder = context.Request.Params["drypowder"];//载干粉量 string heightboardingcar = context.Request.Params["heightboardingcar"]; //登高车工作高度 string frothamount = context.Request.Params["frothamount"]; //泡沫量 string frothamounta = context.Request.Params["frothamounta"];//类泡沫量 string frothamountb = context.Request.Params["frothamountb"];//类泡沫量 string frothamountmulti = context.Request.Params["frothamountmulti"];//多功能泡沫量 string liquidlevel = context.Request.Params["liquidlevel"];//液位 string pressure = context.Request.Params["pressure"];//压力 string telnum = context.Request.Params["telnum"];//电话 string isstart = context.Request.Params["isstart"];//是否启动 //员工表 FangYar.Model.TBL_SYS_CAR model = new Model.TBL_SYS_CAR(); model.ID = id; model.CAR_NAME = car_name; model.CAR_NO = car_no; model.ORG_ID = org_id; model.DEPT_ID = dept_id; model.CAR_NUM = car_num; model.CAR_CODE = car_code; model.FRAME_NUM = frame_num; model.ENGINE_NO = engine_no; model.TRADEMARK = trademark; model.GB_CODE = gbcode; model.FACTORY = factory; model.LIABLEMAN = liableman; model.REGION = region; model.ISRUN = isrun; model.CLASS = bigclass; model.TYPE = type; model.WATERNUM = Convert.ToDecimal(watwernum); model.DRYPOWDER = Convert.ToDecimal(drypowder); model.HEIGHTBOARDINGCAR = Convert.ToDecimal(heightboardingcar); model.FROTHAMOUNT = Convert.ToDecimal(frothamount); model.FROTHAMOUNTA = Convert.ToDecimal(frothamounta); model.FROTHAMOUNTB = Convert.ToDecimal(frothamountb); model.FROTHAMOUNTMULTI = Convert.ToDecimal(frothamountmulti); model.LIQUIDLEVEL = Convert.ToDecimal(liquidlevel); model.PRESSURE = Convert.ToDecimal(pressure); model.TELNUM = telnum; model.ISSTART = isstart; if (bll.Update(model)) { msg = "修改成功!"; code = 1; } else { msg = "修改失败!"; } } catch { msg = "修改失败!"; } returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}"; return returnstr; } //删除车辆 private string DelCar(HttpContext context) { string returnstr = ""; int code = -1; string msg = ""; try { string EmpList = context.Request.Params["carList"]; string[] EmpArray = EmpList.Split(','); string EmpListString = ""; for (int i = 0; i < EmpArray.Length; i++) { if (i == 0) { EmpListString = "'" + EmpArray[i] + "'"; } else { EmpListString += ",'" + EmpArray[i] + "'"; } } if (bll.DeleteList(EmpListString)) { msg = "删除成功!"; code = 1; } else { msg = "删除失败!"; } } catch { msg = "删除失败!"; } returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; return returnstr; } //获取车辆tree private string GetTree(HttpContext context) { string returnstr = ""; try { string orgId = context.Request.Params["OrgId"]; returnstr = "{\"code\":0,\"msg\":\"\",\"data\":"; DataTable data = bll.GetListCarTree(orgId).Tables[0]; data.Columns.Add("nocheck", typeof(string)); //数据类型为文本 for (int i = 0; i < data.Rows.Count; i++) { string aaa = data.Rows[i]["TYPE"].ToString(); if (data.Rows[i]["TYPE"].ToString() == "car") { data.Rows[i]["nocheck"] = "false"; } else { data.Rows[i]["nocheck"] = "true"; } } returnstr += FangYar.Common.JsonHelper.ToJson(data); returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } private string View(HttpContext context) { string returnstr = ""; string data = ""; string msg = ""; try { string ID = context.Request.Params["ID"];//车辆id DataTable dt = new DataTable(); dt = bll.CarInfo(ID).Tables[0]; if (dt != null) { msg = "查看成功!"; data = FangYar.Common.JsonHelper.ToJson(dt); } else { msg = "查看失败!"; } } catch { msg = "添加失败!"; } returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}"; return returnstr; } private string GetCarAccessList(HttpContext context) { string returnstr = ""; try { string OrgId = context.Request.Params["OrgId"]; string keyword = context.Request.Params["keywords"]; string type = context.Request.Params["type"]; string page = context.Request.Params["page"]; string limit = context.Request.Params["limit"]; string bclass = context.Request.Params["class"]; int pageIndex = 1; int pageSize = 10; if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); } if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } string where = "1=1"; if (!string.IsNullOrEmpty(OrgId)) { where += " and ORG_ID = '" + OrgId + "'"; } if (!string.IsNullOrEmpty(bclass)) { where += " and CLASS = '" + bclass + "'"; } if (!string.IsNullOrEmpty(keyword)) { if (where != null) { where += " and "; } where += "( CAR_PLATE like '%" + keyword + "%' or LOLOR like '%" + keyword + "%')"; } where += " order by START_TIME desc"; returnstr = "{\"code\":0,\"msg\":\"\","; int count = cabll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { string data = "["; List list = cabll.QueryList(pageIndex, pageSize, where, ""); for (int i = 0; i < list.Count; i++) { string pic1 = ""; string pic2 = ""; if (list[i].PICTURE != null && list[i].PICTURE.ToString() != "") { pic1 = Convert.ToBase64String((byte[])list[i].PICTURE); } if (list[i].CLOSEUP_PIC != null && list[i].CLOSEUP_PIC.ToString() != "") { pic2 = Convert.ToBase64String((byte[])list[i].CLOSEUP_PIC); } data += "{\"ID\":\"" + list[i].ID + "\",\"TYPE\":\"" + list[i].TYPE + "\",\"CAR_PLATE\":\"" + list[i].CAR_PLATE + "\",\"COLOR\":\"" + list[i].COLOR + "\",\"CAR_COLOR\":\"" + list[i].CAR_COLOR + "\",\"CAR_LOGO\":\"" + list[i].CAR_LOGO + "\",\"START_TIME\":\"" + list[i].START_TIME + "\",\"CAMERA_ID\":\"" + list[i].CAMERA_ID + "\","; data += "\"ORG_ID\":\"" + list[i].ORG_ID + "\",\"VEHICLETYPE\":\"" + list[i].VEHICLETYPE + "\",\"CAR_ID\":\"" + list[i].CAR_ID + "\",\"INOROUT\":\"" + list[i].INOROUT + "\",\"CLASS\":\"" + list[i].CLASS + "\",\"ADDR\":\"" + list[i].ADDR + "\",\"DUTYMANS\":\"" + list[i].DUTYMANS + "\","; data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\"}"; if (i != list.Count - 1) { data += ","; } } returnstr += data + "]"; } returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //获取车辆进出的详细记录 private string ViewAccess(HttpContext context) { FangYar.BLL.TBL_CARACCESS cabll = new BLL.TBL_CARACCESS(); string strwhere = "1=1 "; string returnstr = ""; string data = ""; string msg = ""; try { string ID = context.Request.Params["ID"];// DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(ID)) { strwhere += "and ID='" + ID + "'"; } dt = cabll.GetAccessInfo(strwhere).Tables[0]; if (dt != null) { msg = "查看成功!"; data = "["; string pic1 = ""; string pic2 = ""; if (dt.Rows[0]["PICTURE"] != null && dt.Rows[0]["PICTURE"].ToString() != "") { pic1 = Convert.ToBase64String((byte[])dt.Rows[0]["PICTURE"]); } if (dt.Rows[0]["CLOSEUP_PIC"] != null && dt.Rows[0]["CLOSEUP_PIC"].ToString() != "") { pic2 = Convert.ToBase64String((byte[])dt.Rows[0]["CLOSEUP_PIC"]); } data += "{\"ID\":\"" + dt.Rows[0]["ID"].ToString() + "\",\"TYPE\":\"" + dt.Rows[0]["TYPE"].ToString() + "\",\"CAR_PLATE\":\"" + dt.Rows[0]["CAR_PLATE"].ToString() + "\",\"COLOR\":\"" + dt.Rows[0]["COLOR"].ToString() + "\",\"CAR_COLOR\":\"" + dt.Rows[0]["CAR_COLOR"].ToString() + "\",\"CAR_LOGO\":\"" + dt.Rows[0]["CAR_LOGO"].ToString() + "\",\"START_TIME\":\"" + dt.Rows[0]["START_TIME"].ToString() + "\",\"CAMERA_ID\":\"" + dt.Rows[0]["CAMERA_ID"].ToString() + "\","; data += "\"ORG_ID\":\"" + dt.Rows[0]["ORG_ID"].ToString() + "\",\"VEHICLETYPE\":\"" + dt.Rows[0]["VEHICLETYPE"].ToString() + "\",\"CAR_ID\":\"" + dt.Rows[0]["CAR_ID"].ToString() + "\",\"INOROUT\":\"" + dt.Rows[0]["INOROUT"].ToString() + "\",\"CLASS\":\"" + dt.Rows[0]["CLASS"].ToString() + "\",\"ADDR\":\"" + dt.Rows[0]["ADDR"].ToString() + "\",\"DUTYMANS\":\"" + dt.Rows[0]["DUTYMANS"].ToString() + "\","; data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\"}"; data += "]"; } else { msg = "查看失败!"; } } catch { msg = "查看失败!"; } returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}"; return returnstr; } //获取车辆轨迹点坐标列表 private string CarLocationList(HttpContext context) { string returnstr = ""; string strWhere = ""; string ids = ""; try { string carList = context.Request.Params["carList"]; string stime = context.Request.Params["stime"]; string etime = context.Request.Params["etime"]; string type = context.Request.Params["type"]; returnstr = "{\"code\":0,\"msg\":\"\",\"data\":"; string[] carids = carList.Split(','); if (carids.Length > 0) { foreach (string id in carids) { ids += "'" + id + "',"; } ids += "' '"; strWhere = "carid in (" + ids + ")"; if (!string.IsNullOrEmpty(stime)) { strWhere += " and ( locatetime between '" + stime + "' and '" + etime + "')"; } DataTable data = bll.CarLocationList(strWhere, type).Tables[0]; returnstr += FangYar.Common.JsonHelper.ToJson(data); returnstr += "}"; } else { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //获取车辆数量趋势 private string GetCarWeek(HttpContext context) { string returnstr = ""; try { returnstr = "{\"code\":1,\"msg\":\"\","; returnstr += "\"data\":"; string ORG_ID = context.Request.Params["ORG_ID"]; string where = "1=1"; where += " and (ORG_ID ='" + ORG_ID + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + ORG_ID + "') )"; returnstr += JsonConvert.SerializeObject(cabll.TotalDaysAlarm(7, where)); returnstr += "}"; } catch { returnstr = "{\"code\":-1,\"msg\":\"\","; returnstr += "}"; } return returnstr; } //APP查询车辆列表 private string GetAppCarList(HttpContext context) { string returnstr = ""; try { string OrgId = context.Request.Params["OrgId"]; string carName = context.Request.Params["carName"]; string carNum = context.Request.Params["carNum"]; string carType = context.Request.Params["carType"]; string isRun = context.Request.Params["isRun"]; string isStart = context.Request.Params["isStart"]; 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 = "1=1"; if (!string.IsNullOrEmpty(OrgId)) { where += " and (ORG_ID ='" + OrgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + OrgId + "') )"; } if (!string.IsNullOrEmpty(carName)) { where += " and CAR_NAME like '%" + carName + "%'"; } if (!string.IsNullOrEmpty(carNum)) { where += " and CAR_NUM like '%" + carNum + "%' "; } if (!string.IsNullOrEmpty(carType)) { where += " and CLASS = '" + carType + "'"; } if (!string.IsNullOrEmpty(isRun)) { where += " and ISRUN = '" + isRun + "'"; } if (!string.IsNullOrEmpty(isStart)) { where += " and ISSTART = '" + isStart + "'"; } returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { List list = bll.QueryList(pageIndex, pageSize, where, ""); returnstr += FangYar.Common.JsonHelper.ToJson(list); } returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } //查询装有IMEI的车辆 private string GetCarListByIMEI(HttpContext context) { string returnstr = ""; try { string OrgId = context.Request.Params["OrgId"]; string carNum = context.Request.Params["carNum"]; 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 = " IMEI is not null and IMEI != '' "; if (!string.IsNullOrEmpty(OrgId)) { where += " and (ORG_ID ='" + OrgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + OrgId + "') )"; } if (!string.IsNullOrEmpty(carNum)) { where += " and CAR_NUM like '%" + carNum + "%' "; } returnstr = "{\"code\":0,\"msg\":\"\","; int count = bll.GetRecordCount(where); returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { List list = bll.QueryList(pageIndex, pageSize, where, ""); returnstr += FangYar.Common.JsonHelper.ToJson(list); } returnstr += "}"; } catch { returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]"; } return returnstr; } private string carAccessSta(HttpContext context) { string returnstr = ""; int code = -1; string msg = ""; string data = ""; string strWhere = " 1=1"; try { string ORG_ID = context.Request.Params["Org_Id"]; string S_Time = context.Request.Params["S_Time"]; string E_Time = context.Request.Params["E_Time"]; if (!string.IsNullOrEmpty(ORG_ID)) { code = 1; strWhere += " and ORG_ID='" + ORG_ID + "'"; if (!string.IsNullOrEmpty(S_Time) && !string.IsNullOrEmpty(E_Time)) { strWhere += " and date_format('" + S_Time + "','%Y-%m-%d') < START_TIME"; strWhere += " and date_format('" + E_Time + "','%Y-%m-%d') > START_TIME"; } else { strWhere += " and date_format(START_TIME,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')"; } DataTable dt = cabll.carAccessSta(strWhere); data = FangYar.Common.JsonHelper.ToJson(dt); } } catch { msg = "获取失败!"; } returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}"; return returnstr; } /// /// 首页车辆统计 /// /// /// private string homeCarStaAll(HttpContext context) { string returnstr = ""; int code = -1; string msg = ""; string data = ""; string strWhere = " 1=1"; try { string ORG_ID = context.Request.Params["Org_Id"]; if (!string.IsNullOrEmpty(ORG_ID)) { code = 1; strWhere += " and 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) ) "; strWhere += " and class = '1'"; DataTable dt = bll.homeCarStaNew(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; } public bool IsReusable { get { return false; } } } }