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.
2704 lines
123 KiB
2704 lines
123 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Data;
|
|
using Newtonsoft.Json;
|
|
using System.IO;
|
|
using Spire.Doc;
|
|
using Spire.Doc.Documents;
|
|
using System.Drawing;
|
|
using Spire.Doc.Fields;
|
|
using System.Text;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// CarHandler 的摘要说明
|
|
/// </summary>
|
|
public class CarHandler : 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)
|
|
{
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "车辆信息操作请求", "");
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
|
|
switch (action)
|
|
{
|
|
case "CarList":
|
|
returnstr = GetCarList(context);
|
|
break;
|
|
case "AccountManagement":
|
|
returnstr = AccountManagement(context);
|
|
break;
|
|
case "Add":
|
|
returnstr = AddCar(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = EditCar(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 "GetHomeCarAccessList":
|
|
returnstr = GetHomeCarAccessList(context);
|
|
break;
|
|
case "ViewAccess":
|
|
returnstr = ViewAccess(context);
|
|
break;
|
|
case "GetCarWeek":
|
|
returnstr = GetCarWeek(context);
|
|
break;
|
|
case "GetAppCarList":
|
|
returnstr = GetAppCarList(context);
|
|
break;
|
|
case "CarNumGetModel":
|
|
returnstr = CarNumGetModel(context);
|
|
break;
|
|
case "expList":
|
|
expList(context);
|
|
break;
|
|
case "GetCarListByIMEI":
|
|
returnstr = GetCarListByIMEI(context);
|
|
break;
|
|
case "carAccessSta":
|
|
returnstr = carAccessSta(context);
|
|
break;
|
|
case "carAccessSta2":
|
|
returnstr = carAccessSta2(context);
|
|
break;
|
|
case "homeCarSta":
|
|
returnstr = homeCarSta(context);
|
|
break;
|
|
case "homeCarSta2":
|
|
returnstr = homeCarSta2(context);
|
|
break;
|
|
case "homeCarStaAll":
|
|
returnstr = homeCarStaAll(context);
|
|
break;
|
|
case "homeCarStaNew":
|
|
returnstr = homeCarStaNew(context);
|
|
break;
|
|
case "StatisticsTra":
|
|
returnstr = StatisticsTra(context);
|
|
break;
|
|
case "getCarAccListByTime":
|
|
returnstr = getCarAccListByTime(context);
|
|
break;
|
|
case "getCarAccListByTime2":
|
|
returnstr = getCarAccListByTime2(context);
|
|
break;
|
|
case "htmlToWord":
|
|
returnstr = htmlToWord(context);
|
|
break;
|
|
case "htmlToWord2":
|
|
returnstr = htmlToWord2(context);
|
|
break;
|
|
case "getSubordinateData":
|
|
returnstr = getSubordinateData(context);
|
|
break;
|
|
case "getSubordinateDataAll":
|
|
returnstr = getSubordinateDataAll(context);
|
|
break;
|
|
case "getPerAndCarStatisticss":
|
|
returnstr = getPerAndCarStatisticss(context);
|
|
break;
|
|
case "htmlToWord3":
|
|
HtmlToWord3(context);
|
|
break;
|
|
case "carSta2":
|
|
returnstr = carSta2(context);
|
|
break;
|
|
//车辆在营统计手机端
|
|
case "carSta3":
|
|
returnstr = carSta3(context);
|
|
break;
|
|
case "carLatestOutList":
|
|
returnstr = carLatestOutList(context);
|
|
break;
|
|
// 查询车辆装备文件信息集合
|
|
case "carEquipFileList":
|
|
returnstr = carEquipFileList(context);
|
|
break;
|
|
// 上传车载装备文件
|
|
case "carEquipFileUpload":
|
|
returnstr = carEquipFileUpload(context);
|
|
break;
|
|
// 删除车载装备文件
|
|
case "carEquipFileDel":
|
|
returnstr = carEquipFileDel(context);
|
|
break;
|
|
// 车辆实力统计——查看具体在营离营车辆信息
|
|
case "ViewInOrOutCarInfoApp":
|
|
returnstr = ViewInOrOutCarInfoApp(context);
|
|
break;
|
|
}
|
|
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 删除车载装备文件
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string carEquipFileDel(HttpContext context)
|
|
{
|
|
string returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
try
|
|
{
|
|
var id = context.Request.Params["id"] + "";
|
|
|
|
string insSql = " update tbl_sys_car_equip set IS_Del='1' where id='" + id + "' ";
|
|
|
|
var n = FangYar.Common.MySqlHelper.Execute(insSql);
|
|
|
|
if (n > 0)
|
|
{
|
|
returnstr = "{\"code\":1,\"msg\":\"成功\",\"count\":0,\"data\":[]}";
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "上传车辆装备异常:" + ex);
|
|
returnstr = "{\"code\":-1,\"msg\":\"处理异常\",\"count\":0,\"data\":[]}";
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "车辆信息操作请求", "上传车辆装备");
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传车载装备文件
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string carEquipFileUpload(HttpContext context)
|
|
{
|
|
string returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
try
|
|
{
|
|
var id = context.Request.Params["id"] + "";
|
|
|
|
var file = context.Request.Files[0]; //获取选中文件
|
|
Stream stream = file.InputStream; //将文件转为流
|
|
|
|
|
|
|
|
////获取上传的文件数据
|
|
//var file = context.Request.files["filedata"];
|
|
string filename = file.FileName;
|
|
string filetype = Path.GetExtension(filename).ToLower();
|
|
|
|
//上传的目录
|
|
string uploaddir = "~/File/CarEquip/" + DateTime.Now.ToString("yyyymm") + "/";
|
|
//上传的路径
|
|
//生成年月文件夹及日文件夹
|
|
if (Directory.Exists(context.Server.MapPath(uploaddir)) == false)
|
|
{
|
|
Directory.CreateDirectory(context.Server.MapPath(uploaddir));
|
|
}
|
|
|
|
var guid = Guid.NewGuid().ToString("N");
|
|
|
|
string uploadpath = uploaddir + guid + filetype;
|
|
|
|
//保存文件
|
|
file.SaveAs(context.Server.MapPath(uploadpath));
|
|
|
|
string dbFileUlr = uploadpath.Replace("~", "");
|
|
|
|
string fName = filename.Substring(0, filename.LastIndexOf('.'));
|
|
|
|
string insSql = " insert into tbl_sys_car_equip (id,car_id,File_Url,File_Name) VALUES ('" + guid + "','" + id + "','" + dbFileUlr + "','" + fName + "') ";
|
|
|
|
var n = FangYar.Common.MySqlHelper.Execute(insSql);
|
|
|
|
if (n > 0)
|
|
{
|
|
returnstr = "{\"code\":1,\"msg\":\"成功\",\"count\":0,\"data\":[]}";
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "上传车辆装备异常:" + ex);
|
|
returnstr = "{\"code\":-1,\"msg\":\"处理异常\",\"count\":0,\"data\":[]}";
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "车辆信息操作请求", "上传车辆装备");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询车辆装备文件信息集合
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string carEquipFileList(HttpContext context)
|
|
{
|
|
string returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
try
|
|
{
|
|
// 分页
|
|
string page = context.Request.Params["page"];
|
|
// 分页大小
|
|
string limit = context.Request.Params["limit"];
|
|
// 车辆信息ID
|
|
string id = context.Request.Params["id"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
|
|
pageIndex = pageIndex - 1;
|
|
pageIndex = pageIndex < 0 ? 0 : pageIndex;
|
|
pageSize = pageSize < 1 ? 1 : pageSize;
|
|
|
|
int startNum = pageIndex * pageSize;
|
|
|
|
// 查询信息总数
|
|
string sqlCount = " SELECT count(1) from tbl_sys_car_equip WHERE CAR_ID ='" + id + "' and IS_Del='0' ";
|
|
|
|
var dtNum = FangYar.Common.MySqlHelper.QueryTable(sqlCount);
|
|
// 查询信息总数
|
|
string sql = " SELECT * from tbl_sys_car_equip WHERE CAR_ID ='" + id + "' and IS_Del='0' ORDER BY CREATETIME DESC limit " + startNum + " ," + pageSize + " ";
|
|
|
|
var dt = FangYar.Common.MySqlHelper.QueryTable(sql);
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"success\",\"count\":" + dtNum.Rows[0][0] + ",\"data\":" + FangYar.Common.JsonHelper.ToJson(dt) + "}";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
|
|
string str = "查询党建考试异常:" + ex;
|
|
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
|
|
{
|
|
message = str,
|
|
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
|
|
path = "UpdPartyEmpPhoto"
|
|
});
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
private string AccountManagement(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("SELECT * from fire_org WHERE pid='" + ORG_ID + "' and type='0'");
|
|
object obj = FangYar.Common.MySqlHelper.GetSingle(strSql.ToString());
|
|
//DataTable rcDt = FangYar.Common.MySqlHelper.QueryTable(strSql.ToString());
|
|
|
|
if (obj == null)
|
|
{
|
|
returnstr = "0";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "1";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "查询异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "查询");
|
|
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"];
|
|
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 = " (is_del != '1' or is_del is null) ";
|
|
|
|
//判断树节点是否选择
|
|
if (!string.IsNullOrWhiteSpace(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
|
|
|
|
if (is_content == "1")
|
|
{
|
|
where += " and ( org_id in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids)) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ( ORG_ID = '" + OrgId + "' )";
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
{
|
|
where += " and DEPT_ID = '" + selDeptId + "' ";
|
|
}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and DEPT_ID='" + DeptID + "' ";
|
|
}
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(bclass))
|
|
{
|
|
where += " and CLASS = '" + bclass + "'";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and CAR_NUM like '%" + keyword + "%' ";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<Model.TBL_SYS_CAR> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += 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 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["waternum"];//载水量
|
|
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 PHOTO = context.Request.Params["PHOTO"];//车辆照片
|
|
string IMEI = context.Request.Params["IMEI"];//车辆照片
|
|
string remarks = context.Request.Params["REMARKS"];//备注
|
|
|
|
|
|
string Car_Type1 = context.Request.Params["Car_Type1"];//车辆类型1
|
|
string Car_Type2 = context.Request.Params["Car_Type2"];//车辆类型2
|
|
|
|
//车辆表
|
|
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 = "0";
|
|
model.CLASS = bigclass;
|
|
model.TYPE = type;
|
|
model.REMARKS = remarks;
|
|
model.TELNUM = telnum;
|
|
model.CAR_TYPE1 = Car_Type1;
|
|
model.CAR_TYPE2 = Car_Type2;
|
|
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.ISSTART = "0";
|
|
model.ISAPPLY = "0";
|
|
model.PHOTO = PHOTO;
|
|
model.IMEI = IMEI;
|
|
|
|
FangYar.Model.TBL_SYS_CAR carNumModel = bll.CarNumGetModel(car_num);
|
|
if (carNumModel == null)
|
|
{
|
|
if (bll.Add(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
else
|
|
{
|
|
msg = "此车牌在系统中已存在重复车牌,请确认车牌号是否正确;若为无牌车,可在车牌后添加编号避免重复!";
|
|
code = 2;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "添加异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "车辆信息操作请求", "添加");
|
|
return returnstr;
|
|
}
|
|
|
|
//修改
|
|
private string EditCar(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["waternum"];//载水量
|
|
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"];//是否启动
|
|
string isapply = context.Request.Params["isapply"];//申请状态
|
|
|
|
string PHOTO = context.Request.Params["PHOTO"];//车辆照片
|
|
string IMEI = context.Request.Params["IMEI"];//车辆照片
|
|
string remarks = context.Request.Params["remarks"];//备注
|
|
|
|
string Car_Type1 = context.Request.Params["Car_Type1"];//车辆类型1
|
|
string Car_Type2 = context.Request.Params["Car_Type2"];//车辆类型2
|
|
|
|
FangYar.Model.TBL_SYS_CAR model = new Model.TBL_SYS_CAR();
|
|
model = bll.GetModel(id);
|
|
if (model != null)
|
|
{
|
|
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.REMARKS = remarks;
|
|
model.TELNUM = telnum;
|
|
|
|
model.CAR_TYPE1 = Car_Type1;
|
|
model.CAR_TYPE2 = Car_Type2;
|
|
|
|
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);
|
|
}
|
|
|
|
if (!String.IsNullOrWhiteSpace(isstart))
|
|
{
|
|
model.ISSTART = isstart;
|
|
}
|
|
else
|
|
{
|
|
model.ISSTART = "0";
|
|
}
|
|
|
|
if (!String.IsNullOrWhiteSpace(isapply))
|
|
{
|
|
model.ISAPPLY = isapply;
|
|
}
|
|
model.PHOTO = PHOTO;
|
|
model.IMEI = IMEI;
|
|
|
|
FangYar.Model.TBL_SYS_CAR carNumModel = bll.CarNumGetModelNonSelf(id, car_num);
|
|
if (carNumModel == null)
|
|
{
|
|
if (bll.Update(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
else
|
|
{
|
|
msg = "此车牌在系统中已存在重复车牌,请确认车牌号是否正确;若为无牌车,可在车牌后添加编号避免重复!";
|
|
code = 2;
|
|
}
|
|
}
|
|
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 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 (Exception e)
|
|
{
|
|
msg = "删除失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "删除异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "车辆信息操作请求", "删除");
|
|
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];
|
|
//DataTable data = bll.GetList("ORG_ID='" + orgId + "' and class !=2").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 += Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "获取车辆tree异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "获取车辆tree");
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 查看车辆信息
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
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 (Exception e)
|
|
{
|
|
msg = "查看失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "查看车辆信息异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "查看车辆信息");
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 车辆实力统计——查看具体在营离营车辆信息
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string ViewInOrOutCarInfoApp(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
string data = "";
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = context.Request.Params["ID"];//车辆id
|
|
string sql = " select x.*,y.START_TIME,y.EXTEND2 from (" +
|
|
" select t.*, h.org_name,d.org_name as dept_name,y.area_name from tbl_sys_car t left join fire_org h on t.org_id = h.org_id left join fire_org d on t.dept_id = d.org_id left join tbl_sys_area y on t.region = y.area_code where t.id = '" + ID + "'" +
|
|
" )x left join(" +
|
|
" select * from tbl_caraccess where INOROUT = '1' and CAR_PLATE = (select CAR_NUM from tbl_sys_car where id = '" + ID + "') ORDER BY START_TIME desc limit 0,1" +
|
|
" )y on x.CAR_NUM = y.CAR_PLATE";
|
|
DataTable dt = new DataTable();
|
|
dt = FangYar.Common.MySqlHelper.QueryTable(sql);
|
|
if (dt != null)
|
|
{
|
|
msg = "查看成功!";
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
else
|
|
{
|
|
msg = "查看失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "查看失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "查看车辆信息异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "查看车辆信息");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 车辆出入记录查询
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string GetCarAccessList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
//判断是否APP或者小程序访问
|
|
if (Common.WebCommonUtil.IsPhoneRequest(context))
|
|
{
|
|
//增加上级转换机关机构数据转换
|
|
OrgId = Common.WebCommonUtil.GetOrgIdUpLevelToDownLevel(OrgId);
|
|
}
|
|
|
|
|
|
string pOrgId = "";
|
|
|
|
try
|
|
{
|
|
//查询当前单位是否和上级单位同一驻地
|
|
string sqlStr1 = " SELECT IS_TOP_CAMP,PID from fire_org WHERE ORG_ID = '" + OrgId + "' ";
|
|
|
|
var dt1 = Common.MySqlHelper.QueryTable(sqlStr1);
|
|
|
|
if (dt1.Rows[0]["IS_TOP_CAMP"] + "" == "1")
|
|
{
|
|
pOrgId = Common.WebCommonUtil.GetOrgIdUpLevelToDownLevel(dt1.Rows[0]["PID"] + "");
|
|
|
|
var itemOrg = OrgId;
|
|
OrgId = pOrgId;
|
|
pOrgId = itemOrg;
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
string treeID = context.Request.Params["treeID"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string type = context.Request.Params["type"];
|
|
string beginDate = context.Request.Params["startTime"];
|
|
string endDate = context.Request.Params["endTime"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string bclass = context.Request.Params["class"];
|
|
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 = " 1=1 ";
|
|
|
|
////判断树节点是否选择
|
|
//if (!string.IsNullOrWhiteSpace(treeID))
|
|
//{
|
|
// OrgId = treeID;
|
|
//}
|
|
//判断是否和上级单位同驻地
|
|
if (string.IsNullOrWhiteSpace(pOrgId))
|
|
{
|
|
if (is_content == "1")
|
|
{
|
|
where += " and find_in_set(org_id,cids) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ORG_ID='" + OrgId + "'";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
where += " and (ORG_ID='" + OrgId + "' or ORG_ID='" + pOrgId + "' ) and CAR_PLATE in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID = '" + OrgId +
|
|
"' and CAR_NUM <> '' and CAR_NUM is not null ) ";
|
|
}
|
|
|
|
//if (!string.IsNullOrWhiteSpace(selDeptId))
|
|
//{
|
|
// where += " and CAR_PLATE in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + selDeptId + "' and IS_DEL='0') ";
|
|
//}
|
|
|
|
//判断是否管理员账号,如果不是管理员则只查询本部门数据
|
|
if (IsAdmin != "1")
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DeptID))
|
|
{
|
|
where += " and CAR_PLATE in (SELECT CAR_NUM from tbl_sys_car WHERE ORG_ID='" + OrgId + "' and DEPT_ID='" + DeptID + "' and IS_DEL='0' ) ";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(bclass))
|
|
{
|
|
if (bclass == "1")
|
|
{
|
|
where += " and CLASS = '1'";
|
|
}
|
|
else
|
|
{
|
|
where += " and CLASS != '1'";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and ( CAR_PLATE like '%" + keyword + "%' or COLOR like '%" + keyword + "%')";
|
|
}
|
|
|
|
if (!String.IsNullOrWhiteSpace(beginDate) && !String.IsNullOrWhiteSpace(endDate))
|
|
{
|
|
//if (endDate.Split(' ')[1].TrimStart().TrimEnd().Equals("00:00:00"))
|
|
//{
|
|
// endDate = endDate.ToDateString() + " 23:59:59";
|
|
//}
|
|
|
|
where += " and (START_TIME between date_format('" + beginDate + "','%Y-%m-%d %H:%i:%s') and date_format('" + endDate + "','%Y-%m-%d %H:%i:%s'))";
|
|
}
|
|
|
|
//where += " order by START_TIME desc";
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = cabll.GetRecordCount(where, OrgId);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
string data = "[";
|
|
DataTable dt = cabll.QueryDataTable(pageIndex, pageSize, where, is_content, OrgId);
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
string pic1 = "";
|
|
string pic2 = "";
|
|
if (dt.Rows[i]["PICTURE"] != null && dt.Rows[i]["PICTURE"].ToString() != "")
|
|
{
|
|
pic1 = Convert.ToBase64String((byte[])dt.Rows[i]["PICTURE"]);
|
|
}
|
|
if (dt.Rows[i]["CLOSEUP_PIC"] != null && dt.Rows[i]["CLOSEUP_PIC"].ToString() != "")
|
|
{
|
|
pic2 = Convert.ToBase64String((byte[])dt.Rows[i]["CLOSEUP_PIC"]);
|
|
}
|
|
string className = dt.Rows[i]["CLASS"].ToString() == "0" ? "公务车" : (dt.Rows[i]["CLASS"].ToString() == "1" ? "执勤车" : "地方车");
|
|
data += "{\"ID\":\"" + dt.Rows[i]["ID"].ToString() + "\",\"TYPE\":\"" + dt.Rows[i]["TYPE"].ToString() + "\",\"CAR_PLATE\":\"" + dt.Rows[i]["CAR_PLATE"].ToString() + "\",\"COLOR\":\"" + dt.Rows[i]["COLOR"].ToString() + "\",\"CAR_COLOR\":\"" + dt.Rows[i]["CAR_COLOR"].ToString() + "\",\"CAR_LOGO\":\"" + dt.Rows[i]["CAR_LOGO"].ToString() + "\",\"START_TIME\":\"" + dt.Rows[i]["START_TIME"].ToString() + "\",\"CAMERA_ID\":\"" + dt.Rows[i]["CAMERA_ID"].ToString() + "\",";
|
|
data += "\"ORG_ID\":\"" + dt.Rows[i]["ORG_ID"].ToString() + "\",\"VEHICLETYPE\":\"" + dt.Rows[i]["VEHICLETYPE"].ToString() + "\",\"CAR_ID\":\"" + dt.Rows[i]["CAR_ID"].ToString() + "\",\"INOROUT\":\"" + dt.Rows[i]["INOROUT"].ToString() + "\",\"CLASS\":\"" + dt.Rows[i]["CLASS"].ToString() + "\",\"CLASS_NAME\":\"" + className + "\",\"ADDR\":\"" + dt.Rows[i]["ADDR"].ToString() + "\",\"DUTYMANS\":\"" + dt.Rows[i]["DUTYMANS"].ToString() + "\",\"ORG_NAME\":\"" + dt.Rows[i]["ORG_NAME"].ToString() + "\",\"APPLY_ID\":\"" + dt.Rows[i]["APPLY_ID"].ToString() + "\",\"USERMAN\":\"" + dt.Rows[i]["USERMAN"].ToString() + "\",";
|
|
data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\",";
|
|
data += "\"EXTEND2\":\"" + dt.Rows[i]["EXTEND2"].ToString() + "\",\"EXTEND3\":\"" + dt.Rows[i]["EXTEND3"].ToString() + "\",";
|
|
data += "\"LIABLEMAN\":\"" + dt.Rows[i]["LIABLEMAN"].ToString() + "\",\"DEPT_NAME\":\"" + dt.Rows[i]["DEPT_NAME"].ToString() + "\"}";
|
|
if (i != dt.Rows.Count - 1)
|
|
{
|
|
data += ",";
|
|
}
|
|
}
|
|
returnstr += data + "]";
|
|
}
|
|
//{
|
|
// string data = "[";
|
|
// List<FangYar.Model.TBL_CARACCESS> 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);
|
|
// }
|
|
// string className = list[i].CLASS == "0" ? "公务车" : (list[i].CLASS == "1" ? "执勤车" : "地方车");
|
|
// 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 + "\",\"CLASS_NAME\":\"" + className + "\",\"ADDR\":\"" + list[i].ADDR + "\",\"DUTYMANS\":\"" + list[i].DUTYMANS + "\",\"ORG_NAME\":\"" + list[i].ORG_NAME + "\",\"APPLY_ID\":\"" + list[i].APPLY_ID + "\",\"USERMAN\":\"" + list[i].USERMAN + "\",";
|
|
// data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\",";
|
|
// data += "\"EXTEND2\":\"" + list[i].EXTEND2 + "\",\"EXTEND3\":\"" + list[i].EXTEND3 + "\"}";
|
|
|
|
// if (i != list.Count - 1)
|
|
// {
|
|
// data += ",";
|
|
// }
|
|
// }
|
|
// returnstr += data + "]";
|
|
//}
|
|
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>
|
|
/// 查询首页车辆信息
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string GetHomeCarAccessList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
|
|
int pageIndex = 1;
|
|
int pageSize = 2000;
|
|
|
|
string where = " 1=1 and ORG_ID='" + OrgId + "' ";
|
|
//where += " and date_format(start_time,'%Y-%m-%d ') = date_format(now(),'%Y-%m-%d ') ";
|
|
where += " and start_time > date_format(now(),'%Y-%m-%d ') ";
|
|
|
|
string whereIn = where + " and INOROUT = 0 order by START_TIME desc ";
|
|
string whereOut = where + " and INOROUT = 1 order by START_TIME desc";
|
|
//where += " order by START_TIME desc";
|
|
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = cabll.GetRecordCount(where);
|
|
int countIn = cabll.GetRecordCount(whereIn);
|
|
int countOut = cabll.GetRecordCount(whereOut);
|
|
|
|
returnstr += "\"countIn\":" + countIn + ",\"countOut\":" + countOut;
|
|
returnstr += ",\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
string data = "[";
|
|
DataTable dt = cabll.QueryDataTable(pageIndex, pageSize, where, string.Empty, OrgId);
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
string pic1 = "";
|
|
string pic2 = "";
|
|
if (dt.Rows[i]["PICTURE"] != null && dt.Rows[i]["PICTURE"].ToString() != "")
|
|
{
|
|
pic1 = Convert.ToBase64String((byte[])dt.Rows[i]["PICTURE"]);
|
|
}
|
|
if (dt.Rows[i]["CLOSEUP_PIC"] != null && dt.Rows[i]["CLOSEUP_PIC"].ToString() != "")
|
|
{
|
|
pic2 = Convert.ToBase64String((byte[])dt.Rows[i]["CLOSEUP_PIC"]);
|
|
}
|
|
string className = dt.Rows[i]["CLASS"].ToString() == "0" ? "公务车" : (dt.Rows[i]["CLASS"].ToString() == "1" ? "执勤车" : "地方车");
|
|
data += "{\"ID\":\"" + dt.Rows[i]["ID"].ToString() + "\",\"TYPE\":\"" + dt.Rows[i]["TYPE"].ToString() + "\",\"CAR_PLATE\":\"" + dt.Rows[i]["CAR_PLATE"].ToString() + "\",\"COLOR\":\"" + dt.Rows[i]["COLOR"].ToString() + "\",\"CAR_COLOR\":\"" + dt.Rows[i]["CAR_COLOR"].ToString() + "\",\"CAR_LOGO\":\"" + dt.Rows[i]["CAR_LOGO"].ToString() + "\",\"START_TIME\":\"" + dt.Rows[i]["START_TIME"].ToString() + "\",\"CAMERA_ID\":\"" + dt.Rows[i]["CAMERA_ID"].ToString() + "\",";
|
|
data += "\"ORG_ID\":\"" + dt.Rows[i]["ORG_ID"].ToString() + "\",\"VEHICLETYPE\":\"" + dt.Rows[i]["VEHICLETYPE"].ToString() + "\",\"CAR_ID\":\"" + dt.Rows[i]["CAR_ID"].ToString() + "\",\"INOROUT\":\"" + dt.Rows[i]["INOROUT"].ToString() + "\",\"CLASS\":\"" + dt.Rows[i]["CLASS"].ToString() + "\",\"CLASS_NAME\":\"" + className + "\",\"ADDR\":\"" + dt.Rows[i]["ADDR"].ToString() + "\",\"DUTYMANS\":\"" + dt.Rows[i]["DUTYMANS"].ToString() + "\",\"ORG_NAME\":\"" + dt.Rows[i]["ORG_NAME"].ToString() + "\",\"APPLY_ID\":\"" + dt.Rows[i]["APPLY_ID"].ToString() + "\",\"USERMAN\":\"" + dt.Rows[i]["USERMAN"].ToString() + "\",";
|
|
data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\",";
|
|
data += "\"EXTEND2\":\"" + dt.Rows[i]["EXTEND2"].ToString() + "\",\"EXTEND3\":\"" + dt.Rows[i]["EXTEND3"].ToString() + "\",";
|
|
data += "\"LIABLEMAN\":\"" + dt.Rows[i]["LIABLEMAN"].ToString() + "\",\"DEPT_NAME\":\"" + dt.Rows[i]["DEPT_NAME"].ToString() + "\"}";
|
|
if (i != dt.Rows.Count - 1)
|
|
{
|
|
data += ",";
|
|
}
|
|
}
|
|
returnstr += data + "]";
|
|
}
|
|
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>
|
|
/// 获取车辆进出的详细记录
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string ViewAccess(HttpContext context)
|
|
{
|
|
FangYar.BLL.TBL_CARACCESS cabll = new BLL.TBL_CARACCESS();
|
|
string strwhere = "1=1 ";
|
|
string returnstr = "";
|
|
string data = "";
|
|
string applyString = "\"\"";
|
|
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() + "\",\"ORG_NAME\":\"" + dt.Rows[0]["ORG_NAME"].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 += "\"EXTEND2\":\"" + dt.Rows[0]["EXTEND2"].ToString() + "\",\"EXTEND3\":\"" + dt.Rows[0]["EXTEND3"].ToString() + "\"}";
|
|
|
|
string className = dt.Rows[0]["CLASS"].ToString() == "0" ? "公务车" : (dt.Rows[0]["CLASS"].ToString() == "1" ? "执勤车" : "地方车");
|
|
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() + "\",\"CLASS_NAME\":\"" + className + "\",\"ADDR\":\"" + dt.Rows[0]["ADDR"].ToString() + "\",\"DUTYMANS\":\"" + dt.Rows[0]["DUTYMANS"].ToString() + "\",\"ORG_NAME\":\"" + dt.Rows[0]["ORG_NAME"].ToString() + "\",\"APPLY_ID\":\"" + dt.Rows[0]["APPLY_ID"].ToString() + "\",\"USERMAN\":\"" + dt.Rows[0]["USERMAN"].ToString() + "\",";
|
|
data += "\"PICTURE\":\"" + pic1 + "\",\"CLOSEUP_PIC\":\"" + pic2 + "\",";
|
|
data += "\"EXTEND2\":\"" + dt.Rows[0]["EXTEND2"].ToString() + "\",\"EXTEND3\":\"" + dt.Rows[0]["EXTEND3"].ToString() + "\"";
|
|
//data += "\"LIABLEMAN\":\"" + dt.Rows[0]["LIABLEMAN"].ToString() + "\",\"DEPT_NAME\":\"" + dt.Rows[0]["DEPT_NAME"].ToString() + "\"";
|
|
data += "}]";
|
|
FangYar.BLL.TBL_SYS_CARAPPLY applyBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
FangYar.Model.TBL_SYS_CARAPPLY applyModel = applyBll.GetModel(dt.Rows[0]["APPLY_ID"].ToString());
|
|
if (applyModel != null) applyString = FangYar.Common.JsonHelper.ToJson(applyModel);
|
|
}
|
|
else
|
|
{
|
|
msg = "查看失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "查看失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "获取车辆进出的详细记录异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + ",\"applyModel\":" + applyString + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "获取车辆进出的详细记录");
|
|
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 (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 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 (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\",";
|
|
returnstr += "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "获取车辆数量趋势异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "获取车辆数量趋势");
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// APP查询车辆列表
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string GetAppCarList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string keywords = context.Request.Params["keywords"];
|
|
//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(keywords))
|
|
{
|
|
where += " and (CAR_NAME like '%" + keywords + "%' or CAR_NUM like '%" + keywords + "%')";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.TBL_SYS_CAR> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
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, "车辆信息操作请求", "APP查询车辆列表异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "APP查询车辆列表");
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据车牌查询车辆信息
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string CarNumGetModel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
string data = "";
|
|
string msg = "";
|
|
try
|
|
{
|
|
string CARNUM = context.Request.Params["CARNUM"];//车牌号
|
|
FangYar.Model.TBL_SYS_CAR model = bll.CarNumGetModel("", CARNUM);
|
|
if (model != null)
|
|
{
|
|
msg = "查看成功!";
|
|
data = FangYar.Common.JsonHelper.ToJson(model);
|
|
}
|
|
else
|
|
{
|
|
msg = "查看失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "查看失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "根据车牌查询车辆信息异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "根据车牌查询车辆信息");
|
|
return returnstr;
|
|
}
|
|
//导出公务车辆
|
|
|
|
private void expList(HttpContext context)
|
|
{
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
string type = context.Request.Params["type"];
|
|
string bclass = context.Request.Params["class"];
|
|
|
|
string where = "1=1 and (is_del != '1' or is_del is null)";
|
|
if (!string.IsNullOrEmpty(treeID) && treeID != OrgId)
|
|
{
|
|
|
|
if (is_content == "1")
|
|
{
|
|
where += " and ( org_id in ( select o.org_id from fire_org o ,(select get_Org_child_list('" + treeID + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
where += " or DEPT_ID in ( select o.org_id from fire_org o ,(select get_Org_child_list('" + treeID + "') cids ) s where find_in_set(org_id,cids) )) ";
|
|
}
|
|
else
|
|
{
|
|
where += " and ( ORG_ID = '" + treeID + "'";
|
|
where += " or DEPT_ID = '" + treeID + "')";
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
if (is_content == "1")
|
|
{
|
|
where += " and (org_id in ( select o.org_id from fire_org o ,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) ) ";
|
|
where += " or DEPT_ID in ( select o.org_id from fire_org o ,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) )) ";
|
|
}
|
|
else
|
|
{
|
|
where += "and (ORG_ID = '" + OrgId + "'";
|
|
where += " or DEPT_ID = '" + OrgId + "')";
|
|
}
|
|
}
|
|
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 + "%')";
|
|
}
|
|
int count = bll.GetRecordCount(where);
|
|
|
|
if (count == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.expList(where);
|
|
|
|
System.Collections.Generic.Dictionary<string, string> cellHeaders = new System.Collections.Generic.Dictionary<string, string>();
|
|
cellHeaders.Add("CLASS", "车辆类型");
|
|
cellHeaders.Add("CAR_NAME", "车辆名称");
|
|
cellHeaders.Add("CAR_NO", "车辆编码");
|
|
cellHeaders.Add("CAR_NUM", "号牌号码");
|
|
cellHeaders.Add("TYPE", "车辆应用");
|
|
cellHeaders.Add("ORG_NAME", "机构");
|
|
|
|
cellHeaders.Add("DEPT_NAME", "部门");
|
|
cellHeaders.Add("CAR_CODE", "车辆登记代号");
|
|
cellHeaders.Add("FRAME_NUM", "车架号");
|
|
cellHeaders.Add("ENGINE_NO", "发动机编号");
|
|
cellHeaders.Add("TRADEMARK", "商标");
|
|
|
|
cellHeaders.Add("GB_CODE", "国标代码");
|
|
cellHeaders.Add("LIABLEMAN", "责任人");
|
|
cellHeaders.Add("TELNUM", "电话");
|
|
//cellHeaders.Add("FACTORY", "厂家名称1");
|
|
|
|
cellHeaders.Add("FACTORYNAME", "厂家名称");
|
|
cellHeaders.Add("AREA_NAME", "所属辖区");
|
|
|
|
cellHeaders.Add("ISRUN", "是否运行");
|
|
cellHeaders.Add("ISSTART", "是否启动");
|
|
cellHeaders.Add("ISAPPLY", "申请状态");
|
|
cellHeaders.Add("REMARKS", "备注");
|
|
cellHeaders.Add("LIMIT", "车辆限速");
|
|
cellHeaders.Add("EMP_NAME", "驾驶员");
|
|
|
|
cellHeaders.Add("WATERNUM", "载水量");
|
|
cellHeaders.Add("DRYPOWDER", "载干粉量");
|
|
cellHeaders.Add("HEIGHTBOARDINGCAR", "登高车工作高度");
|
|
cellHeaders.Add("FROTHAMOUNT", "泡沫量");
|
|
cellHeaders.Add("FROTHAMOUNTA", "类泡沫量");
|
|
|
|
cellHeaders.Add("FROTHAMOUNTB", "类泡沫量");
|
|
cellHeaders.Add("FROTHAMOUNTMULTI", "多功能泡沫量");
|
|
cellHeaders.Add("LIQUIDLEVEL", "液位");
|
|
cellHeaders.Add("PRESSURE", "压力");
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "导出公务车辆");
|
|
|
|
FangYar.Common.NPOIExcelHelper.ExportByWeb(dt, null, cellHeaders, DateTime.Now.ToString("yyyyMMddHHmmss") + "车辆信息表.xls");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "导出公务车辆异常:" + e);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询装有IMEI的车辆
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
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 or FACTORY = '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(carNum))
|
|
{
|
|
where += " and CAR_NUM like '%" + carNum + "%' ";
|
|
}
|
|
where += " and (is_del != '1' or is_del is null)";
|
|
// where += " ORDER BY CAR_NO ";
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.TBL_SYS_CAR> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
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, "车辆信息操作请求", "查询装有IMEI的车辆异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "查询装有IMEI的车辆");
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 查询车辆信息
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
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(now(),'%Y-%m-%d') = date_format(START_TIME,'%Y-%m-%d')";
|
|
}
|
|
DataTable dt = cabll.carAccessSta(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 carAccessSta2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
string strWhere = "";
|
|
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"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
return "{\"code\":" + code + ",\"msg\":\"所属机构不能为空\",\"data\":" + data + "}";
|
|
}
|
|
if (is_content == "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) ) ";
|
|
}
|
|
else
|
|
{
|
|
strWhere = " org_id = '" + ORG_ID + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(S_Time) && !string.IsNullOrEmpty(E_Time))
|
|
{
|
|
strWhere += " and date_format('" + S_Time + "-01','%Y-%m-%d') < date_format(START_TIME,'%Y-%m-%d')";
|
|
strWhere += " and date_format('" + E_Time + "-01','%Y-%m-%d') > date_format(START_TIME,'%Y-%m-%d')";
|
|
}
|
|
else
|
|
{
|
|
strWhere += " and date_format(now(),'%Y-%m-%d') = date_format(START_TIME,'%Y-%m-%d')";
|
|
}
|
|
DataTable dt = cabll.carAccessSta(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
code = 1;
|
|
}
|
|
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 homeCarSta(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='" + ORG_ID + "' and (is_del != '1' or is_del is null)";
|
|
DataTable dt = bll.homeCarSta(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 homeCarSta2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
string sql = "select IFNULL(sum(c.gw),0) gw ,IFNULL(sum(c.zq),0) zq ,IFNULL(sum(c.sj),0) sj,IFNULL(sum(c.wl),0) wl ,IFNULL(sum(c.zg),0) zg from(select CASE WHEN t.class ='0' THEN 1 ELSE 0 END gw, CASE WHEN t.class ='1' THEN 1 ELSE 0 END zq, CASE WHEN t.class ='2' THEN 1 ELSE 0 END sj, CASE WHEN t.class ='3' THEN 1 ELSE 0 END wl, CASE WHEN t.ISAPPLY ='0' and t.class in ('0','1','2') THEN 1 ELSE 0 END zg from tbl_sys_car t ";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (!string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
if (!string.IsNullOrEmpty(is_content))
|
|
{
|
|
sql += ",(select get_Org_child_list('" + ORG_ID + "') cids ) s where find_in_set(org_id,cids) ";
|
|
}
|
|
else
|
|
{
|
|
sql += " where ORG_ID='" + ORG_ID + "'";
|
|
}
|
|
sql += " and (is_del != '1' or is_del is null) ) c";
|
|
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
code = 1;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
msg = "获取失败!";
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"data\":" + data + "}";
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 首页车辆统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
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 (is_del != '1' or is_del is null)";
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 首页车辆统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string homeCarStaNew(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='" + ORG_ID + "' and (is_del != '1' or is_del is null)";
|
|
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;
|
|
}
|
|
//按年份查询,按月份统计(未巡查、无隐患、有隐患)统计数
|
|
private string StatisticsTra(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["orgId"];
|
|
//判断是否APP或者小程序访问
|
|
if (Common.WebCommonUtil.IsPhoneRequest(context))
|
|
{
|
|
//增加上级转换机关机构数据转换
|
|
orgId = Common.WebCommonUtil.GetOrgIdUpLevelToDownLevel(orgId);
|
|
}
|
|
string year = context.Request.Params["year"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
DataTable dt = cabll.StatisticsTra(orgId, year, is_content);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = null;
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "按年份查询,按月份统计(未巡查、无隐患、有隐患)统计数异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "按年份查询,按月份统计(未巡查、无隐患、有隐患)统计数");
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
//按车牌号、时间段 查询列表分页
|
|
private string getCarAccListByTime(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string carNum = context.Request.Params["carNum"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
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 = null;
|
|
if (carNum != null && carNum != "")
|
|
{
|
|
where = " CAR_PLATE = '" + carNum + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += "and";
|
|
}
|
|
if (is_content == "1")
|
|
{
|
|
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(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " org_id = '" + orgId + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date_format(START_TIME, '%Y-%m-%d') >= date_format('" + startDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(endDate))
|
|
{
|
|
where += " and date_format(START_TIME, '%Y-%m-%d') < date_format('" + endDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = cabll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by START_TIME desc";
|
|
List<FangYar.Model.TBL_CARACCESS> list = cabll.QueryList(pageIndex, pageSize, where, "");
|
|
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 getCarAccListByTime2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
int count = 0;
|
|
string where = null;
|
|
try
|
|
{
|
|
string carNum = context.Request.Params["carNum"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (string.IsNullOrEmpty(orgId))
|
|
{
|
|
return "{\"code\":" + code + ",\"msg\":\"所属机构不能为空\",\"data\":" + data + "}";
|
|
}
|
|
if (carNum != null && carNum != "")
|
|
{
|
|
where = " c.CAR_PLATE = '" + carNum + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += "and";
|
|
}
|
|
if (is_content == "1")
|
|
{
|
|
where += " c.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(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " c.org_id = '" + orgId + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date_format(c.START_TIME, '%Y-%m-%d') >= date_format('" + startDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(endDate))
|
|
{
|
|
where += " and date_format(c.START_TIME, '%Y-%m-%d') < date_format('" + endDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
where += " AND c.class in ('0','1') GROUP BY o.org_name, c.CAR_PLATE, c.class";
|
|
|
|
DataTable dt = cabll.getCarAccListByTime2(where);
|
|
code = 0;
|
|
count = dt.Rows.Count;
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "按车牌号、时间段 分组统计出入次数异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"count\":" + count + ",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "按车牌号、时间段 分组统计出入次数");
|
|
return returnstr;
|
|
}
|
|
|
|
//html导出Word
|
|
private string htmlToWord(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string by1 = context.Request.Params["by1"];
|
|
|
|
|
|
//实例化一个Document对象
|
|
Document doc = new Document();
|
|
doc.Watermark = null;
|
|
|
|
//添加section和段落
|
|
Section section = doc.AddSection();
|
|
Paragraph para = section.AddParagraph();
|
|
//加载图片到System.Drawing.Image对象, 使用AppendPicture方法将图片插入到段落
|
|
if (by1 != null && by1 != "")
|
|
{
|
|
by1 = HttpUtility.UrlDecode(by1);
|
|
Image image1 = GetImage(by1.Replace("data:image/png;base64,", ""));
|
|
Spire.Doc.Fields.DocPicture picture1 = doc.Sections[0].Paragraphs[0].AppendPicture(image1);
|
|
//设置图片大小
|
|
picture1.Width = 595;
|
|
}
|
|
|
|
String[] headerQiandi = { "所属消防机构", "车牌号", "时间", "方向", "车辆类别" }; //表头字段
|
|
|
|
#region 获取table数据
|
|
string carNum = context.Request.Params["carNum"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
int pageIndex = 1;
|
|
int pageSize = 99999;
|
|
string where = null;
|
|
if (carNum != null && carNum != "")
|
|
{
|
|
where = " CAR_PLATE = '" + carNum + "' ";
|
|
}
|
|
else
|
|
{
|
|
if (is_content == "1")
|
|
{
|
|
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(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where = " org_id = '" + orgId + "' ";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date_format(START_TIME, '%Y-%m-%d') >= date_format('" + startDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(endDate))
|
|
{
|
|
where += " and date_format(START_TIME, '%Y-%m-%d') < date_format('" + endDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
where += " order by START_TIME desc";
|
|
List<FangYar.Model.TBL_CARACCESS> list = cabll.QueryList(pageIndex, pageSize, where, "");
|
|
#endregion 获取table数据
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
string[][] arrQiandiData = new string[list.Count][];
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
var classStr = "无类型";
|
|
switch (list[i].CLASS)
|
|
{
|
|
case "0":
|
|
classStr = "公务车";
|
|
break;
|
|
case "1":
|
|
classStr = "执勤车";
|
|
break;
|
|
case "2":
|
|
classStr = "地方车";
|
|
break;
|
|
}
|
|
|
|
var inoroutStr = "未知";
|
|
switch (list[i].INOROUT)
|
|
{
|
|
case "0":
|
|
inoroutStr = "进入";
|
|
break;
|
|
case "1":
|
|
inoroutStr = "离开";
|
|
break;
|
|
}
|
|
arrQiandiData[i] = new string[] {
|
|
list[i].ORG_NAME,
|
|
list[i].CAR_PLATE,
|
|
list[i].START_TIME.ToString(),
|
|
inoroutStr,
|
|
classStr
|
|
};
|
|
}
|
|
#region 创建Word表格
|
|
Table tableQiandi = section.AddTable(); //新建表格
|
|
tableQiandi.ResetCells(list.Count + 1, headerQiandi.Length);
|
|
tableQiandi.TableFormat.Borders.BorderType = Spire.Doc.Documents.BorderStyle.Single;
|
|
|
|
TableRow rowQiandi = tableQiandi.Rows[0]; //添加行
|
|
rowQiandi.IsHeader = true; //设为表头
|
|
rowQiandi.Height = 30;
|
|
rowQiandi.HeightType = TableRowHeightType.Auto;
|
|
for (int i = 0; i < headerQiandi.Length; i++) //生成表头
|
|
{
|
|
if (i == 2)
|
|
{
|
|
rowQiandi.Cells[i].Width = 170;
|
|
}
|
|
else if (i == 3)
|
|
{
|
|
rowQiandi.Cells[i].Width = 120;
|
|
}
|
|
else
|
|
{
|
|
rowQiandi.Cells[i].Width = 145;
|
|
}
|
|
rowQiandi.Height = 30;
|
|
rowQiandi.Cells[i].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
|
|
rowQiandi.HeightType = TableRowHeightType.Auto;
|
|
Paragraph p = rowQiandi.Cells[i].AddParagraph();
|
|
AddTextRange(section, p, headerQiandi[i], 14, true, "黑体", Spire.Doc.Documents.HorizontalAlignment.Center);
|
|
}
|
|
|
|
for (int r = 0; r < arrQiandiData.Length; r++) //生成表体
|
|
{
|
|
TableRow dataRow = tableQiandi.Rows[r + 1];
|
|
dataRow.RowFormat.BackColor = Color.Empty;
|
|
for (int c = 0; c < arrQiandiData[r].Length; c++)
|
|
{
|
|
if (c == 2)
|
|
{
|
|
dataRow.Cells[c].Width = 170;
|
|
}
|
|
else if (c == 3)
|
|
{
|
|
dataRow.Cells[c].Width = 120;
|
|
}
|
|
else
|
|
{
|
|
dataRow.Cells[c].Width = 145;
|
|
}
|
|
dataRow.Height = 20;
|
|
dataRow.Cells[c].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
|
|
TextRange tr = dataRow.Cells[c].AddParagraph().AppendText(arrQiandiData[r][c]);
|
|
tr.CharacterFormat.FontSize = 12;
|
|
}
|
|
}
|
|
#endregion 创建Word表格
|
|
}
|
|
//保存到文档
|
|
string path = AppDomain.CurrentDomain.BaseDirectory + "\\OA\\VehicleAccess_Statistics\\";
|
|
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".doc";
|
|
if (Directory.Exists(path) == false)//如果不存在就创建文件夹
|
|
{
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
doc.SaveToFile(path + fileName, FileFormat.Doc);
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"url\":\"/OA/VehicleAccess_Statistics/" + fileName + "\"}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "html导出Word异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "html导出Word");
|
|
return returnstr;
|
|
}
|
|
//html导出Word
|
|
private string htmlToWord2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//实例化一个Document对象
|
|
Document doc = new Document();
|
|
doc.Watermark = null;
|
|
|
|
//添加section和段落
|
|
Section section = doc.AddSection();
|
|
Paragraph para = section.AddParagraph();
|
|
|
|
String[] headerQiandi = { "所属消防机构", "车牌号", "车辆类别", "出入次数" }; //表头字段
|
|
|
|
#region 获取table数据
|
|
string carNum = context.Request.Params["carNum"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string where = null;
|
|
if (string.IsNullOrEmpty(orgId))
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"所属机构不能为空\"}";
|
|
}
|
|
if (carNum != null && carNum != "")
|
|
{
|
|
where = " c.CAR_PLATE = '" + carNum + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += "and";
|
|
}
|
|
if (is_content == "1")
|
|
{
|
|
where += " c.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(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " c.org_id = '" + orgId + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date_format(c.START_TIME, '%Y-%m-%d') >= date_format('" + startDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(endDate))
|
|
{
|
|
where += " and date_format(c.START_TIME, '%Y-%m-%d') < date_format('" + endDate + "-01', '%Y-%m-%d') ";
|
|
}
|
|
where += " AND c.class in ('0','1') GROUP BY o.org_name, c.CAR_PLATE, c.class";
|
|
|
|
DataTable dt = cabll.getCarAccListByTime2(where);
|
|
#endregion 获取table数据
|
|
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
string[][] arrQiandiData = new string[dt.Rows.Count][];
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
arrQiandiData[i] = new string[] {
|
|
dt.Rows[i]["ORG_NAME"].ToString(),
|
|
dt.Rows[i]["CAR_PLATE"].ToString(),
|
|
dt.Rows[i]["CLASS_NAME"].ToString(),
|
|
dt.Rows[i]["COUNTNUM"].ToString()
|
|
};
|
|
}
|
|
#region 创建Word表格
|
|
Table tableQiandi = section.AddTable(); //新建表格
|
|
tableQiandi.ResetCells(dt.Rows.Count + 1, headerQiandi.Length);
|
|
tableQiandi.TableFormat.Borders.BorderType = Spire.Doc.Documents.BorderStyle.Single;
|
|
|
|
TableRow rowQiandi = tableQiandi.Rows[0]; //添加行
|
|
rowQiandi.IsHeader = true; //设为表头
|
|
rowQiandi.Height = 30;
|
|
rowQiandi.HeightType = TableRowHeightType.Auto;
|
|
for (int i = 0; i < headerQiandi.Length; i++) //生成表头
|
|
{
|
|
rowQiandi.Cells[i].Width = 145;
|
|
rowQiandi.Height = 30;
|
|
rowQiandi.Cells[i].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
|
|
rowQiandi.HeightType = TableRowHeightType.Auto;
|
|
Paragraph p = rowQiandi.Cells[i].AddParagraph();
|
|
AddTextRange(section, p, headerQiandi[i], 14, true, "黑体", Spire.Doc.Documents.HorizontalAlignment.Center);
|
|
}
|
|
|
|
for (int r = 0; r < arrQiandiData.Length; r++) //生成表体
|
|
{
|
|
TableRow dataRow = tableQiandi.Rows[r + 1];
|
|
dataRow.RowFormat.BackColor = Color.Empty;
|
|
for (int c = 0; c < arrQiandiData[r].Length; c++)
|
|
{
|
|
dataRow.Cells[c].Width = 145;
|
|
dataRow.Height = 20;
|
|
dataRow.Cells[c].CellFormat.VerticalAlignment = VerticalAlignment.Middle;
|
|
TextRange tr = dataRow.Cells[c].AddParagraph().AppendText(arrQiandiData[r][c]);
|
|
tr.CharacterFormat.FontSize = 12;
|
|
}
|
|
}
|
|
#endregion 创建Word表格
|
|
}
|
|
//保存到文档
|
|
string path = AppDomain.CurrentDomain.BaseDirectory + "\\OA\\VehicleAccess_Statistics\\";
|
|
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".doc";
|
|
if (Directory.Exists(path) == false)//如果不存在就创建文件夹
|
|
{
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
doc.SaveToFile(path + fileName, FileFormat.Doc);
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"url\":\"/OA/VehicleAccess_Statistics/" + fileName + "\"}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "html导出Word异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "html导出Word");
|
|
return returnstr;
|
|
}
|
|
|
|
private Image GetImage(string fileName)
|
|
{
|
|
byte[] bytes = Convert.FromBase64String(fileName);
|
|
using (MemoryStream ms = new MemoryStream(bytes))
|
|
{
|
|
return Image.FromStream(ms);
|
|
}
|
|
}
|
|
|
|
private void AddTextRange(Section section, Paragraph pragraph, string word, float fontSize, bool isBold, string fontName, Spire.Doc.Documents.HorizontalAlignment alignType)
|
|
{
|
|
|
|
TextRange textRange = pragraph.AppendText(word);
|
|
textRange.CharacterFormat.FontSize = fontSize;
|
|
textRange.CharacterFormat.Bold = isBold;
|
|
textRange.CharacterFormat.FontName = fontName;
|
|
pragraph.Format.HorizontalAlignment = alignType;
|
|
}
|
|
|
|
|
|
|
|
//首页统计下级单位车辆/人员数量
|
|
private string getSubordinateData(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
//车数
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"carData\":";
|
|
string carWhere = " (is_del != '1' or is_del is null) 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) )";
|
|
DataTable cardt = bll.homeCarStaAll(carWhere);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(cardt);
|
|
|
|
//人数
|
|
FangYar.BLL.TBL.SysEmpBLL ebll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr += ",\"perData\":";
|
|
string perWhere = " (is_del != '1' or is_del is null) 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) )";
|
|
DataTable perdt = ebll.personStaAll(perWhere);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(perdt);
|
|
|
|
//列表
|
|
returnstr += ",\"listData\":";
|
|
DataTable listdt = bll.getSubordinateData(ORG_ID);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(listdt);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"carData\":[],\"perData\":[] }";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "首页统计下级单位车辆/人员数量异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "首页统计下级单位车辆/人员数量");
|
|
return returnstr;
|
|
}
|
|
//首页统计下级单位车辆/人员数量
|
|
private string getSubordinateDataAll(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
//车数
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"carData\":";
|
|
string carWhere = " (is_del != '1' or is_del is null) 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) )";
|
|
DataTable cardt = bll.homeCarStaAll(carWhere);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(cardt);
|
|
|
|
//人数
|
|
FangYar.BLL.TBL.SysEmpBLL ebll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr += ",\"perData\":";
|
|
string perWhere = " (is_del != '1' or is_del is null) 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) )";
|
|
DataTable perdt = ebll.personStaAll(perWhere);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(perdt);
|
|
|
|
//列表
|
|
//获取所有子级,以及子级向对应的所有子级
|
|
string sqlOrgs = " select get_Org_child_list(o.ORG_ID) as cids ,o.* from fire_org o where o.PID='" + ORG_ID + "' and o.type='0' order by field(o.EXTENDCODE1,3,0,2,1) ,o.sort";
|
|
DataTable dtOrgs = FangYar.Common.MySqlHelper.QueryTable(sqlOrgs);
|
|
|
|
|
|
List<OrgsSta> orgStaList = new List<OrgsSta>();
|
|
|
|
for (int i = 0; i < dtOrgs.Rows.Count; i++)
|
|
{
|
|
orgStaList.Add(new OrgsSta()
|
|
{
|
|
ORGID = dtOrgs.Rows[i]["ORG_ID"].ToString(),
|
|
ORGNAME = dtOrgs.Rows[i]["EXTENDCODE3"].ToString(),
|
|
CIDS = dtOrgs.Rows[i]["CIDS"].ToString(),
|
|
CARNUM = 0,
|
|
PERNUM = 0,
|
|
});
|
|
}
|
|
|
|
//获取所有下级的 人员、车辆统计
|
|
string sqlSta = @"SELECT ( SELECT IFNULL(sum(1), 0) countNum FROM tbl_sys_car c WHERE (c.is_del != '1' OR c.is_del IS NULL)
|
|
AND c.org_id = o.org_id ) carNum,( SELECT IFNULL(sum(1), 0) countNum FROM tbl_sys_emp e WHERE e.IS_ADMIN = '0'
|
|
AND ( e.is_del != '1' OR e.is_del IS NULL ) AND e.org_id = o.org_id ) perNum,o.org_id,o.org_name FROM fire_org o WHERE type = '0'
|
|
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))";
|
|
|
|
DataTable dtSta = FangYar.Common.MySqlHelper.QueryTable(sqlSta);
|
|
|
|
List<CarPerSta> carperStaList = new List<CarPerSta>();
|
|
|
|
for (int i = 0; i < dtSta.Rows.Count; i++)
|
|
{
|
|
carperStaList.Add(new CarPerSta()
|
|
{
|
|
ORGID = dtSta.Rows[i]["ORG_ID"].ToString(),
|
|
ORGNAME = dtSta.Rows[i]["ORG_NAME"].ToString(),
|
|
CARNUM = Convert.ToInt32(dtSta.Rows[i]["CARNUM"].ToString()),
|
|
PERNUM = Convert.ToInt32(dtSta.Rows[i]["PERNUM"].ToString()),
|
|
});
|
|
}
|
|
|
|
for (int i = 0; i < orgStaList.Count; i++)
|
|
{
|
|
orgStaList[i].CARNUM = carperStaList.Where(p => ("," + orgStaList[i].CIDS + ",").Contains(p.ORGID)).Sum(p => p.CARNUM);
|
|
orgStaList[i].PERNUM = carperStaList.Where(p => ("," + orgStaList[i].CIDS + ",").Contains(p.ORGID)).Sum(p => p.PERNUM);
|
|
}
|
|
|
|
returnstr += ",\"listData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(orgStaList);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"carData\":[],\"perData\":[] }";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "首页统计下级单位车辆/人员数量异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "首页统计下级单位车辆/人员数量");
|
|
return returnstr;
|
|
}
|
|
//统计分析人员、车辆按单位统计
|
|
private string getPerAndCarStatisticss(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
{
|
|
DataTable dt = bll.getPerAndCarStatisticss(OrgId);
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "统计分析人员、车辆按单位统计异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "统计分析人员、车辆按单位统计");
|
|
return returnstr;
|
|
}
|
|
//导出excel
|
|
private void HtmlToWord3(HttpContext context)
|
|
{
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
|
|
//string whereStr = "";
|
|
//if (!string.IsNullOrEmpty(OrgId))
|
|
//{
|
|
// whereStr = " and pid ='" + OrgId + "' ";
|
|
//}
|
|
|
|
DataTable dt = bll.getPerAndCarStatisticss(OrgId);
|
|
|
|
if (dt.Rows.Count == 0)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
dt.Columns.Remove("ORG_ID");
|
|
dt.Columns.Remove("PID");
|
|
System.Collections.Generic.Dictionary<string, string> cellHeaders = new System.Collections.Generic.Dictionary<string, string>();
|
|
|
|
|
|
cellHeaders.Add("ORG_NAME", "单位名称");
|
|
cellHeaders.Add("PERNUM", "人员总数");
|
|
cellHeaders.Add("CARNUM", "车辆总数");
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车辆信息操作请求", "导出excel");
|
|
|
|
FangYar.Common.NPOIExcelHelper.ExportByWeb(dt, null, cellHeaders, DateTime.Now.ToString("yyyyMMddHHmmss") + "单位人员、车辆统计表.xls");
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车辆信息操作请求", "导出excel异常:" + e);
|
|
}
|
|
}
|
|
|
|
//车辆在岗统计
|
|
private string carSta2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["OrgId"];
|
|
string findDate = context.Request.Params["findDate"];
|
|
if (!string.IsNullOrEmpty(ORG_ID) && !string.IsNullOrEmpty(findDate))
|
|
{
|
|
DataTable dt = bll.carSta2(ORG_ID, findDate);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":" + code + ",\"msg\":\"参数有误\",\"data\":[]}";
|
|
}
|
|
}
|
|
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 carSta3(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["OrgId"];
|
|
string findDate = context.Request.Params["findDate"];
|
|
if (!string.IsNullOrEmpty(ORG_ID) && !string.IsNullOrEmpty(findDate))
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_ORG bllOrg = new BLL.FIRE.FIRE_ORG();
|
|
FangYar.Model.FIRE.FIRE_ORG modelOrg = bllOrg.GetModel(ORG_ID);
|
|
|
|
DataTable dt = bll.carSta3(ORG_ID, findDate, modelOrg.EXTENDCODE1, modelOrg.ISORG);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":" + code + ",\"msg\":\"参数有误\",\"data\":[]}";
|
|
}
|
|
}
|
|
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 carLatestOutList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
try
|
|
{
|
|
string ORG_ID = context.Request.Params["Org_Id"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (!string.IsNullOrEmpty(ORG_ID))
|
|
{
|
|
if (!string.IsNullOrEmpty(is_content))
|
|
{
|
|
if (is_content == "0")
|
|
{
|
|
code = 1;
|
|
string strWhere = " ORG_ID = '" + ORG_ID + "'";
|
|
DataTable dt = bll.carLatestOutList(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
else
|
|
{
|
|
code = 1;
|
|
string 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.carLatestOutList(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
code = 1;
|
|
string strWhere = " ORG_ID = '" + ORG_ID + "'";
|
|
DataTable dt = bll.carLatestOutList(strWhere);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
code = -1;
|
|
msg = "机构ID未获取";
|
|
data = "[]";
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
public class OrgsSta
|
|
{
|
|
public string ORGID { get; set; }
|
|
public string ORGNAME { get; set; }
|
|
public string CIDS { get; set; }
|
|
public int CARNUM { get; set; }
|
|
public int PERNUM { get; set; }
|
|
}
|
|
public class CarPerSta
|
|
{
|
|
public string ORGID { get; set; }
|
|
public string ORGNAME { get; set; }
|
|
public int CARNUM { get; set; }
|
|
public int PERNUM { get; set; }
|
|
}
|
|
}
|