/// <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> 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> 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 + "'}"; }