Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
        private void GetSHLEntity(SHLLotModel lot)
        {
            var cast   = castList.Where(w => w.Lot_ID == lot.Lot_ID).FirstOrDefault() ?? new FVCast_LotModel();
            var lot_pd = curOpeList.Where(w => w.Lot_ID == lot.Lot_ID).FirstOrDefault() ?? new SHLFHOpehsModel();
            //当前pd
            var pd          = pdList.Where(w => w.PD_ID == lot_pd.PD_ID).FirstOrDefault() ?? new SHLFRPDModel();
            var owner       = ownerDeptList.Where(w => w.Lot_ID == lot.Lot_ID).FirstOrDefault() ?? new Report_Lot_OwnerDepartment_Mapping();
            var quota       = quotaList.Where(w => w.Lot_ID == lot.Lot_Family_ID).FirstOrDefault() ?? new Rpt_Lot_Quota_Mapping();
            var opes        = opeList.Where(w => w.Lot_ID == lot.Lot_ID);
            var opes_family = opeList.Where(w => w.Lot_ID == lot.Lot_Family_ID);
            //var opes_withsplits = string.IsNullOrEmpty(lot.Split_Lot_ID)?opes:opes.Union(opeList.Where(w => w.Lot_ID == lot.Split_Lot_ID));
            var inOpeList = opes.Where(w => w.Ope_Category == "Ope_Complete" || w.Ope_Category == "STB" || w.Ope_Category.Contains("Locate"));
            //进站时间:如果lot_id对应操作记录能查找到,则在记录中取,否则进入函数查找
            var inTime = inOpeList.Any()?inOpeList.First().Claim_Time: GetComeinTime(lot);
            //第一站(如果是子批,则对应family lot的第一站)
            var firstpd     = opes_family.Where(w => w.Ope_Category == "Ope_Complete" || w.Ope_Category == "STB").LastOrDefault();
            var ctList_prod = ctList.Where(w => w.ProdSpec_ID == lot.ProdSpec_ID);
            var today       = DateTime.Now.Date.AddHours(8);
            //获取剩余站点
            var    remainPds = ctList_prod.SkipWhile(s => s.Ope_No != lot_pd.Ope_No);
            double m         = lot.Priority_Class == 1 ? 1.3 : 1.6;
            //总 cycle time
            double ctValue_total = ctList_prod.Sum(s => s.PD_STD_Proc_Time_Min) * m;
            //剩余cycle time
            double ctValue_Remain = remainPds.Sum(s => s.PD_STD_Proc_Time_Min) * m;
            int    test           = remainPds.Count();
            //当前站点到wat站点的cycle time
            double   ctValue_wat = remainPds.TakeWhile(t => !watPds.Select(s => s.PD_ID).Contains(t.PD_ID)).Sum(s => s.PD_STD_Proc_Time_Min) * m;
            var      dept        = deptList.Where(w => w.Code_ID == pd.Department);
            DateTime baseTime;

            if (remainPds.Count() == 0)
            {
                baseTime = DateTime.Now;
            }
            else
            {
                baseTime = inTime.AddMinutes(remainPds.First().PD_STD_Cycle_Time_Min) > DateTime.Now ? inTime : DateTime.Now;
            }
            var shl = new ReqRpt048SHLEntity
            {
                LotID          = lot.Lot_ID,
                FoupID         = cast.Cast_ID,
                Location       = cast.Eqp_ID,
                Status         = cast.Xfer_State,
                Priority       = lot.Priority_Class,
                Department     = dept.Any() ? dept.First().Description : pd.Department,
                QuotaOwner     = owner.DisplayOwner,
                QuotaType      = quota.Quota_Type,
                Project        = quota.Project_Desc,
                Purpose        = quota.Purpose,
                Qty            = lot.Qty,
                OpeNo          = lot_pd.Ope_No,
                Description    = pd.Ope_Name,
                LotStates      = lot.Lot_Hold_State,
                ProcessStates  = lot.Lot_Process_State,
                WaferStart     = lot.Created_Time,
                YSDT           = opes.Where(w => w.Claim_Time <today && w.Claim_Time> today.AddDays(-1)).Select(s => s.PD_ID).Distinct().Count(),
                Remark         = lot.Hold_Claim_Memo,
                WAT            = baseTime.AddMinutes(ctValue_wat),
                WaferOut       = baseTime.AddMinutes(ctValue_Remain),
                TargetWaferOut = firstpd.Claim_Time.AddMinutes(ctValue_total),
                ProductID      = lot.ProdSpec_ID,
                QuotaDept      = owner.Description
            };
            var stages = opes.Where(w => w.Priority_Class != lot.Priority_Class);

            shl.PriChgStage = stages.Any() ? stages.First().Stage_ID : "";
            var types = ctList_prod.Where(w => w.Ope_No == lot_pd.Ope_No);

            shl.EqpType = types.Count() > 0?types.First().Eqp_Type:"";
            var eqps  = eqpList.Where(w => w.Eqp_Type == shl.EqpType);
            int total = eqps.Count();
            int ava   = eqps.Where(w => w.E10_State == "PRD" || w.E10_State == "SBY").Count();

            shl.EqpType += string.Format(" {2}/{0}/{1}", ava, total - ava, total);
            SHLEntities.Add(shl);
        }