public static bool TryGetPrevStepInfo(this FabProduct product, ref FabStep step, ref FabProduct prod) { bool isRouteChanged = false; FabStep orgStep = step; FabInterBom shopbom; if (product.TryGetInterRoute(orgStep, out shopbom, false)) { step = shopbom.ChangeStep; prod = shopbom.ChangeProduct; isRouteChanged = true; } if (isRouteChanged == false && step != null) { //step = orgStep.PrevStep as FabStep; if (step.IsAlignStep == false) { List <FabInnerBom> list = product.GetPrevInnerBom(orgStep.PrevStep as FabStep, Position.IN); if (list != null) { step = list[0].ChangeStep; isRouteChanged = true; } } } if (isRouteChanged == false) { step = orgStep.GetPrevMainStep(product, false); //orgStep.GetDefaultPrevStep() as FabStep; } return(isRouteChanged); }
/// <summary> /// </summary> /// <param name="entity"/> /// <param name="now"/> /// <param name="target"/> /// <param name="factor"/> /// <param name="ctx"/> /// <returns/> public WeightValue SMALL_BATCH_MERGE_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx) { if (factor.Factor == 0) { return(new WeightValue(0)); } int baseQty = (int)factor.Criteria[0]; int checkStepCount = (int)factor.Criteria[1]; FabAoEquipment eqp = target as FabAoEquipment; FabLot lot = entity as FabLot; //if (eqp.IsLastPlan(lot.CurrentShopID, lot.CurrentStepID, lot.CurrentProductID, Constants.NULL_ID, lot.OwnerType, lot.OwnerID)) // return new WeightValue(1 * factor.Factor, string.Format("[IsLast:Y]")); FabStep currentStep = lot.CurrentFabStep; var currentProd = lot.FabProduct; FabStep prevStep = currentStep.GetPrevMainStep(lot.FabProduct, true); StepTat tat = null; if (prevStep != null) { tat = prevStep.GetTat(lot.CurrentProductID, true); } if (tat == null) { tat = currentStep.GetDefaultTAT(); } var job = InFlowMaster.GetJobState(lot); if (job == null) { return(new WeightValue(0)); } int waitQty = job.GetCurrenStepWaitWipQty(eqp, currentStep, Constants.NULL_ID, (decimal)TimeSpan.FromMinutes(tat.RunTat).TotalHours); if (waitQty > baseQty) { return(new WeightValue(0, string.Format("[Wait:{0}>{1}:Base]", waitQty, baseQty))); } int prevWipQty = job.GetPrevStepRunWipQty(eqp, currentStep, Constants.NULL_ID, now.AddMinutes(tat.TAT)); if (prevWipQty > 0) { return(new WeightValue(0, string.Format("[PrevRunWip:{0}>0", prevWipQty))); } int nextWipQty = 0; var nextStepList = currentStep.GetNextStepList(currentProd, checkStepCount); foreach (FabStep next in nextStepList) { nextWipQty += job.GetStepWips(next, WipType.Total); } int runQty = job.GetStepWips(currentStep, WipType.Run); if (runQty + nextWipQty == 0) { return(new WeightValue(0, string.Format("[Run:{0} + NextQty:{1} = 0]", runQty, nextWipQty))); } return(new WeightValue(1 * factor.Factor, string.Format("[Run:{0} + NextQty:{1}>0]", runQty, nextWipQty))); }