/// <summary> /// 提交任务 /// </summary> /// <param name="t"></param> /// <returns></returns> public IHttpActionResult SubmitTask(SubmitTask t) { if (t.TaskId == 0 || t.ProofId == "") { return(BadRequest()); } ProofTaskOper pto = new ProofTaskOper(SessionManage.CurrentUser); //提交任务 string re = pto.SubmitTask(t.TaskId); if (re != "") { return(BadRequest(re)); } //执行下步任务 if (t.NextTaskId > 0) { re = pto.BeginTask(t.NextTaskId); if (re != "") { return(BadRequest(re)); } } else { string upTaskNO = ProofTaskOper.GetTask(t.TaskId).TaskNo; Task newTask = new Task { TaskNo = t.NextTaskNO, ProofOrderId = t.ProofId, ProcessId = t.NextProcessId, ProcessName = t.NextProcessName, UpTaskNo = upTaskNO, WorkerName = t.NextWorkerName, BeginDate = DateTime.Now.Date, NeedFinshDate = DateTime.Now.Date.AddDays(1), }; var pt = pto.AddTask(newTask, SG.Model.Stats.进行中); } pto.SaveChanges(); if (re == "") { return(Ok()); } else { return(BadRequest(re)); } }
public IHttpActionResult AddTask(Task task) { ProofTaskOper pto = new ProofTaskOper(SessionManage.CurrentUser); var pt = pto.AddTask(task, SG.Model.Stats.进行中); pto.SaveChanges(); if (pt != null) { if (task.ProcessName == "工艺") { new GyOper().AddOrUpdataGlRecord(pt); } return(Ok()); } return(BadRequest()); }
public IHttpActionResult DeleteTask(string id) { if (id != "") { int Id = int.Parse(id); ProofTaskOper pto = new ProofTaskOper(SessionManage.CurrentUser); if (pto.DeleteTask(Id)) { pto.SaveChanges(); return(Ok()); } else { return(NotFound()); } } else { return(BadRequest()); } }