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.
292 lines
11 KiB
292 lines
11 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;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// FireCarEquipHandler 的摘要说明
|
|
/// </summary>
|
|
public class FireCarEquipHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.FIRE.FIRE_CAR_EQUIP bll = new FangYar.BLL.FIRE.FIRE_CAR_EQUIP();
|
|
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 "CarEquipList":
|
|
returnstr = GetCarEquipList(context);
|
|
break;
|
|
case "EpuTypeAllList":
|
|
returnstr = GetEpuTypeAllList(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = DelCarEquip(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = EditCarEpu(context);
|
|
break;
|
|
case "CreateCarEquip":
|
|
returnstr = AddCarEpu(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
// 添加车载装备
|
|
private string AddCarEpu(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ID = Guid.NewGuid().ToString("N");
|
|
string CAR_ID = context.Request.Params["CAR_ID"];
|
|
string CAR_NUMBER = context.Request.Params["CAR_NUMBER"];
|
|
string EQUIP_ID = context.Request.Params["EQUIP_ID"];
|
|
string EQUIP_CODE = context.Request.Params["EQUIP_CODE"];
|
|
string EQUIP_NAME = context.Request.Params["EQUIP_NAME"];
|
|
string EQUIP_TYPE = context.Request.Params["EQUIP_TYPE"];
|
|
string EQUIP_NUMBER = context.Request.Params["EQUIP_NUMBER"];
|
|
string CREATE_MAN = context.Request.Params["CREATE_MAN"];
|
|
string EQUIP_UNIT = context.Request.Params["EQUIP_UNIT"];
|
|
string CREATE_TIME = context.Request.Params["CREATE_TIME"];
|
|
string REMAEK = context.Request.Params["REMAEK"];
|
|
|
|
|
|
|
|
//消防装备表
|
|
FangYar.Model.FIRE.FIRE_CAR_EQUIP model = new Model.FIRE.FIRE_CAR_EQUIP();
|
|
model.ID = ID;
|
|
model.CAR_ID = CAR_ID;
|
|
model.CAR_NUMBER = CAR_NUMBER.UrlDecode();
|
|
model.EQUIP_ID = EQUIP_ID;
|
|
model.EQUIP_NAME = EQUIP_NAME;
|
|
model.EQUIP_CODE = EQUIP_CODE;
|
|
model.EQUIP_TYPE = EQUIP_TYPE;
|
|
|
|
if (!string.IsNullOrEmpty(EQUIP_NUMBER))
|
|
{
|
|
model.EQUIP_NUMBER = int.Parse(EQUIP_NUMBER);
|
|
}
|
|
else
|
|
{
|
|
model.EQUIP_NUMBER = 1;
|
|
}
|
|
model.CREATE_MAN = CREATE_MAN;
|
|
model.EQUIP_UNIT = EQUIP_UNIT;
|
|
model.CREATE_TIME = DateTime.Now.ToString("G");
|
|
model.REMAEK = REMAEK;
|
|
|
|
if (bll.AddCarEpu(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败:装备编码有重复数据";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车载装备操作请求", "添加异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "车载装备操作请求", "添加");
|
|
return returnstr;
|
|
|
|
}
|
|
|
|
// 查询车载装别
|
|
private string GetCarEquipList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
string data = "";
|
|
string msg = "";
|
|
DataTable dt = new DataTable();
|
|
try
|
|
{
|
|
|
|
string ID = context.Request.Params["ID"];//车辆id
|
|
|
|
if (ID != null)
|
|
{
|
|
msg = "查看成功!";
|
|
|
|
dt = bll.QueryCarEquipList(ID).Tables[0];
|
|
//List<Model.FIRE.FIRE_CAR_EQUIP> list = bll.QueryCarEquipList(ID);
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
|
|
}
|
|
else
|
|
{
|
|
msg = "查看失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败!";
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车载装备操作请求", "查询车载装别异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"" + msg + "\",\"count\":" + dt.Rows.Count + ",\"data\":" + data + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "车载装备操作请求", "查询车载装别");
|
|
return returnstr;
|
|
}
|
|
|
|
//查询消防设备类型全部集合
|
|
private string GetEpuTypeAllList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataSet data = bll.GetAllList();
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(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;
|
|
}
|
|
|
|
//删除车载装备
|
|
private string DelCarEquip(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string EmpList = context.Request.Params["carEquipListEdit"];
|
|
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;
|
|
}
|
|
|
|
|
|
//修改车载装备
|
|
private string EditCarEpu(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string USER_ID = context.Request.Params["USER_ID"];
|
|
string ID = context.Request.Params["ID"];
|
|
|
|
string EQUIP_NAME = context.Request.Params["EQUIP_NAME"];
|
|
string EQUIP_CODE = context.Request.Params["EQUIP_CODE"];
|
|
string EQUIP_TYPE = context.Request.Params["EQUIP_TYPE"];
|
|
string EQUIP_NUMBER = context.Request.Params["EQUIP_NUMBER"];
|
|
string CREATE_MAN = context.Request.Params["CREATE_MAN"];
|
|
string EQUIP_UNIT = context.Request.Params["EQUIP_UNIT"];
|
|
string CREATE_TIME = context.Request.Params["CREATE_TIME"];
|
|
string REMAEK = context.Request.Params["REMAEK"];
|
|
|
|
//消防装备表
|
|
FangYar.Model.FIRE.FIRE_CAR_EQUIP model = new Model.FIRE.FIRE_CAR_EQUIP();
|
|
model.ID = ID;
|
|
model.EQUIP_NAME = EQUIP_NAME;
|
|
model.EQUIP_CODE = EQUIP_CODE;
|
|
model.EQUIP_TYPE = EQUIP_TYPE;
|
|
|
|
if (!string.IsNullOrEmpty(EQUIP_NUMBER))
|
|
{
|
|
model.EQUIP_NUMBER = int.Parse(EQUIP_NUMBER);
|
|
}
|
|
else
|
|
{
|
|
model.EQUIP_NUMBER = 1;
|
|
}
|
|
model.CREATE_MAN = CREATE_MAN;
|
|
model.EQUIP_UNIT = EQUIP_UNIT;
|
|
model.CREATE_TIME = DateTime.Now.ToString("G");
|
|
model.REMAEK = REMAEK;
|
|
//model.U_PER = USER_ID;
|
|
|
|
if (bll.EditCarEpu(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "修改失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "车载装备操作请求", "修改车载装备异常:" + e);
|
|
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "车载装备操作请求", "修改车载装备");
|
|
return returnstr;
|
|
}
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|