软测单独项目
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.
 
 
 
 
 
 

4266 lines
192 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;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// AppHandler 的摘要说明
/// </summary>
public class AppHandler2 : 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)
{
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "APP操作请求2", "");
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 "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 "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;
}
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}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取待办数异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取待办数");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"taskList\":[],\"flowOptions\":\"\",\"pager\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取待办列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取待办列表");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取已办列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取已办列表");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "请假申请异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "请假申请");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取请假待办详情异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取请假待办详情");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "公差申请异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "公差申请");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取公差待办详情异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取公差待办详情");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "用车申请异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "用车申请");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取用车待办详情异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取用车待办详情");
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"];//标题
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);
}
}
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "请假流程处理异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "请假流程处理");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "公差流程处理异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "公差流程处理");
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);
}
}
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "用车流程处理异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "用车流程处理");
return returnstr;
}
#endregion
#region 根据机构ID获取下属所有部门、人员
//根据机构ID获取下属所有部门、人员
private string AppGetOrgDeptEmpTreeByOrgId(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.getOrgDeptEmpTreeByOrgId(orgId);
returnstr += FangYar.Common.JsonHelper.ToJson(data);
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\",\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID获取下属所有部门、人员");
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "根据机构ID获取下属所有部门、人员");
return returnstr;
}
#endregion
#region 根据机构ID获取下属所有部门、车辆
//根据机构ID获取下属所有部门、车辆
private string AppGetOrgDeptCarTreeByOrgId(HttpContext context)
{
string returnstr = "";
try
{
TBL_SYS_CAR bll = new TBL_SYS_CAR();
string orgId = context.Request.Params["OrgId"];
returnstr = "{\"code\":0,\"msg\":\"\",\"data\":";
DataTable data = bll.GetListCarTree(orgId).Tables[0];
//DataTable data = bll.GetList("ORG_ID='" + orgId + "' and class !=2").Tables[0];
data.Columns.Add("nocheck", typeof(string)); //数据类型为文本
for (int i = 0; i < data.Rows.Count; i++)
{
string aaa = data.Rows[i]["TYPE"].ToString();
if (data.Rows[i]["TYPE"].ToString() == "car")
{
data.Rows[i]["nocheck"] = "false";
}
else
{
data.Rows[i]["nocheck"] = "true";
}
}
returnstr += FangYar.Common.JsonHelper.ToJson(data);
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID获取下属所有部门、车辆异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID获取下属所有部门、车辆");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "请假类型列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "请假类型列表");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "公差类型列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "公差类型列表");
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 += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "请假记录列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "请假记录列表");
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\":[] }";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取请假信息、流转记录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取请假信息、流转记录");
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 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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "公差记录列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "公差记录列表");
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\":[] }";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取公差信息、流转记录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取公差信息、流转记录");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "人员报警列表查询异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "人员报警列表查询");
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 sTime = context.Request.Params["sTime"];
string eTime = context.Request.Params["eTime"];
string carNum = context.Request.Params["carNum"];
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='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(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 + "'";
}
if (!string.IsNullOrEmpty(carNum))
{
where += " and CAR_NUM like '%" + carNum + "%'";
}
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "车辆报警列表查询异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "车辆报警列表查询");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "访客登记列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "访客登记列表");
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 = "审批失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "访客登记单处理异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "访客登记单处理");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "用车记录列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "用车记录列表");
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\":[] }";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取用车信息、流转记录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取用车信息、流转记录");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取访客一周数量趋势异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取访客一周数量趋势");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取人员一周数量趋势异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取人员一周数量趋势");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取车辆一周数量趋势异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取车辆一周数量趋势");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取可用车辆列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取可用车辆列表");
return returnstr;
}
#endregion
#region 岗哨交接
//根据uid获取上岗任务
private string AppGetShiftsListByOrgId(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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取上岗任务异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取上岗任务");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取上岗任务异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取上岗任务");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取历史上岗记录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取历史上岗记录");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据条件判断是否允许上岗,返回当前在岗人信息异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据条件判断是否允许上岗,返回当前在岗人信息");
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"];
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.EXTENDCODE4 == "" || model.EXTENDCODE4 == null)
{
model.EXTENDCODE4 = uid;
}
else
{
model.EXTENDCODE4 += "," + uid;
}
ArrayList oUids = new ArrayList(model.O_UID.Split(','));
ArrayList EXTENDCODE4s = new ArrayList(model.EXTENDCODE4.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 (oUids.Count == 0)
{
model.T_NAME = tName;
model.TO_WORK = toWork;
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "修改交接岗位状态异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "修改交接岗位状态");
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\":\"\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "修改缺岗(超期的)交接岗位状态异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "修改缺岗(超期的)交接岗位状态");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID获取所有下级机构异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID获取所有下级机构");
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\":\"{}\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据rfid获取当前在岗、下次上岗人信息异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据rfid获取当前在岗、下次上岗人信息");
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 + "\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据岗哨表ID替换上岗人信息异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "根据岗哨表ID替换上岗人信息");
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 (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID、报警类型、时间、地点获取报警列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID、报警类型、时间、地点获取报警列表");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID、巡查点类型、名称、地点 获取营区内巡查点列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID、巡查点类型、名称、地点 获取营区内巡查点列表");
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;
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据主键ID得到一个对象实体异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据主键ID得到一个对象实体");
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;
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据IFID(芯片编号)得到一个对象实体异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据IFID(芯片编号)得到一个对象实体");
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;
bool a = bll.ExistsSpotNo(SPOT_NO);
if (a == true)
{
msg = "对不起,该芯片编号已经存在";
}
else
{
if (bll.Add(model))
{
msg = "添加成功!";
code = 1;
}
else { msg = "添加失败!"; }
}
}
catch (Exception e)
{
msg = "添加失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "添加营区内巡查点信息异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "添加营区内巡查点信息");
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"];
//巡查点表
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 (bll.Update(model))
{
msg = "修改成功!";
code = 1;
}
else { msg = "修改失败!"; }
}
catch (Exception e)
{
msg = "修改失败!";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "修改营区内巡查点信息异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "APP操作请求2", "修改营区内巡查点信息");
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(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(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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID、名称、编号 获取消防装备列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID、名称、编号 获取消防装备列表");
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 (Exception e)
{
msg = "添加失败:装备编码有重复数据";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "添加消防装备异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "添加消防装备");
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\":\"查询失败\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取访客审批数角标提醒异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取访客审批数角标提醒");
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 e)
{
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取计划巡查数角标提醒异常" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取计划巡查数角标提醒");
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 e)
{
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取隐患整改数角标提醒异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取隐患整改数角标提醒");
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 e)
{
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "查铺查哨数角标提醒异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "查铺查哨数角标提醒");
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))
{
string where = string.Format(" 1=1 and O_UID ='{0}'", uid);
count = fireShiftsBLL.GetRecordCount(where);
returnstr = "{\"code\":0,\"count\":" + count + ",\"msg\":\"查询成功\"}";
}
else
{
return "{\"code\":1,\"count\":" + count + ",\"msg\":\"查询条件不能为空\"}";
}
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"count\":" + count + ",\"msg\":\"查询失败\"}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "上哨任务数角标提醒异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "上哨任务数角标提醒");
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\":[]";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取本机和下级单位异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取本机和下级单位");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "查询当前机构下训练任务列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "查询当前机构下训练任务列表");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据登录人ID获取训练任务列表(带训人)异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据登录人ID获取训练任务列表(带训人)");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据登录人ID获取训练任务列表(参训人)异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据登录人ID获取训练任务列表(参训人)");
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;
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "带训人上报成绩异常:" + e);
}
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "带训人上报成绩");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "查询当前机构下训练科目异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "查询当前机构下训练科目");
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')";
}
}
if (company == "0")
{
where += " order by ACHIEVEMENT desc , RESULT";
}
else
{
where += " order by ACHIEVEMENT desc , (RESULT) desc";
}
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "站内成绩排名异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "站内成绩排名");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据任务ID获取每人每科训练成绩异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据任务ID获取每人每科训练成绩");
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"];
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')";
}
}
//where += " and ACHIEVEMENT is not null";
where += " AND RESULT IS NOT NULL";
returnstr = "{\"code\":200,\"msg\":\"成功\",";
returnstr += "\"data1\":";
DataTable dttop = bll.GetListByPage(where, " ACHIEVEMENT desc ", 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 ACHIEVEMENT desc";
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取红黑榜异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取红黑榜");
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\": []}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据科目获取标准(根据科目单位,排序)异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据科目获取标准(根据科目单位,排序)");
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 (Exception e)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据科目ID获取科目Model异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据科目ID获取科目Model");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取历史成绩异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取历史成绩");
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();
returnstr = "{\"code\":200,\"msg\":\"成功\",\"data0\":";
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取个人各科最高成绩、训练通过率异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取个人各科最高成绩、训练通过率");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid获取人员的训练成绩科目异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid获取人员的训练成绩科目");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据uid、科目ID获取个人近期训练成绩异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据uid、科目ID获取个人近期训练成绩");
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 (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据字典表类型获取战训知识库模块异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据字典表类型获取战训知识库模块");
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(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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据机构ID查询训练知识库列表异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据机构ID查询训练知识库列表");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "根据知识库ID查询训练知识库详情异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "根据知识库ID查询训练知识库详情");
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\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "获取人员通讯录异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "APP操作请求2", "获取人员通讯录");
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 (Exception e)
{
result = "";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "上传单张图片异常:" + e);
}
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "上传单张图片");
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 = "";
try
{
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 (Exception ex)
{
result += "";
string str = "APP操作请求2—上传多张图片异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "AppHandLog" });
}
}
result = result.Substring(0, result.Length - 1);
}
}
catch (Exception e)
{
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "APP操作请求2", "上传多张图片异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "APP操作请求2", "上传多张图片");
return result;
}
#endregion 图片上传
#region IsReusable
public bool IsReusable
{
get
{
return false;
}
}
#endregion
}
}