public static void UpdateEqpPlanQty(MicronBEAssyBELot lot, string eqpID, string status, double qty) { try { string key = SimulationHelper.GetEqpPlanKey(lot, eqpID, status); EqpPlan eqpPlan = null; if (InputMart.Instance.EqpPlans.TryGetValue(key, out eqpPlan)) { eqpPlan.QTY = Convert.ToDecimal(qty); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
public static void CollectEqpPlan(Mozart.SeePlan.Simulation.IHandlingBatch hb, AoEquipment equip, string status) { try { MicronBEAssyBELot lot = hb as MicronBEAssyBELot; string eqpID = string.Empty; if (equip != null) { eqpID = equip.EqpID; } string waitPlanKey = SimulationHelper.GetEqpPlanKey(lot, string.Empty, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKey)) { InputMart.Instance.EqpPlans.Remove(waitPlanKey); } string waitPlanKeyWithEqp = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadState.WAIT.ToString()); if (InputMart.Instance.EqpPlans.ContainsKey(waitPlanKeyWithEqp)) { InputMart.Instance.EqpPlans.Remove(waitPlanKeyWithEqp); } string key = SimulationHelper.GetEqpPlanKey(lot, eqpID, status); string arrivalTimeKey = lot.LotID.Split('_')[0] + lot.CurrentStepID; EqpPlan plan; if (InputMart.Instance.EqpPlans.TryGetValue(key, out plan) == false) { MicronBEAssyEqp eqp; InputMart.Instance.MicronBEAssyEqp.TryGetValue(eqpID, out eqp); plan = new EqpPlan(); plan.LINE_ID = lot.LineID; plan.PRODUCT_ID = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? status : lot.Product.ProductID; plan.LOT_ID = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.LotID; plan.INIT_STEP = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? Mozart.SeePlan.StringUtility.IdentityNull : lot.WipInfo.InitialStep.StepID; plan.ARRIVAL_TIME = status != LoadingStates.BUSY.ToString() && status != LoadState.WAIT.ToString() ? default(DateTime) : FindHelper.GetNowDT(); plan.PROCESS_ID = lot.CurrentStep.Process.ProcessID; plan.STEP_ID = lot.CurrentStepID; plan.EQP_ID = eqpID; //plan.STEP_GROUP = eqp == null ? Mozart.SeePlan.StringUtility.IdentityNull : eqp.StepGroup.ToString(); plan.QTY = lot.UnitQty; plan.STATUS = status; plan.DESIGN_ID = lot.Product.DesignID(); plan.SEQUENCE = lot.CurrentStep.Sequence; plan.COMP_SEQ = lot.Product is AssyMcpPart ? (lot.Product as AssyMcpPart).CompSeq : 1; plan.IS_BASE = UtilityHelper.IsYN(lot.Product.IsBase()); plan.STEP_GROUP = (lot.CurrentStep as MicronBEAssyBEStep).StepGroup; if (lot.Product is AssyMcpProduct) { plan.FINAL_PROD_ID = lot.Product.ProductID; } else if (lot.Product is AssyMcpPart) { plan.FINAL_PROD_ID = (lot.Product as AssyMcpPart).FinalProduct.ProductID; } else { plan.FINAL_PROD_ID = lot.Product.ProductID; } InputMart.Instance.EqpPlans.Add(key, plan); if (status == LoadState.WAIT.ToString()) { DateTime arTime; if (InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime) == false) { InputMart.Instance.ArrivalTime.Add(arrivalTimeKey, plan.ARRIVAL_TIME); } } else { plan.START_TIME = FindHelper.GetNowDT(); plan.END_TIME = FindHelper.GetNowDT(); } } else { DateTime arTime; plan.END_TIME = FindHelper.GetNowDT(); InputMart.Instance.ArrivalTime.TryGetValue(arrivalTimeKey, out arTime); plan.ARRIVAL_TIME = status == LoadingStates.SETUP.ToString() ? default(DateTime) : arTime; key = SimulationHelper.GetEqpPlanKey(lot, eqpID, LoadingStates.SETUP.ToString()); EqpPlan setupPlan; if (InputMart.Instance.EqpPlans.TryGetValue(key, out setupPlan)) { setupPlan.PRODUCT_ID = lot.Product.ProductID; } } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }