internal List <FabLot> GetPrevStepWipList(FabStep currentStep, WipType wipType, string productVersion) { List <FabLot> list = new List <FabLot>(); var prevSteps = currentStep.GetPrevSteps(this.ProductID); foreach (FabStep prev in prevSteps) { if (currentStep.NeedVerCheck == false || prev.NeedVerCheck == false) { productVersion = Constants.NULL_ID; } list.AddRange(GetStepWipList(prev, wipType, productVersion)); } return(list); }
public static int GetContinuousQty(FabLot lot, FabStep baseStep, bool includeFromStep = false) { if (baseStep == null) { return(0); } var jobState = GetJobState(lot); if (jobState == null) { return(0); } string productID = lot.CurrentProductID; string productVersion = lot.CurrentProductVersion; bool isFixedProductVer = EqpArrangeMaster.IsFixedProductVer(baseStep.StdStep, productVersion); if (isFixedProductVer == false) { productVersion = Constants.NULL_ID; } int continuousQty = 0; if (includeFromStep) { //run int runWipQty = jobState.GetStepWips(baseStep, WipType.Run, productVersion); if (runWipQty <= 0) { return(continuousQty); } continuousQty += runWipQty; //wait int waitWipQty = jobState.GetStepWips(baseStep, WipType.Wait, productVersion); if (waitWipQty <= 0) { return(continuousQty); } continuousQty += waitWipQty; } var pevStepList = baseStep.GetPrevSteps(productID); if (pevStepList != null && pevStepList.Count > 0) { //run int runWipQty = 0; foreach (var prevStep in pevStepList) { runWipQty += jobState.GetStepWips(prevStep, WipType.Run, productVersion); } if (runWipQty <= 0) { return(continuousQty); } continuousQty += runWipQty; //wait int waitWipQty = 0; foreach (var prevStep in pevStepList) { waitWipQty += jobState.GetStepWips(prevStep, WipType.Wait, productVersion); } if (waitWipQty <= 0) { return(continuousQty); } continuousQty += waitWipQty; } return(continuousQty); }
public WeightValue SMALL_LOT(ISimEntity entity, DateTime now, ActiveObject target, WeightFactor factor, IDispatchContext ctx) { if (factor.Factor == 0) { return(new WeightValue(0)); } FabAoEquipment eqp = target as FabAoEquipment; FabLot lot = entity as FabLot; int smallSize = (int)factor.Criteria[0]; if (smallSize == 0) { return(new WeightValue(0)); } int stepCount = (int)factor.Criteria[1]; if (stepCount == 0) { return(new WeightValue(0)); } var job = InFlowMaster.GetJobState(lot); if (job == null) { return(new WeightValue(0)); } int currentUnitQty = lot.UnitQty; string shopID = lot.CurrentShopID; string productID = lot.CurrentProductID; string productVer = lot.CurrentProductVersion; bool isLastPlan = ResHelper.IsLastPlan(eqp, lot); float score = 0f; if (isLastPlan) { score = 1f; } FabStep step = lot.CurrentFabStep; string stepType = step.StepType; int cnt = 0; int runQty = 0; int waitQty = 0; int total = 0; while (cnt < stepCount) { List <FabStep> preSteps = step.GetPrevSteps(productID); List <FabLot> runWips = job.GetPrevStepWipList(step, WipType.Run, productVer); List <FabLot> waitWips = job.GetPrevStepWipList(step, WipType.Wait, productVer); if (runWips.Count <= 0 && waitWips.Count <= 0) { cnt++; continue; } int prevRunQty = runWips.Sum(x => x.UnitQty); int preWaitQty = waitWips.Sum(x => x.UnitQty); runQty += prevRunQty; waitQty += preWaitQty; total += runQty + waitQty; foreach (FabStep prevStep in preSteps) { if (prevStep.StepType == "MAIN") { step = prevStep; } if (step == null) { continue; } } cnt++; } int compareQty = currentUnitQty + total; string desc = string.Format("[SmallSize:{0}, CompareQty:{1}, IsLast:{2}]", smallSize, compareQty, isLastPlan); if (compareQty > smallSize) { score = 1f; } return(new WeightValue(score * factor.Factor, desc)); }