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.
6857 lines
302 KiB
6857 lines
302 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Data;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Linq;
|
|
using FangYar.BLL.OA;
|
|
using FangYar.IDAL;
|
|
using NPOI.SS.Formula.Functions;
|
|
using FangYar.BLL;
|
|
using FangYar.BLL.FIRE;
|
|
using System.Collections;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// AppHandler 的摘要说明
|
|
/// </summary>
|
|
public class AppHandler : IHttpHandler
|
|
{
|
|
private RoadFlow.Platform.WorkFlowTask bworkFlowTask = new RoadFlow.Platform.WorkFlowTask();
|
|
private RoadFlow.Platform.WorkFlow bworkFlow = new RoadFlow.Platform.WorkFlow();
|
|
private RoadFlow.Platform.WorkFlowButtons bworkFlowButtons = new RoadFlow.Platform.WorkFlowButtons();
|
|
private RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary();
|
|
private RoadFlow.Platform.Organize borganize = new RoadFlow.Platform.Organize();
|
|
|
|
#region ProcessRequest
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
|
|
switch (action)
|
|
{
|
|
case "AppGetTaskWaitListByUid":
|
|
returnstr = AppGetTaskWaitListByUid(context);
|
|
break;
|
|
case "AppGetTaskProcessedListByUid":
|
|
returnstr = AppGetTaskProcessedListByUid(context);
|
|
break;
|
|
case "AppLeaveTaskApply":
|
|
returnstr = AppLeaveTaskApply(context);
|
|
break;
|
|
case "AppGetTaskWaitLeaveItem":
|
|
returnstr = AppGetTaskWaitLeaveItem(context);
|
|
break;
|
|
case "AppToleranceTaskApply":
|
|
returnstr = AppToleranceTaskApply(context);
|
|
break;
|
|
case "AppGetTaskWaitToleranceItem":
|
|
returnstr = AppGetTaskWaitToleranceItem(context);
|
|
break;
|
|
case "AppCarTaskApply":
|
|
returnstr = AppCarTaskApply(context);
|
|
break;
|
|
case "AppGetTaskWaitCarItem":
|
|
returnstr = AppGetTaskWaitCarItem(context);
|
|
break;
|
|
case "AppLeaveTaskHandle":
|
|
returnstr = AppLeaveTaskHandle(context);
|
|
break;
|
|
case "AppToleranceTaskHandle":
|
|
returnstr = AppToleranceTaskHandle(context);
|
|
break;
|
|
case "AppCarTaskHandle":
|
|
returnstr = AppCarTaskHandle(context);
|
|
break;
|
|
case "AppGetOrgDeptEmpTreeByOrgId":
|
|
returnstr = AppGetOrgDeptEmpTreeByOrgId(context);
|
|
break;
|
|
case "AppGetOrgDeptEmpTreeByOrgId2":
|
|
returnstr = AppGetOrgDeptEmpTreeByOrgId2(context);
|
|
break;
|
|
case "AppGetOrgDeptEmpTreeByOrgId3":
|
|
returnstr = AppGetOrgDeptEmpTreeByOrgId3(context);
|
|
break;
|
|
case "AppGetOrgDeptCarTreeByOrgId":
|
|
returnstr = AppGetOrgDeptCarTreeByOrgId(context);
|
|
break;
|
|
case "AppGetLeaveTypeList":
|
|
returnstr = AppGetLeaveTypeList(context);
|
|
break;
|
|
case "AppGetToleranceTypeList":
|
|
returnstr = AppGetToleranceTypeList(context);
|
|
break;
|
|
case "AppGetAlarmEmpListByOrgId":
|
|
returnstr = AppGetAlarmEmpListByOrgId(context);
|
|
break;
|
|
case "AppGetAlarmCarListByOrgId":
|
|
returnstr = AppGetAlarmCarListByOrgId(context);
|
|
break;
|
|
case "AppGetVisitorRegListByUid":
|
|
returnstr = AppGetVisitorRegListByUid(context);
|
|
break;
|
|
case "AppVisitorRegHandle":
|
|
returnstr = AppVisitorRegHandle(context);
|
|
break;
|
|
case "AppGetLeaveListByUid":
|
|
returnstr = AppGetLeaveListByUid(context);
|
|
break;
|
|
case "AppGetLeaveModelByLeaveId":
|
|
returnstr = AppGetLeaveModelByLeaveId(context);
|
|
break;
|
|
case "AppGetToleranceListByUid":
|
|
returnstr = AppGetToleranceListByUid(context);
|
|
break;
|
|
case "AppGetToleranceModelByToleranceId":
|
|
returnstr = AppGetToleranceModelByToleranceId(context);
|
|
break;
|
|
case "AppGetCarApplyListByUid":
|
|
returnstr = AppGetCarApplyListByUid(context);
|
|
break;
|
|
case "AppDeleteCarApplyById":
|
|
returnstr = AppDeleteCarApplyById(context);
|
|
break;
|
|
case "AppGetCarApplyModelByCarApplyId":
|
|
returnstr = AppGetCarApplyModelByCarApplyId(context);
|
|
break;
|
|
case "AppGetVisitorWeekByOrgId":
|
|
returnstr = AppGetVisitorWeekByOrgId(context);
|
|
break;
|
|
case "AppGetPerAccWeekByOrgId":
|
|
returnstr = AppGetPerAccWeekByOrgId(context);
|
|
break;
|
|
case "AppGetCarAccWeekByOrgId":
|
|
returnstr = AppGetCarAccWeekByOrgId(context);
|
|
break;
|
|
case "AppGetCarNumListByOrgId":
|
|
returnstr = AppGetCarNumListByOrgId(context);
|
|
break;
|
|
//岗哨交接
|
|
case "AppGetShiftsListByOrgId":
|
|
returnstr = AppGetShiftsListByOrgId(context);
|
|
break;
|
|
case "AppGetShiftsListByUserUid":
|
|
returnstr = AppGetShiftsListByUserUid(context);
|
|
break;
|
|
case "AppGetShiftsHistoryListByOrgId":
|
|
returnstr = AppGetShiftsHistoryListByOrgId(context);
|
|
break;
|
|
case "AppGetShiftsIsDutyByIFID":
|
|
returnstr = AppGetShiftsIsDutyByIFID(context);
|
|
break;
|
|
case "AppUpdateShiftsByID":
|
|
returnstr = AppUpdateShiftsByID(context);
|
|
break;
|
|
case "AppUpdateShiftsOverdueByID":
|
|
returnstr = AppUpdateShiftsOverdueByID(context);
|
|
break;
|
|
case "AppGetOrgListByOrgId":
|
|
returnstr = AppGetOrgListByOrgId(context);
|
|
break;
|
|
case "AppGetAlarmDataListByOrgId":
|
|
returnstr = AppGetAlarmDataListByOrgId(context);
|
|
break;
|
|
case "AppGetOaPatrolSpotListByOrgId":
|
|
returnstr = AppGetOaPatrolSpotListByOrgId(context);
|
|
break;
|
|
case "AppGetOaPatrolSpotModelById":
|
|
returnstr = AppGetOaPatrolSpotModelById(context);
|
|
break;
|
|
case "AppGetOaPatrolSpotModelByRFID":
|
|
returnstr = AppGetOaPatrolSpotModelByRFID(context);
|
|
break;
|
|
case "AppAddOaPatrolSpotModel":
|
|
returnstr = AppAddOaPatrolSpotModel(context);
|
|
break;
|
|
case "AppEditOaPatrolSpotModel":
|
|
returnstr = AppEditOaPatrolSpotModel(context);
|
|
break;
|
|
case "AppGetFireEpuipListByOrgId":
|
|
returnstr = AppGetFireEpuipListByOrgId(context);
|
|
break;
|
|
case "AppAddFireEpuipModel":
|
|
returnstr = AppAddFireEpuipModel(context);
|
|
break;
|
|
//提示角标接口
|
|
case "AppGetTaskWaitCountByUid"://获取待办数
|
|
returnstr = AppGetTaskWaitCountByUid(context);
|
|
break;
|
|
case "AppGetVisitorApplySuperscript"://访客审批
|
|
returnstr = AppGetVisitorApplySuperscript(context);
|
|
break;
|
|
case "AppGetProjectPatrolSuperscript"://计划巡查
|
|
returnstr = AppGetProjectPatrolSuperscript(context);
|
|
break;
|
|
case "AppGetRectifySecurityThreatSuperscript"://隐患整改
|
|
returnstr = AppGetRectifySecurityThreatSuperscript(context);
|
|
break;
|
|
case "AppGetSentryAndRestInspectSuperscript":
|
|
returnstr = AppGetSentryAndRestInspectSuperscript(context);//查铺查哨
|
|
break;
|
|
case "AppGetBeOnSentrySuperscript":
|
|
returnstr = AppGetBeOnSentrySuperscript(context);//上哨任务
|
|
break;
|
|
case "AppGetOrgTree":
|
|
returnstr = AppGetOrgTree(context);//获取本机和下级单位
|
|
break;
|
|
//战训功能接口
|
|
case "AppGetTrainTaskListByOrgId":
|
|
returnstr = AppGetTrainTaskListByOrgId(context);
|
|
break;
|
|
case "AppGetTrainTaskListByUserUid":
|
|
returnstr = AppGetTrainTaskListByUserUid(context);
|
|
break;
|
|
case "AppGetTrainParticipateTaskListByUserUid":
|
|
returnstr = AppGetTrainParticipateTaskListByUserUid(context);
|
|
break;
|
|
case "AppAddTrainReportScore":
|
|
returnstr = AppAddTrainReportScore(context);
|
|
break;
|
|
case "AppGetTrainSubject":
|
|
returnstr = AppGetTrainSubject(context);
|
|
break;
|
|
case "AppGetTrainScoreBySubjectid":
|
|
returnstr = AppGetTrainScoreBySubjectid(context);
|
|
break;
|
|
case "AppGetTrainScoreListByTaskID":
|
|
returnstr = AppGetTrainScoreListByTaskID(context);
|
|
break;
|
|
case "AppGetTrainRedBlackListByOrgId":
|
|
returnstr = AppGetTrainRedBlackListByOrgId(context);
|
|
break;
|
|
case "AppGetTrainStandardListBySubjectId":
|
|
returnstr = AppGetTrainStandardListBySubjectId(context);
|
|
break;
|
|
case "AppGetTrainSubjectModelBySubjectId":
|
|
returnstr = AppGetTrainSubjectModelBySubjectId(context);
|
|
break;
|
|
case "AppGetTrainHistoryScoreListByUserUid":
|
|
returnstr = AppGetTrainHistoryScoreListByUserUid(context);
|
|
break;
|
|
case "AppGetTrainBestScoreByUserUid":
|
|
returnstr = AppGetTrainBestScoreByUserUid(context);
|
|
break;
|
|
case "AppGetTrainTimeScoreSubjectByUid":
|
|
returnstr = AppGetTrainTimeScoreSubjectByUid(context);
|
|
break;
|
|
case "AppGetTrainTimeScoreBySubjectId":
|
|
returnstr = AppGetTrainTimeScoreBySubjectId(context);
|
|
break;
|
|
case "AppGetTrainKnowDicListByMod":
|
|
returnstr = AppGetTrainKnowDicListByMod(context);
|
|
break;
|
|
case "AppGetTrainKnowListByOrgId":
|
|
returnstr = AppGetTrainKnowListByOrgId(context);
|
|
break;
|
|
case "AppGetTrainKnowModelByKnowId":
|
|
returnstr = AppGetTrainKnowModelByKnowId(context);
|
|
break;
|
|
case "AppGetPerPhoneListByOrgId":
|
|
returnstr = AppGetPerPhoneListByOrgId(context);
|
|
break;
|
|
case "AppGetShiftsOnDutyByRFID":
|
|
returnstr = AppGetShiftsOnDutyByRFID(context);
|
|
break;
|
|
case "AppUpdateShiftsDutyByID":
|
|
returnstr = AppUpdateShiftsDutyByID(context);
|
|
break;
|
|
case "AppLeaveTaskApplyMoreStep"://请假申请-多分支多级机构
|
|
returnstr = AppLeaveTaskApplyMoreStep(context);
|
|
break;
|
|
case "AppCarTaskApplyMoreStep"://用车申请-多级分支多级机构
|
|
returnstr = AppCarTaskApplyMoreStep(context);
|
|
break;
|
|
case "AppLeaveWorkFlowTaskHandle"://请假流程处理-多级分支多级机构
|
|
returnstr = AppLeaveWorkFlowTaskHandle(context);
|
|
break;
|
|
case "AppCarWorkFlowTaskHandle"://车辆审批流程处理-多级分支多级机构
|
|
returnstr = AppCarWorkFlowTaskHandle(context);
|
|
break;
|
|
case "AppGetOrgNodeTree"://多级机构
|
|
returnstr = AppGetOrgNodeTree(context);
|
|
break;
|
|
case "AppGetToleranceListByOrgId"://本单位公差记录列表
|
|
returnstr = AppGetToleranceListByOrgId(context);
|
|
break;
|
|
case "AppCountEmp"://人员统计
|
|
returnstr = AppCountEmp(context);
|
|
break;
|
|
case "AppCountCar"://车辆统计
|
|
returnstr = AppCountCar(context);
|
|
break;
|
|
case "AppToleranceTaskApplyMoreStep"://公差审批流程-发起-多级分支多级机构
|
|
returnstr = AppToleranceTaskApplyMoreStep(context);
|
|
break;
|
|
case "AppToleranceWorkFlowTaskHandle"://公差审批流程-处理-多级分支多级机构
|
|
returnstr = AppToleranceWorkFlowTaskHandle(context);
|
|
break;
|
|
case "AppCountFireInspect"://查铺查哨(机构+任务)
|
|
returnstr = AppCountFireInspect(context);
|
|
break;
|
|
case "AppCountFireInspectPlace"://查铺查哨(地点)
|
|
returnstr = AppCountFireInspectPlace(context);
|
|
break;
|
|
case "AppCountPatrolTask"://查铺查哨(地点)
|
|
returnstr = AppCountPatrolTask(context);
|
|
break;
|
|
case "AppCountPatrolTaskList":
|
|
returnstr = AppCountPatrolTaskList(context);
|
|
break;
|
|
case "AppGetPartolTaskTrajectory":
|
|
returnstr = AppGetPartolTaskTrajectory(context);
|
|
break;
|
|
case "AppGetOrgEmpList":
|
|
returnstr = AppGetOrgEmpList(context);
|
|
break;
|
|
case "AppGetOrgCarList":
|
|
returnstr = AppGetOrgCarList(context);
|
|
break;
|
|
case "AppGetToleranceSta":
|
|
returnstr = AppGetToleranceSta(context);
|
|
break;
|
|
case "AppGetToleranceStaList":
|
|
returnstr = AppGetToleranceStaList(context);
|
|
break;
|
|
case "AppCountLeave":
|
|
returnstr = AppCountLeave(context);
|
|
break;
|
|
case "AppGetOrgLeaveList":
|
|
returnstr = AppGetOrgLeaveList(context);
|
|
break;
|
|
case "AppGetCarApplyListByOrgId":
|
|
returnstr = AppGetCarApplyListByOrgId(context);
|
|
break;
|
|
case "AppCountCarApply":
|
|
returnstr = AppCountCarApply(context);
|
|
break;
|
|
case "AppGetOaAttendanceRecord":
|
|
returnstr = AppGetOaAttendanceRecord(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 流程相关接口
|
|
|
|
#region 获取待办数
|
|
//获取待办数
|
|
private string AppGetTaskWaitCountByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string useruid = context.Request.Params["useruid"];
|
|
string title = context.Request.Params["title"];
|
|
string flowid = context.Request.Params["flowid"];
|
|
string sender = context.Request.Params["sender"];
|
|
string date1 = context.Request.Params["date1"];
|
|
string date2 = context.Request.Params["date2"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
int pageIndex = 1;
|
|
int pageSize = 99999;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
List<RoadFlow.Data.Model.WorkFlowTask> taskList = bworkFlowTask.AppGetTasks
|
|
(useruid, pageIndex, pageSize, title, flowid, sender, date1, date2);
|
|
returnstr = "{\"code\":0,\"count\":" + taskList.Count + "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":0}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取待办列表
|
|
//获取待办列表
|
|
private string AppGetTaskWaitListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string useruid = context.Request.Params["useruid"];
|
|
string title = context.Request.Params["title"];
|
|
string flowid = context.Request.Params["flowid"];
|
|
string sender = context.Request.Params["sender"];
|
|
string date1 = context.Request.Params["date1"];
|
|
string date2 = context.Request.Params["date2"];
|
|
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); }
|
|
List<RoadFlow.Data.Model.WorkFlowTask> taskList = bworkFlowTask.AppGetTasks
|
|
(useruid, pageIndex, pageSize, title, flowid, sender, date1, date2);
|
|
taskList = bworkFlowTask.AppGetTasks(useruid,
|
|
pageIndex, pageSize, title, flowid, sender, date1, date2);
|
|
returnstr = "{\"code\":" + taskList.Count + ",\"msg\":\"\",\"taskList\":";
|
|
if (taskList.Count > 0)
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(taskList);
|
|
}
|
|
else
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
returnstr += ",\"newDate\":\"" + DateTime.Now.ToString() + "\"}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"taskList\":[],\"flowOptions\":\"\",\"pager\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取已办列表
|
|
//获取待办列表
|
|
private string AppGetTaskProcessedListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string useruid = context.Request.Params["useruid"];
|
|
string title = context.Request.Params["title"];
|
|
string flowid = context.Request.Params["flowid"];
|
|
string sender = context.Request.Params["sender"];
|
|
string date1 = context.Request.Params["date1"];
|
|
string date2 = context.Request.Params["date2"];
|
|
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); }
|
|
List<RoadFlow.Data.Model.WorkFlowTask> taskList = bworkFlowTask.AppGetTasks
|
|
(useruid, pageIndex, pageSize, title, flowid, sender, date1, date2);
|
|
taskList = bworkFlowTask.AppGetTasks(useruid,
|
|
pageIndex, pageSize, title, flowid, sender, date1, date2, 1);
|
|
returnstr = "{\"code\":" + taskList.Count + ",\"msg\":\"\",\"taskList\":";
|
|
if (taskList.Count > 0)
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(taskList);
|
|
}
|
|
else
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"taskList\":[],\"flowOptions\":\"\",\"pager\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 请假申请
|
|
|
|
//请假申请
|
|
private string AppLeaveTaskApply(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//请假表单字段
|
|
string leaveId = context.Request.Params["leaveId"];
|
|
if (string.IsNullOrEmpty(leaveId))
|
|
{
|
|
flag = true;
|
|
leaveId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string pplId = context.Request.Params["pplId"];
|
|
string pplName = context.Request.Params["pplName"];
|
|
string lType = context.Request.Params["lType"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string lNum = context.Request.Params["lNum"];
|
|
string lOut = context.Request.Params["lOut"];
|
|
string accPplId = context.Request.Params["accId"];
|
|
string repPplId = context.Request.Params["repId"];
|
|
string lReason = context.Request.Params["reason"];
|
|
string title = context.Request.Params["title"];
|
|
|
|
FangYar.Model.OA_LEAVE leaveModel = new FangYar.Model.OA_LEAVE();
|
|
leaveModel.ID = leaveId;
|
|
leaveModel.PPL_ID = pplId;
|
|
leaveModel.PPL_NAME = pplName;
|
|
leaveModel.L_TYPE = lType;
|
|
leaveModel.S_TIME = sTime;
|
|
leaveModel.E_TIME = eTime;
|
|
leaveModel.L_NUM = lNum;
|
|
leaveModel.L_OUT = lOut;
|
|
leaveModel.ACC_PPL = accPplId;
|
|
leaveModel.REP_PPL = repPplId;
|
|
leaveModel.L_REASON = lReason;
|
|
leaveModel.TITLE = title;
|
|
leaveModel.STATE = "0";
|
|
leaveModel.IS_RETURN = "1";
|
|
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
FangYar.BLL.OA_LEAVE leaveBll = new FangYar.BLL.OA_LEAVE();
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("48b51077-4bc7-4807-bcc2-b33e8ef0f5b2");
|
|
if (flag)
|
|
{
|
|
leaveBll.Add(leaveModel);
|
|
|
|
execute.FlowID = "48b51077-4bc7-4807-bcc2-b33e8ef0f5b2".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = leaveModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(pplId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
leaveBll.Update(leaveModel);
|
|
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "请假申请", "[" + pplName + "]的请假申请,请查看!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取请假待办详情
|
|
//获取请假待办详情
|
|
private string AppGetTaskWaitLeaveItem(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string flowid = context.Request.Params["flowid"];
|
|
string stepid = context.Request.Params["stepid"];
|
|
string instanceid = context.Request.Params["instanceid"];
|
|
|
|
string status = context.Request.Params["status"];
|
|
if (status == "0")
|
|
{
|
|
//更新打开时间
|
|
Guid taskgid;
|
|
string taskid = context.Request.Params["taskid"];
|
|
taskid.IsGuid(out taskgid);
|
|
RoadFlow.Data.Model.WorkFlowTask task = bworkFlowTask.Get(taskgid);
|
|
|
|
//如果是执行,并且任务ID为GUID,则更新打开时间和状态,检查当前任务是否可以执行。
|
|
bworkFlowTask.UpdateOpenTime(taskgid, RoadFlow.Utility.DateTimeNew.Now, true);
|
|
}
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
|
|
Guid stepID;
|
|
if (!stepid.IsGuid(out stepID))
|
|
{
|
|
stepID = wfInstalled.FirstStepID;
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
RoadFlow.Data.Model.WorkFlowInstalledSub.Step currentStep = wfInstalled.Steps.ToList().Find(p => p.ID == stepID);
|
|
returnstr += ",\"buttons\":";
|
|
//按钮
|
|
List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button> buttons = new List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button>();
|
|
foreach (var button in currentStep.Buttons)
|
|
{
|
|
buttons.Add(button);
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(buttons);
|
|
|
|
returnstr += ",\"leaveModel\":";
|
|
FangYar.BLL.OA_LEAVE leavebll = new FangYar.BLL.OA_LEAVE();
|
|
List<DataTable> data = leavebll.getLeave(instanceid);
|
|
if (data == null)
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"未查询到详情!\",\"buttons\":[],\"leaveModel\":\"\",\"commentData\":\"\"}";
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"commentData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"buttons\":[],\"leaveModel\":\"\",\"commentData\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 公差申请
|
|
//公差申请
|
|
private string AppToleranceTaskApply(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//请假表单字段
|
|
string toleranceId = context.Request.Params["toleranceId"];
|
|
if (string.IsNullOrEmpty(toleranceId))
|
|
{
|
|
flag = true;
|
|
toleranceId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string pplId = context.Request.Params["pplId"];
|
|
string pplName = context.Request.Params["pplName"];
|
|
string lType = context.Request.Params["lType"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string lNum = context.Request.Params["lNum"];
|
|
string lOut = context.Request.Params["lOut"];
|
|
string accPplId = context.Request.Params["accId"];
|
|
string repPplId = context.Request.Params["repId"];
|
|
string lReason = context.Request.Params["reason"];
|
|
string title = context.Request.Params["title"];
|
|
string carNum = context.Request.Params["carNum"];
|
|
|
|
FangYar.Model.OA.OA_TOLERANCE toleranceModel = new FangYar.Model.OA.OA_TOLERANCE();
|
|
toleranceModel.ID = toleranceId;
|
|
toleranceModel.PPL_ID = pplId;
|
|
toleranceModel.PPL_NAME = pplName;
|
|
toleranceModel.L_TYPE = lType;
|
|
toleranceModel.S_TIME = sTime;
|
|
toleranceModel.E_TIME = eTime;
|
|
toleranceModel.L_NUM = lNum;
|
|
toleranceModel.L_OUT = lOut;
|
|
toleranceModel.ACC_PPL = accPplId;
|
|
toleranceModel.REP_PPL = repPplId;
|
|
toleranceModel.L_REASON = lReason;
|
|
toleranceModel.TITLE = title;
|
|
toleranceModel.STATE = "0";
|
|
toleranceModel.CAR_NUM = carNum;
|
|
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
FangYar.BLL.OA.OA_TOLERANCE toleranceBll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("37337d05-251a-459d-8c5e-b545b8593f9c");
|
|
if (flag)
|
|
{
|
|
toleranceBll.Add(toleranceModel);
|
|
|
|
execute.FlowID = "37337d05-251a-459d-8c5e-b545b8593f9c".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = toleranceModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(pplId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
toleranceBll.Update(toleranceModel);
|
|
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "公差申请", "[" + pplName + "]的公差申请,请查看!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取公差待办详情
|
|
|
|
//获取公差待办详情
|
|
private string AppGetTaskWaitToleranceItem(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string flowid = context.Request.Params["flowid"];
|
|
string stepid = context.Request.Params["stepid"];
|
|
string instanceid = context.Request.Params["instanceid"];
|
|
|
|
string status = context.Request.Params["status"];
|
|
if (status == "0")
|
|
{
|
|
//更新打开时间
|
|
Guid taskgid;
|
|
string taskid = context.Request.Params["taskid"];
|
|
taskid.IsGuid(out taskgid);
|
|
RoadFlow.Data.Model.WorkFlowTask task = bworkFlowTask.Get(taskgid);
|
|
|
|
//如果是执行,并且任务ID为GUID,则更新打开时间和状态,检查当前任务是否可以执行。
|
|
bworkFlowTask.UpdateOpenTime(taskgid, RoadFlow.Utility.DateTimeNew.Now, true);
|
|
}
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
|
|
Guid stepID;
|
|
if (!stepid.IsGuid(out stepID))
|
|
{
|
|
stepID = wfInstalled.FirstStepID;
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
RoadFlow.Data.Model.WorkFlowInstalledSub.Step currentStep = wfInstalled.Steps.ToList().Find(p => p.ID == stepID);
|
|
returnstr += ",\"buttons\":";
|
|
//按钮
|
|
List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button> buttons = new List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button>();
|
|
foreach (var button in currentStep.Buttons)
|
|
{
|
|
buttons.Add(button);
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(buttons);
|
|
|
|
returnstr += ",\"toleranceModel\":";
|
|
FangYar.BLL.OA.OA_TOLERANCE tolerancebll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
List<DataTable> data = tolerancebll.getTolerance(instanceid);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"commentData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"buttons\":[],\"toleranceModel\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 用车申请
|
|
//用车申请
|
|
private string AppCarTaskApply(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//用车表单字段
|
|
string applyId = context.Request.Params["applyId"];
|
|
if (string.IsNullOrEmpty(applyId))
|
|
{
|
|
flag = true;
|
|
applyId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string userId = context.Request.Params["userId"];
|
|
string userName = context.Request.Params["userName"];
|
|
string userPhone = context.Request.Params["userPhone"];
|
|
string carId = context.Request.Params["carId"];
|
|
string carNum = context.Request.Params["carNum"];
|
|
string userMan = context.Request.Params["userMan"];
|
|
string rideNum = context.Request.Params["rideNum"];
|
|
string rideMan = context.Request.Params["rideMan"];
|
|
string ridePurpose = context.Request.Params["ridePurpose"];
|
|
string startPoint = context.Request.Params["startPoint"];
|
|
string endPoint = context.Request.Params["endPoint"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
string title = context.Request.Params["title"];
|
|
|
|
FangYar.Model.TBL_SYS_CARAPPLY carModel = new FangYar.Model.TBL_SYS_CARAPPLY();
|
|
carModel.ID = applyId;
|
|
carModel.USERID = userId;
|
|
carModel.USERNAME = userName;
|
|
carModel.USERPHONE = userPhone;
|
|
carModel.CARID = carId;
|
|
carModel.CARNUM = carNum;
|
|
carModel.USERMAN = userMan;
|
|
if (!string.IsNullOrEmpty(rideNum))
|
|
{
|
|
carModel.RIDENUM = Int32.Parse(rideNum);
|
|
}
|
|
else
|
|
{
|
|
carModel.RIDENUM = 1;
|
|
}
|
|
carModel.RIDEMANS = rideMan;
|
|
carModel.RIDEPURPOSE = ridePurpose;
|
|
carModel.STARTPOINT = startPoint;
|
|
carModel.DESTINATION = endPoint;
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
carModel.STARTTIME = DateTime.Parse(startTime);
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
carModel.FINISHTIME = DateTime.Parse(endTime);
|
|
}
|
|
carModel.STATE = "0";
|
|
carModel.EXTENDCODE2 = "1";
|
|
carModel.TITLE = title;
|
|
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("c6533642-dc36-4728-aac7-81e6989f6105");
|
|
if (flag)
|
|
{
|
|
carBll.Add(carModel);
|
|
|
|
execute.FlowID = "c6533642-dc36-4728-aac7-81e6989f6105".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = carModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(userId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
carBll.Update(carModel);
|
|
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "用车申请", "[" + userName + "]的用车申请,请查看!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取用车待办详情
|
|
//获取用车待办详情
|
|
private string AppGetTaskWaitCarItem(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string flowid = context.Request.Params["flowid"];
|
|
string stepid = context.Request.Params["stepid"];
|
|
string instanceid = context.Request.Params["instanceid"];
|
|
|
|
string status = context.Request.Params["status"];
|
|
if (status == "0")
|
|
{
|
|
//更新打开时间
|
|
Guid taskgid;
|
|
string taskid = context.Request.Params["taskid"];
|
|
taskid.IsGuid(out taskgid);
|
|
RoadFlow.Data.Model.WorkFlowTask task = bworkFlowTask.Get(taskgid);
|
|
|
|
//如果是执行,并且任务ID为GUID,则更新打开时间和状态,检查当前任务是否可以执行。
|
|
bworkFlowTask.UpdateOpenTime(taskgid, RoadFlow.Utility.DateTimeNew.Now, true);
|
|
}
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
|
|
Guid stepID;
|
|
if (!stepid.IsGuid(out stepID))
|
|
{
|
|
stepID = wfInstalled.FirstStepID;
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
RoadFlow.Data.Model.WorkFlowInstalledSub.Step currentStep = wfInstalled.Steps.ToList().Find(p => p.ID == stepID);
|
|
returnstr += ",\"buttons\":";
|
|
//按钮
|
|
List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button> buttons = new List<RoadFlow.Data.Model.WorkFlowInstalledSub.StepSet.Button>();
|
|
foreach (var button in currentStep.Buttons)
|
|
{
|
|
buttons.Add(button);
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(buttons);
|
|
|
|
returnstr += ",\"carModel\":";
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carbll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
List<DataTable> data = carbll.getCarApply(instanceid);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"commentData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"buttons\":[],\"carModel\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 请假流程处理
|
|
//请假流程处理
|
|
private string AppLeaveTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
string EXTEND = context.Request.Params["EXTEND"];//延假小时
|
|
string isEXTEND = context.Request.Params["isEXTEND"];//是否为延假 0销假;1延假
|
|
|
|
if (isEXTEND == "1")
|
|
{
|
|
FangYar.BLL.OA_LEAVE ldal = new FangYar.BLL.OA_LEAVE();
|
|
FangYar.Model.OA_LEAVE lmodel = ldal.GetModel(instanceid);
|
|
lmodel.EXTEND = EXTEND;
|
|
ldal.Update(lmodel);
|
|
}
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.OA_LEAVE leavebll = new FangYar.BLL.OA_LEAVE();
|
|
FangYar.Model.OA_LEAVE leaveModel = leavebll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
leavebll.EditState(instanceid, "1");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
leavebll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.Model.TBL.TBL_SYS_EMP_Model emodel = new FangYar.Model.TBL.TBL_SYS_EMP_Model();
|
|
emodel.USERS_UID = leaveModel.PPL_ID;
|
|
emodel.IS_WORK = "1";
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
var accUsers = leaveModel.ACC_PPL.Split(',');
|
|
foreach (string uid in accUsers)
|
|
{
|
|
emodel.USERS_UID = uid.Replace("u_", "");
|
|
empbll.EditEmpIswork(emodel);
|
|
}
|
|
}
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
int backType = currentStep.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
for (int i = 0; i < nextSteps.Count; i++)
|
|
{
|
|
if (isEXTEND == "0")
|
|
{
|
|
if (nextSteps[i].ID == "5899f4f3-44ed-4235-9241-3e8ce0c84aec".ToGuid())
|
|
{
|
|
execute.Steps.Add(nextSteps[i].ID, borganize.GetAllUsersIdString(receiveId));
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
break;
|
|
}
|
|
}
|
|
else if (isEXTEND == "1")
|
|
{
|
|
if (nextSteps[i].ID == "50067d16-19cf-439f-9b63-662ba04566ab".ToGuid())
|
|
{
|
|
execute.Steps.Add(nextSteps[i].ID, borganize.GetAllUsersIdString(receiveId));
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
foreach (var step in steps)
|
|
{
|
|
//步骤提交后事件
|
|
if (!step.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(step.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!step.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(step.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
}
|
|
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "请销假审批", "您有一条[请销假]待办审批反馈,状态:" + comment.Trim() + "!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 公差流程处理
|
|
//公差流程处理
|
|
private string AppToleranceTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.OA.OA_TOLERANCE tolerancebll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
FangYar.Model.OA.OA_TOLERANCE toleranceModel = tolerancebll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
tolerancebll.EditState(instanceid, "1");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
tolerancebll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.Model.TBL.TBL_SYS_EMP_Model emodel = new FangYar.Model.TBL.TBL_SYS_EMP_Model();
|
|
emodel.USERS_UID = toleranceModel.PPL_ID;
|
|
emodel.IS_WORK = "1";
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
var accUsers = toleranceModel.ACC_PPL.Split(',');
|
|
foreach (string uid in accUsers)
|
|
{
|
|
emodel.USERS_UID = uid.Replace("u_", "");
|
|
empbll.EditEmpIswork(emodel);
|
|
}
|
|
}
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
var steps2 = wfInstalled.Steps.Where(p => p.ID == stepid.ToGuid());
|
|
var currentStep2 = steps2.First();
|
|
int backType = currentStep2.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "审批", "您有一条[公差]待办审批反馈,状态:" + comment.Trim() + "!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 用车流程处理
|
|
//用车流程处理
|
|
private string AppCarTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
FangYar.Model.TBL_SYS_CARAPPLY carModel = carBll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
carBll.EditState(instanceid, "1");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
carBll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.Model.TBL.TBL_SYS_EMP_Model emodel = new FangYar.Model.TBL.TBL_SYS_EMP_Model();
|
|
emodel.USERS_UID = carModel.USERID;
|
|
emodel.IS_WORK = "1";
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
emodel.USERS_UID = carModel.USERMAN;
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
var accUsers = carModel.RIDEMANS.Split(',');
|
|
foreach (string uid in accUsers)
|
|
{
|
|
emodel.USERS_UID = uid.Replace("u_", "");
|
|
empbll.EditEmpIswork(emodel);
|
|
}
|
|
|
|
//还车通过后修改车辆的状态
|
|
FangYar.BLL.TBL_SYS_CAR carbll = new BLL.TBL_SYS_CAR();
|
|
FangYar.Model.TBL_SYS_CAR carmodel = carbll.GetModel(carModel.CARID);
|
|
if (carmodel != null)
|
|
{
|
|
carmodel.ISAPPLY = "0";
|
|
}
|
|
carbll.EditCarIsapply(carmodel);
|
|
|
|
}
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
var steps2 = wfInstalled.Steps.Where(p => p.ID == stepid.ToGuid());
|
|
var currentStep2 = steps2.First();
|
|
int backType = currentStep2.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
//app推送消息
|
|
try
|
|
{
|
|
FangYar.FYMQTT.MessagePush mp = new FYMQTT.MessagePush();
|
|
mp.AloneMsgPush(receiveId, "用车审批", "您有一条[用车]待办审批反馈,状态:" + comment.Trim() + "!");
|
|
}
|
|
catch (Exception e) { }
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 根据机构ID获取下属所有部门、人员
|
|
//根据机构ID获取下属所有部门、人员
|
|
private string AppGetOrgDeptEmpTreeByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
|
|
DataTable dt = orgBll.GetSuperiorOrgListTreeByOrgId(orgId);
|
|
if (dt != null)
|
|
{
|
|
string[] org_ids = dt.Rows[0]["ORG_IDS"].ToString().Split(',');
|
|
string orgIds = "";
|
|
for (int i = 0; i < org_ids.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
orgIds = "'" + org_ids[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
orgIds += ",'" + org_ids[i] + "'";
|
|
}
|
|
}
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgIds(orgIds);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
else
|
|
{
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgId(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据机构ID获取上级所有机构、部门、人员
|
|
private string AppGetOrgDeptEmpTreeByOrgId2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
|
|
DataTable dt = orgBll.GetSuperiorOrgListTreeByOrgId(orgId);
|
|
if (dt != null)
|
|
{
|
|
string[] org_ids = dt.Rows[0]["ORG_IDS"].ToString().Split(',');
|
|
string orgIds = "";
|
|
for (int i = 0; i < org_ids.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
orgIds = "'" + org_ids[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
orgIds += ",'" + org_ids[i] + "'";
|
|
}
|
|
}
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgIds(orgIds);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
else
|
|
{
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgId(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
//根据机构ID获取下属所有机构、部门、人员
|
|
private string AppGetOrgDeptEmpTreeByOrgId3(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
|
|
DataTable dt = orgBll.GetSubordinateOrgListTreeByOrgId(orgId);
|
|
if (dt != null)
|
|
{
|
|
string[] org_ids = dt.Rows[0]["ORG_IDS"].ToString().Split(',');
|
|
string orgIds = "";
|
|
for (int i = 0; i < org_ids.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
orgIds = "'" + org_ids[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
orgIds += ",'" + org_ids[i] + "'";
|
|
}
|
|
}
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgIds(orgIds);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
else
|
|
{
|
|
DataTable data = empBll.getOrgDeptEmpTreeByOrgId(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 根据机构ID获取下属所有部门、车辆
|
|
//根据机构ID获取下属所有部门、车辆
|
|
private string AppGetOrgDeptCarTreeByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
BLL.TBL_SYS_CAR bll = new BLL.TBL_SYS_CAR();
|
|
string orgId = context.Request.Params["OrgId"];
|
|
string type = context.Request.Params["type"];
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataTable data = null;
|
|
if (string.IsNullOrEmpty(type))
|
|
{
|
|
data = bll.GetListCarTree(orgId).Tables[0];
|
|
}
|
|
else
|
|
{
|
|
data = bll.GetListCarTree(orgId, type).Tables[0];
|
|
}
|
|
data.Columns.Add("nocheck", typeof(string)); //数据类型为文本
|
|
for (int i = 0; i < data.Rows.Count; i++)
|
|
{
|
|
string aaa = data.Rows[i]["TYPE"].ToString();
|
|
if (data.Rows[i]["TYPE"].ToString() == "car")
|
|
{
|
|
data.Rows[i]["nocheck"] = "false";
|
|
}
|
|
else
|
|
{
|
|
data.Rows[i]["nocheck"] = "true";
|
|
}
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 请假类型列表
|
|
//请假类型列表
|
|
private string AppGetLeaveTypeList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
RoadFlow.Platform.Dictionary dicBll = new RoadFlow.Platform.Dictionary();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
List<RoadFlow.Data.Model.Dictionary> data = dicBll.GetChilds("e7f836be-f091-460f-86e1-f0b6cdceba39".ToGuid());
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 公差类型列表
|
|
//公差类型列表
|
|
private string AppGetToleranceTypeList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
RoadFlow.Platform.Dictionary dicBll = new RoadFlow.Platform.Dictionary();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
List<RoadFlow.Data.Model.Dictionary> data = dicBll.GetChilds("e420e6ab-acb3-4de2-a316-d9a67ca76e69".ToGuid());
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#endregion 流程相关接口
|
|
|
|
#region 请假记录列表
|
|
|
|
//请假记录列表
|
|
private string AppGetLeaveListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string uid = context.Request.Params["uid"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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); }
|
|
FangYar.BLL.OA_LEAVE leaveBll = new FangYar.BLL.OA_LEAVE();
|
|
|
|
string where = null;
|
|
where = "(PPL_ID = '" + uid + "' or PPL_ID = 'u_" + uid + "') ";
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (L_OUT like '" + keyword + "' or L_REASON like '" + keyword + "') ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = leaveBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA_LEAVE> list = leaveBll.QueryList(pageIndex, pageSize, where, " s_time desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += ",\"newDate\":\"" + DateTime.Now.ToString() + "\"}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取请假信息、流转记录
|
|
|
|
//获取请假信息、流转记录
|
|
private string AppGetLeaveModelByLeaveId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string leaveId = context.Request.Params["leaveId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"leaveData\":";
|
|
FangYar.BLL.OA_LEAVE leaveBll = new FangYar.BLL.OA_LEAVE();
|
|
List<DataTable> data = leaveBll.getLeave(leaveId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"waitData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"leaveData\":[],\"waitData\":[] }";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 公差记录列表
|
|
|
|
//个人公差记录列表
|
|
private string AppGetToleranceListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string uid = context.Request.Params["uid"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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); }
|
|
FangYar.BLL.OA.OA_TOLERANCE toleranceBll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
|
|
string where = null;
|
|
where = "(PPL_ID = '" + uid + "' or PPL_ID = 'u_" + uid + "') ";
|
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (PPL_NAME like '%" + keyword + "%' TITLE like '%" + keyword + "%' L_OUT like '%" + keyword + "' or L_REASON like '%" + keyword + "%') ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = toleranceBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA.OA_TOLERANCE> list = toleranceBll.QueryList(pageIndex, pageSize, where, " s_time desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//本单位公差记录列表
|
|
private string AppGetToleranceListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["orgid"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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); }
|
|
FangYar.BLL.OA.OA_TOLERANCE toleranceBll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
|
|
string where = null;
|
|
where = " PPL_ID in ( select USERS_UID from TBL_SYS_EMP where IS_ADMIN='0' and org_id ='" + OrgId + "' ) ";
|
|
|
|
//where = " ORG_ID = '" + OrgId + "'";
|
|
//where = "(PPL_ID = '" + uid + "' or PPL_ID = 'u_" + uid + "') ";
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (PPL_NAME like '%" + keyword + "%' or TITLE like '%" + keyword + "%' or L_OUT like '%" + keyword + "' or L_REASON like '%" + keyword + "%') ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = toleranceBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA.OA_TOLERANCE> list = toleranceBll.QueryList(pageIndex, pageSize, where, " s_time desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取公差信息、流转记录
|
|
|
|
//获取公差信息、流转记录
|
|
private string AppGetToleranceModelByToleranceId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string toleranceId = context.Request.Params["toleranceId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"toleranceData\":";
|
|
FangYar.BLL.OA.OA_TOLERANCE toleranceBll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
List<DataTable> data = toleranceBll.getTolerance(toleranceId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"waitData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"toleranceData\":[],\"waitData\":[] }";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 人员报警列表查询
|
|
|
|
//人员报警列表查询
|
|
private string AppGetAlarmEmpListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_ALARMDATA alarmBll = new FangYar.BLL.TBL_ALARMDATA();
|
|
|
|
string OrgId = context.Request.Params["orgId"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string type = context.Request.Params["type"];
|
|
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 = " ALARM_TYPE='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(sTime))
|
|
{
|
|
where += " and TIME >= date_format('" + sTime + "','%Y-%m-%d')";
|
|
}
|
|
if (!string.IsNullOrEmpty(eTime))
|
|
{
|
|
where += " and TIME <= date_format('" + eTime + "','%Y-%m-%d')";
|
|
}
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
where += " and EXTENDCODE1 = '" + type + "'";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = alarmBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = alarmBll.GetListByPage(where, " TIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 车辆报警列表查询
|
|
|
|
//车辆报警列表查询
|
|
private string AppGetAlarmCarListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_ALARMDATA alarmBll = new FangYar.BLL.TBL_ALARMDATA();
|
|
|
|
string OrgId = context.Request.Params["orgId"];
|
|
string keywords = context.Request.Params["keywords"];
|
|
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 = " ALARM_TYPE='2' ";
|
|
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_NUM like '%" + keywords + "%'";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = alarmBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = alarmBll.GetListByPage(where, " TIME desc ", (pageIndex - 1) * pageSize, pageSize).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 访客登记列表
|
|
|
|
//访客登记列表
|
|
private string AppGetVisitorRegListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string userId = context.Request.Params["userId"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string state = context.Request.Params["state"];
|
|
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 + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(userId))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " VED_ID ='" + userId + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(sTime))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " date_format(APPROVALTIME,'%Y-%m-%d %H:%i:%s') >= date_format('" + sTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
if (!string.IsNullOrEmpty(eTime))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " date_format(APPROVALTIME,'%Y-%m-%d %H:%i:%s') <= date_format('" + eTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " name like '%" + keyword + "%' ";
|
|
}
|
|
FangYar.BLL.OA.TBL_VISITOR_REG visBll = new FangYar.BLL.OA.TBL_VISITOR_REG();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = visBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA.TBL_VISITOR_REG> list = visBll.QueryList(pageIndex, pageSize, where, " REGISTERTIME desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 访客登记单处理
|
|
|
|
//访客登记单处理
|
|
private string AppVisitorRegHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string visId = context.Request.Params["visId"];
|
|
string state = context.Request.Params["state"];
|
|
string feedbackinfo = context.Request.Params["feedbackinfo"];
|
|
FangYar.BLL.OA.TBL_VISITOR_REG visBll = new FangYar.BLL.OA.TBL_VISITOR_REG();
|
|
FangYar.Model.OA.TBL_VISITOR_REG vrmodel = new FangYar.Model.OA.TBL_VISITOR_REG();
|
|
vrmodel.ID = visId;
|
|
vrmodel.STATE = state;
|
|
if (feedbackinfo == "" || feedbackinfo == null)
|
|
{
|
|
if (state == "1")
|
|
{
|
|
feedbackinfo = "同意";
|
|
}
|
|
else if (state == "2")
|
|
{
|
|
feedbackinfo = "不同意";
|
|
}
|
|
}
|
|
vrmodel.FEEDBACKINFO = feedbackinfo;
|
|
if (visBll.editVisReg(vrmodel))
|
|
{
|
|
msg = "审批成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "审批失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "审批失败!";
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 用车记录列表
|
|
|
|
//用车记录列表
|
|
private string AppGetCarApplyListByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string uid = context.Request.Params["uid"];
|
|
string name = context.Request.Params["name"];
|
|
string phone = context.Request.Params["phone"];
|
|
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); }
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
|
|
string where = null;
|
|
where = "(USERID = '" + uid + "' or USERID = 'u_" + uid + "') ";
|
|
if (!string.IsNullOrEmpty(name))
|
|
{
|
|
where += " and USERNAME like '%" + name + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(phone))
|
|
{
|
|
where += " and USERPHONE like '%" + phone + "%' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(carNum))
|
|
{
|
|
where += " and CARNUM like '%" + carNum + "%' ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = carBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.TBL_SYS_CARAPPLY> list = carBll.QueryList(pageIndex, pageSize, where, " STARTTIME desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//删除审批失败的用车申请记录
|
|
private string AppDeleteCarApplyById(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string id = context.Request.Params["id"];
|
|
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
|
|
if (carBll.DeleteCarApplyById(id))
|
|
{
|
|
returnstr += "{\"code\":0,\"msg\":\"删除成功!\",\"count\":0,\"data\":[]}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"删除失败!\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取用车信息、流转记录
|
|
|
|
//获取用车信息、流转记录
|
|
private string AppGetCarApplyModelByCarApplyId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
string id = context.Request.Params["carApplyId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"applyData\":";
|
|
List<DataTable> data = carBll.getCarApply(id);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[0]);
|
|
returnstr += ",\"waitData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data[1]);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"toleranceData\":[],\"waitData\":[] }";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取访客一周数量趋势
|
|
|
|
//获取访客一周数量趋势
|
|
private string AppGetVisitorWeekByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_VISITOR visBll = new FangYar.BLL.TBL_VISITOR();
|
|
returnstr = "{\"code\":1,\"msg\":\"\",";
|
|
returnstr += "\"data\":";
|
|
string orgId = context.Request.Params["orgId"];
|
|
string where = "1=1";
|
|
where += " and (ORG_ID ='" + orgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + orgId + "') )";
|
|
returnstr += JsonConvert.SerializeObject(visBll.TotalDaysAlarm(7, where));
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取人员一周数量趋势
|
|
|
|
//获取人员一周数量趋势
|
|
private string AppGetPerAccWeekByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_PERSONACCESS perBll = new FangYar.BLL.TBL_PERSONACCESS();
|
|
returnstr = "{\"code\":1,\"msg\":\"\",";
|
|
returnstr += "\"data\":";
|
|
string orgId = context.Request.Params["orgId"];
|
|
string where = "1=1";
|
|
where += " and (ORG_ID ='" + orgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + orgId + "') )";
|
|
returnstr += JsonConvert.SerializeObject(perBll.TotalDaysAlarm(7, where));
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取车辆一周数量趋势
|
|
|
|
//获取车辆一周数量趋势
|
|
private string AppGetCarAccWeekByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_CARACCESS carBll = new BLL.TBL_CARACCESS();
|
|
string orgId = context.Request.Params["orgId"];
|
|
returnstr = "{\"code\":1,\"msg\":\"\"";
|
|
returnstr += ",\"InData\":";
|
|
string where = " INOROUT = '0' and (ORG_ID ='" + orgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + orgId + "') )";
|
|
returnstr += JsonConvert.SerializeObject(carBll.TotalDaysAlarm(7, where));
|
|
|
|
returnstr += ",\"OutData\":";
|
|
string where1 = " INOROUT = '1' and (ORG_ID ='" + orgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + orgId + "') )";
|
|
returnstr += JsonConvert.SerializeObject(carBll.TotalDaysAlarm(7, where1));
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取可用车辆列表
|
|
|
|
//获取可用车辆列表
|
|
private string AppGetCarNumListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.TBL_SYS_CAR carBll = new FangYar.BLL.TBL_SYS_CAR();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataTable data = carBll.getCarNumListByOrgId(orgId);
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 岗哨交接
|
|
|
|
//根据orgid获取岗哨记录
|
|
private string AppGetShiftsListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string orgId = context.Request.Params["orgId"];
|
|
string ifid = context.Request.Params["ifid"];
|
|
string state = context.Request.Params["state"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
|
|
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 = "";
|
|
if (!string.IsNullOrEmpty(orgId))
|
|
{
|
|
where += " ORG_ID ='" + orgId + "'";
|
|
}
|
|
else
|
|
{
|
|
return returnstr = "{\"code\":0,\"msg\":\"未查询到机构下数据\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(ifid))
|
|
{
|
|
where += " and EXTENDCODE3='" + ifid + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(state))
|
|
{
|
|
where += " and TO_STATE='" + state + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (O_NAME like '%" + keyword + "%' or T_NAME like '%" + keyword + "%')";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = shiftsBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.FIRE.FIRE_SHIFTS> list = shiftsBll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据uid获取上岗任务
|
|
private string AppGetShiftsListByUserUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string uid = context.Request.Params["uid"];
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataTable dt = shiftsBll.getShiftsListByState(uid, "0", "O_DATE");
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据uid获取历史上岗记录
|
|
private string AppGetShiftsHistoryListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string uid = context.Request.Params["uid"];
|
|
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 = " instr(',' || O_UID || ',',',' || '" + uid + "' || ',')<> 0 and TO_STATE in (1,2,3) ";
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = shiftsBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by o_date desc";
|
|
List<FangYar.Model.FIRE.FIRE_SHIFTS> list = shiftsBll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据条件判断是否允许上岗,返回当前在岗人信息
|
|
private string AppGetShiftsIsDutyByIFID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string id = context.Request.Params["id"];
|
|
string ifid = context.Request.Params["ifid"];
|
|
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model = shiftsBll.GetModel(id);
|
|
if (model == null) { return "{\"code\":-1,\"msg\":\"未查询到该任务\"}"; }
|
|
|
|
System.DateTime oDate = Convert.ToDateTime(model.O_DATE.ToString());
|
|
System.DateTime startTime = oDate.AddMinutes(-20);
|
|
System.DateTime endTime = oDate.AddMinutes(+15);
|
|
System.DateTime newTime = System.DateTime.Now;
|
|
|
|
if (ifid == model.EXTENDCODE3)
|
|
{
|
|
if (startTime <= newTime && endTime >= newTime)
|
|
{
|
|
returnstr = "{\"code\":0,\"data\":";
|
|
DataTable dt = shiftsBll.getPreviousShiftsModel(ifid, model.O_DATE.ToString(), model.T_DATE.ToString());
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += ",\"isDuty\":0}";
|
|
}
|
|
else if (endTime < newTime && model.T_DATE > newTime)
|
|
{
|
|
returnstr = "{\"code\":0,\"data\":";
|
|
DataTable dt = shiftsBll.getPreviousShiftsModel(ifid, model.O_DATE.ToString(), model.T_DATE.ToString());
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += ",\"isDuty\":1}";
|
|
}
|
|
else if (model.T_DATE < newTime)
|
|
{
|
|
returnstr = "{\"code\":-3,\"msg\":\"您已缺岗,请返回任务填写缺岗理由!\"}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-4,\"msg\":\"还未到上岗时间,无法上岗!\"}";
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-2,\"msg\":\"信息不匹配无法上岗!\"}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//修改交接岗位状态
|
|
private string AppUpdateShiftsByID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string id = context.Request.Params["id"];
|
|
string tName = context.Request.Params["tName"];
|
|
string toWork = context.Request.Params["toWork"];
|
|
string upid = context.Request.Params["upid"];
|
|
string uid = context.Request.Params["uid"];
|
|
string uName = context.Request.Params["uname"];
|
|
|
|
System.DateTime toDate = System.DateTime.Now;
|
|
System.DateTime time = toDate.AddMinutes(-15);
|
|
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model = shiftsBll.GetModel(id);
|
|
if (model == null) { return "{\"code\":-1,\"msg\":\"未查询到该任务\"}"; }
|
|
if (model.EXTENDCODE5 == "" || model.EXTENDCODE5 == null)
|
|
{
|
|
model.EXTENDCODE5 = uid;
|
|
}
|
|
else
|
|
{
|
|
model.EXTENDCODE5 += "," + uid;
|
|
}
|
|
ArrayList oUids = new ArrayList(model.O_UID.Split(','));
|
|
ArrayList EXTENDCODE4s = new ArrayList(model.EXTENDCODE5.Split(','));
|
|
for (int i = 0; i < oUids.Count; i++)
|
|
{
|
|
for (int y = 0; y < EXTENDCODE4s.Count; y++)
|
|
{
|
|
var a = oUids[i].ToString();
|
|
var b = EXTENDCODE4s[y].ToString();
|
|
if (oUids[i].ToString() == EXTENDCODE4s[y].ToString())
|
|
{
|
|
oUids.RemoveAt(i);
|
|
}
|
|
}
|
|
}
|
|
if (String.IsNullOrEmpty(model.TO_WORK))
|
|
{
|
|
model.TO_WORK = uName + ":" + toWork;
|
|
}
|
|
else
|
|
{
|
|
model.TO_WORK += "<br />" + uName + ":" + toWork;
|
|
}
|
|
|
|
if (String.IsNullOrEmpty(model.T_NAME))
|
|
{
|
|
model.T_NAME = tName;
|
|
}
|
|
else
|
|
{
|
|
model.T_NAME += "," + tName;
|
|
}
|
|
|
|
if (String.IsNullOrEmpty(model.TO_PHOTO))
|
|
{
|
|
model.TO_PHOTO = AddPhotoWatermark("FireShifts", context, "U_" + id);
|
|
}
|
|
else
|
|
{
|
|
model.TO_PHOTO += "," + AddPhotoWatermark("FireShifts", context, "U_" + id);
|
|
}
|
|
|
|
if (oUids.Count == 0)
|
|
{
|
|
model.T_NAME = tName;
|
|
model.TO_DATE = toDate;
|
|
if (time < model.O_DATE)
|
|
{
|
|
model.TO_STATE = "2";
|
|
}
|
|
else
|
|
{
|
|
model.TO_STATE = "1";
|
|
}
|
|
}
|
|
if (upid != null && upid != "")
|
|
{
|
|
if (upid.Contains(","))
|
|
{
|
|
string[] upids = upid.Split(',');
|
|
for (int i = 0; i < upids.Length; i++)
|
|
{
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model2 = shiftsBll.GetModel(upids[i]);
|
|
model2.TO_TIME = toDate.ToString();
|
|
shiftsBll.Update(model2);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model2 = shiftsBll.GetModel(upid);
|
|
model2.TO_TIME = toDate.ToString();
|
|
shiftsBll.Update(model2);
|
|
}
|
|
}
|
|
if (shiftsBll.Update(model))
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"交接成功!\"}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-2,\"msg\":\"交接失败!\"}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//修改缺岗(超期的)交接岗位状态
|
|
private string AppUpdateShiftsOverdueByID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string id = context.Request.Params["id"];
|
|
string tName = context.Request.Params["tName"];
|
|
string toWork = context.Request.Params["toWork"];
|
|
|
|
System.DateTime toDate = System.DateTime.Now;
|
|
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model = shiftsBll.GetModel(id);
|
|
model.T_NAME = tName;
|
|
model.TO_WORK = toWork;
|
|
model.TO_DATE = toDate;
|
|
model.TO_TIME = toDate.ToString();
|
|
model.TO_STATE = "3";
|
|
|
|
if (shiftsBll.Update(model))
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"已办结!\"}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-2,\"msg\":\"办结失败!\"}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据机构ID获取所有下级机构
|
|
private string AppGetOrgListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
FangYar.BLL.FIRE.FIRE_ORG bll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
List<FangYar.Model.FIRE.FIRE_ORG> data = bll.GetOrgListTreeByOrgId(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
|
|
}
|
|
|
|
//根据rfid获取当前在岗、下次上岗人信息
|
|
private string AppGetShiftsOnDutyByRFID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string rfid = context.Request.Params["ifid"];
|
|
string newTime = DateTime.Now.ToString();
|
|
|
|
returnstr = "{\"code\":0,\"onDuty\":";
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model = shiftsBll.GetModelByRfid(rfid, newTime);
|
|
if (model == null)
|
|
{
|
|
returnstr += "\"\"";
|
|
}
|
|
else
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(model);
|
|
}
|
|
returnstr += ",\"nextDuty\":";
|
|
FangYar.Model.FIRE.FIRE_SHIFTS model2 = shiftsBll.GetNextModelByRfid(rfid, newTime);
|
|
if (model2 == null)
|
|
{
|
|
returnstr += "\"\"";
|
|
}
|
|
else
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(model2);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"onDuty\":\"{}\",\"nextDuty\":\"{}\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据岗哨表ID替换上岗人信息
|
|
private string AppUpdateShiftsDutyByID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_SHIFTS shiftsBll = new FangYar.BLL.FIRE.FIRE_SHIFTS();
|
|
|
|
string id = context.Request.Params["id"];
|
|
string ifid = context.Request.Params["ifid"];
|
|
string olduid = context.Request.Params["olduid"];
|
|
string newuid = context.Request.Params["newuid"];
|
|
string oldname = context.Request.Params["oldname"];
|
|
string newname = context.Request.Params["newname"];
|
|
string oldfpr = context.Request.Params["oldfpr"];
|
|
string newfpr = context.Request.Params["newfpr"];
|
|
|
|
if (shiftsBll.UpdateDuty(id, olduid, newuid, oldname, newname, oldfpr, newfpr))
|
|
{
|
|
return AppGetShiftsIsDutyByIFID(context);
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-5,\"msg\":\"替班失败!\"}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion 岗哨交接
|
|
|
|
#region 安防报警
|
|
|
|
//根据机构ID、报警类型、时间、地点获取报警列表
|
|
private string AppGetAlarmDataListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL_ALARMDATA bll = new FangYar.BLL.TBL_ALARMDATA();
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string type = context.Request.Params["type"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
string addr = context.Request.Params["addr"];
|
|
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 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
|
|
{
|
|
return returnstr = "{\"code\":0,\"msg\":\"未查询到机构下数据\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
where += " and TYPE='" + type + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
where += " and time >= date_format('" + startTime + " 00:00:00','yyyy/mm/dd hh24:mi:ss')";
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
where += " and time <= date_format('" + endTime + " 23:59:59','yyyy/mm/dd hh24:mi:ss')";
|
|
}
|
|
if (!string.IsNullOrEmpty(addr))
|
|
{
|
|
where += " and ADDR like '%" + addr + "%' ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
string data = "[";
|
|
List<FangYar.Model.OA.TBL_ALARMDATA> list = bll.QueryList(pageIndex, pageSize, where, " time desc");
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
|
|
string pic1 = "";
|
|
if (list[i].PIC != null && list[i].PIC.ToString() != "")
|
|
{
|
|
pic1 = Convert.ToBase64String((byte[])list[i].PIC);
|
|
}
|
|
data += "{\"ID\":\"" + list[i].ID + "\",\"DVC_ID\":\"" + list[i].DVC_ID + "\",\"ORG_ID\":\"" + list[i].ORG_ID + "\",\"TYPE\":\"" + list[i].TYPE + "\",";
|
|
data += "\"TIME\":\"" + list[i].TIME + "\",\"ADDR\":\"" + list[i].ADDR + "\",";
|
|
data += "\"PICSRC\":\"" + list[i].PICSRC + "\",\"VALUE\":\"" + list[i].VALUE + "\",";
|
|
data += "\"PIC\":\"" + pic1 + "\"}";
|
|
if (i != list.Count - 1)
|
|
{
|
|
data += ",";
|
|
}
|
|
}
|
|
returnstr += data + "]";
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion 安防报警
|
|
|
|
#region 巡查巡检
|
|
|
|
//根据机构ID、巡查点类型、名称、地点 获取营区内巡查点列表
|
|
private string AppGetOaPatrolSpotListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.OA_PATROL_SPOT bll = new FangYar.BLL.OA_PATROL_SPOT();
|
|
string orgId = context.Request.Params["OrgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string EXTENDCODE1 = context.Request.Params["EXTENDCODE1"];
|
|
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;
|
|
where = "ORG_ID = '" + orgId + "' ";
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (NAME like '%" + keyword + "%' or ADDR like '%" + keyword + "%') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(EXTENDCODE1))
|
|
{
|
|
where += " and EXTENDCODE1 = '" + EXTENDCODE1 + "' ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.OA_PATROL_SPOT> list = bll.QueryList(pageIndex, pageSize, where, " CAST(SORT AS INTEGER)");
|
|
foreach (FangYar.Model.OA_PATROL_SPOT model in list)
|
|
{
|
|
JObject EXTENDCODE2_s = JsonConvert.DeserializeObject<JObject>(model.EXTENDCODE2);
|
|
string EXTENDCODE21 = "";
|
|
int EXTENDCODE21count = 0;
|
|
if (EXTENDCODE2_s != null)
|
|
{
|
|
foreach (JObject EXTENDCODE31obj in EXTENDCODE2_s.Value<JArray>("data"))
|
|
{
|
|
if (EXTENDCODE21count == 0)
|
|
{
|
|
EXTENDCODE21 = "" + EXTENDCODE31obj["ppl_Name"];
|
|
}
|
|
else
|
|
{
|
|
EXTENDCODE21 += "," + EXTENDCODE31obj["ppl_Name"];
|
|
}
|
|
EXTENDCODE21count++;
|
|
}
|
|
}
|
|
model.EXTENDCODE21 = EXTENDCODE21;
|
|
}
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据主键ID得到一个对象实体
|
|
private string AppGetOaPatrolSpotModelById(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.OA_PATROL_SPOT bll = new FangYar.BLL.OA_PATROL_SPOT();
|
|
string ID = context.Request.Params["ID"];
|
|
FangYar.Model.OA_PATROL_SPOT model = bll.GetModel(ID);
|
|
if (model == null)
|
|
{
|
|
returnstr = "{}";
|
|
}
|
|
else
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(model);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = null;
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//根据IFID(芯片编号)得到一个对象实体
|
|
private string AppGetOaPatrolSpotModelByRFID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.OA_PATROL_SPOT bll = new FangYar.BLL.OA_PATROL_SPOT();
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string RFID = context.Request.Params["RFID"];
|
|
FangYar.Model.OA_PATROL_SPOT model = bll.IFIDGetModel(ORG_ID, RFID);
|
|
if (model == null)
|
|
{
|
|
returnstr = "{}";
|
|
}
|
|
else
|
|
{
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(model);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = null;
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//添加营区内巡查点信息
|
|
private string AppAddOaPatrolSpotModel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
FangYar.BLL.OA_PATROL_SPOT bll = new FangYar.BLL.OA_PATROL_SPOT();
|
|
string spotId = Guid.NewGuid().ToString("N");
|
|
string orgId = context.Request.Params["ORG_ID"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string SPOT_NO = context.Request.Params["SPOT_NO"];
|
|
string POINT = context.Request.Params["POINT"];
|
|
string DES = context.Request.Params["DES"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
string EXTENDCODE1 = context.Request.Params["EXTENDCODE1"];
|
|
string EXTENDCODE2 = context.Request.Params["EXTENDCODE2"];
|
|
string SORT = context.Request.Params["SORT"];
|
|
|
|
//巡查点表
|
|
FangYar.Model.OA_PATROL_SPOT model = new Model.OA_PATROL_SPOT();
|
|
model.ID = spotId;
|
|
model.NAME = NAME;
|
|
model.SPOT_NO = SPOT_NO;
|
|
model.POINT = POINT;
|
|
model.DES = DES;
|
|
model.ADDR = ADDR;
|
|
model.ORG_ID = orgId;
|
|
model.STATE = STATE;
|
|
model.SORT = SORT;
|
|
model.EXTENDCODE1 = EXTENDCODE1;
|
|
model.EXTENDCODE2 = EXTENDCODE2;
|
|
model.PHOTO = UploadFile("OaPatrolSpot", context, spotId);
|
|
|
|
bool a = bll.ExistsSpotNo(SPOT_NO);
|
|
if (a == true)
|
|
{
|
|
msg = "对不起,该芯片编号已经存在";
|
|
}
|
|
else
|
|
{
|
|
if (bll.Add(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败!";
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
|
|
//修改营区内巡查点信息
|
|
private string AppEditOaPatrolSpotModel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
FangYar.BLL.OA_PATROL_SPOT bll = new FangYar.BLL.OA_PATROL_SPOT();
|
|
string ID = context.Request.Params["ID"];
|
|
string orgId = context.Request.Params["ORG_ID"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string SPOT_NO = context.Request.Params["SPOT_NO"];
|
|
string POINT = context.Request.Params["POINT"];
|
|
string DES = context.Request.Params["DES"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
string EXTENDCODE1 = context.Request.Params["EXTENDCODE1"];
|
|
string EXTENDCODE2 = context.Request.Params["EXTENDCODE2"];
|
|
string SORT = context.Request.Params["SORT"];
|
|
string oldimgs = context.Request.Params["oldimgs"];
|
|
|
|
//巡查点表
|
|
FangYar.Model.OA_PATROL_SPOT model = new Model.OA_PATROL_SPOT();
|
|
model.ID = ID;
|
|
model.NAME = NAME;
|
|
model.SPOT_NO = SPOT_NO;
|
|
model.POINT = POINT;
|
|
model.DES = DES;
|
|
model.ADDR = ADDR;
|
|
model.ORG_ID = orgId;
|
|
model.STATE = STATE;
|
|
model.SORT = SORT;
|
|
model.EXTENDCODE1 = EXTENDCODE1;
|
|
model.EXTENDCODE2 = EXTENDCODE2;
|
|
|
|
if (oldimgs == "")
|
|
{
|
|
model.PHOTO = UploadFile("OaPatrolSpot", context, Guid.NewGuid().ToString("N"));
|
|
}
|
|
else
|
|
{
|
|
string newimg = UploadFile("OaPatrolSpot", context, Guid.NewGuid().ToString("N"));
|
|
if (newimg == "")
|
|
{
|
|
model.PHOTO = oldimgs;
|
|
}
|
|
else
|
|
{
|
|
model.PHOTO = oldimgs + "," + newimg;
|
|
}
|
|
}
|
|
|
|
if (bll.Update(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
if (e.Message.ToString().IndexOf("违反唯一约束条件") > -1)
|
|
{
|
|
msg = "芯片编号重复!";
|
|
}
|
|
else
|
|
{
|
|
msg = "修改失败!";
|
|
}
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion 巡查巡检
|
|
|
|
#region 物资管理
|
|
|
|
//根据机构ID、名称、编号 获取消防装备列表
|
|
private string AppGetFireEpuipListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL ebll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.BLL.FIRE.FIRE_EPUIP bll = new FangYar.BLL.FIRE.FIRE_EPUIP();
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string isChildren = context.Request.Params["isChildren"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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 = "";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (!string.IsNullOrEmpty(isChildren))
|
|
{
|
|
if (isChildren == "false")
|
|
{
|
|
where = " org_id = '" + OrgId + "' ";
|
|
}
|
|
if (isChildren == "true")
|
|
{
|
|
where = " org_id in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(o.org_id,cids)) ";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
where = " org_id in ( select o.org_id from fire_org o,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(o.org_id,cids)) ";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":0,\"msg\":\"未查询到机构下数据\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " (NAME like '%" + keyword + "%' or code 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 AppAddFireEpuipModel(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_EPUIP bll = new FangYar.BLL.FIRE.FIRE_EPUIP();
|
|
string USER_ID = context.Request.Params["USER_ID"];
|
|
string ID = Guid.NewGuid().ToString("N");
|
|
string TYPE_ID = context.Request.Params["TYPE_ID"];
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string EQ_NUM = context.Request.Params["EQ_NUM"];
|
|
string SENSOR = context.Request.Params["SENSOR"];
|
|
string TRADEMARK = context.Request.Params["TRADEMARK"];
|
|
string GB_CODE = context.Request.Params["GB_CODE"];
|
|
string MANUFACTOR = context.Request.Params["MANUFACTOR"];
|
|
string LIABLE = context.Request.Params["LIABLE"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
|
|
//上传图片
|
|
string EXTENDCODE1 = UploadFile(context, ID);
|
|
|
|
//消防装备表
|
|
FangYar.Model.FIRE.FIRE_EPUIP model = new Model.FIRE.FIRE_EPUIP();
|
|
model.ID = ID;
|
|
model.TYPE_ID = TYPE_ID;
|
|
model.ORG_ID = ORG_ID;
|
|
if (!string.IsNullOrEmpty(EQ_NUM))
|
|
{
|
|
model.EQ_NUM = int.Parse(EQ_NUM);
|
|
}
|
|
else
|
|
{
|
|
model.EQ_NUM = 1;
|
|
}
|
|
model.SENSOR = SENSOR;
|
|
model.TRADEMARK = TRADEMARK;
|
|
model.GB_CODE = GB_CODE;
|
|
model.MANUFACTOR = MANUFACTOR;
|
|
model.LIABLE = LIABLE;
|
|
model.EXTENDCODE1 = EXTENDCODE1;
|
|
model.STATE = STATE;
|
|
model.A_PER = USER_ID;
|
|
|
|
if (bll.AddEpu(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch
|
|
{
|
|
msg = "添加失败:装备编码有重复数据";
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
#endregion 物资管理
|
|
|
|
#region App日常巡查角标提醒
|
|
|
|
|
|
#region 获取访客待审批数角标提醒
|
|
|
|
/// <summary>
|
|
/// 获取访客审批数角标提醒
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetVisitorApplySuperscript(HttpContext context)
|
|
{
|
|
|
|
string returnstr = "";
|
|
int count = 0;
|
|
try
|
|
{
|
|
//GetRecordCount
|
|
TBL_VISITOR_REG visitorReg = new TBL_VISITOR_REG();
|
|
string useruid = context.Request.Params["useruid"];
|
|
|
|
if (!String.IsNullOrWhiteSpace(useruid))
|
|
{
|
|
string where = string.Format(" 1=1 and state='0' and ved_id='{0}'", useruid);
|
|
count = visitorReg.GetRecordCount(where);
|
|
returnstr = "{\"code\":0,\"count\":" + count + ",\"msg\":\"" + "查询成功" + "\"}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":1,\"count\":" + count + ",\"msg\":\"" + "查询条件不能为空" + "\"}";
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取计划巡查数角标提醒
|
|
|
|
/// <summary>
|
|
/// 获取计划巡查数角标提醒
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetProjectPatrolSuperscript(HttpContext context)
|
|
{
|
|
OA_PATROL_TASK partolTaskBLL = new OA_PATROL_TASK();
|
|
string returnstr = "";
|
|
string userid = context.Request.Params["useruid"];
|
|
int count = 0;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(userid))
|
|
{
|
|
string where = string.Format(" 1=1 and state='0' and EMP_ID ='{0}'", userid);
|
|
count = partolTaskBLL.GetRecordCount(where);
|
|
returnstr = "{\"code\":0,\"count\":" + count + ",\"msg\":\"查询成功\"}";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":1,\"count\":" + count + ",\"msg\":\"查询条件不能为空\"}";
|
|
}
|
|
|
|
}
|
|
catch (Exception)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取隐患整改数角标提醒
|
|
|
|
/// <summary>
|
|
/// 获取隐患整改数角标提醒
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetRectifySecurityThreatSuperscript(HttpContext context)
|
|
{
|
|
|
|
|
|
OA_PATROL_DANGER patrolDangerBLL = new OA_PATROL_DANGER();
|
|
string returnstr = "";
|
|
string orgId = context.Request.Params["orgId"];
|
|
int count = 0;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(orgId))
|
|
{
|
|
string where = string.Format(" 1=1 and state='0' and ORG_ID ='{0}'", orgId);
|
|
count = patrolDangerBLL.GetRecordCount(where);
|
|
returnstr = "{\"code\":0,\"count\":" + count + ",\"msg\":\"查询成功\"}";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":1,\"count\":" + count + ",\"msg\":\"查询条件不能为空\"}";
|
|
}
|
|
|
|
}
|
|
catch (Exception)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
|
|
}
|
|
return returnstr;
|
|
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 查铺查哨数角标提醒
|
|
|
|
/// <summary>
|
|
/// 查铺查哨数角标提醒
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetSentryAndRestInspectSuperscript(HttpContext context)
|
|
{
|
|
|
|
|
|
OA_PATROLSENTRYTASK patrolSentryBLL = new OA_PATROLSENTRYTASK();
|
|
string returnstr = "";
|
|
string patrollerId = context.Request.Params["patrollerId"];
|
|
int count = 0;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(patrollerId))
|
|
{
|
|
string where = string.Format(" 1=1 and PATROLLERID ='{0}'", patrollerId);
|
|
count = patrolSentryBLL.GetRecordCount(where);
|
|
returnstr = "{\"code\":0,\"count\":" + count + ",\"msg\":\"查询成功\"}";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":1,\"count\":" + count + ",\"msg\":\"查询条件不能为空\"}";
|
|
}
|
|
|
|
}
|
|
catch (Exception)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
|
|
}
|
|
return returnstr;
|
|
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 上哨任务数角标提醒
|
|
/// <summary>
|
|
/// 上哨任务数角标提醒
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetBeOnSentrySuperscript(HttpContext context)
|
|
{
|
|
|
|
FIRE_SHIFTS fireShiftsBLL = new FIRE_SHIFTS();
|
|
string returnstr = "";
|
|
string uid = context.Request.Params["uid"];
|
|
int count = 0;
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(uid))
|
|
{
|
|
DataTable dt = fireShiftsBLL.getShiftsListByState(uid, "0", "O_DATE");
|
|
//string where = string.Format(" 1=1 and O_UID ='{0}'", uid);
|
|
//count = fireShiftsBLL.GetRecordCount(where);
|
|
returnstr = "{\"code\":0,\"count\":" + dt.Rows.Count + ",\"msg\":\"查询成功\"}";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":1,\"count\":" + count + ",\"msg\":\"查询条件不能为空\"}";
|
|
}
|
|
|
|
}
|
|
catch (Exception)
|
|
{
|
|
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
|
|
}
|
|
return returnstr;
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 获取本机和下级单位
|
|
/// <summary>
|
|
/// 获取本机和下级单位
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
public string AppGetOrgTree(HttpContext context)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataTable data = empbll.getOrgOnlyTree(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region 战训功能
|
|
/// <summary>
|
|
/// 查询当前机构下训练任务列表
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainTaskListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
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;
|
|
int startIndex = 0;
|
|
int endIndex = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
startIndex = (pageIndex - 1) * pageSize;
|
|
endIndex = pageSize;
|
|
|
|
string where = "";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
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 find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " ORG_ID = '" + OrgId + "'";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"OrgId参数错误\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and NAME like '%" + keyword + "%'";
|
|
}
|
|
FangYar.BLL.TRAIN.T_TRAININGTASK bll = new BLL.TRAIN.T_TRAININGTASK();
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage(where, "TRAINIGDATE desc", startIndex, endIndex).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据登录人ID获取训练任务列表(带训人)
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainTaskListByUserUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string UserUid = context.Request.Params["UserUid"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
|
|
string where = "";
|
|
if (!string.IsNullOrEmpty(UserUid))
|
|
{
|
|
where += " instr ('\"ppl_Id\":\"'||LEADTRAINING||'\"','\"ppl_Id\":\"'||'" + UserUid + "'||'\"')<>0";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"UserUid参数错误\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and NAME like '%" + keyword + "%'";
|
|
}
|
|
where += " and (state != '0' or state != null)";
|
|
FangYar.BLL.TRAIN.T_TRAININGTASK bll = new BLL.TRAIN.T_TRAININGTASK();
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by STATE,TRAINIGDATE desc";
|
|
List<FangYar.Model.TRAIN.T_TRAININGTASK> list = bll.GetModelList(where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据登录人ID获取训练任务列表(参训人)
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainParticipateTaskListByUserUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string UserUid = context.Request.Params["UserUid"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
|
|
string where = "";
|
|
if (!string.IsNullOrEmpty(UserUid))
|
|
{
|
|
where += " instr ('\"ppl_Id\":\"'||TRAININGPERSON||'\"','\"ppl_Id\":\"'||'" + UserUid + "'||'\"')<>0";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"UserUid参数错误\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and NAME like '%" + keyword + "%'";
|
|
}
|
|
FangYar.BLL.TRAIN.T_TRAININGTASK bll = new BLL.TRAIN.T_TRAININGTASK();
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by STATE,TRAINIGDATE desc";
|
|
List<FangYar.Model.TRAIN.T_TRAININGTASK> list = bll.GetModelList(where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 带训人上报成绩
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppAddTrainReportScore(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string data = context.Request.Params["data"];
|
|
string taskid = "";
|
|
List<FangYar.Model.OA.CommonSql> ht = new List<FangYar.Model.OA.CommonSql>();
|
|
|
|
JObject jsonobj = JsonConvert.DeserializeObject<JObject>(data);
|
|
|
|
foreach (JObject obj in jsonobj.Value<JArray>("data0"))
|
|
{
|
|
FangYar.Model.TRAIN.T_TRAININGSCORE scoremodel = new Model.TRAIN.T_TRAININGSCORE();
|
|
scoremodel.ID = Guid.NewGuid().ToString("N");
|
|
scoremodel.USERS_UID = obj["uuid"].ToString();
|
|
scoremodel.USERS_NAME = obj["name"].ToString();
|
|
scoremodel.SUBJECTID = obj["subjectid"].ToString();
|
|
scoremodel.SUBJECTNAME = obj["subjectname"].ToString();
|
|
scoremodel.TRAINIGDATE = obj["traintime"].ToString();
|
|
scoremodel.TASKID = obj["taskid"].ToString();
|
|
scoremodel.TASKNAME = obj["taskname"].ToString();
|
|
scoremodel.RESULT = obj["result"].ToString();
|
|
scoremodel.ACHIEVEMENT = decimal.Parse(obj["achievement"].ToString() != "" ? obj["achievement"].ToString() : "0");
|
|
scoremodel.REPORTPERSONID = obj["reportuid"].ToString();
|
|
scoremodel.REPORTPERSONNAME = obj["reportname"].ToString();
|
|
scoremodel.REPORTTIME = DateTime.Now;
|
|
//scoremodel.REMARK = obj["remark"].ToString();
|
|
scoremodel.ORG_ID = obj["orgid"].ToString();
|
|
scoremodel.ORG_NAME = obj["orgname"].ToString();
|
|
taskid = scoremodel.TASKID;
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE score_bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
FangYar.Model.OA.CommonSql scoreModel = score_bll.getInsertScoreSql(scoremodel);
|
|
ht.Add(scoreModel);
|
|
}
|
|
|
|
//上传图片
|
|
string filesurl = UploadFile("TrainingTask", context, taskid);
|
|
FangYar.BLL.TRAIN.T_TRAININGTASK bll = new BLL.TRAIN.T_TRAININGTASK();
|
|
FangYar.Model.OA.CommonSql taskModel = bll.getUpdateTaskSql(taskid, filesurl);
|
|
ht.Add(taskModel);
|
|
|
|
if (FangYar.Common.MySqlHelper.ExecuteSqlTranBool(ht))
|
|
{
|
|
code = 1;
|
|
msg = "操作成功";
|
|
}
|
|
else
|
|
{
|
|
code = 0;
|
|
msg = "操作失败";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = e.Message;
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 查询当前机构下训练科目
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainSubject(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TRAIN.T_SUBJECT subject_bll = new BLL.TRAIN.T_SUBJECT();
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",\"count\":0,\"data\":";
|
|
DataTable dt = subject_bll.GetList(" ORG_ID = '" + OrgId + "'").Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 站内成绩排名
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainScoreBySubjectid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string subjectid = context.Request.Params["subjectid"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
string company = context.Request.Params["company"];
|
|
|
|
if (!string.IsNullOrEmpty(subjectid))
|
|
{
|
|
string where = " SUBJECTID = '" + subjectid + "' and org_id in ( select oo.org_id from fire_org oo,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) )";
|
|
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
if (!startTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') >= date_format('" + startTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
if (!endTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') <= date_format('" + endTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
|
|
//单位 0时间;1次数;2分数;3是否通过
|
|
string sortStr = "";
|
|
if (company == "0")
|
|
{
|
|
sortStr = " order by ACHIEVEMENT desc , case RESULT when '0' then '9999分' end,RESULT) ";
|
|
}
|
|
else if (company == "1")
|
|
{
|
|
sortStr = " order by ACHIEVEMENT desc , RESULT desc ";
|
|
}
|
|
else if (company == "2")
|
|
{
|
|
sortStr = " order by ACHIEVEMENT desc , RESULT desc ";
|
|
}
|
|
else if (company == "3")
|
|
{
|
|
sortStr = " order by ACHIEVEMENT desc ";
|
|
}
|
|
else
|
|
{
|
|
sortStr = " order by ACHIEVEMENT desc ";
|
|
}
|
|
|
|
where += sortStr;
|
|
returnstr = "{\"code\":200,\"data\":";
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
DataTable dt = bll.GetList(where).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"未查询到数据\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据任务ID获取每人每科训练成绩
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainScoreListByTaskID(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string TaskId = context.Request.Params["TaskId"];
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE score_bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
DataTable dt = score_bll.GetScoreListByTaskID(TaskId);
|
|
returnstr = "{\"code\":200,\"data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 获取红黑榜
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainRedBlackListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string subjectid = context.Request.Params["subjectid"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
string company = context.Request.Params["company"];
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
if (!string.IsNullOrEmpty(subjectid))
|
|
{
|
|
string where = " SUBJECTID = '" + subjectid + "' and org_id in ( select oo.org_id from fire_org oo,(select get_Org_child_list('" + OrgId + "') cids ) s where find_in_set(org_id,cids) )";
|
|
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
if (!startTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') >= date_format('" + startTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
if (!endTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') <= date_format('" + endTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
|
|
|
|
//单位 0时间;1次数;2分数;3是否通过
|
|
string sortStr = "";
|
|
if (company == "0")
|
|
{
|
|
sortStr = " ACHIEVEMENT desc , case RESULT when '0' then '9999分' end,RESULT) ";
|
|
}
|
|
else if (company == "1")
|
|
{
|
|
sortStr = " ACHIEVEMENT desc , RESULT desc ";
|
|
}
|
|
else if (company == "2")
|
|
{
|
|
sortStr = " ACHIEVEMENT desc , RESULT desc ";
|
|
}
|
|
else if (company == "3")
|
|
{
|
|
sortStr = " ACHIEVEMENT desc ";
|
|
}
|
|
else
|
|
{
|
|
sortStr = " ACHIEVEMENT desc ";
|
|
}
|
|
|
|
where += " AND RESULT IS NOT NULL";
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",";
|
|
|
|
returnstr += "\"data1\":";
|
|
DataTable dttop = bll.GetListByPage(where, sortStr, 0, 3).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dttop);
|
|
|
|
//where += " and ACHIEVEMENT<60 order by ACHIEVEMENT asc";
|
|
where += " AND RESULT IS NOT NULL order by " + sortStr;
|
|
returnstr += ",\"data2\":";
|
|
DataTable dtbottom = bll.GetList(where).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dtbottom);
|
|
|
|
returnstr += "}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":-10,\"msg\":\"未查询到数据\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-10,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据科目获取标准(根据科目单位,排序)
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainStandardListBySubjectId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string subjectid = context.Request.Params["subjectid"];
|
|
string company = context.Request.Params["company"];
|
|
var subjectid_s = subjectid.Split(',');
|
|
var company_s = company.Split(',');
|
|
returnstr = "{ \"list\": [";
|
|
for (int i = 0; i < subjectid_s.Length; i++)
|
|
{
|
|
string subjectid_item = subjectid_s[i];
|
|
string company_item = company_s[i];
|
|
string where = " SUBJECTID = '" + subjectid_item + "'";
|
|
if (i == 0)
|
|
{
|
|
returnstr += "{\"id\":\"" + subjectid_item + "\",\"company\":\"" + company_item + "\",";
|
|
}
|
|
else
|
|
{
|
|
returnstr += ",{\"id\":\"" + subjectid_item + "\",\"company\":\"" + company_item + "\",";
|
|
}
|
|
FangYar.BLL.TRAIN.T_SUBJECTGRADESTANDARD bll = new BLL.TRAIN.T_SUBJECTGRADESTANDARD();
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
if (company_item == "0")
|
|
{
|
|
where += " order by GENDER ,AGE1 desc ,STASYS1";
|
|
}
|
|
else if (company_item == "1")
|
|
{
|
|
where += " order by GENDER ,AGE1 desc ,STASYS1 desc";
|
|
}
|
|
DataTable dt = bll.GetList(where).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
returnstr += "]}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{ \"code\": -1,\"msg\": \"" + e.Message + "\",\"list\": []}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据科目ID获取科目Model
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainSubjectModelBySubjectId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
FangYar.BLL.TRAIN.T_SUBJECT bll = new BLL.TRAIN.T_SUBJECT();
|
|
string subjectId = context.Request.Params["subjectId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
FangYar.Model.TRAIN.T_SUBJECT data = bll.GetModel(subjectId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据uid获取历史成绩
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainHistoryScoreListByUserUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string subjectid = context.Request.Params["subjectid"];
|
|
string UserUid = context.Request.Params["UserUid"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
|
|
string where = "";
|
|
if (!string.IsNullOrEmpty(UserUid))
|
|
{
|
|
where += " users_uid = '" + UserUid + "'";
|
|
}
|
|
else
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"参数错误\",\"count\":0,\"data\":[]}";
|
|
}
|
|
if (!string.IsNullOrEmpty(subjectid))
|
|
{
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += " and";
|
|
}
|
|
where += " subjectid = '" + subjectid + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
if (!startTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') >= date_format('" + startTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
if (!endTime.Contains("请选择"))
|
|
{
|
|
where += " and date_format(TRAINIGDATE,'%Y-%m-%d %H:%i:%s') <= date_format('" + endTime + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
}
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by TRAINIGDATE desc";
|
|
List<FangYar.Model.TRAIN.T_TRAININGSCORE> dt = bll.GetModelList(where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-2,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据uid获取个人各科最高成绩、训练通过率
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainBestScoreByUserUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string UserUid = context.Request.Params["UserUid"];
|
|
if (string.IsNullOrEmpty(UserUid))
|
|
{
|
|
return "{\"code\":-1,\"msg\":\"参数错误\",\"count\":0,\"data\":[]}";
|
|
}
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
FangYar.BLL.TRAIN.TRAININGSCOREBEST bestbll = new BLL.TRAIN.TRAININGSCOREBEST();
|
|
returnstr = "{\"code\":200,\"msg\":\"成功\",\"data0\":";
|
|
|
|
DataTable dt0 = bestbll.GetList("users_uid='" + UserUid + "'").Tables[0];
|
|
//DataTable dt0 = bll.GetBestScore("users_uid='" + UserUid + "' and (achievement is not null or achievement != '0') and (RESULT is not null or RESULT != '0')");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt0);
|
|
returnstr += ",\"data1\":";
|
|
DataTable dt1 = bll.GetPassRate(" users_uid = '" + UserUid + "' and ACHIEVEMENT is not null ");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt1);
|
|
//returnstr += ",\"data2\":";
|
|
//DataTable dt2 = bll.timeScoreSubject(" users_uid = '" + UserUid + "'");
|
|
//returnstr += FangYar.Common.JsonHelper.ToJson(dt2);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-2,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据uid获取人员的训练成绩科目
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainTimeScoreSubjectByUid(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string UID = context.Request.Params["UID"];
|
|
|
|
if (!string.IsNullOrEmpty(UID))
|
|
{
|
|
string where = " users_uid = '" + UID + "'";
|
|
|
|
returnstr = "{\"code\":1,\"msg\":\"\",";
|
|
|
|
returnstr += "\"count\":-1,\"data\":";
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
DataTable dt = bll.timeScoreSubject(where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":0,\"未查询到数据\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"" + e.Message + "\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据uid、科目ID获取个人近期训练成绩
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainTimeScoreBySubjectId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string UID = context.Request.Params["UID"];
|
|
string subjectid = context.Request.Params["subjectid"];
|
|
if (!string.IsNullOrEmpty(UID))
|
|
{
|
|
|
|
string where = " subjectid = '" + subjectid + "' and users_uid = '" + UID + "'";
|
|
|
|
returnstr = "{\"code\":1,\"msg\":\"\",";
|
|
|
|
returnstr += "\"count\":-1,\"data\":";
|
|
FangYar.BLL.TRAIN.T_TRAININGSCORE bll = new BLL.TRAIN.T_TRAININGSCORE();
|
|
DataTable dt = bll.timeScore(where);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
else
|
|
{
|
|
returnstr = "{\"code\":0,\"未查询到数据\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"" + e.Message + "\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据字典表类型获取战训知识库模块
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainKnowDicListByMod(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string mod_code = context.Request.Params["mod_code"];
|
|
string dic_fid = context.Request.Params["dic_fid"];
|
|
|
|
string where = " mod_code = '" + mod_code + "' ";
|
|
if (!string.IsNullOrEmpty(dic_fid))
|
|
{
|
|
where += " and dic_fid = '" + dic_fid + "' ";
|
|
}
|
|
else
|
|
{
|
|
where += " and dic_fid is null ";
|
|
}
|
|
FangYar.BLL.TBL.SysDicdetailBLL dicbll = new BLL.TBL.SysDicdetailBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
returnstr += "\"count\":-1,\"data\":";
|
|
DataTable dt = dicbll.GetList(where).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 根据机构ID查询训练知识库列表
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainKnowListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string cls = context.Request.Params["cls"];
|
|
string ntype = context.Request.Params["ntype"];
|
|
string keyword = context.Request.Params["keyword"];
|
|
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); }
|
|
int startIndex = (pageIndex - 1) * pageSize;
|
|
int endIndex = pageSize;
|
|
string where = "";
|
|
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 find_in_set(o.org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where = " ORG_ID = '" + OrgId + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(cls))
|
|
{
|
|
where += " and CLS = '" + cls + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(ntype))
|
|
{
|
|
where += " and NTYPE = '" + ntype + "'";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and ART_TITLE like '%" + keyword + "%' ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
FangYar.BLL.OA.OA_KNOWLEDGEBASE bll = new BLL.OA.OA_KNOWLEDGEBASE();
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = bll.GetListByPage2(where, "", startIndex, endIndex).Tables[0];
|
|
returnstr += Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 根据知识库ID查询训练知识库详情
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetTrainKnowModelByKnowId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string KnowId = context.Request.Params["KnowId"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
FangYar.BLL.OA.OA_KNOWLEDGEBASE bll = new BLL.OA.OA_KNOWLEDGEBASE();
|
|
DataTable dt = bll.GetDataTableById(KnowId);
|
|
returnstr += Common.JsonHelper.ToJson(dt);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion 战训功能
|
|
|
|
#region 人员通讯录
|
|
//获取人员通讯录
|
|
private string AppGetPerPhoneListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
DataTable data = empBll.getPerPhoneListByOrgId(orgId);
|
|
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#region 图片操作
|
|
/// <summary>
|
|
/// 上传单张图片
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <param name="CONNMOD_ID"></param>
|
|
/// <returns></returns>
|
|
private static string UploadFile(HttpContext context, string CONNMOD_ID)
|
|
{
|
|
string result = "";
|
|
if (context.Request.Files.Count > 0)
|
|
{
|
|
HttpPostedFile item = context.Request.Files[0];
|
|
string imageRootPath = "/upload/Fire/Epuip/";
|
|
string extensionStr = System.IO.Path.GetExtension(item.FileName);
|
|
string str = System.DateTime.Now.ToString("yyyyHHddHHmmss");
|
|
string fileName = str + CONNMOD_ID + extensionStr + ".png";
|
|
try
|
|
{
|
|
string rootPath = System.AppDomain.CurrentDomain.BaseDirectory + imageRootPath;
|
|
if (System.IO.Directory.Exists(rootPath))
|
|
{
|
|
item.SaveAs(rootPath + fileName);
|
|
result = imageRootPath + fileName;
|
|
}
|
|
else
|
|
{
|
|
System.IO.Directory.CreateDirectory(rootPath);
|
|
item.SaveAs(rootPath + fileName);
|
|
result = imageRootPath + fileName;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
result = "";
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传多张图片
|
|
/// </summary>
|
|
/// <param name="url"></param>
|
|
/// <param name="context"></param>
|
|
/// <param name="CONNMOD_ID"></param>
|
|
/// <returns></returns>
|
|
private static string UploadFile(string url, HttpContext context, string CONNMOD_ID)
|
|
{
|
|
string result = "";
|
|
if (context.Request.Files.Count > 0)
|
|
{
|
|
string ImageFilePath = "/Upload/" + url + "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/";
|
|
if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(ImageFilePath)) == false)//如果不存在就创建文件夹
|
|
{
|
|
System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(ImageFilePath));
|
|
}
|
|
for (int i = 0; i < context.Request.Files.Count; i++)
|
|
{
|
|
HttpPostedFile item = context.Request.Files[i];
|
|
string fileName = CONNMOD_ID + i + ".png";
|
|
try
|
|
{
|
|
string rootPath = System.AppDomain.CurrentDomain.BaseDirectory + ImageFilePath;
|
|
item.SaveAs(rootPath + fileName);
|
|
result += ImageFilePath + fileName + ",";
|
|
}
|
|
catch
|
|
{
|
|
result += "";
|
|
}
|
|
}
|
|
result = result.Substring(0, result.Length - 1);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传多张图片(加水印)
|
|
/// </summary>
|
|
/// <param name="url"></param>
|
|
/// <param name="context"></param>
|
|
/// <param name="CONNMOD_ID"></param>
|
|
/// <returns></returns>
|
|
private static string AddPhotoWatermark(string url, HttpContext context, string CONNMOD_ID)
|
|
{
|
|
string result = "";
|
|
if (context.Request.Files.Count > 0)
|
|
{
|
|
string ImageFilePath = "/Upload/" + url + "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/";
|
|
if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(ImageFilePath)) == false)//如果不存在就创建文件夹
|
|
{
|
|
System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(ImageFilePath));
|
|
}
|
|
for (int i = 0; i < context.Request.Files.Count; i++)
|
|
{
|
|
HttpPostedFile item = context.Request.Files[i];
|
|
string fileName = CONNMOD_ID + i + ".png";
|
|
try
|
|
{
|
|
string rootPath = System.AppDomain.CurrentDomain.BaseDirectory + ImageFilePath;
|
|
System.Drawing.Image img = Image.FromStream(item.InputStream);
|
|
//创建画布
|
|
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(img);
|
|
g.DrawString(DateTime.Now.ToString(), new Font("黑体", 100), new SolidBrush(Color.Black), 10, 10);
|
|
|
|
//释放画布
|
|
g.Dispose();
|
|
System.Drawing.Image img2 = new Bitmap(img);
|
|
img.Dispose();
|
|
img2.Save(rootPath + fileName);
|
|
img2.Dispose();
|
|
result += ImageFilePath + fileName + ",";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
result += "";
|
|
}
|
|
}
|
|
result = result.Substring(0, result.Length - 1);
|
|
}
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 请假申请-多分支多级机构
|
|
|
|
//请假申请
|
|
private string AppLeaveTaskApplyMoreStep(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//请假表单字段
|
|
string leaveId = context.Request.Params["leaveId"];
|
|
if (string.IsNullOrEmpty(leaveId))
|
|
{
|
|
flag = true;
|
|
leaveId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string pplId = context.Request.Params["pplId"];
|
|
string pplName = context.Request.Params["pplName"];
|
|
string lType = context.Request.Params["lType"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string lNum = context.Request.Params["lNum"];
|
|
string lOut = context.Request.Params["lOut"];
|
|
string accPplId = context.Request.Params["accId"];
|
|
string repPplId = context.Request.Params["repId"];
|
|
string lReason = context.Request.Params["reason"];
|
|
string title = context.Request.Params["title"];
|
|
string extend2 = context.Request.Params["extend2"];
|
|
|
|
FangYar.Model.OA_LEAVE leaveModel = new FangYar.Model.OA_LEAVE();
|
|
leaveModel.ID = leaveId;
|
|
leaveModel.PPL_ID = pplId;
|
|
leaveModel.PPL_NAME = pplName;
|
|
leaveModel.L_TYPE = lType;
|
|
leaveModel.S_TIME = sTime;
|
|
leaveModel.E_TIME = eTime;
|
|
leaveModel.L_NUM = lNum;
|
|
leaveModel.L_OUT = lOut;
|
|
leaveModel.ACC_PPL = accPplId;
|
|
leaveModel.REP_PPL = repPplId;
|
|
leaveModel.L_REASON = lReason;
|
|
leaveModel.TITLE = title;
|
|
leaveModel.STATE = "0";
|
|
leaveModel.IS_RETURN = "1";
|
|
leaveModel.EXTEND2 = extend2;
|
|
|
|
leaveModel.EXTEND4 = "1_";
|
|
string str = AppLeaveFirst(pplId);
|
|
if (str != null && str.Contains(';'))
|
|
{
|
|
var str2 = str.Split(';');
|
|
leaveModel.EXTEND3 = str2[1];
|
|
leaveModel.EXTEND4 = str2[0];
|
|
}
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
if (string.IsNullOrEmpty(receiveId))
|
|
{
|
|
receiveId = leaveModel.EXTEND3;
|
|
}
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
FangYar.BLL.OA_LEAVE leaveBll = new FangYar.BLL.OA_LEAVE();
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("1e293f27-ac08-4087-8a0e-6c0aa9e3af6f");
|
|
if (flag)
|
|
{
|
|
leaveBll.Add(leaveModel);
|
|
|
|
execute.FlowID = "1e293f27-ac08-4087-8a0e-6c0aa9e3af6f".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = leaveModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(pplId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
leaveBll.Update(leaveModel);
|
|
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == eventParams.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
|
|
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取流转步骤
|
|
/// </summary>
|
|
/// <param name="instanceid"></param>
|
|
/// <param name="StepID"></param>
|
|
/// <param name="wfInstalled"></param>
|
|
/// <returns></returns>
|
|
public List<RoadFlow.Data.Model.WorkFlowInstalledSub.Step> GetNextSteps(RoadFlow.Data.Model.WorkFlowInstalledSub.Step currentStep, RoadFlow.Data.Model.WorkFlowInstalled wfInstalled, RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams)
|
|
{
|
|
List<Guid> removeIDList = new List<Guid>();
|
|
RoadFlow.Platform.WorkFlowTask btask = new RoadFlow.Platform.WorkFlowTask();
|
|
RoadFlow.Platform.Users busers = new RoadFlow.Platform.Users();
|
|
var nextSteps = bworkFlow.GetNextSteps(wfInstalled.ID, currentStep.ID).OrderBy(p => p.Position_x).ThenBy(p => p.Position_y).ToList();
|
|
foreach (var step in nextSteps)
|
|
{
|
|
var lines = wfInstalled.Lines.Where(p => p.ToID == step.ID && p.FromID == currentStep.ID);
|
|
if (lines.Count() > 0)
|
|
{
|
|
var line = lines.First();
|
|
if (!line.SqlWhere.IsNullOrEmpty())
|
|
{
|
|
if (wfInstalled.DataBases.Count() == 0)
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
//nosubmitMsg.Append("流程未设置数据连接");
|
|
//nosubmitMsg.Append("\\n");
|
|
}
|
|
else
|
|
{
|
|
if (!btask.TestLineSql(wfInstalled.DataBases.First().LinkID, wfInstalled.DataBases.First().Table,
|
|
wfInstalled.DataBases.First().PrimaryKey, eventParams.InstanceID, line.SqlWhere))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
//nosubmitMsg.Append(string.Concat("提交条件未满足"));
|
|
//nosubmitMsg.Append("\\n");
|
|
}
|
|
}
|
|
}
|
|
if (!line.CustomMethod.IsNullOrEmpty())
|
|
{
|
|
object obj = btask.ExecuteFlowCustomEvent(line.CustomMethod.Trim(), eventParams);
|
|
var objType = obj.GetType();
|
|
var boolType = typeof(Boolean);
|
|
if (objType != boolType && "1" != obj.ToString())
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
|
|
}
|
|
else if (objType == boolType && !(bool)obj)
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
|
|
}
|
|
}
|
|
#region 组织机构关系判断
|
|
string SenderID = RoadFlow.Platform.Users.CurrentUserID;
|
|
if ("1" == line.Organize_SenderChargeLeader && !busers.IsChargeLeader(SenderID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if (!line.Organize_SenderIn.IsNullOrEmpty() && !busers.IsContains(SenderID, line.Organize_SenderIn))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_SenderLeader && !busers.IsLeader(SenderID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if (!line.Organize_SenderNotIn.IsNullOrEmpty() && busers.IsContains(SenderID, line.Organize_SenderNotIn))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
string sponserID = "";//发起者ID
|
|
if (currentStep.ID == wfInstalled.FirstStepID)//如果是第一步则发起者就是发送者
|
|
{
|
|
sponserID = SenderID;
|
|
}
|
|
else
|
|
{
|
|
sponserID = btask.GetFirstSnderID(eventParams.FlowID, eventParams.GroupID.ToString());
|
|
}
|
|
if ("1" == line.Organize_SponsorChargeLeader && !busers.IsChargeLeader(sponserID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if (!line.Organize_SponsorIn.IsNullOrEmpty() && !busers.IsContains(sponserID, line.Organize_SponsorIn))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_SponsorLeader && !busers.IsLeader(sponserID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if (!line.Organize_SponsorNotIn.IsNullOrEmpty() && busers.IsContains(sponserID, line.Organize_SponsorNotIn))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_NotSenderChargeLeader && busers.IsChargeLeader(SenderID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_NotSenderLeader && busers.IsLeader(SenderID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_NotSponsorChargeLeader && busers.IsChargeLeader(sponserID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
if ("1" == line.Organize_NotSponsorLeader && busers.IsLeader(sponserID))
|
|
{
|
|
removeIDList.Add(step.ID);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
foreach (Guid rid in removeIDList)
|
|
{
|
|
nextSteps.RemoveAll(p => p.ID == rid);
|
|
}
|
|
return nextSteps;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppLeaveFirst(string userId)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.BLL.FIRE.FIRE_ORG bll_org = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
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(",政治委员,")))
|
|
{
|
|
nextUid += model.USERS_UID + ",";
|
|
}
|
|
//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 + ",";
|
|
}
|
|
//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 += nextStep + ";" + nextUid;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#region 请假流程处理
|
|
//请假流程处理
|
|
private string AppLeaveWorkFlowTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
string EXTEND = context.Request.Params["EXTEND"];//延假小时
|
|
string isEXTEND = context.Request.Params["isEXTEND"];//是否为延假 0销假;1延假
|
|
//string EXTEND3 = context.Request.Params["EXTEND3"];//
|
|
//receiveId = EXTEND3;
|
|
if (isEXTEND == "1")
|
|
{
|
|
FangYar.BLL.OA_LEAVE ldal = new FangYar.BLL.OA_LEAVE();
|
|
FangYar.Model.OA_LEAVE lmodel = ldal.GetModel(instanceid);
|
|
lmodel.EXTEND = EXTEND;
|
|
ldal.Update(lmodel);
|
|
}
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.OA_LEAVE leavebll = new FangYar.BLL.OA_LEAVE();
|
|
FangYar.Model.OA_LEAVE leaveModel = leavebll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
//leavebll.EditState(instanceid, "1");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
leavebll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.Model.TBL.TBL_SYS_EMP_Model emodel = new FangYar.Model.TBL.TBL_SYS_EMP_Model();
|
|
emodel.USERS_UID = leaveModel.PPL_ID;
|
|
emodel.IS_WORK = "1";
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
var accUsers = leaveModel.ACC_PPL.Split(',');
|
|
foreach (string uid in accUsers)
|
|
{
|
|
emodel.USERS_UID = uid.Replace("u_", "");
|
|
empbll.EditEmpIswork(emodel);
|
|
}
|
|
}
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
int backType = currentStep.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
for (int i = 0; i < nextSteps.Count; i++)
|
|
{
|
|
switch (nextSteps[i].Behavior.HandlerType)
|
|
{
|
|
case 5://发起者
|
|
receiveId = bworkFlowTask.GetFirstSnderID(wfInstalled.ID, groupid);
|
|
break;
|
|
case 6://前一步骤处理者
|
|
//defaultMember = btask.GetStepSnderIDString(wfInstalled.ID, currentStep.ID, groupid.ToGuid());
|
|
//if (defaultMember.IsNullOrEmpty() && currentStep.ID == wfInstalled.FirstStepID)
|
|
//{
|
|
receiveId = RoadFlow.Platform.Users.PREFIX + RoadFlow.Platform.Users.CurrentUserID.ToString();
|
|
//}
|
|
break;
|
|
case 7://某一步骤处理者
|
|
receiveId = bworkFlowTask.GetStepSnderIDString(wfInstalled.ID, nextSteps[i].Behavior.HandlerStepID, groupid.ToGuid());
|
|
|
|
break;
|
|
case 8://字段值
|
|
string linkString = nextSteps[i].Behavior.ValueField;
|
|
if (!linkString.IsNullOrEmpty() && !instanceid.IsNullOrEmpty() && wfInstalled.DataBases.Count() > 0)
|
|
{
|
|
receiveId = new RoadFlow.Platform.DBConnection().GetFieldValue(linkString, wfInstalled.DataBases.First().PrimaryKey, instanceid);
|
|
}
|
|
break;
|
|
}
|
|
execute.Steps.Add(nextSteps[i].ID, borganize.GetAllUsersIdString(receiveId));
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 用车申请-多级分支多级机构
|
|
//用车申请
|
|
private string AppCarTaskApplyMoreStep(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//用车表单字段
|
|
string applyId = context.Request.Params["applyId"];
|
|
if (string.IsNullOrEmpty(applyId))
|
|
{
|
|
flag = true;
|
|
applyId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string userId = context.Request.Params["userId"];
|
|
string userName = context.Request.Params["userName"];
|
|
string userPhone = context.Request.Params["userPhone"];
|
|
string carId = context.Request.Params["carId"];
|
|
string carNum = context.Request.Params["carNum"];
|
|
string userMan = context.Request.Params["userMan"];
|
|
string rideNum = context.Request.Params["rideNum"];
|
|
string rideMan = context.Request.Params["rideMan"];
|
|
string ridePurpose = context.Request.Params["ridePurpose"];
|
|
string startPoint = context.Request.Params["startPoint"];
|
|
string endPoint = context.Request.Params["endPoint"];
|
|
string startTime = context.Request.Params["startTime"];
|
|
string endTime = context.Request.Params["endTime"];
|
|
string title = context.Request.Params["title"];
|
|
string extend = context.Request.Params["extend"];
|
|
string extend2 = context.Request.Params["extend2"];
|
|
FangYar.Model.TBL_SYS_CARAPPLY carModel = new FangYar.Model.TBL_SYS_CARAPPLY();
|
|
carModel.ID = applyId;
|
|
carModel.USERID = userId;
|
|
carModel.USERNAME = userName;
|
|
carModel.USERPHONE = userPhone;
|
|
carModel.CARID = carId;
|
|
carModel.CARNUM = carNum;
|
|
carModel.USERMAN = userMan;
|
|
if (!string.IsNullOrEmpty(rideNum))
|
|
{
|
|
carModel.RIDENUM = Int32.Parse(rideNum);
|
|
}
|
|
else
|
|
{
|
|
carModel.RIDENUM = 1;
|
|
}
|
|
carModel.RIDEMANS = rideMan;
|
|
carModel.RIDEPURPOSE = ridePurpose;
|
|
carModel.STARTPOINT = startPoint;
|
|
carModel.DESTINATION = endPoint;
|
|
if (!string.IsNullOrEmpty(startTime))
|
|
{
|
|
carModel.STARTTIME = DateTime.Parse(startTime);
|
|
}
|
|
if (!string.IsNullOrEmpty(endTime))
|
|
{
|
|
carModel.FINISHTIME = DateTime.Parse(endTime);
|
|
}
|
|
carModel.STATE = "0";
|
|
carModel.EXTENDCODE2 = "1";
|
|
carModel.TITLE = title;
|
|
carModel.EXTENDCODE3 = extend;
|
|
carModel.EXTENDCODE6 = extend2;
|
|
carModel.EXTENDCODE5 = "1_";
|
|
string str = AppCarApplyFirst(userId);
|
|
if (str != null && str.Contains(';'))
|
|
{
|
|
var str2 = str.Split(';');
|
|
carModel.EXTENDCODE4 = str2[1];
|
|
carModel.EXTENDCODE5 = str2[0];
|
|
}
|
|
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
if (string.IsNullOrEmpty(receiveId))
|
|
{
|
|
receiveId = carModel.EXTENDCODE4;
|
|
}
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("830258e8-69e8-404d-ac32-5da2545c18e0");
|
|
if (flag)
|
|
{
|
|
carBll.Add(carModel);
|
|
|
|
execute.FlowID = "830258e8-69e8-404d-ac32-5da2545c18e0".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = carModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(userId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
carBll.Update(carModel);
|
|
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == eventParams.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCarApplyFirst(string userId)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.BLL.FIRE.FIRE_ORG bll_org = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
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 + ",";
|
|
}
|
|
//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 + ",";
|
|
}
|
|
//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 += nextStep + ";" + nextUid;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#region 用车流程处理
|
|
//用车流程处理
|
|
private string AppCarWorkFlowTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
FangYar.Model.TBL_SYS_CARAPPLY carModel = carBll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
carBll.EditState(instanceid, "1");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
carBll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL empbll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.Model.TBL.TBL_SYS_EMP_Model emodel = new FangYar.Model.TBL.TBL_SYS_EMP_Model();
|
|
emodel.USERS_UID = carModel.USERID;
|
|
emodel.IS_WORK = "1";
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
emodel.USERS_UID = carModel.USERMAN;
|
|
empbll.EditEmpIswork(emodel);
|
|
|
|
var accUsers = carModel.RIDEMANS.Split(',');
|
|
foreach (string uid in accUsers)
|
|
{
|
|
emodel.USERS_UID = uid.Replace("u_", "");
|
|
empbll.EditEmpIswork(emodel);
|
|
}
|
|
}
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
var steps2 = wfInstalled.Steps.Where(p => p.ID == stepid.ToGuid());
|
|
var currentStep2 = steps2.First();
|
|
int backType = currentStep2.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
switch (nextSteps[0].Behavior.HandlerType)
|
|
{
|
|
case 5://发起者
|
|
receiveId = bworkFlowTask.GetFirstSnderID(wfInstalled.ID, groupid);
|
|
break;
|
|
case 6://前一步骤处理者
|
|
//defaultMember = btask.GetStepSnderIDString(wfInstalled.ID, currentStep.ID, groupid.ToGuid());
|
|
//if (defaultMember.IsNullOrEmpty() && currentStep.ID == wfInstalled.FirstStepID)
|
|
//{
|
|
receiveId = RoadFlow.Platform.Users.PREFIX + RoadFlow.Platform.Users.CurrentUserID.ToString();
|
|
//}
|
|
break;
|
|
case 7://某一步骤处理者
|
|
receiveId = bworkFlowTask.GetStepSnderIDString(wfInstalled.ID, nextSteps[0].Behavior.HandlerStepID, groupid.ToGuid());
|
|
|
|
break;
|
|
case 8://字段值
|
|
string linkString = nextSteps[0].Behavior.ValueField;
|
|
if (!linkString.IsNullOrEmpty() && !instanceid.IsNullOrEmpty() && wfInstalled.DataBases.Count() > 0)
|
|
{
|
|
receiveId = new RoadFlow.Platform.DBConnection().GetFieldValue(linkString, wfInstalled.DataBases.First().PrimaryKey, instanceid);
|
|
}
|
|
break;
|
|
}
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
|
|
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 公差申请-多级分支多级机构
|
|
//用车申请
|
|
private string AppToleranceTaskApplyMoreStep(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
bool flag = false;
|
|
//公差表单字段
|
|
string toleranceId = context.Request.Params["toleranceId"];
|
|
if (string.IsNullOrEmpty(toleranceId))
|
|
{
|
|
flag = true;
|
|
toleranceId = Guid.NewGuid().ToString().ToGuid().ToString();
|
|
}
|
|
string pplId = context.Request.Params["pplId"];
|
|
string pplName = context.Request.Params["pplName"];
|
|
string lType = context.Request.Params["lType"];
|
|
string sTime = context.Request.Params["sTime"];
|
|
string eTime = context.Request.Params["eTime"];
|
|
string lNum = context.Request.Params["lNum"];
|
|
string lOut = context.Request.Params["lOut"];
|
|
string accPplId = context.Request.Params["accId"];
|
|
string repPplId = context.Request.Params["repId"];
|
|
string lReason = context.Request.Params["reason"];
|
|
string title = context.Request.Params["title"];
|
|
string carNum = context.Request.Params["carNum"];
|
|
|
|
FangYar.Model.OA.OA_TOLERANCE toleranceModel = new FangYar.Model.OA.OA_TOLERANCE();
|
|
toleranceModel.ID = toleranceId;
|
|
toleranceModel.PPL_ID = pplId;
|
|
toleranceModel.PPL_NAME = pplName;
|
|
toleranceModel.L_TYPE = lType;
|
|
toleranceModel.S_TIME = sTime;
|
|
toleranceModel.E_TIME = eTime;
|
|
toleranceModel.L_NUM = lNum;
|
|
toleranceModel.L_OUT = lOut;
|
|
toleranceModel.ACC_PPL = accPplId;
|
|
toleranceModel.REP_PPL = repPplId;
|
|
toleranceModel.L_REASON = lReason;
|
|
toleranceModel.TITLE = title;
|
|
toleranceModel.STATE = "0";
|
|
toleranceModel.CAR_NUM = carNum;
|
|
|
|
string str = AppToleranceApplyFirst(pplId);
|
|
if (str != null && str.Contains(';'))
|
|
{
|
|
var str2 = str.Split(';');
|
|
toleranceModel.EXTENDCODE1 = str2[1];
|
|
toleranceModel.EXTENDCODE2 = str2[0];
|
|
}
|
|
|
|
FangYar.BLL.OA.OA_TOLERANCE carBll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
if (string.IsNullOrEmpty(receiveId))
|
|
{
|
|
receiveId = toleranceModel.EXTENDCODE1;
|
|
}
|
|
switch (opation)
|
|
{
|
|
case "apply":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
}
|
|
|
|
//流程字段
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel("7a3711b6-4cf1-4501-823e-9ccd69eec4da");
|
|
if (flag)
|
|
{
|
|
carBll.Add(toleranceModel);
|
|
|
|
execute.FlowID = "7a3711b6-4cf1-4501-823e-9ccd69eec4da".ToGuid();
|
|
execute.GroupID = Guid.Empty;
|
|
execute.InstanceID = toleranceModel.ID.ToGuid().ToString();
|
|
execute.IsSign = false;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(pplId);
|
|
execute.StepID = wfInstalled.FirstStepID;
|
|
execute.TaskID = Guid.Empty;
|
|
}
|
|
else
|
|
{
|
|
carBll.Update(toleranceModel);
|
|
wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
}
|
|
execute.Title = title ?? "";
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == eventParams.StepID);
|
|
var currentStep = steps.First();
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 流程发起查询对应步骤和处理人
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppToleranceApplyFirst(string userId)
|
|
{
|
|
FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
FangYar.BLL.FIRE.FIRE_ORG bll_org = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
var user = bll.GetModelByUID(userId);
|
|
var nextUid = "";
|
|
var nextStep = "";
|
|
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
|
|
var unit_org = org;//所在单位
|
|
|
|
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 += nextStep + ";" + nextUid;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
returnstr = "";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#region 公差流程处理
|
|
|
|
//公差流程处理
|
|
private string AppToleranceWorkFlowTaskHandle(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
//流程字段
|
|
string comment = context.Request.Params["comment"];//处理意见
|
|
string opation = context.Request.Params["opation"];//操作类型
|
|
string flowid = context.Request.Params["flowid"];//流程ID
|
|
string groupid = context.Request.Params["groupid"];//分组ID
|
|
string instanceid = context.Request.Params["instanceid"];//实例ID
|
|
string issign = context.Request.Params["issign"];//是否签章
|
|
string senderId = context.Request.Params["senderId"];//发送人员
|
|
string receiveId = context.Request.Params["receiveId"];//接收人员
|
|
string stepid = context.Request.Params["stepid"];//步骤ID
|
|
string taskid = context.Request.Params["taskid"];//任务ID
|
|
string title = context.Request.Params["title"];//标题
|
|
|
|
RoadFlow.Data.Model.WorkFlowExecute.Execute execute = new RoadFlow.Data.Model.WorkFlowExecute.Execute();
|
|
|
|
FangYar.BLL.OA.OA_TOLERANCE tolerancebll = new FangYar.BLL.OA.OA_TOLERANCE();
|
|
FangYar.Model.OA.OA_TOLERANCE toleranceModel = tolerancebll.GetModel(instanceid);
|
|
switch (opation)
|
|
{
|
|
case "submit":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit;
|
|
break;
|
|
case "save":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Save;
|
|
break;
|
|
case "back":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "completed":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed;
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
case "redirect":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Redirect;
|
|
break;
|
|
//新增同意
|
|
case "agree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree;
|
|
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
//新增不同意
|
|
case "disagree":
|
|
execute.ExecuteType = RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree;
|
|
tolerancebll.EditState(instanceid, "2");
|
|
execute.Comment = comment.IsNullOrEmpty() ? "" : comment.Trim();
|
|
break;
|
|
}
|
|
FangYar.BLL.TBL.SysUsersBLL userBll = new FangYar.BLL.TBL.SysUsersBLL();
|
|
var wfInstalled = bworkFlow.GetWorkFlowRunModel(flowid);
|
|
execute.FlowID = flowid.ToGuid();
|
|
execute.GroupID = groupid.ToGuid();
|
|
execute.InstanceID = instanceid;
|
|
execute.IsSign = "1" == issign;
|
|
execute.Note = "";
|
|
execute.Sender = userBll.GetModelByUID(senderId);
|
|
execute.StepID = stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID;
|
|
execute.TaskID = taskid.ToGuid();
|
|
execute.Title = title ?? "";
|
|
|
|
|
|
RoadFlow.Data.Model.WorkFlowCustomEventParams eventParams = new RoadFlow.Data.Model.WorkFlowCustomEventParams();
|
|
eventParams.FlowID = execute.FlowID;
|
|
eventParams.GroupID = execute.GroupID;
|
|
eventParams.StepID = execute.StepID;
|
|
eventParams.TaskID = execute.TaskID;
|
|
eventParams.InstanceID = execute.InstanceID;
|
|
var steps = wfInstalled.Steps.Where(p => p.ID == execute.StepID);
|
|
var currentStep = steps.First();
|
|
if (execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
var steps2 = wfInstalled.Steps.Where(p => p.ID == stepid.ToGuid());
|
|
var currentStep2 = steps2.First();
|
|
int backType = currentStep2.Behavior.BackType;//退回类型
|
|
var prevSteps = bworkFlowTask.GetBackSteps(taskid.ToGuid(), backType, stepid.IsGuid() ? stepid.ToGuid() : wfInstalled.FirstStepID, wfInstalled);
|
|
foreach (var step in prevSteps)
|
|
{
|
|
execute.Steps.Add(step.Key, new List<FangYar.Model.TBL.TBL_SYS_USERS_Model>());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
var nextSteps = GetNextSteps(currentStep, wfInstalled, eventParams);
|
|
if (nextSteps.Count > 0)
|
|
{
|
|
switch (nextSteps[0].Behavior.HandlerType)
|
|
{
|
|
case 5://发起者
|
|
receiveId = bworkFlowTask.GetFirstSnderID(wfInstalled.ID, groupid);
|
|
break;
|
|
case 6://前一步骤处理者
|
|
//defaultMember = btask.GetStepSnderIDString(wfInstalled.ID, currentStep.ID, groupid.ToGuid());
|
|
//if (defaultMember.IsNullOrEmpty() && currentStep.ID == wfInstalled.FirstStepID)
|
|
//{
|
|
receiveId = RoadFlow.Platform.Users.PREFIX + RoadFlow.Platform.Users.CurrentUserID.ToString();
|
|
//}
|
|
break;
|
|
case 7://某一步骤处理者
|
|
receiveId = bworkFlowTask.GetStepSnderIDString(wfInstalled.ID, nextSteps[0].Behavior.HandlerStepID, groupid.ToGuid());
|
|
|
|
break;
|
|
case 8://字段值
|
|
string linkString = nextSteps[0].Behavior.ValueField;
|
|
if (!linkString.IsNullOrEmpty() && !instanceid.IsNullOrEmpty() && wfInstalled.DataBases.Count() > 0)
|
|
{
|
|
receiveId = new RoadFlow.Platform.DBConnection().GetFieldValue(linkString, wfInstalled.DataBases.First().PrimaryKey, instanceid);
|
|
}
|
|
break;
|
|
}
|
|
execute.Steps.Add(nextSteps[0].ID, borganize.GetAllUsersIdString(receiveId));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
var reslut = bworkFlowTask.AppExecute(execute);
|
|
//步骤提交后事件
|
|
if (!currentStep.Event.SubmitAfter.IsNullOrEmpty() &&
|
|
(execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Submit
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Completed
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Agree
|
|
|| execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Disagree))
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.SubmitAfter.Trim(), eventParams);
|
|
}
|
|
//步骤退回后事件
|
|
if (!currentStep.Event.BackAfter.IsNullOrEmpty() && execute.ExecuteType == RoadFlow.Data.Model.WorkFlowExecute.EnumType.ExecuteType.Back)
|
|
{
|
|
object obj = bworkFlowTask.ExecuteFlowCustomEvent(currentStep.Event.BackAfter.Trim(), eventParams);
|
|
}
|
|
|
|
|
|
returnstr += "{\"code\":0,\"msg\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(reslut);
|
|
returnstr += "}";
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 获取机构
|
|
private string AppGetOrgNodeTree(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
string type = context.Request.Params["Type"];
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
|
|
var data = GetNode(orgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
private Model.TreeNodeModel GetNode(string Pid)
|
|
{
|
|
FangYar.BLL.FIRE.FIRE_ORG bll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
var org = bll.GetModel(Pid);
|
|
var node = GetTreeNodeModel(org);
|
|
node.childs = GetChildList(node.id);
|
|
return node;
|
|
}
|
|
public Model.TreeNodeModel GetTreeNodeModel(DataRow dr)
|
|
{
|
|
Model.TreeNodeModel childViewModel = new Model.TreeNodeModel();
|
|
childViewModel.id = dr["ORG_ID"].ToString();
|
|
childViewModel.pId = dr["PID"].ToString();
|
|
childViewModel.name = dr["ORG_NAME"].ToString();
|
|
childViewModel.extend = dr["TYPE"].ToString();
|
|
return childViewModel;
|
|
}
|
|
public Model.TreeNodeModel GetTreeNodeModel(FangYar.Model.FIRE.FIRE_ORG org)
|
|
{
|
|
Model.TreeNodeModel childViewModel = new Model.TreeNodeModel();
|
|
childViewModel.id = org.ORG_ID;
|
|
childViewModel.pId = org.PID;
|
|
childViewModel.name = org.ORG_NAME;
|
|
childViewModel.extend = org.TYPE;
|
|
return childViewModel;
|
|
}
|
|
public List<Model.TreeNodeModel> GetChildList(string Pid)
|
|
{
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG bll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
var orgList = bll.GetModelList(" pid='" + Pid + "'");
|
|
List<Model.TreeNodeModel> list = new List<Model.TreeNodeModel>();
|
|
|
|
if (orgList.Count > 0)
|
|
{
|
|
foreach (var org in orgList)
|
|
{
|
|
Model.TreeNodeModel node = GetTreeNodeModel(org);
|
|
node.childs = GetChildList(node.id);
|
|
list.Add(node);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
return list;
|
|
}
|
|
#endregion
|
|
|
|
#region 统计
|
|
|
|
/// <summary>
|
|
/// 人员统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountEmp(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
string sql = " select b.org_id,b.org_name,IFNULL(zs,0) zs,IFNULL(zg,0) zg,IFNULL(zs,0)-IFNULL(zg,0)-IFNULL(qj,0) qt,IFNULL(qj,0) qj,round((IFNULL(zg,0)/IFNULL(zs,0))*100,2)||'%' zgl from (select org_id,org_name from fire_org,(select get_Org_child_list('" + orgId + "') cids ) s where type=0 and find_in_set(org_id,cids)) b ";
|
|
sql += " left join (select count(1) zs,org_id from TBL_SYS_EMP where IS_ADMIN='0' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)c on b.org_id=c.org_id ";
|
|
sql += " left join (select count(1) qj,org_id from TBL_SYS_EMP where IS_ADMIN='0' and is_work='4' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)d on b.org_id=d.org_id ";
|
|
sql += " left join (select count(1) zg,org_id from TBL_SYS_EMP where IS_ADMIN='0' and is_work='1' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)e on b.org_id=e.org_id ";
|
|
|
|
DataTable data = new CommomBLL().GetTableList(sql);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 车辆统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountCar(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
string sql = " select b.org_id,b.org_name,IFNULL(zs,0) zs,IFNULL(zg,0)+IFNULL(sqz,0) zg ,IFNULL(zs,0)-IFNULL(zg,0)-IFNULL(sqz,0)-IFNULL(ly,0) qt,IFNULL(ly,0) ly,round((IFNULL(zg,0)/IFNULL(zs,0))*100,2)||'%' zgl from (select org_id,org_name from fire_org,(select get_Org_child_list('" + orgId + "') cids ) s where type=0 and find_in_set(org_id,cids)) b ";
|
|
sql += " left join (select count(1) zs,org_id from TBL_SYS_CAR where (IS_DEL ='0' or IS_DEL is null ) group by org_id)c on b.org_id=c.org_id ";
|
|
sql += " left join (select count(1) zg,org_id from TBL_SYS_CAR where ISAPPLY='0' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)d on b.org_id=d.org_id ";
|
|
sql += " left join (select count(1) sqz,org_id from TBL_SYS_CAR where ISAPPLY='1' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)f on b.org_id=f.org_id ";
|
|
sql += " left join (select count(1) ly,org_id from TBL_SYS_CAR where ISAPPLY='2' and (IS_DEL ='0' or IS_DEL is null ) group by org_id)e on b.org_id=e.org_id ";
|
|
|
|
DataTable data = new CommomBLL().GetTableList(sql);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查铺查哨(机构和任务)
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountFireInspect(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];//机构id
|
|
string sn_Id = context.Request.Params["sn_Id"];//1.查铺2.查哨
|
|
string date = context.Request.Params["date"];//日期
|
|
string sql = "";
|
|
string sql1 = "";
|
|
sql = "select b.org_id,b.org_name,IFNULL(placeZS,0) placeZS,IFNULL(placeYXC,0) placeYXC,(IFNULL(placeZS,0)-IFNULL(placeYXC,0)) placeWXC," +
|
|
"IFNULL(zs,0) zs,IFNULL(zw,0) zw,IFNULL(wd,0) wd,IFNULL(wc,0) wc";
|
|
sql += " from (select org_id,org_name from fire_org,(select get_Org_child_list('" + orgId + "') cids ) s ";
|
|
sql += " where type=0 and extendcode1 = 1 and find_in_set(org_id,cids) ) b";
|
|
sql += " left join (select count(1) placeZS,org_id from fire_inspect t inner join OA_PATROLSENTRYTASK s on t.sentrytaskid=s.id where date_format(s.begindate,'%Y-%m-%d')='" + date + "' group by org_id)a on a.org_id=b.org_id ";
|
|
sql += " left join (select count(1) placeYXC,org_id from fire_inspect t inner join OA_PATROLSENTRYTASK s on t.sentrytaskid=s.id where date_format(s.begindate,'%Y-%m-%d')='" + date + "' and EXTENDCODE2 is not null group by org_id)d on d.org_id=b.org_id ";
|
|
sql += " left join (select t.org_id,sum(EXTENDCODE6) zs,sum(EXTENDCODE2) zw,sum(EXTENDCODE4) wd,sum(LEAVE_NUM) wc ";
|
|
sql += " from fire_inspect t inner join OA_PATROLSENTRYTASK s on t.sentrytaskid=s.id where date_format(s.begindate,'%Y-%m-%d')='" + date + "' group by t.org_id) c on c.org_id=b.org_id";
|
|
|
|
sql1 += "select b.orgid,b.Id Task_ID,b.TASKNAME,b.PATROLLER,date_format(b.BEGINDATE,'%Y-%m-%d') InspectDate,date_format(b.BEGINDATE,'%H:%i:%s') BEGINDATE,date_format(b.ENDDATE,'%H:%i:%s') ENDDATE,IFNULL(placeZS,0) placeZS,IFNULL(placeYXC,0) placeYXC,(IFNULL(placeZS,0)-IFNULL(placeYXC,0)) placeWXC," +
|
|
"IFNULL(zs,0) zs,IFNULL(zw,0) zw,IFNULL(wd,0) wd,IFNULL(wc,0) wc";
|
|
sql1 += " from OA_PATROLSENTRYTASK b";
|
|
sql1 += " left join (select count(1) placeZS,SENTRYTASKID from fire_inspect t group by SENTRYTASKID)a on a.SENTRYTASKID=b.id";
|
|
sql1 += " left join (select count(1) placeYXC,SENTRYTASKID from fire_inspect t where EXTENDCODE2 is not null group by SENTRYTASKID)d on d.SENTRYTASKID=b.id";
|
|
sql1 += " left join (select t.SENTRYTASKID,sum(EXTENDCODE6) zs,sum(EXTENDCODE2) zw,sum(EXTENDCODE4) wd,sum(LEAVE_NUM) wc";
|
|
sql1 += " from fire_inspect t group by t.SENTRYTASKID) c on c.SENTRYTASKID=b.id";
|
|
sql1 += " where b.orgid='" + orgId + "' and date_format(b.begindate,'%Y-%m-%d')='" + date + "' order by createdate desc";
|
|
FangYar.OracleDAL.FIRE.FIRE_ORG orgDal = new FangYar.OracleDAL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.FIRE.FIRE_INSPECT inspectBLL = new FangYar.BLL.FIRE.FIRE_INSPECT();
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
//int childs = orgDal.GetOrgCount("pid='"+orgId+"' and type='0'");//判断是否是最后一级机构(如果是,就只展示此机构下任务列表)
|
|
|
|
|
|
returnstr += ",\"orgData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += ",\"taskData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql1));
|
|
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 查铺查哨(地点)
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountFireInspectPlace(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string taskId = context.Request.Params["taskId"];//任务Id
|
|
string sn_Id = context.Request.Params["sn_Id"];//1.查铺2.查哨
|
|
string sql = "";
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.FIRE.FIRE_INSPECT inspectBLL = new FangYar.BLL.FIRE.FIRE_INSPECT();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
//任务列表
|
|
sql = "select t.ADDR,IFNULL(t.EXTENDCODE6,0) zs,IFNULL(t.EXTENDCODE2,0) zw,IFNULL(t.EXTENDCODE4,0) wd,IFNULL(t.LEAVE_NUM,0) wc from FIRE_INSPECT t " +
|
|
" where t.SENTRYTASKID = '" + taskId + "' ";
|
|
DataTable data = new CommomBLL().GetTableList(sql);
|
|
//图表
|
|
sql = "";
|
|
sql += "select b.id,b.TASKNAME,IFNULL(placeZS,0) placeZS,IFNULL(placeYXC,0) placeYXC,(IFNULL(placeZS,0)-IFNULL(placeYXC,0)) placeWXC,";
|
|
sql += "IFNULL(zs,0) zs,IFNULL(zw,0) zw,IFNULL(wd,0) wd,IFNULL(wc,0) wc from ";
|
|
sql += " OA_PATROLSENTRYTASK b";
|
|
sql += " left join (select t.SENTRYTASKID,IFNULL(sum(t.EXTENDCODE6),0) zs,IFNULL(sum(t.EXTENDCODE2),0) zw,IFNULL(sum(t.EXTENDCODE4),0) wd,IFNULL(sum(t.LEAVE_NUM),0) wc ";
|
|
sql += " from FIRE_INSPECT t";
|
|
sql += " group by t.SENTRYTASKID) a on a.SENTRYTASKID=b.id";
|
|
sql += " left join (select count(1) placeZS,SENTRYTASKID from fire_inspect t group by SENTRYTASKID)c on c.SENTRYTASKID=b.id ";
|
|
sql += " left join (select count(1) placeYXC,SENTRYTASKID from fire_inspect t where EXTENDCODE2 is not null group by SENTRYTASKID)d on d.SENTRYTASKID=b.id";
|
|
sql += " where b.id='" + taskId + "'";
|
|
sql += "";
|
|
DataTable data2 = new CommomBLL().GetTableList(sql);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
returnstr += ",\"echartsData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data2);
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 巡查巡检
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountPatrolTask(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string orgId = context.Request.Params["OrgId"];//机构id
|
|
string date = context.Request.Params["date"];//日期
|
|
string sql = "";
|
|
string sql1 = "";
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.FIRE.FIRE_INSPECT inspectBLL = new FangYar.BLL.FIRE.FIRE_INSPECT();
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
|
|
sql += " select org_name,org_id ,IFNULL(wxc, 0)+IFNULL(yxc, 0) zs,";
|
|
sql += " IFNULL(wxc, 0) wxc, IFNULL(yxc, 0) yxc,CONCAT(round(IFNULL((IFNULL(yxc,0)/(case when IFNULL(wxc+yxc,0)=0 then 1 else IFNULL(wxc+yxc,0) end))*100,0),2),'%') xcl from ";
|
|
sql += " (SELECT org_name,org_id,IFNULL(sum(case state when '0' then 1 else 0 end),0) wxc,IFNULL(sum(case state when '1' then 1 else 0 end),0) yxc";
|
|
sql += " from ( select fo.org_name , fo.org_id , pt.state state from fire_org fo left join ( ";
|
|
sql += " select tas.id , tas.org_id , tra.state from ( ";
|
|
sql += " select * from oa_patrol_task where date_format(s_time,'%Y-%m-%d') = date_format('" + date + "','%Y-%m-%d') ";
|
|
sql += " ) tas left join oa_patrol_trajectory tra on tas.id = tra.task_id ";
|
|
sql += " ) pt on fo.org_id = pt.org_id where fo.org_id in ";
|
|
sql += " (select org_id from fire_org,(select get_Org_child_list('" + orgId + "') cids) s where extendcode1 = 1 and find_in_set(org_id,cids) ) and fo.TYPE = 0) ";
|
|
sql += " )t GROUP BY org_name,org_id) s";
|
|
|
|
|
|
sql1 += "select b.id taskid,b.org_id,b.NAME,b.EMP_NAME,date_format(s_time,'%Y-%m-%d %H:%i:%s') S_TIME,";
|
|
sql1 += "date_format(e_time,'%Y-%m-%d %H:%i:%s') E_TIME,STATE from oa_patrol_task b ";
|
|
sql1 += " where b.org_id='" + orgId + "'";
|
|
sql1 += " and date_format(s_time,'%Y-%m-%d %H:%i:%s') = date_format('" + date + "','%Y-%m-%d')";
|
|
|
|
|
|
returnstr += ",\"orgData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += ",\"taskData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql1));
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 巡查巡检任务列表
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountPatrolTaskList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string task_Id = context.Request.Params["task_Id"];//机构id
|
|
string sql = "";
|
|
string sql1 = "";
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.FIRE.FIRE_INSPECT inspectBLL = new FangYar.BLL.FIRE.FIRE_INSPECT();
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
|
|
sql += " SELECT '" + task_Id + "' TASK_ID,(select name from oa_patrol_task t WHERE t.id='" + task_Id + "' ) TASKNAME ";
|
|
|
|
sql1 += " ,wxc+yxc ZS,WXC,YXC,CONCAT(round(yxc/wxc+yxc,2),'%') XCL from ( ";
|
|
sql1 += " select IFNULL(SUM(case state when 0 then 1 else 0 end),0) wxc,IFNULL(SUM(case state when 1 then 1 else 0 end),0) yxc ";
|
|
sql1 += " from( select state from oa_patrol_trajectory where task_id='" + task_Id + "' ) t) s";
|
|
|
|
returnstr += ",\"Data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += ",\"echartsData\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql1));
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 巡查巡检任务点数据
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetPartolTaskTrajectory(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string org_id = context.Request.Params["org_id"];//机构id
|
|
string taskdate = context.Request.Params["taskdate"];//taskdate
|
|
string type = context.Request.Params["type"];//type
|
|
string islower = context.Request.Params["islower"];//islower
|
|
string page = context.Request.Params["page"];//page
|
|
string limit = context.Request.Params["limit"];//limit
|
|
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
int satrtNum = 1, endNum = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
satrtNum = (pageIndex - 1) * pageSize;
|
|
satrtNum = satrtNum < 0 ? 0 : satrtNum;
|
|
endNum = pageSize;
|
|
string sql = "";
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
|
|
sql += " select t.name, opt.* from OA_PATROL_TASK t inner join OA_PATROL_TRAJECTORY opt on t.id = opt.task_id ";
|
|
sql += " where ";
|
|
if (islower == "0")
|
|
{
|
|
sql += " t.org_id = '" + org_id + "' ";
|
|
}
|
|
else if (islower == "1")
|
|
{
|
|
sql += " t.org_id in ( select o.org_id from fire_org o,(select get_Org_child_list('" + org_id + "') cids ) s where find_in_set(org_id,cids) )";
|
|
}
|
|
sql += "and date_format(t.s_time,'%Y-%m-%d %H:%i:%s')= date_format('" + taskdate + "', '%Y-%m-%d')";
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
if (type == "0") //未完成
|
|
{
|
|
sql += " and opt.state! = '1'";
|
|
}
|
|
else
|
|
{
|
|
sql += " and opt.state = '1'";
|
|
}
|
|
}
|
|
sql += " limit " + satrtNum + " , " + endNum;
|
|
returnstr += ",\"Data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 公差统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetToleranceSta(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string org_id = context.Request.Params["org_id"];//机构id
|
|
string stime = context.Request.Params["stime"];//stime
|
|
string etime = context.Request.Params["etime"];//etime
|
|
string islower = context.Request.Params["islower"];//islower 0 本级 1多级
|
|
|
|
string sql = "";
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
|
|
sql += @" SELECT org_name,org_id
|
|
,IFNULL(SUM(case L_type when 'ee62a186-336f-4984-b650-fd9826ad82cd' then gcnum else 0 end),0) incar
|
|
,IFNULL(SUM(case L_type when '33a0821a-c264-44be-8da3-70a4077e933e' then gcnum else 0 end),0) innocar
|
|
,IFNULL(SUM(case L_type when '6bba0521-37e7-4c30-9bcd-971815ac6168' then gcnum else 0 end),0) outcar
|
|
,IFNULL(SUM(case L_type when '48137282-3373-4da0-836f-fd223849a85f' then gcnum else 0 end),0) outnocar ";
|
|
sql += " from( select a.org_name, a.org_id, b.L_TYPE, b.gcnum from fire_org a left join (";
|
|
sql += " select org_id, l_type, count(l_type) as gcnum from( select t.*, e.org_id from OA_TOLERANCE t left";
|
|
sql += " join tbl_sys_emp e on e.IS_ADMIN='0' and t.ppl_id = e.users_uid left join dictionary d on t.l_type = d.id";
|
|
sql += " where date_format('" + stime + "', '%Y-%m-%d') <= date_format(t.S_TIME, '%Y-%m-%d %H:%i:%s')";
|
|
sql += " and date_format('" + etime + "', '%Y-%m-%d') >= date_format(t.E_TIME, '%Y-%m-%d %H:%i:%s')";
|
|
sql += " ) s group by org_id, l_type";
|
|
sql += " ) b on a.org_id = b.org_id where ";
|
|
if (islower == "1")
|
|
{
|
|
sql += " a.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(org_id,cids) )";
|
|
}
|
|
else if (islower == "0")
|
|
{
|
|
sql += " a.org_id ='" + org_id + "'";
|
|
}
|
|
sql += " order by a.extendcode1 ";
|
|
|
|
sql += " ) v GROUP BY org_name,org_id ";
|
|
returnstr += ",\"Data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
/// <summary>
|
|
/// 公差统计列表
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppGetToleranceStaList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string org_id = context.Request.Params["org_id"];//机构id
|
|
string ppl_name = context.Request.Params["ppl_name"];//ppl_name
|
|
string l_type = context.Request.Params["l_type"];//l_type
|
|
string stime = context.Request.Params["stime"];//stime
|
|
string etime = context.Request.Params["etime"];//etime
|
|
string islower = context.Request.Params["islower"];//islower 0 本级 1多级
|
|
string page = context.Request.Params["page"];//page
|
|
string limit = context.Request.Params["limit"];//limit
|
|
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
int satrtNum = 1, endNum = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
satrtNum = (pageIndex - 1) * pageSize;
|
|
satrtNum = satrtNum < 0 ? 0 : satrtNum;
|
|
endNum = pageSize;
|
|
|
|
string sql = "";
|
|
returnstr = "{\"code\":0,\"msg\":\"\"";
|
|
|
|
sql += " select * from ( select a.* ,b.org_name from(";
|
|
sql += " select t.*,e.org_id , d.title as dtitle from OA_TOLERANCE t left";
|
|
sql += " join tbl_sys_emp e on e.IS_ADMIN='0' and t.ppl_id = e.users_uid left join dictionary d on t.l_type = d.id";
|
|
sql += " where 1 = 1";
|
|
if (!string.IsNullOrEmpty(ppl_name))
|
|
{
|
|
sql += " and ppl_name like '%" + ppl_name + "%'";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(l_type))
|
|
{
|
|
sql += " and l_type = '" + l_type + "'";
|
|
}
|
|
|
|
sql += " and date_format('" + stime + "', '%Y-%m-%d') <= date_format(t.S_TIME, '%Y-%m-%d') ";
|
|
sql += " and date_format('" + etime + "', '%Y-%m-%d') >= date_format(t.E_TIME, '%Y-%m-%d')";
|
|
sql += " )a left join fire_org b on a.org_id = b.org_id ";
|
|
sql += " where ";
|
|
if (islower == "1")
|
|
{
|
|
sql += " a.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(org_id,cids) )";
|
|
}
|
|
else if (islower == "0")
|
|
{
|
|
sql += " a.org_id ='" + org_id + "'";
|
|
}
|
|
sql += " ) t limit " + satrtNum + " , " + endNum;
|
|
|
|
returnstr += ",\"Data\":";
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(new CommomBLL().GetTableList(sql));
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 请假统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountLeave(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string org_id = context.Request.Params["org_id"];//机构id
|
|
string stime = context.Request.Params["stime"];//stime
|
|
string etime = context.Request.Params["etime"];//etime
|
|
string islower = context.Request.Params["islower"];//islower 0 本级 1多级
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
string sql = "select o.org_id,o.org_name,IFNULL(sj+bj+nj+cj+phj+lx+tqj,0) qjzs,IFNULL(sj,0)sj,IFNULL(bj,0)bj,IFNULL(nj,0)nj,IFNULL(cj,0)cj,IFNULL(phj,0)phj,nIFNULLvl(lx,0)lx,IFNULL(tqj,0)tqj from ";
|
|
sql += " (select org_id,org_name from fire_org,(select get_Org_child_list('" + org_id + "') cids ) s where type=0 ";
|
|
if (!string.IsNullOrEmpty(islower) && islower == "1")
|
|
{
|
|
sql += " and find_in_set(org_id,cids) ";
|
|
}
|
|
else
|
|
{
|
|
sql += " and org_id ='" + org_id + "' ";
|
|
}
|
|
|
|
sql += ") o left join ";
|
|
sql += @" (SELECT org_id ,sum(case l_type when 'a1e92887-8230-4aba-8a06-bebffdee8043' then 1 else 0 end) sj
|
|
,sum(case l_type when 'd0b8d5f6-b708-4bec-ba2f-f4bd15d274e4' then 1 else 0 end) bj
|
|
,sum(case l_type when '88f884d7-4b8e-441a-a3f5-b9192629d4e0' then 1 else 0 end) nj
|
|
,sum(case l_type when 'd2122199-23a7-4b59-87d4-b9b60e17735b' then 1 else 0 end) cj
|
|
,sum(case l_type when 'f594d6d0-4ad7-4695-ad2e-6a06c870b25d' then 1 else 0 end) phj
|
|
,sum(case l_type when '16c2c5d0-bd9f-efa9-b9af-6f71ab17f8ba' then 1 else 0 end) lx
|
|
,sum(case l_type when '1cc3d849-b755-4f2c-8fc7-d47610030373' then 1 else 0 end) tqj
|
|
from ( ";
|
|
sql += " select users_uid,org_id,l_type from OA_LEAVE a left join TBL_SYS_EMP b on b.IS_ADMIN='0' and b.users_uid=a.ppl_id ";
|
|
sql += " where STATE='1' AND date_format(substr(S_TIME, 1,10), '%Y-%m-%d') >= date_format('" + stime + "', '%Y-%m-%d') ";
|
|
sql += " and date_format(substr(E_TIME, 1,10), '%Y-%m-%d') <= date_format('" + etime + "', '%Y-%m-%d') ";
|
|
sql += " ) t group by org_id ) k on o.org_id=k.org_id";
|
|
DataTable data = new CommomBLL().GetTableList(sql);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 用车统计
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns></returns>
|
|
private string AppCountCarApply(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string org_id = context.Request.Params["org_id"];//机构id
|
|
string stime = context.Request.Params["stime"];//stime
|
|
string etime = context.Request.Params["etime"];//etime
|
|
string islower = context.Request.Params["islower"];//islower 0 本级 1多级
|
|
|
|
FangYar.BLL.FIRE.FIRE_ORG orgBll = new FangYar.BLL.FIRE.FIRE_ORG();
|
|
FangYar.BLL.TBL.SysEmpBLL empBll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
|
|
string sql = "select o.org_id,o.org_name,nvl(k.zs,0) from ";
|
|
sql += " (select org_id,org_name from fire_org where,(select get_Org_child_list('" + org_id + "') cids ) s type=0 ";
|
|
if (!string.IsNullOrEmpty(islower) && islower == "1")
|
|
{
|
|
sql += " and find_in_set(org_id,cids) ";
|
|
}
|
|
else
|
|
{
|
|
sql += " and org_id ='" + org_id + "' ";
|
|
}
|
|
|
|
sql += ") o left join ";
|
|
sql += " (select org_id,count(1) zs from ( ";
|
|
sql += " select USERID,org_id from TBL_SYS_CARAPPLY a left join TBL_SYS_EMP b on b.IS_ADMIN='0' and b.users_uid=a.userid ";
|
|
sql += " where STATE='1' AND date_format(STARTTIME, '%Y-%m-%d') >= date_format('" + stime + "', '%Y-%m-%d') ";
|
|
sql += " and date_format(FINISHTIME, '%Y-%m-%d') <= date_format('" + etime + "', '%Y-%m-%d') )";
|
|
sql += " group by org_id) k on o.org_id=k.org_id";
|
|
DataTable data = new CommomBLL().GetTableList(sql);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(data);
|
|
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 信息列表
|
|
|
|
//人员列表查询
|
|
private string AppGetOrgEmpList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["orgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string iswork = context.Request.Params["iswork"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string islower = context.Request.Params["islower"];
|
|
string sdate = context.Request.Params["sdate"];
|
|
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(islower) && islower == "1")
|
|
{
|
|
where = " find_in_set(org_id,cids) ";
|
|
}
|
|
else
|
|
{
|
|
where = " ORG_ID = '" + OrgId + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(iswork))
|
|
{
|
|
if (iswork == "1")
|
|
{
|
|
//where += " and IS_WORK='1' ";
|
|
where += "and USERS_UID not in ( select PPL_ID from OA_LEAVE where STATE='1' AND date_format( substr(s_time,1,10 ), '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format( substr(e_time,0,10 ), '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d')) ";
|
|
where += "and USERS_UID not in ( select PPL_ID from OA_TOLERANCE where STATE='1' AND date_format( substr(s_time,1,10 ), '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format( substr(e_time,0,10 ), '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d')) ";
|
|
|
|
}
|
|
else if (iswork == "2")
|
|
{
|
|
//where += " and IS_WORK='4' ";
|
|
|
|
where += "and USERS_UID in ( select PPL_ID from OA_LEAVE where STATE='1' AND date_format( substr(s_time,1,10 ), '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format( substr(e_time,0,10 ), '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d')) ";
|
|
}
|
|
else if (iswork == "3")
|
|
{
|
|
|
|
// where += " and IS_WORK != '1' and IS_WORK != '4' ";
|
|
where += "and USERS_UID in ( select PPL_ID from OA_TOLERANCE where STATE='1' AND date_format( substr(s_time,1,10 ), '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format( substr(e_time,0,10 ), '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d')) ";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and ( emp_name like '%" + keyword + "%' or idnumber like '%" + keyword + "%')";
|
|
}
|
|
where += " and (IS_DEL ='0' or IS_DEL is null ) ";
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
|
|
int count = bll.GetRecordCount(where, OrgId);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.TBL.TBL_SYS_EMP_Model> list = bll.QueryList(pageIndex, pageSize, where, " sort desc , emp_num ", OrgId);
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//车辆列表查询
|
|
private string AppGetOrgCarList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["orgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string iswork = context.Request.Params["iswork"];
|
|
string type = context.Request.Params["type"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string islower = context.Request.Params["islower"];
|
|
string sdate = context.Request.Params["sdate"];
|
|
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(islower) && islower == "1")
|
|
{
|
|
where = " 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 = " ORG_ID = '" + OrgId + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(iswork))
|
|
{
|
|
if (iswork == "1")
|
|
{
|
|
//where += " and (ISAPPLY='0' or ISAPPLY='1' ) ";
|
|
where += " and CAR_NUM not in (select CARNUM from tbl_sys_carapply where STATE='1' AND date_format(STARTTIME, '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format(FINISHTIME, '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d'))";
|
|
|
|
}
|
|
else if (iswork == "2")
|
|
{
|
|
//where += " and ISAPPLY='2' ";
|
|
where += "and CAR_NUM in (select CARNUM from tbl_sys_carapply where STATE='1' AND date_format(STARTTIME, '%Y-%m-%d') >= date_format('" + sdate + "', '%Y-%m-%d') and date_format(FINISHTIME, '%Y-%m-%d') <= date_format('" + sdate + "', '%Y-%m-%d'))";
|
|
}
|
|
else if (iswork == "3")
|
|
{
|
|
where += " and ISAPPLY != '0' and ISAPPLY != '1' ";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
where += "and CLASS='" + type + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and ( CAR_NUM like '%" + keyword + "%' or CAR_NO like '%" + keyword + "%' or CAR_NAME like '%" + keyword + "%')";
|
|
}
|
|
where += " and (IS_DEL ='0' or IS_DEL is null ) ";
|
|
FangYar.BLL.TBL_SYS_CAR bll = new FangYar.BLL.TBL_SYS_CAR();
|
|
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\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//请假列表查询
|
|
private string AppGetOrgLeaveList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["org_id"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string type = context.Request.Params["type"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string islower = context.Request.Params["islower"];
|
|
string stime = context.Request.Params["stime"];//stime
|
|
string etime = context.Request.Params["etime"];//etime
|
|
|
|
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(islower) && islower == "1")
|
|
{
|
|
where = " ppl_id in(select users_uid from TBL_SYS_EMP,(select get_Org_child_list('" + OrgId + "') cids ) s where IS_ADMIN='0' and find_in_set(org_id,cids)) ";
|
|
}
|
|
else
|
|
{
|
|
where = "ppl_id in(select users_uid from TBL_SYS_EMP where IS_ADMIN='0' and ORG_ID = '" + OrgId + "') ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(type))
|
|
{
|
|
where += "and L_TYPE='" + type + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
where += " and (PPL_NAME like '%" + keyword + "%' or TITLE like '%" + keyword + "%' or L_OUT like '%" + keyword + "%' or L_REASON like '%" + keyword + "%') ";
|
|
}
|
|
where += " and date_format(substr(S_TIME, 1,10), '%Y-%m-%d') >= date_format('" + stime + "', '%Y-%m-%d') ";
|
|
where += " and date_format(substr(E_TIME, 1,10), '%Y-%m-%d') <= date_format('" + etime + "', '%Y-%m-%d') ";
|
|
where += " and STATE='1' ";
|
|
FangYar.BLL.OA_LEAVE bll = new FangYar.BLL.OA_LEAVE();
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<Model.OA_LEAVE> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
//用车记录列表
|
|
private string AppGetCarApplyListByOrgId(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["org_id"];
|
|
string keywords = context.Request.Params["keywords"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string stime = context.Request.Params["stime"];
|
|
string etime = context.Request.Params["etime"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
FangYar.BLL.TBL_SYS_CARAPPLY carBll = new FangYar.BLL.TBL_SYS_CARAPPLY();
|
|
|
|
string where = null;
|
|
//where = "(USERID = '" + uid + "' or USERID = 'u_" + uid + "') ";
|
|
|
|
where = " USERID in ( select USERS_UID from TBL_SYS_EMP where IS_ADMIN='0' and org_id ='" + OrgId + "' ) ";
|
|
|
|
if (!string.IsNullOrEmpty(keywords))
|
|
{
|
|
where += " and ( USERNAME like '%" + keywords + "%' or TITLE like '%" + keywords + "%' or carnum like '%" + keywords + "%' ) ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(stime))
|
|
{
|
|
where += " and date_format(STARTTIME, '%Y-%m-%d') >= date_format('" + stime + "', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(etime))
|
|
{
|
|
where += " and date_format(FINISHTIME, '%Y-%m-%d') <= date_format('" + etime + "', '%Y-%m-%d') ";
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = carBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.TBL_SYS_CARAPPLY> list = carBll.QueryList(pageIndex, pageSize, where, " STARTTIME desc");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 考勤模块
|
|
//用车记录列表
|
|
private string AppGetOaAttendanceRecord(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["org_id"];
|
|
string recordtime = context.Request.Params["recordtime"];
|
|
string up_state = context.Request.Params["up_state"];
|
|
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); }
|
|
int startIndex = (pageIndex - 1) * pageSize + 1;
|
|
int endIndex = pageSize;
|
|
startIndex = startIndex < 0 ? 0 : startIndex;
|
|
FangYar.BLL.OA.OA_ATTENDANCE_RECORD arBll = new FangYar.BLL.OA.OA_ATTENDANCE_RECORD();
|
|
|
|
string where = " 1=1 ";
|
|
where += " and org_id ='" + OrgId + "'";
|
|
if (!string.IsNullOrEmpty(recordtime))
|
|
{
|
|
where += " and date_format(attendance_date, '%Y-%m-%d') = date_format('" + recordtime + "', '%Y-%m-%d') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(up_state))
|
|
{
|
|
if (up_state == "0")
|
|
{
|
|
where += " and((up_state = '0' or up_state is null) or (down_state = '0' or down_state is null)) "; //未打卡
|
|
}
|
|
else
|
|
{
|
|
where += " and ( up_state = '" + up_state + "' or down_state = '" + up_state + "')";
|
|
// 0未打卡 -- 1 正常 '2'-- 迟到 '3'-- 外勤
|
|
}
|
|
}
|
|
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = arBll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = arBll.GetListByPage(where, " up_report_time ", startIndex, endIndex).Tables[0];
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsReusable
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|