예제 #1
0
        /// <summary>
        /// 获取零件最新版本图纸信息
        /// </summary>
        /// <param name="partNumber">零件编码</param>
        /// <returns></returns>
        public async Task <PartDrawingDto> GetPartDrawingLastVersion(string partNumber)
        {
            if (string.IsNullOrWhiteSpace(partNumber))
            {
                throw new ArgumentNullException(nameof(partNumber));
            }

            var sourceList = await this._winchillRepository.GetByPartItem(new GetByPartItemInput
            {
                PartNumber = partNumber
            });

            if (sourceList == null || !sourceList.Any())
            {
                return(null);
            }

            var lastPartVersions = sourceList
                                   .GroupBy(pd => pd.PartVersion)
                                   .OrderByDescending(g => g.Key)
                                   .FirstOrDefault();

            PartDrawingDto partDrawing = PartDrawingFactory.Create(lastPartVersions).FirstOrDefault();

            return(partDrawing);
        }
예제 #2
0
        /// <summary>
        /// 取得所有零件图纸
        /// </summary>
        public async Task <ListResultDto <PartDrawingDto> > GetAllDrawings()
        {
            var results      = new List <PartItemDoc>();
            var partVersions = await this._winchillRepository.GetAllPartVersions();

            foreach (var pv in partVersions)
            {
                var sourceList = await this._winchillRepository.GetByPartItem(new GetByPartItemInput
                {
                    PartNumber  = pv.PartNumber,
                    PartVersion = pv.PartVersion,
                });

                if (sourceList == null || !sourceList.Any())
                {
                    continue;
                }

                results.AddRange(sourceList);
            }

            List <PartDrawingDto> partDrawings = PartDrawingFactory.Create(results);

            return(new ListResultDto <PartDrawingDto>(partDrawings));
        }
예제 #3
0
        /// <summary>
        /// 获取图纸信息
        /// </summary>
        /// <param name="partNumber">零件编码</param>
        /// <param name="partVersion">零件版本</param>
        /// <returns></returns>
        public async Task <PartDrawingDto> GetPartDrawing(string partNumber, string partVersion)
        {
            if (string.IsNullOrWhiteSpace(partNumber))
            {
                throw new ArgumentNullException(nameof(partNumber));
            }
            if (string.IsNullOrWhiteSpace(partVersion))
            {
                throw new ArgumentNullException(nameof(partVersion));
            }

            var sourceList = await this._winchillRepository.GetByPartItem(new GetByPartItemInput
            {
                PartNumber  = partNumber,
                PartVersion = partVersion,
            });

            if (sourceList == null || !sourceList.Any())
            {
                return(null);
            }

            PartDrawingDto partDrawing = PartDrawingFactory.Create(sourceList).FirstOrDefault();

            return(partDrawing);
        }
예제 #4
0
        /// <summary>
        /// 获取图纸信息(所有零件版本)
        /// </summary>
        /// <param name="partNumber">零件编码</param>
        public async Task <ListResultDto <PartDrawingDto> > GetPartDrawingAll(string partNumber)
        {
            if (string.IsNullOrWhiteSpace(partNumber))
            {
                throw new ArgumentNullException(nameof(partNumber));
            }

            var sourceList = await this._winchillRepository.GetByPartItem(new GetByPartItemInput
            {
                PartNumber = partNumber
            });

            if (sourceList == null || !sourceList.Any())
            {
                return(null);
            }

            List <PartDrawingDto> partDrawings = PartDrawingFactory.Create(sourceList);

            return(new ListResultDto <PartDrawingDto>(partDrawings));
        }