Esempio n. 1
0
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var taskWork = TaskWork.Search(e => e.ReceiverAccount == ClientCookie.UserCode &&
                                           e.SourceCode == FlowCode.Closure &&
                                           e.TypeCode == FlowCode.Closure_LegalReview && e.RefID == this.ProjectId
                                           ).FirstOrDefault();

            TaskWork.Cancel(t => t.RefID == ProjectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == this.WorkflowCode);//取消老的流程实例的所有未完成任务
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";

            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);

            taskWork.ReceiverAccount  = closureEntity.AssetActorAccount;
            taskWork.ReceiverNameENUS = closureEntity.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.AssetActorNameENUS;
            taskWork.Id           = Guid.NewGuid();
            taskWork.ProcInstID   = null;
            taskWork.CreateTime   = DateTime.Now;
            taskWork.Url          = "/closure/Main#/LegalReview?projectId=" + this.ProjectId;
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            TaskWork.Add(taskWork);


            this.IsHistory = true;
            //TaskWork.SetTaskHistory(this.Id, this.ProcInstID);

            this.Save();
            var _db = GetDb();

            _db.Entry(this).State = EntityState.Modified;

            var objectCopy = new ObjectCopy();
            var newEntity  = objectCopy.AutoCopy(this);

            newEntity.Id           = Guid.NewGuid();
            newEntity.ProcInstID   = 0;
            newEntity.LegalCommers = "";
            newEntity.Save();
            ProjectInfo.Reset(this.ProjectId, FlowCode.Closure_LegalReview);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureLegalReview.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);

            _db.SaveChanges();
            return(taskWork.Url);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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_ClosureTool);

            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.FinanceAccount;
            taskWork.ReceiverNameENUS = closureEntity.FinanceNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.FinanceNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_ClosureTool, this.ProjectId, "");
            TaskWork.Add(taskWork);

            this.IsHistory = true;
            TaskWork.SetTaskHistory(this.Id, this.ProcInstID);
            this.Save();

            var objectCopy = new ObjectCopy();
            var newEntity  = objectCopy.AutoCopy(this);

            newEntity.Id         = Guid.NewGuid();
            newEntity.ProcInstID = 0;
            newEntity.IsHistory  = false;
            newEntity.Save();

            //复制ImpactOtherStore信息
            var impactOtherStores = ClosureToolImpactOtherStore.Search(i => i.ClosureId == this.Id).AsNoTracking().ToArray();

            if (impactOtherStores.Length > 0)
            {
                foreach (var impactItem in impactOtherStores)
                {
                    impactItem.Id        = Guid.NewGuid();
                    impactItem.ClosureId = newEntity.Id;
                }
                ClosureToolImpactOtherStore.Add(impactOtherStores);
            }

            ProjectInfo.Reset(this.ProjectId, FlowCode.Closure_ClosureTool);

            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureTool.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }