예제 #1
0
        public void CreateByLayoutAndProject(PedestalInput input)
        {
            // 检查台座上是否有梁片,被占用报错
            if (_repository.GetAll().Where(q => q.ProjectId == input.ProjectId)
                .Include(v => v.SubProject)
                .Any(v => v.SubProject != null))
            {
                throw new UserFriendlyException("台座被占用无法切换台座");
            }
            //如果项目存在布局实例进行删除操作,保证项目布局唯一 //q.WorkshopLayoutId == input.LayoutId
            var entity = _repository.FirstOrDefault(q => q.ProjectId == input.ProjectId);

            if (entity != null)
            {
                _repository.Delete(q => q.ProjectId == input.ProjectId);
            }

            var workshopLayoutEntity = _workshopLayoutRepository.Get(input.LayoutId);

            WorkshopLayoutInput workshopLayoutInput = new WorkshopLayoutInput();

            workshopLayoutInput.IsSave    = true;
            workshopLayoutInput.LayoutId  = input.LayoutId;
            workshopLayoutInput.ProjectId = input.ProjectId;

            workshopLayoutInput.ProductionLine = workshopLayoutEntity.ProductionLine;
            workshopLayoutInput.BeamPedestal   = workshopLayoutEntity.BeamPedestal;
            workshopLayoutInput.SaveBeam       = workshopLayoutEntity.SaveBeam;
            workshopLayoutInput.BindRebar      = workshopLayoutEntity.BindRebar;
            _workshopLayoutAppService.Generate(workshopLayoutInput);
        }
예제 #2
0
        public Task <List <GenerateOutput> > GetListByLayoutAndProject(PedestalInput input)
        {
            List <GenerateOutput> generateOutputs = new List <GenerateOutput>();

            //根据布局和项目获取台座
            var pedestalList = _repository.GetAll()
                               .Where(q => q.WorkshopLayoutId == input.LayoutId && q.ProjectId == input.ProjectId)
                               .Include(v => v.SubProject).ToList();
            //获取生产线信息
            var productLines = pedestalList.GroupBy(q => q.ProductionLine).Select(q => q.Key);

            foreach (var item in productLines)
            {
                #region 返回布局信息

                //根据生产线过滤台座
                var tempList = pedestalList.Where(q => q.ProductionLine == item);

                GenerateOutput output = new GenerateOutput();
                output.ProductionLine = item.ToString();
                //左部或上部钢筋绑扎台
                var LU_BindRebar = tempList.Where(q => q.Type == "GJ" && q.Area == "LU").ToList();
                //左部或上部制梁台
                var LU_BeamPedestal = tempList.Where(q => q.Type == "ZL" && q.Area == "LU").ToList();
                //左部或上部存梁台
                var LU_SaveBeam = tempList.Where(q => q.Type == "CL" && q.Area == "LU").ToList();
                //右部或下部钢筋绑扎台
                var RD_BindRebar = tempList.Where(q => q.Type == "GJ" && q.Area == "RD").ToList();
                //右部或下部制梁台
                var RD_BeamPedestal = tempList.Where(q => q.Type == "ZL" && q.Area == "RD").ToList();
                //右部或下部存梁台
                var RD_SaveBeam = tempList.Where(q => q.Type == "CL" && q.Area == "RD").ToList();

                output.LU_BindRebar    = ObjectMapper.Map <List <PedestalDto> >(LU_BindRebar);
                output.LU_BeamPedestal = ObjectMapper.Map <List <PedestalDto> >(LU_BeamPedestal);
                output.LU_SaveBeam     = ObjectMapper.Map <List <PedestalDto> >(LU_SaveBeam);
                output.RD_BindRebar    = ObjectMapper.Map <List <PedestalDto> >(RD_BindRebar);
                output.RD_BeamPedestal = ObjectMapper.Map <List <PedestalDto> >(RD_BeamPedestal);
                output.RD_SaveBeam     = ObjectMapper.Map <List <PedestalDto> >(RD_SaveBeam);

                generateOutputs.Add(output);

                #endregion
            }

            return(Task.FromResult(generateOutputs));
        }