public List <InitWorkFlowOutput> Create(CreateSupplyScrapMainInput input) { var ret = new List <InitWorkFlowOutput>(); foreach (var x in input.SupplyScrapSub) { var data = CreateV2(new CreateSupplyScrapMainInput() { FlowId = input.FlowId, FlowTitle = input.FlowTitle, SupplyScrapSub = new List <CreateSupplyScrapSubInput>() { x } }); var entity = _workFlowWorkTaskAppService.InitWorkFlowInstance(new InitWorkFlowInput() { FlowId = input.FlowId, FlowTitle = input.FlowTitle, InStanceId = data.InStanceId }); ret.Add(entity); } return(ret); }
/// <summary> /// 申请报废 /// </summary> /// <param name="input">报废物品id列表</param> /// <returns></returns> public InitWorkFlowOutput CreateV2(CreateSupplyScrapMainInput input) { var x = input.SupplyScrapSub.FirstOrDefault(); var t = new SupplyScrapSub(); //t.MainId = model.Id; t.SupplyId = x.SupplyId; t.UserSupplyId = x.UserSupplyId; t.Reason = x.Reason; t.Id = Guid.NewGuid(); _supplyScrapSubRepository.Insert(t); var s = _supplyBaseRepository.Get(x.SupplyId); s.Status = (int)SupplyStatus.报废中; _supplyBaseRepository.Update(s); var u = _userSupplyRepository.Get(x.UserSupplyId); u.Status = (int)UserSupplyStatus.报废中; return(new InitWorkFlowOutput() { InStanceId = t.Id.ToString() }); }