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.
402 lines
16 KiB
402 lines
16 KiB
11 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
using System.Data;
|
||
|
using System.Text;
|
||
|
using System.Collections;
|
||
|
using System.Reflection;
|
||
|
using System.Web.Script.Serialization;
|
||
|
using FangYar.Model;
|
||
|
using FangYar.BLL;
|
||
|
|
||
|
namespace FangYar.WebUI.ashx
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// OaLeaveHandler 的摘要说明
|
||
|
/// </summary>
|
||
|
public class FireEpuHandler : IHttpHandler
|
||
|
{
|
||
|
private FangYar.BLL.FIRE.FIRE_EPUIP bll = new FangYar.BLL.FIRE.FIRE_EPUIP();
|
||
|
private FangYar.BLL.FIRE.FIRE_STATION sbll = new FangYar.BLL.FIRE.FIRE_STATION();
|
||
|
private FangYar.BLL.TBL.SysEmpBLL ebll = new FangYar.BLL.TBL.SysEmpBLL();
|
||
|
public void ProcessRequest(HttpContext context)
|
||
|
{
|
||
|
context.Response.ContentType = "text/plain";
|
||
|
string action = context.Request.Params["Action"];
|
||
|
string returnstr = "";
|
||
|
|
||
|
switch (action)
|
||
|
{
|
||
|
case "EpuList":
|
||
|
returnstr = GetEpuList(context);
|
||
|
break;
|
||
|
case "Add":
|
||
|
returnstr = AddEpu(context);
|
||
|
break;
|
||
|
case "Edit":
|
||
|
returnstr = EditEpu(context);
|
||
|
break;
|
||
|
case "StaList":
|
||
|
returnstr = getStaList(context);
|
||
|
break;
|
||
|
case "Del":
|
||
|
returnstr = DelEpu(context);
|
||
|
break;
|
||
|
}
|
||
|
//case "EpuList":
|
||
|
//{
|
||
|
// returnstr = GetEpuList(context);
|
||
|
//}
|
||
|
context.Response.Write(returnstr);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//查询
|
||
|
private string GetEpuList(HttpContext context)
|
||
|
{
|
||
|
string returnstr = "";
|
||
|
try
|
||
|
{
|
||
|
string OrgId = context.Request.Params["OrgId"];
|
||
|
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 is_content = context.Request.Params["is_content"];
|
||
|
int pageIndex = 1;
|
||
|
int pageSize = 10;
|
||
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
||
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
||
|
string where = "";
|
||
|
|
||
|
if (!string.IsNullOrEmpty(treeID) && treeID != OrgId)
|
||
|
{
|
||
|
if (is_content == "1")
|
||
|
{
|
||
|
where = "org_id in ( select org_id from fire_org, (SELECT get_Org_child_list('" + treeID + "') cids) t where find_in_set(ORG_ID, cids))";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
where = " ORG_ID = '" + treeID + "'";
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (is_content == "1")
|
||
|
{
|
||
|
where = "org_id in ( select org_id from fire_org, (SELECT get_Org_child_list('" + OrgId + "') cids) t where find_in_set(ORG_ID, cids))";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
where = " ORG_ID = '" + OrgId + "'";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (!string.IsNullOrEmpty(keyword))
|
||
|
{
|
||
|
if (where != null)
|
||
|
{
|
||
|
where += " and ";
|
||
|
}
|
||
|
where += "( name like '%" + keyword + "%' or sta_name like '%" + keyword + "%')";
|
||
|
}
|
||
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
||
|
int count = bll.GetRecordCount(where);
|
||
|
returnstr += "\"count\":" + count + ",\"data\":";
|
||
|
if (count == 0)
|
||
|
{
|
||
|
returnstr += "[]";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
List<FangYar.Model.FIRE.FIRE_EPUIP> list = bll.QueryList(pageIndex, pageSize, where, "");
|
||
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
||
|
}
|
||
|
returnstr += "}";
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
||
|
}
|
||
|
return returnstr;
|
||
|
}
|
||
|
|
||
|
|
||
|
//获取所属消防机关列表
|
||
|
private string getStaList(HttpContext context)
|
||
|
{
|
||
|
string returnstr = "";
|
||
|
try
|
||
|
{
|
||
|
string orgId = context.Request.Params["OrgId"];
|
||
|
|
||
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
||
|
DataTable data = sbll.getStaList(orgId);
|
||
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
||
|
returnstr += "}";
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
||
|
}
|
||
|
return returnstr;
|
||
|
|
||
|
}
|
||
|
|
||
|
//添加消防装备
|
||
|
private string AddEpu(HttpContext context)
|
||
|
{
|
||
|
string returnstr = "";
|
||
|
int code = -1;
|
||
|
string msg = "";
|
||
|
try
|
||
|
{
|
||
|
string USER_ID = context.Request.Params["USER_ID"];
|
||
|
string ID = Guid.NewGuid().ToString("N");
|
||
|
string TYPE_ID = context.Request.Params["TYPE_ID"];
|
||
|
string CODE = context.Request.Params["CODE"];
|
||
|
string TYPE_CODE = context.Request.Params["TYPE_CODE"];
|
||
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
||
|
string EQ_NUM = context.Request.Params["EQ_NUM"];
|
||
|
string UNIT_PER = context.Request.Params["UNIT_PER"];
|
||
|
string UNIT_W_PHONE = context.Request.Params["UNIT_W_PHONE"];
|
||
|
string UNIT_M_PHONE = context.Request.Params["UNIT_M_PHONE"];
|
||
|
string CONT_PER = context.Request.Params["CONT_PER"];
|
||
|
string CONT_W_PHONE = context.Request.Params["CONT_W_PHONE"];
|
||
|
string CONT_M_PHONE = context.Request.Params["CONT_M_PHONE"];
|
||
|
string CONT_R_PHONE = context.Request.Params["CONT_R_PHONE"];
|
||
|
string UNIT = context.Request.Params["UNIT"];
|
||
|
string UNIT_ADDR = context.Request.Params["UNIT_ADDR"];
|
||
|
string PRICE = context.Request.Params["PRICE"];
|
||
|
string RESERVE = context.Request.Params["RESERVE"];
|
||
|
string R_TIME = context.Request.Params["R_TIME"];
|
||
|
string Q_G_P = context.Request.Params["Q_G_P"];
|
||
|
string DES = context.Request.Params["DES"];
|
||
|
string ADDR = context.Request.Params["ADDR"];
|
||
|
string UNIT_MEAS = context.Request.Params["UNIT_MEAS"];
|
||
|
string E_NAME = context.Request.Params["E_NAME"];
|
||
|
string H_LEVEL = context.Request.Params["H_LEVEL"];
|
||
|
string SECRET = context.Request.Params["SECRET"];
|
||
|
string DUTY_PHONE = context.Request.Params["DUTY_PHONE"];
|
||
|
string TRADEMARK = context.Request.Params["TRADEMARK"];
|
||
|
string MANUFACTOR = context.Request.Params["MANUFACTOR"];
|
||
|
string LIABLE = context.Request.Params["LIABLE"];
|
||
|
string EXTENDCODE1_PATH = context.Request.Params["EXTENDCODE1_PATH"];
|
||
|
string STATE = context.Request.Params["STATE"];
|
||
|
string REMARKS = context.Request.Params["REMARKS"];
|
||
|
|
||
|
//消防装备表
|
||
|
FangYar.Model.FIRE.FIRE_EPUIP model = new Model.FIRE.FIRE_EPUIP();
|
||
|
model.ID = ID;
|
||
|
model.TYPE_ID = TYPE_ID;
|
||
|
model.CODE = CODE;
|
||
|
model.TYPE_CODE = TYPE_CODE;
|
||
|
model.ORG_ID = ORG_ID;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(EQ_NUM))
|
||
|
{
|
||
|
model.EQ_NUM = int.Parse(EQ_NUM);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
model.EQ_NUM = 1;
|
||
|
}
|
||
|
model.UNIT_PER = UNIT_PER;
|
||
|
model.UNIT_W_PHONE = UNIT_W_PHONE;
|
||
|
model.UNIT_M_PHONE = UNIT_M_PHONE;
|
||
|
model.CONT_PER = CONT_PER;
|
||
|
model.CONT_W_PHONE = CONT_W_PHONE;
|
||
|
model.CONT_M_PHONE = CONT_M_PHONE;
|
||
|
model.CONT_R_PHONE = CONT_R_PHONE;
|
||
|
model.UNIT = UNIT;
|
||
|
model.UNIT_ADDR = UNIT_ADDR;
|
||
|
model.PRICE = PRICE;
|
||
|
model.RESERVE = RESERVE;
|
||
|
model.R_TIME = R_TIME;
|
||
|
model.Q_G_P = Q_G_P;
|
||
|
model.DES = DES;
|
||
|
model.ADDR = ADDR;
|
||
|
model.UNIT_MEAS = UNIT_MEAS;
|
||
|
model.E_NAME = E_NAME;
|
||
|
model.H_LEVEL = H_LEVEL;
|
||
|
model.SECRET = SECRET;
|
||
|
model.DUTY_PHONE = DUTY_PHONE;
|
||
|
model.TRADEMARK = TRADEMARK;
|
||
|
model.MANUFACTOR = MANUFACTOR;
|
||
|
model.LIABLE = LIABLE;
|
||
|
model.EXTENDCODE1 = EXTENDCODE1_PATH;
|
||
|
model.STATE = STATE;
|
||
|
model.REMARKS = REMARKS;
|
||
|
model.A_PER = USER_ID;
|
||
|
model.A_TIME = DateTime.Now.ToString("G");
|
||
|
|
||
|
if (bll.AddEpu(model))
|
||
|
{
|
||
|
msg = "添加成功!";
|
||
|
code = 1;
|
||
|
}
|
||
|
else { msg = "添加失败!"; }
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
msg = "添加失败:装备编码有重复数据";
|
||
|
}
|
||
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
||
|
return returnstr;
|
||
|
}
|
||
|
|
||
|
//修改消防装备
|
||
|
private string EditEpu(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 TYPE_ID = context.Request.Params["TYPE_ID"];
|
||
|
string CODE = context.Request.Params["CODE"];
|
||
|
string TYPE_CODE = context.Request.Params["TYPE_CODE"];
|
||
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
||
|
string EQ_NUM = context.Request.Params["EQ_NUM"];
|
||
|
string UNIT_PER = context.Request.Params["UNIT_PER"];
|
||
|
string UNIT_W_PHONE = context.Request.Params["UNIT_W_PHONE"];
|
||
|
string UNIT_M_PHONE = context.Request.Params["UNIT_M_PHONE"];
|
||
|
string CONT_PER = context.Request.Params["CONT_PER"];
|
||
|
string CONT_W_PHONE = context.Request.Params["CONT_W_PHONE"];
|
||
|
string CONT_M_PHONE = context.Request.Params["CONT_M_PHONE"];
|
||
|
string CONT_R_PHONE = context.Request.Params["CONT_R_PHONE"];
|
||
|
string UNIT = context.Request.Params["UNIT"];
|
||
|
string UNIT_ADDR = context.Request.Params["UNIT_ADDR"];
|
||
|
string PRICE = context.Request.Params["PRICE"];
|
||
|
string RESERVE = context.Request.Params["RESERVE"];
|
||
|
string R_TIME = context.Request.Params["R_TIME"];
|
||
|
string Q_G_P = context.Request.Params["Q_G_P"];
|
||
|
string DES = context.Request.Params["DES"];
|
||
|
string ADDR = context.Request.Params["ADDR"];
|
||
|
string UNIT_MEAS = context.Request.Params["UNIT_MEAS"];
|
||
|
string E_NAME = context.Request.Params["E_NAME"];
|
||
|
string H_LEVEL = context.Request.Params["H_LEVEL"];
|
||
|
string SECRET = context.Request.Params["SECRET"];
|
||
|
string DUTY_PHONE = context.Request.Params["DUTY_PHONE"];
|
||
|
string TRADEMARK = context.Request.Params["TRADEMARK"];
|
||
|
string MANUFACTOR = context.Request.Params["MANUFACTOR"];
|
||
|
string LIABLE = context.Request.Params["LIABLE"];
|
||
|
string EXTENDCODE1_PATH = context.Request.Params["EXTENDCODE1_PATH"];
|
||
|
string STATE = context.Request.Params["STATE"];
|
||
|
string REMARKS = context.Request.Params["REMARKS"];
|
||
|
|
||
|
//消防装备表
|
||
|
FangYar.Model.FIRE.FIRE_EPUIP model = new Model.FIRE.FIRE_EPUIP();
|
||
|
model.ID = ID;
|
||
|
model.TYPE_ID = TYPE_ID;
|
||
|
model.CODE = CODE;
|
||
|
model.TYPE_CODE = TYPE_CODE;
|
||
|
model.ORG_ID = ORG_ID;
|
||
|
|
||
|
if (!string.IsNullOrEmpty(EQ_NUM))
|
||
|
{
|
||
|
model.EQ_NUM = int.Parse(EQ_NUM);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
model.EQ_NUM = 1;
|
||
|
}
|
||
|
model.UNIT_PER = UNIT_PER;
|
||
|
model.UNIT_W_PHONE = UNIT_W_PHONE;
|
||
|
model.UNIT_M_PHONE = UNIT_M_PHONE;
|
||
|
model.CONT_PER = CONT_PER;
|
||
|
model.CONT_W_PHONE = CONT_W_PHONE;
|
||
|
model.CONT_M_PHONE = CONT_M_PHONE;
|
||
|
model.CONT_R_PHONE = CONT_R_PHONE;
|
||
|
model.UNIT = UNIT;
|
||
|
model.UNIT_ADDR = UNIT_ADDR;
|
||
|
model.PRICE = PRICE;
|
||
|
model.RESERVE = RESERVE;
|
||
|
model.R_TIME = R_TIME;
|
||
|
model.Q_G_P = Q_G_P;
|
||
|
model.DES = DES;
|
||
|
model.ADDR = ADDR;
|
||
|
model.UNIT_MEAS = UNIT_MEAS;
|
||
|
model.E_NAME = E_NAME;
|
||
|
model.H_LEVEL = H_LEVEL;
|
||
|
model.SECRET = SECRET;
|
||
|
model.DUTY_PHONE = DUTY_PHONE;
|
||
|
model.TRADEMARK = TRADEMARK;
|
||
|
model.MANUFACTOR = MANUFACTOR;
|
||
|
model.LIABLE = LIABLE;
|
||
|
model.EXTENDCODE1 = EXTENDCODE1_PATH;
|
||
|
model.STATE = STATE;
|
||
|
model.REMARKS = REMARKS;
|
||
|
model.U_PER = USER_ID;
|
||
|
model.U_TIME = DateTime.Now.ToString("G");
|
||
|
|
||
|
if (bll.EditEpu(model))
|
||
|
{
|
||
|
msg = "修改成功!";
|
||
|
code = 1;
|
||
|
}
|
||
|
else { msg = "修改失败!"; }
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
msg = "修改失败!";
|
||
|
}
|
||
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
||
|
return returnstr;
|
||
|
}
|
||
|
|
||
|
//删除消防装备
|
||
|
private string DelEpu(HttpContext context)
|
||
|
{
|
||
|
string returnstr = "";
|
||
|
int code = -1;
|
||
|
string msg = "";
|
||
|
try
|
||
|
{
|
||
|
string EpuList = context.Request.Params["EpuList"];
|
||
|
string[] EpuArray = EpuList.Split(',');
|
||
|
string EpuListString = "";
|
||
|
for (int i = 0; i < EpuArray.Length; i++)
|
||
|
{
|
||
|
if (i == 0)
|
||
|
{
|
||
|
EpuListString = "'" + EpuArray[i] + "'";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
EpuListString += ",'" + EpuArray[i] + "'";
|
||
|
}
|
||
|
}
|
||
|
if (bll.DeleteList(EpuListString))
|
||
|
{
|
||
|
msg = "删除成功!";
|
||
|
code = 1;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
msg = "删除失败!";
|
||
|
}
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
msg = "删除失败!";
|
||
|
}
|
||
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
||
|
return returnstr;
|
||
|
}
|
||
|
|
||
|
public bool IsReusable
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|