Ejemplo n.º 1
0
        /// <summary>
        /// 用品修好后,个人进入待办事项确认领取
        /// </summary>
        /// <param name="input">维修id</param>
        public async Task ApplyForFlow(Guid input)
        {
            var r = _supplyRepairRepository.Get(input);
            var u = _userSupplyRepository.GetAll().FirstOrDefault(ite => ite.SupplyId == r.SupplyId && ite.Status == (int)UserSupplyStatus.已修好);
            if (u != null)
            {
                u.Status = (int)UserSupplyStatus.使用中;
                _userSupplyRepository.Update(u);
            }
            var s = _supplyBaseRepository.Get(r.SupplyId);
            s.Status = (int)SupplyStatus.被领用;
            _supplyBaseRepository.Update(s);

            /*
            判断当前申请是否都已处理完毕,是则调用流程结束方法
            */

            var task = _workflowtaskRepository.GetAll().OrderByDescending(ite => ite.SenderTime).FirstOrDefault(ite => ite.InstanceID == input.ToString());
            if (task == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "未找到当前待办任务。");
            }

            // var _taskAppService=  Abp.AbpBootstrapper.Create<Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve<IWorkFlowWorkTaskAppService>();
            await _workFlowWorkTaskAppService.ExecuteTask(new ExecuteWorkFlowInput()
            {
                ActionType = "completed",
                FlowId = task.FlowID,
                GroupId = task.GroupID,
                StepId = task.StepID,
                TaskId = task.Id,
                Title = "报修用品已认领"
            });

        }
Ejemplo n.º 2
0
        public async Task Sure(SupplyScrapInput input)
        {
            var model = _supplyScrapSubRepository.Get(input.Id);

            if (model.Status == 1)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该报废申请已处理。");
            }
            switch (input.Type)
            {
            case 0:
                model.Status = (int)SupplyScrapSubStatus.已报废;
                break;

            case 1:
                model.Status = (int)SupplyScrapSubStatus.驳回;
                break;
            }
            _supplyScrapSubRepository.Update(model);

            var supply = _supplyBaseRepository.Get(model.SupplyId);

            if (supply == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "要报废的物品不存在。");
            }
            switch (input.Type)
            {
            case 0:
                supply.Status = (int)SupplyStatus.已报废;
                break;

            case 1:
                supply.Status = (int)SupplyStatus.被领用;
                break;
            }
            _supplyBaseRepository.Update(supply);
            var u = _userSupplyRepository.GetAll().FirstOrDefault(ite => ite.Status == (int)UserSupplyStatus.报废中 && ite.SupplyId == model.SupplyId);

            if (u != null)
            {
                switch (input.Type)
                {
                case 0:
                    u.Status = (int)UserSupplyStatus.已报废;
                    break;

                case 1:
                    u.Status = (int)UserSupplyStatus.使用中;
                    break;
                }
                _userSupplyRepository.Update(u);
            }

            /*
             * 判断当前申请的列表是否都已处理完毕,是则调用流程结束方法
             */

            var task = _workflowtaskRepository.GetAll().OrderByDescending(ite => ite.SenderTime).FirstOrDefault(ite => ite.InstanceID == model.MainId.ToString() && ite.ReceiveID == AbpSession.UserId.Value);

            if (task == null)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "未找到当前待办任务。");
            }
            var hasnoback = _supplyScrapSubRepository.GetAll().Count(ite => ite.MainId == model.MainId && ite.Status == 0);

            if (hasnoback == 1)
            {
                // var _taskAppService=  Abp.AbpBootstrapper.Create<Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve<IWorkFlowWorkTaskAppService>();
                await _workFlowWorkTaskAppService.ExecuteTask(new ExecuteWorkFlowInput()
                {
                    ActionType = "completed",
                    FlowId     = task.FlowID,
                    GroupId    = task.GroupID,
                    StepId     = task.StepID,
                    TaskId     = task.Id,
                    Title      = "退还申请已处理"
                });
            }
        }