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.
335 lines
13 KiB
335 lines
13 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// WorkFlowHandler 的摘要说明
|
|
/// </summary>
|
|
public class WorkFlowHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
private FangYar.BLL.FIRE.FIRE_ORG bll_org = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
|
|
switch (action)
|
|
{
|
|
case "getLeaveFirst":
|
|
returnstr = getLeaveFirst(context);
|
|
break;
|
|
case "getCarApplyFirst":
|
|
returnstr = getCarApplyFirst(context);
|
|
break;
|
|
case "getGCApplyFirst":
|
|
returnstr = getGCApplyFirst(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人-请假
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string getLeaveFirst(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string userId = context.Request.Params["qjr"];
|
|
|
|
var user = bll.GetModelByUID(userId);
|
|
var nextUid = "";
|
|
var nextStep = "";
|
|
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
|
|
var unit_org = org;//所在单位
|
|
//if (unit_org.TYPE=='1') {
|
|
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
|
|
//}
|
|
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
|
|
if (user.TAGS != null && user.TAGS.Contains("消防站"))
|
|
{
|
|
nextStep = "1_";
|
|
nextUid = "";
|
|
//获取消防站主官
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else if (user.TAGS.Contains("常委"))
|
|
{
|
|
nextStep = "4_";
|
|
nextUid = "";
|
|
//获取支队长、政委
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && !model.TAGS.Contains("副支队长") && (model.TAGS.Contains("支队长") || model.TAGS.Contains("政治委员")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else if (user.TAGS.Contains("大队"))
|
|
{
|
|
nextStep = "2_";
|
|
nextUid = "";
|
|
//获取支队长、政委
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else
|
|
{
|
|
nextStep = "3_";
|
|
nextUid = "";
|
|
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
|
|
if (dept_org != null && dept_org.LEADER != null)
|
|
{
|
|
|
|
var kz = bll.GetModelByID(dept_org.LEADER);
|
|
if (kz != null && kz.USERS_UID != null)
|
|
{
|
|
nextUid = kz.USERS_UID;//部门领导
|
|
}
|
|
|
|
}
|
|
}
|
|
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人-用车
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string getCarApplyFirst(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string userId = context.Request.Params["qjr"];
|
|
|
|
var user = bll.GetModelByUID(userId);
|
|
var nextUid = "";
|
|
var nextStep = "";
|
|
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
|
|
var unit_org = org;//所在单位
|
|
//if (unit_org.TYPE=='1') {
|
|
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
|
|
//}
|
|
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
|
|
if (user.TAGS != null && user.TAGS.Contains("消防站"))
|
|
{
|
|
nextStep = "1_";
|
|
nextUid = "";
|
|
//获取消防站主官
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
|
|
else if (user.TAGS.Contains("大队"))
|
|
{
|
|
nextStep = "2_";
|
|
nextUid = "";
|
|
//获取支队长、政委
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else
|
|
{
|
|
nextStep = "3_";
|
|
nextUid = "";
|
|
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
|
|
if (dept_org != null && dept_org.LEADER != null)
|
|
{
|
|
var kz = bll.GetModelByID(dept_org.LEADER);
|
|
if (kz != null && kz.USERS_UID != null)
|
|
{
|
|
nextUid = kz.USERS_UID;//部门领导
|
|
}
|
|
|
|
}
|
|
}
|
|
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人-公差
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string getGCApplyFirst(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string userId = context.Request.Params["qjr"];
|
|
|
|
var user = bll.GetModelByUID(userId);
|
|
var nextUid = "";
|
|
var nextStep = "";
|
|
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
|
|
var unit_org = org;//所在单位
|
|
//if (unit_org.TYPE=='1') {
|
|
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
|
|
//}
|
|
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
|
|
if (user.TAGS != null && user.TAGS.Contains("消防站"))
|
|
{
|
|
nextStep = "1_";
|
|
nextUid = "";
|
|
//获取消防站主官
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else if (user.TAGS.Contains("常委"))
|
|
{
|
|
nextStep = "4_";
|
|
nextUid = "";
|
|
//获取支队长、政委
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && !model.TAGS.Contains("副支队长") && (model.TAGS.Contains("支队长") || model.TAGS.Contains("政治委员")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else if (user.TAGS.Contains("大队"))
|
|
{
|
|
nextStep = "2_";
|
|
nextUid = "";
|
|
//获取支队长、政委
|
|
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
|
|
if (listuser != null && listuser.Count > 0)
|
|
{
|
|
foreach (var model in listuser)
|
|
{
|
|
|
|
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
}
|
|
}
|
|
nextUid = nextUid.Trim(',');
|
|
}
|
|
else
|
|
{
|
|
nextStep = "3_";
|
|
nextUid = "";
|
|
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
|
|
if (dept_org != null && dept_org.LEADER != null)
|
|
{
|
|
|
|
var kz = bll.GetModelByID(dept_org.LEADER);
|
|
if (kz != null && kz.USERS_UID != null)
|
|
{
|
|
nextUid = kz.USERS_UID;//部门领导
|
|
}
|
|
|
|
}
|
|
}
|
|
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|