public IActionResult Return(PlanApproveSubmitDto parm)
        {
            if (string.IsNullOrEmpty(parm.ID))
            {
                return(toResponse(StatusCodeType.Error, "提交id不能为空,请核对"));
            }
            var userinfo     = _tokenManager.GetSessionInfo();
            var maincontract = _contractitemplanService.GetId(parm.ID);

            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Core.DbContext.BeginTran();
                try
                {
                    List <SugarParameter> parameters = new List <SugarParameter>();
                    parameters.Add(new SugarParameter("UserID", userinfo.UserID));
                    parameters.Add(new SugarParameter("UserName", userinfo.UserName));

                    Step.Cancel(db, maincontract, "Biz_Contract_Plan", "ID", "status", "301", parameters, UpdatePlanAfterCancelled, "审批通过");
                    Core.DbContext.CommitTran();
                    return(toResponse("提交成功"));
                }
                catch (Exception ex)
                {
                    Core.DbContext.RollbackTran();
                    return(toResponse(StatusCodeType.Error, ex.Message));
                }
            }
        }
Beispiel #2
0
 public override void Cancel()
 {
     if (RunningTask != null && RunningTask.Status == TaskStatus.Running)
     {
         LOGGER.Info($"Canceling step '{Step.GetType().Name}'");
         CancellationTokenSource.Cancel();
         Step?.Cancel();
     }
 }
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除 Id 不能为空"));
            }
            var userinfo = _tokenManager.GetSessionInfo();

            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Core.DbContext.BeginTran();
                try
                {
                    var contract = _contractitemplanService.GetId(id);
                    db.Deleteable <Biz_Contract_Plan>()
                    .Where(it => it.ID == id).ExecuteCommand();

                    //删除任务子项目信息
                    List <Biz_ContractItem_Sub> subitmlist = db.Queryable <Biz_ContractItem_Sub>().Where(it => it.ContractPlanID == contract.ID).ToList();
                    foreach (var subitem in subitmlist)
                    {
                        List <SugarParameter> parameters = new List <SugarParameter>();
                        parameters.Add(new SugarParameter("UserID", userinfo.UserID));
                        parameters.Add(new SugarParameter("UserName", userinfo.UserName));

                        Step.Cancel(db, subitem, "Biz_ContractItem_Sub", "ID", "status", "201", parameters, UpdateBizEntityAfterCancelled, "撤销安排");
                    }

                    //删除审核员
                    db.Deleteable <Biz_Contract_PlanAuditor>().Where(m => m.ContractPlanID == contract.ID).ExecuteCommand();

                    //删除审核员详细信息
                    db.Deleteable <Biz_Contract_PlanAuditor_Item>().Where(m => m.ContractPlanID == contract.ID).ExecuteCommand();

                    Core.DbContext.CommitTran();

                    return(toResponse("删除成功"));
                }
                catch (Exception ex)
                {
                    Core.DbContext.RollbackTran();
                    return(toResponse(StatusCodeType.Error, ex.Message));
                }
            }
        }
        public IActionResult ApproveCancel(string id = null)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "Id 不能为空"));
            }
            var userinfo     = _tokenManager.GetSessionInfo();
            var maincontract = _maincontractService.GetId(id);

            using (SqlSugarClient db = Core.DbContext.CurrentDB)
            {
                Core.DbContext.BeginTran();
                try
                {
                    //判断时候存在已经审核安排的体系子项目
                    if (db.Ado.GetScalar("select 1 from Biz_ContractItem_Sub where MainContractID=@MainContractID and status > 20000", new { MainContractID = id }) != null)
                    {
                        return(toResponse(StatusCodeType.Error, "当前合同已经有项目完成审核安排,不允许撤销"));
                    }

                    List <SugarParameter> parameters = new List <SugarParameter>();
                    parameters.Add(new SugarParameter("UserID", userinfo.UserID));
                    parameters.Add(new SugarParameter("UserName", userinfo.UserName));

                    Step.Cancel(db, maincontract, "Biz_MainContract", "ID", "status", "103", parameters, UpdateBizEntityAfterCancelled, "撤销审批");

                    db.Ado.ExecuteCommand("delete from Biz_ContractItem_Sub where MainContractID=@MainContractID", new { MainContractID = id });

                    Core.DbContext.CommitTran();
                    return(toResponse("提交成功"));
                }
                catch (Exception ex)
                {
                    Core.DbContext.RollbackTran();
                    return(toResponse(StatusCodeType.Error, ex.Message));
                }
            }
        }