예제 #1
0
        public DataResult GetFlowStep([FromQuery] int wId, int qId, bool menu, bool report)
        {
            var result = new DataResult();

            if (menu)
            {
                result.datas.AddRange(FlowStepHelper.GetMenuDetails(wId, qId, report));
            }
            else
            {
                var data = FlowStepHelper.GetDetails(wId, qId, report);
                //var defectIds = data.SelectMany(x => x.DefectIds);
                //var defects = DefectHelper.Instance.GetByIds<Defect>(defectIds);
                //foreach (var d in data)
                //{
                //    d.Defects = d.DefectIds.Where(defectId => defects.Any(x => x.Id == defectId)).Select(defectId => defects.First(x => x.Id == defectId).Name).Join();
                //}
                result.datas.AddRange(data);
            }
            if (qId != 0 && !result.datas.Any())
            {
                result.errno = Error.FlowStepNotExist;
                return(result);
            }
            return(result);
        }
예제 #2
0
        public object GetFlowCode([FromQuery] int wId, bool menu, int qId, int cId, bool step)
        {
            if (step && qId != 0)
            {
                var data    = FlowCodeHelper.GetDetail(wId, qId);
                var stepIds = data.SelectMany(x => x.StepIds).Distinct();
                if (stepIds.Any())
                {
                    var steps = FlowStepHelper.GetDetails(stepIds).ToDictionary(x => x.Id);
                    foreach (var d in data)
                    {
                        d.StepList.AddRange(d.StepIds.Where(stepId => steps.ContainsKey(stepId)).Select(stepId => new
                        {
                            steps[stepId].Id,
                            steps[stepId].Name,
                            steps[stepId].Category,
                            steps[stepId].FormatId,
                        }));
                    }
                }

                return(new
                {
                    errno = 0,
                    errmsg = "成功",
                    datas = data
                });
            }
            var result = new DataResult();

            if (menu)
            {
                result.datas.AddRange(FlowCodeHelper.GetMenu(wId, qId, cId));
            }
            else
            {
                var data    = FlowCodeHelper.GetDetail(wId, qId, cId);
                var stepIds = data.SelectMany(x => x.StepIds);
                if (stepIds.Any())
                {
                    var steps = FlowStepHelper.Instance.GetByIds <FlowStep>(stepIds).ToDictionary(x => x.Id);
                    foreach (var d in data)
                    {
                        d.Steps = d.StepIds.Where(stepId => steps.ContainsKey(stepId)).Select(stepId => steps[stepId].Name).Join();
                    }
                }
                result.datas.AddRange(data);
            }
            if (qId != 0 && !result.datas.Any())
            {
                result.errno = Error.FlowCodeNotExist;
                return(result);
            }
            return(result);
        }
예제 #3
0
        public object GetCapacity([FromQuery] int qId, int cId, int wId, bool menu, bool step)
        {
            if (step && qId != 0)
            {
                var data    = CapacityHelper.GetDetail(wId, qId);
                var stepIds = data.SelectMany(x => x.StepIds).Distinct();
                if (stepIds.Any())
                {
                    var steps = FlowStepHelper.GetDetails(stepIds).ToDictionary(x => x.Id);
                    foreach (var d in data)
                    {
                        d.CapacityList.AddRange(d.StepVList.Where(x => steps.ContainsKey(x.StepId)).Select(x => new
                        {
                            steps[x.StepId].Id,
                            steps[x.StepId].Name,
                            steps[x.StepId].Category,
                            V = x.Number,
                        }));
                    }
                }

                return(new
                {
                    errno = 0,
                    errmsg = "成功",
                    datas = data
                });
            }
            var result = new DataResult();

            result.datas.AddRange(menu
                ? CapacityHelper.GetMenu(wId, qId, cId)
                : CapacityHelper.GetDetail(wId, qId, cId));
            if (qId != 0 && !result.datas.Any())
            {
                result.errno = Error.CapacityNotExist;
                return(result);
            }
            return(result);
        }