/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> //int i = 1; public bool OnAfterLoad_Demand(Demand entity) { MicronBETestProduct demandProd = FindHelper.FindDemandProduct(entity.PRODUCT_ID); if (demandProd == null) { return(false); } MicronBETestBEMoMaster moMaster; if (InputMart.Instance.MicronBETestBEMoMaster.TryGetValue(entity.PRODUCT_ID, out moMaster) == false) { moMaster = new MicronBETestBEMoMaster(); moMaster.Product = demandProd; InputMart.Instance.MicronBETestBEMoMaster.Add(entity.PRODUCT_ID, moMaster); } MicronBETestBEMoPlan moPlan = new MicronBETestBEMoPlan(); moPlan.MoMaster = moMaster; moPlan.Qty = Convert.ToDouble(entity.QTY); moPlan.DueDate = entity.DUE_DATE; //moPlan.Priority = i++.ToString(); moMaster.AddMoPlan(moPlan); return(false); }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_Wip(Wip entity) { MicronBETestProduct product = FindHelper.FindProduct(entity.PRODUCT_ID); if (product == null) { return(false); } MicronBETestProcess process = FindHelper.FindProcess(entity.PROCESS_ID); if (process == null) { return(false); } MicronBETestWipInfo wipInfo = new MicronBETestWipInfo(); wipInfo.LotID = entity.LOT_ID; wipInfo.LineID = entity.LINE_ID; wipInfo.Product = product; wipInfo.Process = process; wipInfo.UnitQty = Convert.ToDouble(entity.LOT_QTY); wipInfo.InitialStep = process.FindStep(entity.STEP_ID); wipInfo.CurrentState = FindHelper.FindLotState(entity.LOT_STATE); InputMart.Instance.MicronBETestWipInfo.Add(wipInfo.InitialStep.StepID, wipInfo); return(false); }
/// <summary> /// </summary> /// <param name="wstep"/> /// <param name="context"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public IEnumerable <AoEquipment> SELECT_DOWN_EQP0(WorkStep wstep, JobChangeContext context, ref bool handled, IEnumerable <AoEquipment> prevReturnValue) { MicronBEAssyWorkStep ws = wstep as MicronBEAssyWorkStep; DateTime availableDownTime = ws.AvailableDownTime; DateTime nowDt = FindHelper.GetNowDT(); if (nowDt < availableDownTime) { return(null); } else { var t = wstep.LoadedEqps.FirstOrDefault(); if (t != null) { Logger.MonitorInfo(string.Format("Down Eqp -> STEP : {0}, EQP_ID : {1}, NowDT : {2}", ws.Key.ToString(), t.Target.EqpID, DateUtility.DbToString(FindHelper.GetNowDT()))); return(new AoEquipment[] { t.Target }); } else { return(null); } } }
/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public double GET_YIELD0(Mozart.SeePlan.Pegging.PegPart pegPart, ref bool handled, double prevReturnValue) { MicronBETestBEPegPart pp = pegPart as MicronBETestBEPegPart; double yield = FindHelper.FindYield(pp.Product.LineID, pp.Product.ProductID, pp.CurrentStep.StepID); return(yield); }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_Equipment(Equipment entity) { try { MicronBEAssyEqp eqp = new MicronBEAssyEqp(); eqp.Init(entity.EQP_ID, FindHelper.GetEngineStartTime(), FindHelper.GetEngineStartTime(), entity.SIM_TYPE); eqp.LineID = entity.LINE_ID; eqp.EqpID = entity.EQP_ID; string stepGroup = string.Empty; //eqp.StepGroup = UtilityHelper.StringToEnum(entity.STEP_GROUP, StepGroup.NONE); eqp.EqpModel = entity.EQP_MODEL; eqp.UtilRate = (double)entity.UTIL_RATE; eqp.DispatchingRule = entity.DISPATCHING_TYPE; if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(eqp.EqpID) == false) { InputMart.Instance.MicronBEAssyEqp.Add(eqp.EqpID, eqp); } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
public void RefreshValues() { if (!string.IsNullOrEmpty(Code) && ListControl != null) { var data = (DataSourceView)methodInfo.Invoke(ListControl, new object[0]); var view = data as TableDataSourceView; if (view == null) { throw new Exception( string.Format("Конрол '{0}' не использует TableDataSourceView в виде источника", ListControl.ID)); } var dic = new Dictionary <string, string> { { CodeField, Code } }; DataRowView row = FindHelper.FindRow(dic, new DataView(view.Table, view.GetFilterString(), "", DataViewRowState.CurrentRows)); if (row != null) { Value = row[ValueField].ToString(); } else { throw new Exception(string.Format("Table '{0}' not containt code in '{1}'", view.Table.TableName, EnableControls.ID)); } } if (!string.IsNullOrEmpty(Value) && BaseListDataBoundControl != null) { ClientID = BaseListDataBoundControl.GetClientID(Value); ControlID = ClientID; } }
public static string AddDropDownList(StringBuilder sb, string key, string id, long?value, long?valueNotSet, string textNotSet, IDataSource dataSource, string width) { var idValue = key + "_" + id; var view = dataSource.GetView("default"); IEnumerable dataSourceData = null; view.Select(new DataSourceSelectArguments(), delegate(IEnumerable data) { dataSourceData = data; }); if (dataSourceData != null) { sb.AppendFormat(HtmlGenerator.dropDownListStart, idValue, width, HtmlGenerator.dropDownListScript); sb.AppendFormat( valueNotSet == value ? HtmlGenerator.dropDownListSelectedOption : HtmlGenerator.dropDownListOption, valueNotSet, textNotSet); foreach (var row in dataSourceData) { var propertyID = row.GetType().GetProperty("id"); var propertyName = row.GetType().GetProperty(FindHelper.GetContentFieldName("nameRu", "nameKz")); var rowID = (long)propertyID.GetValue(row, null); var rowName = propertyName.GetValue(row, null); sb.AppendFormat( rowID == value ? HtmlGenerator.dropDownListSelectedOption : HtmlGenerator.dropDownListOption, rowID, rowName); } sb.AppendFormat(HtmlGenerator.dropDownListEnd); } return(idValue); }
/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="isRun"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TAT0(Mozart.SeePlan.Pegging.PegPart pegPart, bool isRun, ref bool handled, TimeSpan prevReturnValue) { try { MicronBEAssyBEPegPart pp = pegPart as MicronBEAssyBEPegPart; StepTat stepTat = FindHelper.FindTAT(pp.Product.ProductID, pp.CurrentStep.StepID, pp.Product.LineID); if (stepTat == null) { return(TimeSpan.FromSeconds(0)); } double tat = 0; if (isRun) { tat = (double)stepTat.RUN_TAT; } else { tat = (double)stepTat.WAIT_TAT; } return(TimeSpan.FromSeconds(tat)); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(TimeSpan)); } }
/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="isRun"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TAT0(Mozart.SeePlan.Pegging.PegPart pegPart, bool isRun, ref bool handled, TimeSpan prevReturnValue) { MicronBETestBEPegPart pp = pegPart as MicronBETestBEPegPart; double tat = FindHelper.FindTAT(pp.Product.LineID, pp.Product.ProductID, pp.CurrentStep.StepID, isRun); return(TimeSpan.FromSeconds(tat)); }
/// <summary> /// </summary> /// <param name="upWorkStep"/> /// <param name="context"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public bool CAN_ASSIGN_MORE0(WorkStep upWorkStep, JobChangeContext context, ref bool handled, bool prevReturnValue) { try { DateTime nowDT = FindHelper.GetNowDT(); return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(bool)); } }
/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public double GET_YIELD0(Mozart.SeePlan.Pegging.PegPart pegPart, ref bool handled, double prevReturnValue) { try { MicronBEAssyBEPegPart pp = pegPart as MicronBEAssyBEPegPart; double yield = FindHelper.FindYield(pp.Product.ProductID, pp.CurrentStep.StepID, pp.Product.LineID); return(yield); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(1d); } }
/// <summary> /// Заполнить спсок DataSourceOther. /// </summary> public void FillDataSourceOther(int maximumRows) { var list = new List <KeyValuePair <long, string> >(); DataSourceView view = DataSource.GetView("default"); var baseView = view as BaseDataSourceView <long>; if (baseView != null) { baseView.CancelTreeUse = true; } IEnumerable dataSourceData = null; var arguments = new DataSourceSelectArguments(); if (maximumRows > 0) { arguments.MaximumRows = maximumRows; } view.Select(arguments, delegate(IEnumerable data) { dataSourceData = data; }); if (dataSourceData != null) { var enumerator = dataSourceData.GetEnumerator(); PropertyInfo propertyID = null; PropertyInfo propertyName = null; if (enumerator.MoveNext()) { var fieldName = FindHelper.GetContentFieldName("nameRu", "nameKz"); var row = enumerator.Current; propertyID = row.GetType().GetProperty("id"); propertyName = row.GetType().GetProperty(fieldName); list.Add( new KeyValuePair <long, string>( (long)propertyID.GetValue(row, null), (propertyName.GetValue(row, null) ?? string.Empty).ToString())); } while (enumerator.MoveNext()) { var row = enumerator.Current; list.Add( new KeyValuePair <long, string>( (long)propertyID.GetValue(row, null), (propertyName.GetValue(row, null) ?? string.Empty).ToString())); } } DataSourceOther = list; }
public static CodeNamespaceItem MapNamespace(NamespaceDeclarationSyntax member, ICodeViewUserControl control, SemanticModel semanticModel, SyntaxTree tree) { if (member == null) { return(null); } var item = BaseMapper.MapBase <CodeNamespaceItem>(member, member.Name, control, semanticModel); item.Kind = CodeItemKindEnum.Namespace; item.Moniker = IconMapper.MapMoniker(item.Kind, item.Access); item.BorderColor = Colors.DarkGray; item.IgnoreVisibility = VisibilityHelper.GetIgnoreVisibility(item); if (TriviaSummaryMapper.HasSummary(member) && SettingsHelper.UseXMLComments) { item.Tooltip = TriviaSummaryMapper.Map(member); } var regions = RegionMapper.MapRegions(tree, member.Span, control); foreach (var namespaceMember in member.Members) { var memberItem = SyntaxMapper.MapMember(namespaceMember); if (memberItem != null && !RegionMapper.AddToRegion(regions, memberItem)) { item.Members.Add(memberItem); } } // Add regions to namespace if they are not present in any children of the namespace if (regions.Any()) { foreach (var region in regions) { if (FindHelper.FindCodeItem(item.Members, region.Id) == null) { item.Members.Add(region); } } } return(item); }
public static CodeNamespaceItem MapNamespace(VisualBasicSyntax.NamespaceBlockSyntax member, ICodeViewUserControl control, SemanticModel semanticModel, SyntaxTree tree) { if (member == null) { return(null); } var item = BaseMapper.MapBase <CodeNamespaceItem>(member, member.NamespaceStatement.Name, control, semanticModel); item.Kind = CodeItemKindEnum.Namespace; item.Moniker = IconMapper.MapMoniker(item.Kind, item.Access); item.BorderColor = Colors.DarkGray; if (TriviaSummaryMapper.HasSummary(member) && SettingsHelper.UseXMLComments) { item.Tooltip = TriviaSummaryMapper.Map(member); } var regions = RegionMapper.MapRegions(tree, member.Span, control); foreach (var namespaceMember in member.Members) { var memberItem = SyntaxMapper.MapMember(namespaceMember); if (memberItem != null && !RegionMapper.AddToRegion(regions, memberItem)) { item.Members.Add(memberItem); } } // Add regions to class if they have a region member inside them if (regions.Any()) { foreach (var region in regions) { if (FindHelper.FindCodeItem(item.Members, region.Id) == null) { item.Members.Add(region); } } } return(item); }
public bool OnAfterLoad_Demand(Demand entity) { try { entity.DEMAND_ID = UtilityHelper.Trim(entity.DEMAND_ID); entity.LINE_ID = UtilityHelper.Trim(entity.LINE_ID); entity.PRODUCT_ID = UtilityHelper.Trim(entity.PRODUCT_ID); entity.PRODUCT_NAME = UtilityHelper.Trim(entity.PRODUCT_NAME); entity.CUSTOMER = UtilityHelper.Trim(entity.CUSTOMER); entity.WEEK_NO = UtilityHelper.Trim(entity.WEEK_NO); entity.DEMAND_TYPE = UtilityHelper.Trim(entity.DEMAND_TYPE); entity.PRODUCT_TYPE = UtilityHelper.Trim(entity.PRODUCT_TYPE); entity.GRADE = UtilityHelper.Trim(entity.GRADE); Product demandProd = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID); if (demandProd == null) { return(false); } i++; MicronBEAssyBEMoMaster moMaster; if (InputMart.Instance.MicronBEAssyBEMoMaster.TryGetValue(entity.PRODUCT_ID, out moMaster) == false) { moMaster = new MicronBEAssyBEMoMaster(); moMaster.Product = demandProd; InputMart.Instance.MicronBEAssyBEMoMaster.Add(entity.PRODUCT_ID, moMaster); } MicronBEAssyBEMoPlan moPlan = NewHelper.NewMicronBEAssyMoPlan(moMaster, entity, i); moMaster.AddMoPlan(moPlan); return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
private static void IndexProduct(FindHelper helper, IIndexableContent p) { if (p.ShouldIndex()) { var currentMarket = ServiceLocator.Current.GetInstance <Mediachase.Commerce.ICurrentMarket>().GetCurrentMarket(); FindProduct findProduct = p.GetFindProduct(currentMarket); if (findProduct != null) { IClient client = SearchClient.Instance; client.Index(findProduct); } } else { //TODO: remove product from index //IClient client = SearchClient.Instance; //var lang = p.Language; //client.Delete<FindProduct>(productContent.ContentLink.ID + "_" + (lang == null ? string.Empty : lang.Name)); } }
public void ON_AFTER_RUN0(WorkAgent wagent, ref bool handled) { if (wagent.Groups == null) { return; } else { var nowDT = FindHelper.GetNowDT(); //if (count > 1) // return; foreach (var wg in wagent.Groups) { foreach (var ws in wg.Steps) { foreach (var profile in ws.Profiles) { foreach (var lot in profile.Value) { if (ws.Key.ToString() == "S0250" && profile.Key.Target.EqpID == "WB02" && nowDT >= new DateTime(2018, 01, 12, 12, 10, 00)) { if (ws.Inflows.Contains(lot)) { Logger.MonitorInfo("Inflow Profile -> STEP : {0}, EQP_ID : {1}, LOT_ID : {2}, IN_TIME : {3}, OUT_TIME : {4}, NowDT : {5}", ws.Key.ToString(), profile.Key.Target.EqpID, lot.Lot.LotID, lot.InTime, lot.OutTime, wagent.NowDT); } else { Logger.MonitorInfo("Profile -> STEP : {0}, EQP_ID : {1}, LOT_ID : {2}, IN_TIME : {3}, OUT_TIME : {4}, NowDT : {5}", ws.Key.ToString(), profile.Key.Target.EqpID, lot.Lot.LotID, lot.InTime, lot.OutTime, wagent.NowDT); } } } } } } count++; } }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_ProductMaster(ProductMaster entity) { try { entity.LINE_ID = UtilityHelper.Trim(entity.LINE_ID); entity.PRODUCT_ID = UtilityHelper.Trim(entity.PRODUCT_ID); entity.PRODUCT_NAME = UtilityHelper.Trim(entity.PRODUCT_NAME); entity.PROCESS_ID = UtilityHelper.Trim(entity.PROCESS_ID); entity.DESIGN_ID = UtilityHelper.Trim(entity.DESIGN_ID); entity.MATERIAL_GROUP = UtilityHelper.Trim(entity.MATERIAL_GROUP); entity.PKG_FAMILY = UtilityHelper.Trim(entity.PKG_FAMILY); entity.PKG_TYPE = UtilityHelper.Trim(entity.PKG_TYPE); MicronBEAssyProcess process = FindHelper.FindProcess(entity.LINE_ID, entity.PROCESS_ID); if (process != null) { Tuple <string, string> key = new Tuple <string, string>(entity.LINE_ID, entity.PRODUCT_ID); if (InputMart.Instance.ProductDetail.ContainsKey(key) == false) { ProductDetail detail = NewHelper.NewProductDetail(entity, process); InputMart.Instance.ProductDetail.Add(key, detail); } } else { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PROCESS, entity.LINE_ID, string.Empty, string.Empty, entity.PRODUCT_ID, entity.DESIGN_ID, string.Empty, 0, string.Empty, ErrorMessageHelper.CANNOT_FIND_PROCESS_STEP, string.Format("PROCESS_ID : {0}", entity.PROCESS_ID), entity.GetType().Name); } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
/// <summary> /// </summary> /// <param name="upWorkStep"/> /// <param name="assignEqps"/> /// <param name="context"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public List <AssignEqp> DO_FILTER_ASSIGN_EQP0(WorkStep upWorkStep, List <AssignEqp> assignEqps, JobChangeContext context, ref bool handled, List <AssignEqp> prevReturnValue) { try { List <AssignEqp> list = new List <AssignEqp>(); foreach (AssignEqp eqp in assignEqps) { if (eqp.WorkStep == null || eqp.WorkStep.OperationType == OperationType.Down) { list.Add(eqp); continue; } int properEqpCount = SimulationHelper.CalculateProperEqpCount(eqp); bool canFilter = false; canFilter = SimulationHelper.CanFilterAssignEqp(eqp); if (properEqpCount < eqp.WorkStep.LoadedEqpCount && canFilter) { #if DEBUG DateTime nowDt = FindHelper.GetNowDT(); MicronBEAssyWorkStep ws = eqp.WorkStep as MicronBEAssyWorkStep; if (eqp.WorkStep.Key.ToString() == "S0250") { Console.WriteLine(); } Logger.MonitorInfo(string.Format("Filtered -> STEP : {0}, EQP_ID : {1}, NowDT : {2}, Available Down : {3}", eqp.WorkStep.Key.ToString(), eqp.Target.EqpID, DateUtility.DbToString(FindHelper.GetNowDT()), DateUtility.DbToString(ws.AvailableDownTime))); #endif list.Add(eqp); } } return(list); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(List <AssignEqp>)); } }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_ProductMaster(ProductMaster entity) { MicronBETestProcess process = FindHelper.FindProcess(entity.PROCESS_ID); if (process == null) { return(false); } MicronBETestProduct product = new MicronBETestProduct(entity.PRODUCT_ID, process); product.LineID = entity.LINE_ID; //product.IsFinal = entity.IS_FINAL == "Y" ? true : false; //product.Grade = string.IsNullOrEmpty(entity.GRADE) ? "Z" : entity.GRADE; if (InputMart.Instance.MicronBETestProduct.ContainsKey(entity.PRODUCT_ID) == false) { InputMart.Instance.MicronBETestProduct.Add(entity.PRODUCT_ID, product); } return(false); }
/// <summary> /// Note! This method should not fail, it will prevent the product from /// being saved. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void events_PublishedContent(object sender, ContentEventArgs e) { if (IndexingEnabled == false) { return; } FindHelper helper = ServiceLocator.Current.GetInstance <FindHelper>(); if (e.Content is IIndexableContent) { try { IndexProduct(helper, e.Content as IIndexableContent); } catch (Exception exception) { _log.Error("Cannot index: " + e.ContentLink.ToString(), exception); } } else if (e.Content is FashionItemContent) { EntryContentBase parent = GetParent(e.Content as EntryContentBase); FashionProductContent productContent = parent as FashionProductContent; if (productContent != null) { try { IndexProduct(helper, productContent); } catch (Exception exception) { _log.Error("Cannot index: " + e.ContentLink.ToString(), exception); } } } }
/// <summary> /// </summary> /// <param name="step"/> /// <param name="assignedEqps"/> /// <param name="context"/> /// <param name="handled"/> public void ON_AFTER_ASSIGN_EQP0(WorkStep step, List <AssignEqp> assignedEqps, JobChangeContext context, ref bool handled) { try { Logger.MonitorInfo(string.Format("Assign Eqp -> STEP : {0}, EQP_ID : {1}, NowDT : {2}", step.Key.ToString(), assignedEqps.ElementAt(0).Target.EqpID, DateUtility.DbToString(FindHelper.GetNowDT()))); MicronBEAssyWorkStep ws = step as MicronBEAssyWorkStep; double setupTime = 0d; ws.AvailableDownTime = SimulationHelper.CalculateAvailableDownTime(step, assignedEqps.ElementAt(0), ref setupTime); Logger.MonitorInfo(string.Format("Available Down Time : {0}, Setup Time : {1}", ws.AvailableDownTime, setupTime)); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } //foreach (AssignEqp eqp in assignedEqps) //{ // eqp.Target.WakeUp(); //} }
private static void IndexProduct(FindHelper helper, IIndexableContent p) { if (p.ShouldIndex()) { var currentMarket = ServiceLocator.Current.GetInstance<Mediachase.Commerce.ICurrentMarket>().GetCurrentMarket(); FindProduct findProduct = p.GetFindProduct(currentMarket); if (findProduct != null) { IClient client = SearchClient.Instance; client.Index(findProduct); } } else { //TODO: remove product from index //IClient client = SearchClient.Instance; //var lang = p.Language; //client.Delete<FindProduct>(productContent.ContentLink.ID + "_" + (lang == null ? string.Empty : lang.Name)); } }
/// <summary> /// </summary> /// <param name="step"/> /// <param name="context"/> /// <param name="reason"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public OperationType CLASSIFY_OPERATION_TYPE0(WorkStep step, JobChangeContext context, out object reason, ref bool handled, OperationType prevReturnValue) { try { reason = string.Empty; OperationType oType = OperationType.Keep; MicronBEAssyWorkStep ws = step as MicronBEAssyWorkStep; DateTime nowDT = FindHelper.GetNowDT(); #if DEBUG if (step.Key.ToString() == "S0250" && nowDT >= new DateTime(2018, 06, 12, 12, 10, 00)) { Console.WriteLine(); } #endif if (ws.LoadedEqps.Count > 1) { DateTime runDownTime = JobChangeHelper.GetMinRunDownTime(ws); if (runDownTime.Subtract(nowDT).TotalSeconds < ws.DownInterval.TotalSeconds) { return(OperationType.Down); } } if (ws.LoadedEqps.Count == 1) { if (ws.ProfileAssignWips.Count <= 0) { return(OperationType.Down); } } if (ws.Wips.Count > 0) { AoEquipment selectEqp = null; DateTime minNextInTime = DateTime.MaxValue; foreach (AoEquipment aeqp in ws.LoadableEqps) { if (ws.LoadedEqpIDs.Contains(aeqp.EqpID)) { continue; } //DateTime nextInTime = (DateTime)SimulationHelper.GetNextInTime(aeqp, false); DateTime nextInTime = (DateTime)aeqp.GetNextInTime(false); if (selectEqp == null || minNextInTime > nextInTime) { selectEqp = aeqp; minNextInTime = nextInTime; } } if (selectEqp != null) { if (step.Key.ToString() == "S0300" && nowDT >= new DateTime(2018, 01, 26, 07, 30, 00)) { Console.WriteLine(); } if (step.Key.ToString() == "S0300" && nowDT >= new DateTime(2018, 01, 26, 11, 00, 00)) { Console.WriteLine(); } ws.AddLoadedEqp(selectEqp); ws.Group.CalculateProfile(ws); //SimulationHelper.CalculateProfile(ws.Group, ws); DateTime runDownTime = JobChangeHelper.GetMinRunDownTime(ws); ws.RemoveLoadedEqp(selectEqp); ws.Group.CalculateProfile(ws); //SimulationHelper.CalculateProfile(ws.Group, ws); var setupControl = ServiceLocator.Resolve <SetupControl>(); var processControl = ServiceLocator.Resolve <ProcessControl>(); bool isNeedSetup = false; var setupTime = 0d; var wip = ws.Wips.FirstOrDefault(); if (wip != null) { var beLot = wip.Lot as MicronBEAssyBELot; bool _handled = false; isNeedSetup = processControl.IS_NEED_SETUP0(selectEqp, beLot, ref _handled, false); if (isNeedSetup) { setupTime = setupControl.GET_SETUP_TIME0(selectEqp, beLot, ref _handled, default(Mozart.Simulation.Engine.Time)).TotalSeconds; } } if (runDownTime > nowDT.AddSeconds(ws.NewUpInterval.TotalSeconds + setupTime)) { #if DEBUG if (step.Key.ToString() == "S0250" && nowDT >= new DateTime(2018, 06, 12, 12, 10, 00)) { Console.WriteLine(); } #endif oType = OperationType.Up; } else { oType = OperationType.Keep; } } } return(oType); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); reason = string.Empty; return(default(OperationType)); } }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_McpBom(McpBom entity) { try { entity.LINE_ID = UtilityHelper.Trim(entity.LINE_ID); entity.STEP_ID = UtilityHelper.Trim(entity.STEP_ID); entity.FROM_PROD_ID = UtilityHelper.Trim(entity.FROM_PROD_ID); entity.FROM_PROD_NAME = UtilityHelper.Trim(entity.FROM_PROD_NAME); entity.TO_PROD_ID = UtilityHelper.Trim(entity.TO_PROD_ID); entity.TO_PROD_NAME = UtilityHelper.Trim(entity.TO_PROD_NAME); entity.FINAL_PROD_ID = UtilityHelper.Trim(entity.FINAL_PROD_ID); entity.FINAL_PROD_NAME = UtilityHelper.Trim(entity.FINAL_PROD_NAME); entity.ASSY_IN_PROD_ID = UtilityHelper.Trim(entity.ASSY_IN_PROD_ID); entity.ASSY_IN_PROD_NAME = UtilityHelper.Trim(entity.ASSY_IN_PROD_NAME); #if DEBUG if (entity.ASSY_IN_PROD_ID == "357937") { Console.WriteLine(); } if (entity.FINAL_PROD_ID == "357937") { Console.WriteLine(); } #endif AssyMcpProduct finalProduct = null; Tuple <string, string, bool, bool, int> key = new Tuple <string, string, bool, bool, int>(entity.LINE_ID, entity.FINAL_PROD_ID, false, false, 1); if (InputMart.Instance.MicronBEProducts.TryGetValue(key, out finalProduct) == false) { ProductDetail productDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.FINAL_PROD_ID); if (productDetail == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PRODUCT, entity.LINE_ID, string.Empty, string.Empty, entity.FINAL_PROD_ID, string.Empty, string.Empty, 0, string.Empty, "Cannot find ProductMaster", string.Empty, "McpBom"); return(false); } finalProduct = NewHelper.NewAssyMcpProduct(entity, productDetail); InputMart.Instance.MicronBEProducts.Add(key, finalProduct); } ProductDetail inProductDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.ASSY_IN_PROD_ID); if (inProductDetail == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PRODUCT, entity.LINE_ID, string.Empty, string.Empty, entity.ASSY_IN_PROD_ID, string.Empty, string.Empty, 0, string.Empty, "Cannot find ProductMaster", string.Empty, "McpBom"); return(false); } Tuple <string, string, bool, bool, int> inProdKey = new Tuple <string, string, bool, bool, int>(entity.LINE_ID, entity.ASSY_IN_PROD_ID, true, false, entity.COMP_SEQ); AssyMcpPart inMcpPart; if (InputMart.Instance.MicronBEProducts.TryGetValue(inProdKey, out inMcpPart) == false) { inMcpPart = NewHelper.NewAssyMcpPart(entity.LINE_ID, entity.ASSY_IN_PROD_ID, finalProduct, false, entity.COMP_SEQ, entity.COMP_QTY, inProductDetail); inMcpPart.PartChangeStep = entity.STEP_ID; InputMart.Instance.MicronBEProducts.Add(inProdKey, inMcpPart); } if (finalProduct.AllParts.Contains(inMcpPart) == false) { finalProduct.AllParts.Add(inMcpPart); } if (finalProduct.AssyParts.Contains(inMcpPart) == false) { finalProduct.AssyParts.Add(inMcpPart); } finalProduct.MaxSequence = finalProduct.AssyParts.Count; return(true); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_Wip(Wip entity) { try { entity.LOT_ID = UtilityHelper.Trim(entity.LOT_ID); entity.LINE_ID = UtilityHelper.Trim(entity.LINE_ID); entity.STEP_ID = UtilityHelper.Trim(entity.STEP_ID); entity.PROCESS_ID = UtilityHelper.Trim(entity.PROCESS_ID); entity.PRODUCT_ID = UtilityHelper.Trim(entity.PRODUCT_ID); entity.PRODUCT_NAME = UtilityHelper.Trim(entity.PRODUCT_NAME); entity.HOLD_CODE = UtilityHelper.Trim(entity.HOLD_CODE); entity.LOT_STATE = UtilityHelper.Trim(entity.LOT_STATE); entity.EQP_ID = UtilityHelper.Trim(entity.EQP_ID); entity.ASM_RESERVATION_ID = UtilityHelper.Trim(entity.ASM_RESERVATION_ID); #if DEBUG if (entity.LOT_ID.StartsWith("BF8QK4N.5X")) { Console.WriteLine(); } if (entity.PRODUCT_ID == "BF8QK4N.5X") { Console.WriteLine(); } #endif ProductDetail productDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.PRODUCT_ID); Mozart.SeePlan.Simulation.EntityState state = FindHelper.FindLotState(entity.LOT_STATE, entity.HOLD_CODE, entity.EQP_ID); if (productDetail == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID, entity.LOT_ID, entity.PRODUCT_ID, string.Empty, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProductMaster", string.Empty, "Wip"); WriteHelper.WriteUnpeg(entity, string.Empty, false, state, UnpegReason.MASTER_DATA, "Cannot find ProductMaster"); return(false); } MicronBEAssyProcess process = productDetail.Process; MicronBEAssyBEStep step = process.FindStep(entity.STEP_ID) as MicronBEAssyBEStep; if (step == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID, entity.LOT_ID, entity.PRODUCT_ID, productDetail.DesignID, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProcessStep", string.Format("PROCESS_ID : {0}", productDetail.Process.ProcessID), "Wip"); WriteHelper.WriteUnpeg(entity, productDetail.DesignID, false, state, UnpegReason.MASTER_DATA, "Cannot find ProcessStep"); return(false); } string unpegReason = string.Empty; Product product = FindHelper.FindWipProduct(entity, process, step, state, out unpegReason); if (product == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.WIP, entity.LINE_ID, entity.STEP_ID, entity.LOT_ID, entity.PRODUCT_ID, productDetail.DesignID, string.Empty, entity.LOT_QTY, string.Empty, "Cannot find ProcessStep", string.Format("PROCESS_ID : {0}", productDetail.Process.ProcessID), "Wip"); WriteHelper.WriteUnpeg(entity, productDetail.DesignID, false, state, UnpegReason.MASTER_DATA, unpegReason); return(false); } MicronBEAssyWipInfo wipInfo = new MicronBEAssyWipInfo(); wipInfo.LotID = entity.LOT_ID; wipInfo.Product = product; wipInfo.Process = process; wipInfo.UnitQty = (double)entity.LOT_QTY; wipInfo.InitialStep = process.FindStep(entity.STEP_ID); wipInfo.CurrentState = state; wipInfo.LineID = entity.LINE_ID; InputMart.Instance.MicronBEAssyWipInfo.Add(wipInfo.InitialStep.StepID, wipInfo); return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }
/// <summary> /// </summary> /// <param name="weqp"/> /// <param name="wlot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public TimeSpan GET_TACT_TIME0(WorkEqp weqp, WorkLot wlot, ref bool handled, TimeSpan prevReturnValue) { try { MicronBEAssyWorkLot lot = wlot as MicronBEAssyWorkLot; double unitQty = (wlot.Batch as MicronBEAssyBELot).UnitQtyDouble; MicronBEAssyBELot beLot = wlot.Batch as MicronBEAssyBELot; var setupControl = ServiceLocator.Resolve <SetupControl>(); var processControl = ServiceLocator.Resolve <ProcessControl>(); MicronBEAssyEqp eqp = FindHelper.FindEquipment(weqp.Target.EqpID); double tactTime = SimulationHelper.GetTactTime(beLot.LineID, lot.Step.StepID, lot.Product.ProductID, eqp); if (beLot.CurrentStepID != weqp.Step.Key.ToString()) { return(TimeSpan.FromSeconds(tactTime * unitQty)); } #if DEBUG //if (lot.LotID == "LOT10_3") // Console.WriteLine(); //if (FindHelper.GetNowDT().Hour == 22 && FindHelper.GetNowDT().Minute == 30) // Console.WriteLine(); var nowDt = FindHelper.GetNowDT(); if (lot.LotID == "LOT10_9" && lot.Step.Key.ToString() == "S0300" && weqp.Target.EqpID == "DA01" && nowDt >= new DateTime(2018, 01, 26, 12, 00, 00)) { Console.WriteLine(); } #endif bool isNeedSetup = false; double setupTime = 0d; var lastWorkLots = weqp.Step.Profiles[weqp]; if (lastWorkLots != null && lastWorkLots.Count != 0) { isNeedSetup = SimulationHelper.IsNeedSetupProfile(weqp, beLot); if (isNeedSetup) { setupTime = SimulationHelper.GetSetupTimeProfile(weqp, beLot).TotalSeconds; } } else { bool _handled = false; isNeedSetup = processControl.IS_NEED_SETUP0(weqp.Target, beLot, ref _handled, false); if (isNeedSetup) { setupTime = setupControl.GET_SETUP_TIME0(weqp.Target, beLot, ref _handled, default(Mozart.Simulation.Engine.Time)).TotalSeconds; } } double tactTimeWithSetup = setupTime + (tactTime * unitQty); return(TimeSpan.FromSeconds(tactTimeWithSetup)); //return TimeSpan.FromSeconds(tactTime); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(TimeSpan)); } }
/// <summary> /// </summary> /// <param name="wstep"/> /// <param name="wlot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public WorkLot UPDATE0(WorkStep wstep, WorkLot wlot, ref bool handled, WorkLot prevReturnValue) { try { MicronBEAssyBELot lot = wlot.Batch as MicronBEAssyBELot; bool isRun = JobChangeHelper.IsRun(lot); DateTime availableTime = FindHelper.GetNowDT(); MicronBEAssyEqp eqp = FindHelper.FindEquipment(lot.CurrentPlan.ResID); double tactTime = SimulationHelper.GetTactTime(lot.LineID, lot.CurrentStepID, lot.Product.ProductID, eqp); StepTat stepTat = FindHelper.FindTAT(lot.Product.ProductID, lot.CurrentStepID, lot.LineID); if (isRun) { #if DEBUG //var nowDt = FindHelper.GetNowDT(); if (lot.LotID == "LOT11_1" && lot.CurrentStepID == "S0200") { Console.WriteLine(); } //if (nowDt >= new DateTime(2018, 06, 12, 11, 40, 00)) // Console.WriteLine(); #endif double runTat = stepTat == null ? 0 : (double)stepTat.RUN_TAT; #if DEBUG if (runTat > 0) { Console.WriteLine(); } #endif availableTime = availableTime.AddSeconds(tactTime * lot.UnitQtyDouble + runTat); } else { double waitTat = stepTat == null ? 0 : (double)stepTat.WAIT_TAT; #if DEBUG if (waitTat > 0) { Console.WriteLine(); } #endif availableTime = availableTime.AddSeconds(waitTat); } AoEquipment reservationEqp = isRun ? null : lot.ReservationEqp; MicronBEAssyWorkLot newWorkLot = CreateHelper.CreateWorkLot(wlot.Batch, availableTime, wstep.Key, wstep.Steps[0], reservationEqp); return(newWorkLot); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(WorkLot)); } }
/// <summary> /// </summary> /// <param name="wstep"/> /// <param name="wlot"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public IEnumerable <WorkLot> ADVANCE0(WorkStep wstep, WorkLot wlot, ref bool handled, IEnumerable <WorkLot> prevReturnValue) { try { var nowDt = FindHelper.GetNowDT(); #if DEBUG if (nowDt >= new DateTime(2018, 01, 26, 07, 00, 00)) { Console.WriteLine(); } if (wstep.Key.ToString() == "S0250" && wlot.Lot.LotID == "LOT10_1") { Console.WriteLine(); } if (wlot.Lot.LotID == "LOT11_1") { Console.WriteLine(); } #endif if (wlot.OutTime > FindHelper.GetNowDT().AddHours(10)) { return(null); } #if DEBUG //if (wstep.Key.ToString() == "S0100") // Console.WriteLine(); #endif List <WorkLot> list = new List <WorkLot>(); MicronBEAssyWorkLot currentWLot = wlot as MicronBEAssyWorkLot; MicronBEAssyBEStep currentStep = wstep.Steps[0] as MicronBEAssyBEStep; string stepKey = JobChangeHelper.GetStepKey(currentWLot.Product, currentStep.GetDefaultNextStep() as MicronBEAssyBEStep, false); //string stepKey = currentStep.GetDefaultNextStep().StepID; if (stepKey != null) { MicronBEAssyWorkStep nextWorkStep = wstep.Group.TryGetStep(stepKey) as MicronBEAssyWorkStep; if (nextWorkStep != null) { MicronBEAssyWorkLot newWorkLot = CreateHelper.CreateWorkLot(wlot.Batch, wlot.OutTime, nextWorkStep.Key, nextWorkStep.Steps.ElementAt(0), null); newWorkLot.LotID = currentWLot.LotID; newWorkLot.Product = currentWLot.Product; newWorkLot.UnitQty = currentWLot.UnitQty; //if (currentWLot.Product is AssyMcpPart) //{ // MicronBEAssyBEStep workTargetStep = wstep.Steps[0] as MicronBEAssyBEStep; // if (workTargetStep.StepAction != null && workTargetStep.StepAction.FWTractIn == StepActionInfo.MCP) // { // AssyMcpPart mcpPart = currentWLot.Product as AssyMcpPart; // if (mcpPart.SequenceResolved != (wstep as MicronBEAssyWorkStep).Sequence) // newWorkLot.Product = mcpPart.Next == null ? mcpPart.OutProduct as Product : mcpPart.Next as Product; // } //} if (newWorkLot.Product != null) { list.Add(newWorkLot); } } } return(list); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(IEnumerable <WorkLot>)); } }
/// <summary> /// </summary> /// <param name="context"/> public void OnAction_McpBom(IPersistContext context) { try { HashSet <AssyMcpProduct> mcpProductList = new HashSet <AssyMcpProduct>(); InputMart.Instance.McpBom.DefaultView.Sort = "COMP_SEQ"; foreach (McpBom bom in InputMart.Instance.McpBom.DefaultView) { #if DEBUG if (bom.FINAL_PROD_ID == "357937") { Console.WriteLine(); } #endif Tuple <string, string, bool, bool, int> key = new Tuple <string, string, bool, bool, int>(bom.LINE_ID, bom.FINAL_PROD_ID, false, false, 1); AssyMcpProduct mcpProduct = FindHelper.FindProduct(bom.LINE_ID, bom.FINAL_PROD_ID) as AssyMcpProduct; if (mcpProduct == null) { continue; } mcpProductList.Add(mcpProduct); AssyMcpPart inMcpPart = FindHelper.FindProduct(bom.LINE_ID, bom.ASSY_IN_PROD_ID, true, false, bom.COMP_SEQ) as AssyMcpPart; if (inMcpPart == null) { continue; } AssyMcpPart fromMcpPart = null; if (bom.FROM_PROD_ID == bom.ASSY_IN_PROD_ID && bom.COMP_SEQ == 1) { fromMcpPart = null; } else { fromMcpPart = FindHelper.FindProduct(bom.LINE_ID, bom.FROM_PROD_ID, true, true, bom.COMP_SEQ - 1) as AssyMcpPart; if (fromMcpPart == null) { continue; } fromMcpPart.PartChangeStep = bom.STEP_ID; } #if DEBUG try { if (mcpProduct.MaxSequence > bom.COMP_QTY) { Console.WriteLine(); } } catch { Console.WriteLine(); } #endif if (mcpProduct.MaxSequence > bom.COMP_SEQ) { AssyMcpPart toMcpPart = FindHelper.FindProduct(bom.LINE_ID, bom.TO_PROD_ID, true, true, bom.COMP_SEQ) as AssyMcpPart; if (toMcpPart == null) { ProductDetail midProductDetail = FindHelper.FindProductDetail(bom.LINE_ID, bom.TO_PROD_ID); if (midProductDetail == null) { continue; } Tuple <string, string, bool, bool, int> midKey = new Tuple <string, string, bool, bool, int>(bom.LINE_ID, bom.TO_PROD_ID, true, true, bom.COMP_SEQ); if (InputMart.Instance.MicronBEProducts.ContainsKey(midKey) == false) { toMcpPart = NewHelper.NewAssyMcpPart(bom.LINE_ID, bom.TO_PROD_ID, mcpProduct, true, bom.COMP_SEQ, 1, midProductDetail); InputMart.Instance.MicronBEProducts.Add(midKey, toMcpPart); toMcpPart.AddPrev(inMcpPart); inMcpPart.AddNext(toMcpPart); if (fromMcpPart != null) { fromMcpPart.AddNext(toMcpPart); toMcpPart.AddPrev(fromMcpPart); } mcpProduct.AllParts.Add(toMcpPart); } } } else { if (fromMcpPart != null) { mcpProduct.AddPrev(fromMcpPart); } mcpProduct.AddPrev(inMcpPart); } } foreach (AssyMcpProduct mcpProduct in mcpProductList) { foreach (AssyMcpPart mcpPart in mcpProduct.AllParts) { if (mcpPart.IsMidPart || mcpPart.CompSeq == 1) { mcpPart.IsBase = true; } } } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
/// <summary> /// </summary> /// <param name="entity"/> /// <returns/> public bool OnAfterLoad_ProductRoute(ProductRoute entity) { try { entity.LINE_ID = UtilityHelper.Trim(entity.LINE_ID); entity.FROM_PROD_ID = UtilityHelper.Trim(entity.FROM_PROD_ID); entity.FROM_PROD_NAME = UtilityHelper.Trim(entity.FROM_PROD_NAME); entity.STEP_ID = UtilityHelper.Trim(entity.STEP_ID); entity.TO_PROD_ID = UtilityHelper.Trim(entity.TO_PROD_ID); entity.TO_PROD_NAME = UtilityHelper.Trim(entity.TO_PROD_NAME); ProductDetail fromProdDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.FROM_PROD_ID); if (fromProdDetail == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PRODUCT, entity.LINE_ID, string.Empty, string.Empty, entity.FROM_PROD_ID, string.Empty, string.Empty, 0, string.Empty, "Cannot find ProductMaster", string.Empty, "ProductRoute"); return(false); } Tuple <string, string, bool, bool, int> fromProdKey = new Tuple <string, string, bool, bool, int>(entity.LINE_ID, entity.FROM_PROD_ID, false, false, 1); MicronBEAssyProduct fromProduct; if (InputMart.Instance.MicronBEProducts.TryGetValue(fromProdKey, out fromProduct) == false) { fromProduct = NewHelper.NewMicronBeAssyProduct(fromProdDetail); fromProduct.PartChangeStep = entity.STEP_ID; InputMart.Instance.MicronBEProducts.Add(fromProdKey, fromProduct); } ProductDetail toProdDetail = FindHelper.FindProductDetail(entity.LINE_ID, entity.TO_PROD_ID); if (toProdDetail == null) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PRODUCT, entity.LINE_ID, string.Empty, string.Empty, entity.TO_PROD_ID, string.Empty, string.Empty, 0, string.Empty, "Cannot find ProductMaster", string.Empty, "ProductRoute"); return(false); } ICollection <AssyMcpPart> assyInProducts = FindHelper.FindAssyInParts(entity.LINE_ID, entity.TO_PROD_ID); if (assyInProducts.IsNullOrEmpty()) { WriteHelper.WriteMasterDataErrorLog(MasterDataErrorEventType.PRODUCT, entity.LINE_ID, string.Empty, string.Empty, entity.TO_PROD_ID, string.Empty, string.Empty, 0, string.Empty, "Cannot find McpBom", string.Empty, "ProductRoute"); return(false); } foreach (AssyMcpPart inPart in assyInProducts) { inPart.AddPrev(fromProduct); fromProduct.AddNext(inPart); } return(false); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(false); } }