public override string Edit() { if (!PreEdit(this.ProjectId)) { return(""); } var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId); var store = StoreBasicInfo.GetStorInfo(closureEntity.USCode); var taskWork = new TaskWork(); var source = FlowInfo.Get(FlowCode.Closure); var taskType = FlowInfo.Get(FlowCode.Closure_WOCheckList); taskWork.SourceCode = source.Code; taskWork.SourceNameZHCN = source.NameZHCN; taskWork.SourceNameENUS = source.NameENUS; taskWork.Status = TaskWorkStatus.UnFinish; taskWork.StatusNameZHCN = "任务"; taskWork.StatusNameENUS = "任务"; taskWork.Title = TaskWork.BuildTitle(this.ProjectId, store.NameZHCN, store.NameENUS); taskWork.RefID = this.ProjectId; taskWork.StoreCode = closureEntity.USCode; taskWork.TypeCode = taskType.Code; taskWork.TypeNameENUS = taskType.NameENUS; taskWork.TypeNameZHCN = taskType.NameZHCN; taskWork.ReceiverAccount = closureEntity.PMAccount; taskWork.ReceiverNameENUS = closureEntity.PMNameENUS; taskWork.ReceiverNameZHCN = closureEntity.PMNameZHCN; taskWork.Id = Guid.NewGuid(); taskWork.CreateTime = DateTime.Now; taskWork.Url = TaskWork.BuildUrl(FlowCode.Closure_WOCheckList, this.ProjectId, ""); taskWork.ActivityName = NodeCode.Start; TaskWork.Add(taskWork); this.IsHistory = true; this.RefreshClosureTool = false; //TaskWork.SetTaskHistory(this.Id, this.ProcInstID); this.Save(); var objectCopy = new ObjectCopy(); var newWo = objectCopy.AutoCopy(this); newWo.Id = Guid.NewGuid(); newWo.ProcInstID = 0; newWo.Save(); var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_WOCheckList); ProjectInfo.UnFinishNode(this.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_Approve, ProjectStatus.UnFinish); var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() && e.RefTableName == ClosureWOCheckList.TableName); var objCopy = new ObjectCopy(); var newList = new List <Attachment>(); foreach (var att in attList) { var newAtt = objCopy.AutoCopy(att); newAtt.RefTableID = newWo.Id.ToString(); newAtt.ID = Guid.NewGuid(); newList.Add(newAtt); } Attachment.AddList(newList); return(taskWork.Url); }
public override string Edit() { var taskWork = TaskWork.Search(e => e.ReceiverAccount == ClientCookie.UserCode && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ConsInvtChecking && e.RefID == this.ProjectId ).AsNoTracking().FirstOrDefault(); taskWork.Status = TaskWorkStatus.UnFinish; taskWork.StatusNameZHCN = "任务"; taskWork.StatusNameENUS = "任务"; var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId); taskWork.ReceiverAccount = closureEntity.PMAccount; taskWork.ReceiverNameENUS = closureEntity.PMNameENUS; taskWork.ReceiverNameZHCN = closureEntity.PMNameZHCN; taskWork.Id = Guid.NewGuid(); taskWork.ProcInstID = null; taskWork.CreateTime = DateTime.Now; taskWork.Url = "/Closure/Main#/ConsInvtChecking?projectId=" + this.ProjectId; taskWork.ActivityName = NodeCode.Start; taskWork.ActionName = SetTaskActionName(ProjectId); taskWork.ProcInstID = null; taskWork.FinishTime = null; TaskWork.Add(taskWork); this.IsHistory = true; this.Save(); var objectCopy = new ObjectCopy(); var newEntity = objectCopy.AutoCopy(this); newEntity.Id = Guid.NewGuid(); newEntity.ProcInstID = 0; newEntity.Save(); //var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_ConsInvtChecking); //projectEntity.Status = ProjectStatus.UnFinish; //ProjectInfo.Update(projectEntity); //ProjectInfo.UpdateProjectNode(this.ProjectId, FlowCode.Closure_ConsInvtChecking, // NodeCode.Closure_ConsInvtChecking_Approve); //ProjectInfo.Reset(ProjectId, FlowCode.Closure); ProjectInfo.Reset(ProjectId, FlowCode.Closure_ConsInvtChecking); ProjectInfo.UnFinishNode(this.ProjectId, FlowCode.Closure_ConsInvtChecking, NodeCode.Closure_ConsInvtChecking_Approve, ProjectStatus.UnFinish); var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() && e.RefTableName == ClosureConsInvtChecking.TableName).AsNoTracking(); var newList = new List <Attachment>(); foreach (var att in attList) { var newAtt = objectCopy.AutoCopy(att); newAtt.RefTableID = newEntity.Id.ToString(); newAtt.ID = Guid.NewGuid(); newList.Add(newAtt); } Attachment.Add(newList.ToArray()); return(taskWork.Url); }