private SectionSummaryDto CreateSection(AssessmentInstance assessmentInstance, ItemDefinition sectionItemDefinition)
        {
            var sectionSummaryDto = new SectionSummaryDto
            {
                ItemDefinitionCode = sectionItemDefinition.CodedConcept.Code,
                PercentComplete    =
                    _assessmentCompletenessManager.CalculateCompleteness(assessmentInstance, sectionItemDefinition).PercentComplete
            };

            return(sectionSummaryDto);
        }
Example #2
0
        private void WriteSection(ISheet sheet, SectionSummaryDto excelData, ref int rowIndex)
        {
            sheet.CreateRow(rowIndex);
            rowIndex++;
            // 写标题
            string[] heads = new string[] { "序号", "品名", "样品个数", "化验元素", "火试金" };
            IRow     tRow  = sheet.CreateRow(rowIndex);

            for (int i = 0; i < 5; i++)
            {
                ICell tCell = tRow.CreateCell(i);
                SetCell(tCell, typeof(string).FullName, heads[i]);
            }
            rowIndex++;

            // 写出全部数据
            var sectionList = excelData.SpecList;
            // 第一行数据
            IRow  firstRow      = sheet.CreateRow(rowIndex);
            ICell firstRowCell0 = firstRow.CreateCell(0);

            SetCell(firstRowCell0, typeof(string).FullName, excelData.OrgName);
            ICell firstRowCell1 = firstRow.CreateCell(1);

            SetCell(firstRowCell1, typeof(string).FullName, sectionList[0].SpecName);
            ICell firstRowCell2 = firstRow.CreateCell(2);

            SetCell(firstRowCell2, typeof(int).FullName, sectionList[0].SpecCount.ToString());
            ICell firstRowCell3 = firstRow.CreateCell(3);

            SetCell(firstRowCell3, typeof(int).FullName, sectionList[0].EleCount.ToString());
            ICell firstRowCell4 = firstRow.CreateCell(4);

            SetCell(firstRowCell4, typeof(int).FullName, sectionList[0].AuAg.ToString());
            rowIndex++;
            for (int i = 1; i < sectionList.Count; i++)
            {
                IRow  tempRow      = sheet.CreateRow(rowIndex);
                ICell tempRowCell0 = tempRow.CreateCell(0);
                ICell tempRowCell1 = tempRow.CreateCell(1);
                SetCell(tempRowCell1, typeof(string).FullName, sectionList[i].SpecName);
                ICell tempRowCell2 = tempRow.CreateCell(2);
                SetCell(tempRowCell2, typeof(int).FullName, sectionList[i].SpecCount.ToString());
                ICell tempRowCell3 = tempRow.CreateCell(3);
                SetCell(tempRowCell3, typeof(int).FullName, sectionList[i].EleCount.ToString());
                ICell tempRowCell4 = tempRow.CreateCell(4);
                SetCell(tempRowCell4, typeof(int).FullName, sectionList[i].AuAg.ToString());
                rowIndex++;
            }

            rowIndex += 2;
        }
Example #3
0
        /// <summary>
        ///     Gets the resource.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper.</param>
        /// <param name="sectionSummaryDto">The item dto.</param>
        /// <param name="suffix">The suffix.</param>
        /// <returns>The resource for the item dto.</returns>
        public static string GetResource(this HtmlHelper htmlHelper, SectionSummaryDto sectionSummaryDto, string suffix = null)
        {
            var resourceManager = htmlHelper.ViewData["ResourceManager"] as ResourceManager;
            var resource        = string.Empty;

            if (resourceManager != null)
            {
                resource =
                    resourceManager.GetString(
                        SharedStringNames.ResourceKeyPrefix + sectionSummaryDto.ItemDefinitionCode +
                        (suffix == null ? string.Empty : SharedStringNames.ResourceKeyPrefix + suffix));
            }
            return(resource);
        }
Example #4
0
        // 获取单个分厂的数据
        public PlantSummaryDto GetPlantSummary(DateTime beginTime, DateTime endTime, string orgCode)
        {
            using (UnitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete))
            {
                // 获取查询的机构下所有的化验模板
                var tplList = _tplRepostitory.GetAll().Where(x => x.OrgCode.StartsWith(orgCode)).ToList();
                var tplIds  = tplList.Select(x => x.Id).ToList();
                // 获取模板下的所有样品
                var tplSpecList = _tplSpecRepostitory.GetAll().Where(x => tplIds.Contains(x.TplId)).ToList();
                // 获取所有的输入信息
                var typeInList     = _typeInRepostitory.GetAll().Where(x => tplIds.Contains(x.TplId) && x.SignTm >= beginTime && x.SignTm <= endTime).ToList();
                var typeInIds      = typeInList.Select(x => x.Id).ToList();
                var typeInItemList = this._typeInItemRepostitory.GetAll().Where(x => typeInIds.Contains(x.TypeInId));
                // 获取模板中所有的Org信息
                var orgList     = tplList.GroupBy(x => x.OrgCode).Select(x => x.Key).ToList();
                var orgInfoList = _orgRepostitory.GetAll().Where(x => orgList.Contains(x.Code)).ToList();


                List <SectionSummaryDto> sectionSummaryList = new List <SectionSummaryDto>();
                // 组织信息
                foreach (var item in orgList)
                {
                    List <SpecSummaryDto> specList = new List <SpecSummaryDto>();
                    // 当前组织下的所有模板
                    var tempTplList = tplList.Where(x => x.OrgCode == item).Select(x => x.Id).ToList();
                    if (tempTplList.Count == 0)
                    {
                        continue;
                    }
                    // 组织下的所有化验元素
                    var tempTypeIn = typeInList.Where(x => tempTplList.Contains(x.TplId)).ToList();
                    if (tempTypeIn.Count == 0)
                    {
                        continue;
                    }
                    // 所有化验结果按照样品分类
                    var groupSpec = tempTypeIn.GroupBy(x => new { x.SpecId }).Select(x => x.Key.SpecId);
                    foreach (var specItem in groupSpec)
                    {
                        // 按照样品,获取所有的化验主表Id
                        var tTypeInIds = tempTypeIn.Where(x => x.SpecId == specItem).Select(x => x.Id).ToList();
                        // 获取样品下的所有元素
                        var tTypeInItemList = typeInItemList.Where(x => tTypeInIds.Contains(x.TypeInId) && !string.IsNullOrEmpty(x.EleValue)).ToList();
                        if (tTypeInItemList.Count() == 0)
                        {
                            continue;
                        }
                        string specName = tplSpecList.Where(x => x.Id == specItem).Select(x => x.SpecName).First();
                        // 金银个数
                        int auCount   = tTypeInItemList.Where(x => x.EleName == "Au").Count();
                        int agCount   = tTypeInItemList.Where(x => x.EleName == "Ag").Count();
                        int auAgCount = auCount > agCount ? auCount : agCount; // 金银取最大值

                        int allCount = tTypeInItemList.Count();                // 全部个数
                                                                               // 普通元素个数
                        int commonCount = allCount - auCount - agCount;
                        // 样品个数
                        int specCount = tTypeInIds.Count();

                        SpecSummaryDto tSpecSummary = new SpecSummaryDto()
                        {
                            SpecName  = specName,
                            SpecCount = specCount,
                            AuAg      = auAgCount,
                            EleCount  = commonCount
                        };
                        specList.Add(tSpecSummary);
                    }

                    string            orgName = orgInfoList.Where(x => x.Code == item).Select(x => x.OrgName).First();
                    SectionSummaryDto ssd     = new SectionSummaryDto()
                    {
                        OrgCode  = item,
                        OrgName  = orgName,
                        SpecList = specList
                    };

                    sectionSummaryList.Add(ssd);
                }
                string          plantName = _orgRepostitory.GetAll().Where(x => x.Code == orgCode).Select(x => x.OrgName).First();
                PlantSummaryDto p         = new PlantSummaryDto()
                {
                    OrgName     = plantName,
                    OrgCode     = orgCode,
                    SectionList = sectionSummaryList
                };
                return(p);
            }
        }