private DateTime GetComeinTime(SHLLotModel lot) { string lotID = lot.Lot_ID; string subLotID = string.Join("", lotID.TakeWhile(t => t != '.')); DB2DataCatcher <SHLFHOpehsModel> opehsCatcher = new DB2DataCatcher <SHLFHOpehsModel>("MMVIEW.FHOPEHS") { Conditions = string.Format("where lot_id like '{0}.%' order by claim_time", subLotID) }; var list = opehsCatcher.GetEntities().EntityList; var sub_list = list.TakeWhile(w => !(w.Lot_ID == lot.Lot_ID && w.Ope_Category == "Split")); var motherLotOpe = sub_list.Where(w => w.Lot_ID == lot.Lot_ID && (w.Ope_Category == "Ope_Complete" || w.Ope_Category == "STB" || w.Ope_Category.Contains("Locate"))); if (motherLotOpe.Any()) { return(motherLotOpe.Last().Claim_Time); } else { //如果母批也是split。。。 return(GetComeinTimeCaseMotherNoIn(lot, list)); } }
private DateTime GetComeinTimeCaseMotherNoIn(SHLLotModel lot, IList <SHLFHOpehsModel> opes) { DB2DataCatcher <SHLFRLot_Family> familyCatcher = new DB2DataCatcher <SHLFRLot_Family>("MMVIEW.FRLot") { Conditions = string.Format("where lot_family_id='{0}'", lot.Lot_Family_ID) }; var familyList = familyCatcher.GetEntities().EntityList; string split_lot = lot.Split_Lot_ID; while (!string.IsNullOrEmpty(split_lot)) { var nextSplit = familyList.Where(w => w.Lot_ID == split_lot).First(); var sub_list = opes.TakeWhile(w => !(w.Lot_ID == nextSplit.Lot_ID && w.Ope_Category == "Split")); var motherLotOpe = sub_list.Where(w => w.Lot_ID == nextSplit.Lot_ID && (w.Ope_Category == "Ope_Complete" || w.Ope_Category == "STB" || w.Ope_Category.Contains("Locate"))); if (motherLotOpe.Any()) { return(motherLotOpe.Last().Claim_Time); } split_lot = nextSplit.Split_Lot_ID; } throw new Exception("ReqRpt048SHLTableViewModel:GetComeinTimeCaseMotherNoIn:History Not Found Enter PD record!"); }
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); }