Пример #1
0
        private void GetDepartmentEntity()
        {
            var quotaMap_project = quotaList.Where(w => w.Quota_Type == 1);

            foreach (var dept in deptList)
            {
                var entity = new ReqRpt048DepartmentQuotaEntity {
                    Department = dept.Description
                };
                //部门所有的shl、hl
                var lots = SHLEntities.Where(w => w.QuotaDept == dept.Description);
                //部门定义的quota
                var quotaDefine = quotaDefineList.Where(w => w.Department == dept.Description);
                //部门普通shl quota
                var quotaDefine_normal = quotaDefine.Where(w => w.Quota_Type == 0);
                //部门project shl quota
                var quotaDefine_project = quotaDefine.Where(w => w.Quota_Type == 1);

                var shls       = lots.Where(w => w.Priority == 1).Select(s => s.LotID.Split('.')[0]).Distinct(); //shl
                var hls        = lots.Where(w => w.Priority == 2).Select(s => s.LotID.Split('.')[0]).Distinct(); //hl
                int allSHLUsed = shls.Count();
                int allHLUsed  = hls.Count();
                entity.NormalHLQuota   = quotaDefine_normal.Sum(s => s.Quota_HL);
                entity.NormalSHLQuota  = quotaDefine_normal.Sum(s => s.Quota_SHL);
                entity.ProjectSHLQuota = quotaDefine_project.Sum(s => s.Quota_SHL);
                entity.ProjectHLQuota  = quotaDefine_project.Sum(s => s.Quota_HL);
                entity.ProjectSHLUsed  = shls.Intersect(quotaMap_project.Select(s => s.Lot_ID.Split('.')[0])).Count();
                entity.ProjectHLUsed   = hls.Intersect(quotaMap_project.Select(s => s.Lot_ID.Split('.')[0])).Count();
                entity.NormalSHLUsed   = allSHLUsed - entity.ProjectSHLUsed;
                entity.NormalHLUsed    = allHLUsed - entity.ProjectHLUsed;
                DepartmentQuotaEntities.Add(entity);
            }
        }
Пример #2
0
        private void GetNormalEntity()
        {
            var quota_normal = quotaDefineList.Where(w => w.Quota_Type == 0);

            foreach (var define in quota_normal)
            {
                var entity = new ReqRpt048ProjectQuotaEntity {
                    Department = define.Department, Project = "", QuotaSHL = define.Quota_SHL, QuotaHL = define.Quota_HL, Purpose = define.Purpose, QuotaType = define.Quota_Type
                };
                var shls = SHLEntities.Where(w => w.QuotaDept == define.Department && w.QuotaType == define.Quota_Type);
                entity.UsedHL  = shls.Where(w => w.Priority == 2).Select(s => s.LotID.Split('.')[0]).Count();
                entity.UsedSHL = shls.Where(w => w.Priority == 1).Select(s => s.LotID.Split('.')[0]).Count();
                ProjectQuotaEntities.Add(entity);
            }
        }