private void ExportByIDs() { #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { return; } #endregion DataTable taskDt = BLL.ProjectTaskInfo.Instance.GetExportTaskList(taskIDStr); if (taskDt != null) { ExportData(taskDt); } }
/// <summary> /// 收回任务 /// </summary> /// <param name="msg"></param> internal void RevokeTask(out string msg) { msg = string.Empty; string Result = "yes"; string ErrorMsg = ""; //不为空 if (!string.IsNullOrEmpty(TaskIDS)) { if (TaskIDS.IndexOf(',') > 0) { for (int i = 0; i < TaskIDS.Split(',').Length; i++) { int userid = 0; Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS.Split(',')[i])); //判断任务状态,是否为已处理 if (Model.TaskStatus != (int)Entities.TaskStatus.Processed) { //取要被收回任务的处理人 if (Model.AssignUserID != null && Model.AssignUserID != -2) { userid = Convert.ToInt32(Model.AssignUserID); } Model.AssignUserID = null; Model.TaskStatus = (int)Entities.TaskStatus.NoAllocation; BLL.OrderTask.Instance.Update(Model); Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Recover; logmodel.TaskStatus = (int)Entities.TaskStatus.NoAllocation; if (userid != 0) { logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(userid); } logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。"; } } } else { int userid = 0; Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS)); //判断任务状态,是否为已处理 if (Model.TaskStatus != (int)Entities.TaskStatus.Processed) { //取要被收回任务的处理人 if (Model.AssignUserID != null && Model.AssignUserID != -2) { userid = Convert.ToInt32(Model.AssignUserID); } Model.AssignUserID = null; Model.TaskStatus = (int)Entities.TaskStatus.NoAllocation; BLL.OrderTask.Instance.Update(Model); Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Recover; logmodel.TaskStatus = (int)Entities.TaskStatus.NoAllocation; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(userid); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。"; } } } msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}"; }
/// <summary> /// 分配任务 /// </summary> /// <param name="msg"></param> internal void AssignTask(out string msg) { msg = string.Empty; string Result = "yes"; string ErrorMsg = ""; //不为空 if (!string.IsNullOrEmpty(TaskIDS) && !string.IsNullOrEmpty(AssignUserID)) { if (TaskIDS.IndexOf(',') > 0) { for (int i = 0; i < TaskIDS.Split(',').Length; i++) { Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS.Split(',')[i])); if (Model.TaskStatus == (int)Entities.TaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.TaskStatus.NoProcess; BLL.OrderTask.Instance.Update(Model); //插入任务操作日志 Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.TaskStatus.NoProcess; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(Convert.ToInt32(AssignUserID)); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } else { Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS)); if (Model.TaskStatus == (int)Entities.TaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.TaskStatus.NoProcess; BLL.OrderTask.Instance.Update(Model); //插入任务操作日志 Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.TaskStatus.NoProcess; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(Convert.ToInt32(AssignUserID)); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}"; }
/// <summary> /// 回收任务 /// </summary> /// <param name="msg"></param> private void RecedeTask(out string msg) { msg = ""; //增加回收权限控制 int userId = BLL.Util.GetLoginUserID(); if (!BLL.Util.CheckRight(userId, "SYS024BUT150102")) { msg += "您没有收回操作权限"; return; } #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.OtherTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { //可回收的任务:任务状态为2-未处理、3-处理中 if (dr["TaskStatus"].ToString() != "2" && dr["TaskStatus"].ToString() != "3") { msg += "所选任务中,存在不允许收回的任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } #endregion #region 除 BLL.ProjectTask_Employee.Instance.DeleteByIDs(taskIDStr); #endregion #region 改状态 foreach (string item in tidList) { BLL.OtherTaskInfo.Instance.UpdateTaskStatus(item, Entities.OtheTaskStatus.Unallocated, Entities.EnumProjectTaskOperationStatus.TaskBack, "回收", userId); } #endregion }
private void StopTask(out string msg) { msg = ""; //增加结束权限控制 int userId = BLL.Util.GetLoginUserID(); if (!BLL.Util.CheckRight(userId, "SYS024BUT150104")) { msg += "您没有结束操作权限"; return; } #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.OtherTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { if (dr["TaskStatus"].ToString() == "4" || dr["TaskStatus"].ToString() == "5") { msg += "所选任务中,存在不允许结束的任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } #endregion #region 改状态 // BLL.ProjectTask_Employee.Instance.UpdateStatus(taskIDStr, "180016"); foreach (string item in tidList) { BLL.OtherTaskInfo.Instance.UpdateTaskStatus(item, Entities.OtheTaskStatus.StopTask, Entities.EnumProjectTaskOperationStatus.TaskFinish, "结束", userId); } #endregion }
/// <summary> /// 分配任务 /// </summary> /// <param name="msg"></param> private void AssignTaskByUseid(out string msg) { msg = ""; #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.OtherTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { int isAutoCall = CommonFunction.ObjectToInteger(dr["isAutoCall"].ToString()); int projectacstatus = CommonFunction.ObjectToInteger(dr["ProjectACStatus"].ToString()); int taskstatus = CommonFunction.ObjectToInteger(dr["TaskStatus"].ToString()); //所能分配的任务为:1-未分配;未处理-2;处理中-3 if (taskstatus != 1 && taskstatus != 2 && taskstatus != 3) { msg += "所选任务中,存在不允许分配的任务"; break; } else if (isAutoCall == 1 && projectacstatus == (int)ProjectACStatus.P01_进行中) { msg += "所选任务中,存在正在进行中的自动外呼任务,无法分配任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } #endregion #region MyRegion Entities.ProjectTask_Employee model = null; List <Entities.ProjectTask_Employee> list = new List <Entities.ProjectTask_Employee>(); foreach (string str in tidList) { model = new Entities.ProjectTask_Employee(); model.PTID = str; model.UserID = int.Parse(AssignUserID); model.Status = 0; model.CreateTime = DateTime.Now; model.CreateUserID = userId; list.Add(model); } #endregion #region 除原分配信息,插入新分配信息 BLL.ProjectTask_Employee.Instance.DeleteByIDs(taskIDStr); foreach (Entities.ProjectTask_Employee item in list) { BLL.ProjectTask_Employee.Instance.Add(item); insertLog(null, item); } foreach (string item in tidList) { BLL.OtherTaskInfo.Instance.UpdateTaskStatus(item, Entities.OtheTaskStatus.Untreated, Entities.EnumProjectTaskOperationStatus.TaskAllot, "分配", userId); } #endregion }
/// <summary> /// 分配任务 /// </summary> /// <param name="msg"></param> private void AssignTask(out string msg) { msg = string.Empty; string Result = "yes"; string ErrorMsg = ""; //不为空 if (!string.IsNullOrEmpty(TaskIDS) && !string.IsNullOrEmpty(AssignUserID)) { if (TaskIDS.IndexOf(',') > 0) { string[] arrayTaskIDS = TaskIDS.Split(','); foreach (string taskid in arrayTaskIDS) { Entities.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(taskid)); if (Model.TaskStatus == (int)Entities.GroupTaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.GroupTaskStatus.NoProcess; BLL.GroupOrderTask.Instance.Update(Model); //插入任务操作日志 Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.GroupTaskStatus.NoProcess; logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } else { Entities.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(TaskIDS)); if (Model.TaskStatus == (int)Entities.GroupTaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.GroupTaskStatus.NoProcess; BLL.GroupOrderTask.Instance.Update(Model); //插入任务操作日志 Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.GroupTaskStatus.NoProcess; logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}"; }
private void StopTask(out string msg) { msg = ""; int userId = BLL.Util.GetLoginUserID(); if (BLL.Util.CheckRight(userId, "SYS024BUT150104")) //添加“任务列表--其它任务”结束验证逻辑 { msg += "没有结束权限"; return; } #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.ProjectTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { if (dr["TaskStatus"].ToString() == "180014" || dr["TaskStatus"].ToString() == "180015" || dr["TaskStatus"].ToString() == "180016") { msg += "所选任务中,存在不允许结束的任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } List <Entities.CustLastOperTask> list_OperTask = new List <Entities.CustLastOperTask>(); List <Entities.CustLastOperTask> list_OldOperTask = new List <Entities.CustLastOperTask>(); DateTime operTime = DateTime.Now; for (int p = 0; p < taskDt.Rows.Count; p++) { if (taskDt.Rows[p]["CRMCustID"].ToString() != "") { Entities.CustLastOperTask operTaskModel = new CustLastOperTask(); Entities.CustLastOperTask operOldTaskModel = null; operOldTaskModel = BLL.CustLastOperTask.Instance.GetCustLastOperTask(taskDt.Rows[p]["CRMCustID"].ToString()); if (operOldTaskModel != null) { list_OldOperTask.Add(operOldTaskModel); operTaskModel.CustID = taskDt.Rows[p]["CRMCustID"].ToString(); operTaskModel.TaskID = taskDt.Rows[p]["PTID"].ToString(); operTaskModel.TaskType = 1; operTaskModel.LastOperTime = operTime; operTaskModel.LastOperUserID = BLL.Util.GetLoginUserID(); list_OperTask.Add(operTaskModel); } } } #endregion #region 改变状态 foreach (string item in tidList) { BLL.ProjectTaskInfo.Instance.UpdateTaskStatus(item, EnumProjectTaskStatus.STOPTask, EnumProjectTaskOperationStatus.TaskFinish, operTime); } #endregion }
private void AssignTaskByUseid(out string msg) { msg = ""; int userId = BLL.Util.GetLoginUserID(); if (BLL.Util.CheckRight(userId, "SYS024BUT150102")) //添加“任务列表--其它任务”回收验证逻辑 { msg += "没有回收权限"; return; } #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.ProjectTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { if (dr["TaskStatus"].ToString() != "180012" && dr["TaskStatus"].ToString() != "180000" && dr["TaskStatus"].ToString() != "180001") { msg += "所选任务中,存在不允许分配的任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } List <Entities.CustLastOperTask> list_OperTask = new List <Entities.CustLastOperTask>(); List <Entities.CustLastOperTask> list_OldOperTask = new List <Entities.CustLastOperTask>(); DateTime operTime = DateTime.Now; for (int p = 0; p < taskDt.Rows.Count; p++) { if (taskDt.Rows[p]["CRMCustID"].ToString() != "") { Entities.CustLastOperTask operTaskModel = new CustLastOperTask(); Entities.CustLastOperTask operOldTaskModel = null; operOldTaskModel = BLL.CustLastOperTask.Instance.GetCustLastOperTask(taskDt.Rows[p]["CRMCustID"].ToString()); if (operOldTaskModel != null) { list_OldOperTask.Add(operOldTaskModel); operTaskModel.CustID = taskDt.Rows[p]["CRMCustID"].ToString(); operTaskModel.TaskID = taskDt.Rows[p]["PTID"].ToString(); operTaskModel.TaskType = 1; operTaskModel.LastOperTime = operTime; operTaskModel.LastOperUserID = BLL.Util.GetLoginUserID(); list_OperTask.Add(operTaskModel); } } } #endregion #region MyRegion Entities.ProjectTask_Employee model = null; List <Entities.ProjectTask_Employee> list = new List <Entities.ProjectTask_Employee>(); foreach (string str in tidList) { model = new Entities.ProjectTask_Employee(); model.PTID = str; model.UserID = int.Parse(AssignUserID); model.Status = 0; model.CreateTime = operTime; model.CreateUserID = userId; list.Add(model); } #endregion #region 除原分配信息,插入新分配信息 BLL.ProjectTask_Employee.Instance.DeleteByIDs(taskIDStr); foreach (Entities.ProjectTask_Employee item in list) { BLL.ProjectTask_Employee.Instance.Add(item); } //BLL.ProjectTask_Employee.Instance.UpdateStatus(taskIDStr, "180000"); foreach (string item in tidList) { BLL.ProjectTaskInfo.Instance.UpdateTaskStatus(item, EnumProjectTaskStatus.NoAssign, EnumProjectTaskOperationStatus.TaskAllot, operTime); } #endregion }
/// <summary> /// 回收任务 /// </summary> /// <param name="msg"></param> private void RecedeTask(out string msg) { msg = ""; #region ID列表串 string taskIDStr = ""; string[] tidList = TaskIDS.Split(','); foreach (string item in tidList) { taskIDStr += "'" + item + "',"; } if (taskIDStr != "") { taskIDStr = taskIDStr.Substring(0, taskIDStr.Length - 1); } else { msg += "请选择任务"; return; } #endregion #region 判断任务状态 //判断任务状态 DataTable taskDt = BLL.ProjectTaskInfo.Instance.GetTaskInfoListByIDs(taskIDStr); if (taskDt != null) { foreach (DataRow dr in taskDt.Rows) { if (dr["TaskStatus"].ToString() != "180001" && dr["TaskStatus"].ToString() != "180000") { msg += "所选任务中,存在不允许收回的任务"; break; } } if (msg != "") { return; } } else { msg += "没找到对应任务"; } List <Entities.CustLastOperTask> list_OperTask = new List <Entities.CustLastOperTask>(); List <Entities.CustLastOperTask> list_OldOperTask = new List <Entities.CustLastOperTask>(); DateTime operTime = DateTime.Now; for (int p = 0; p < taskDt.Rows.Count; p++) { if (taskDt.Rows[p]["CRMCustID"].ToString() != "") { Entities.CustLastOperTask operTaskModel = new CustLastOperTask(); Entities.CustLastOperTask operOldTaskModel = null; operOldTaskModel = BLL.CustLastOperTask.Instance.GetCustLastOperTask(taskDt.Rows[p]["CRMCustID"].ToString()); if (operOldTaskModel != null) { list_OldOperTask.Add(operOldTaskModel); operTaskModel.CustID = taskDt.Rows[p]["CRMCustID"].ToString(); operTaskModel.TaskID = taskDt.Rows[p]["PTID"].ToString(); operTaskModel.TaskType = 1; operTaskModel.LastOperTime = operTime; operTaskModel.LastOperUserID = BLL.Util.GetLoginUserID(); list_OperTask.Add(operTaskModel); } } } #endregion #region 除 BLL.ProjectTask_Employee.Instance.DeleteByIDs(taskIDStr); #endregion #region 改状态 foreach (string item in tidList) { BLL.ProjectTaskInfo.Instance.UpdateTaskStatus(item, EnumProjectTaskStatus.NoSelEmployee, EnumProjectTaskOperationStatus.TaskBack, operTime); } #endregion }