public static MicronBEAssyBatch CreateBatch(MicronBEAssyBELot lot) { try { AssyMcpProduct aoProd = lot.Product.GetAssyOutProduct(); if (aoProd == null) { return(null); } string aoProdID = aoProd.ProductID; Tuple <string, string> key = Tuple.Create(aoProdID, lot.LineID); MicronBEAssyBatch batch; if (InputMart.Instance.MicronBEAssyBatch.TryGetValue(key, out batch) == false) { batch = new MicronBEAssyBatch(); batch.AoProdID = aoProdID; batch.LineID = lot.LineID; SimulationHelper.SetSteps(batch, lot.Product); InputMart.Instance.MicronBEAssyBatch.Add(key, batch); } return(batch); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(MicronBEAssyBatch)); } }
/// <summary> /// </summary> /// <param name="hb"/> /// <param name="wagent"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public object GET_WORK_GROUP_KEY0(IHandlingBatch hb, WorkAgent wagent, ref bool handled, object prevReturnValue) { try { MicronBEAssyBELot lot = hb.Sample as MicronBEAssyBELot; string productID = lot.Product.ProductID; Product prod = null; InputMart.Instance.MicronBEProducts.TryGetValue(productID, out prod); AssyMcpProduct aoProd = null; if (prod is AssyMcpPart) { AssyMcpPart part = prod as AssyMcpPart; aoProd = part.FinalProduct as AssyMcpProduct; } if (prod is AssyMcpProduct) { aoProd = prod as AssyMcpProduct; } if (aoProd != null) { return(aoProd.ProductID); } return(null); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(default(object)); } }
internal static AssyMcpPart NewAssyMcpPart(string lineID, string productID, AssyMcpProduct finalProduct, bool isMidPart, int compSeq, int compQty, ProductDetail productDetail) { try { AssyMcpPart mcpPart = new AssyMcpPart(); mcpPart.Process = productDetail.Process; mcpPart.LineID = lineID; mcpPart.ProductID = productID; mcpPart.FinalProduct = finalProduct; mcpPart.IsMidPart = isMidPart; mcpPart.CompSeq = compSeq; mcpPart.CompQty = compQty; if (mcpPart.CompQty <= 0) { mcpPart.CompQty = 1; } mcpPart.ProductDetail = productDetail; return(mcpPart); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(null); } }
/// <summary> /// </summary> /// <param name="pegPart"/> /// <param name="isRun"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public List <object> GET_PART_CHANGE_INFOS0(Mozart.SeePlan.Pegging.PegPart pegPart, bool isRun, ref bool handled, List <object> prevReturnValue) { try { MicronBEAssyBEStep currentStep = pegPart.CurrentStep as MicronBEAssyBEStep; MicronBEAssyBEPegPart pp = pegPart as MicronBEAssyBEPegPart; List <object> list = new List <object>(); if (isRun) { if (pp.Product is AssyMcpProduct) { AssyMcpProduct mcpProduct = pp.Product as AssyMcpProduct; string stepID = string.Empty; if (mcpProduct.HasPrevs && mcpProduct.Prevs.ElementAt(0) is AssyMcpPart) { stepID = (mcpProduct.Prevs.ElementAt(0) as AssyMcpPart).PartChangeStep; } if (stepID == currentStep.StepID) { list.AddRange(mcpProduct.Prevs); } } else if (pp.Product is AssyMcpPart) { #if DEBUG if (currentStep.StepID == "DIE ATTACH") { Console.WriteLine(); } #endif AssyMcpPart mcpPart = pp.Product as AssyMcpPart; if (mcpPart.IsMidPart) { string stepID = string.Empty; if (mcpPart.HasPrevs && mcpPart.Prevs.ElementAt(0) is AssyMcpPart) { stepID = (mcpPart.Prevs.ElementAt(0) as AssyMcpPart).PartChangeStep; } if (stepID == currentStep.StepID) { list.AddRange(mcpPart.Prevs); } } } } return(list); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(new List <object>()); } }
/// <summary> /// </summary> /// <param name="da"/> /// <param name="hb"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public bool INTERCEPT_IN0(DispatchingAgent da, IHandlingBatch hb, ref bool handled, bool prevReturnValue) { try { MicronBEAssyBEStep currentStep = hb.CurrentStep as MicronBEAssyBEStep; MicronBEAssyBELot lot = hb as MicronBEAssyBELot; if (lot.Product is AssyMcpPart) { AssyMcpPart mcpPart = lot.Product as AssyMcpPart; AssyMcpProduct mcpProduct = mcpPart.FinalProduct as AssyMcpProduct; if (mcpPart.PartChangeStep == lot.CurrentStepID) { Tuple <AssyMcpProduct, AssyMcpPart> baseKey = null; Tuple <AssyMcpProduct, AssyMcpPart> sourceKey = null; AssyMcpPart mergeMcpPart = McpHelper.GetMergeMcpPart(mcpPart); if (mcpPart.IsBase) { baseKey = Tuple.Create(mcpProduct, mcpPart); sourceKey = Tuple.Create(mcpProduct, mergeMcpPart); InputMart.Instance.MatchingLotList.Add(baseKey, lot); } else { baseKey = Tuple.Create(mcpProduct, mergeMcpPart); sourceKey = Tuple.Create(mcpProduct, mcpPart); InputMart.Instance.MatchingLotList.Add(sourceKey, lot); } List <MicronBEAssyBELot> matchLotList = SimulationHelper.MatchingMcpLot(da, baseKey, sourceKey); foreach (MicronBEAssyBELot matchLot in matchLotList) { da.ReEnter(matchLot); } return(true); } } 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)); } }
public static void SetSteps(MicronBEAssyBatch batch, Product product) { try { if (product.IsMcp()) { AssyMcpProduct mcpProduct = null; if (product is AssyMcpPart) { mcpProduct = (product as AssyMcpPart).FinalProduct as AssyMcpProduct; } else { mcpProduct = product as AssyMcpProduct; } foreach (AssyMcpPart mcpPart in mcpProduct.AllParts) { //if (mcpPart.IsMain == false) // continue; MicronBEAssyProcess proc = mcpPart.Process as MicronBEAssyProcess; int seq = mcpPart.CompSeq; //if (proc.ProcessType == ProcessType.COW) //{ // if (mcpPart.IsMidPart == false && mcpPart.IsBase)//COW 1차는 Merge 후 2차 DA에서 진행하기 때문에 없다고 판단해야함. // { // continue; // } //} AddSteps(batch, proc, seq); } AddSteps(batch, mcpProduct.Process as MicronBEAssyProcess, mcpProduct.MaxSequence); } else { AddSteps(batch, product.Process as MicronBEAssyProcess, 1); } } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); } }
public static AssyMcpPart GetMcpPart(this AssyMcpProduct mcpProduct, string mcpCode) { try { foreach (AssyMcpPart mcpPart in mcpProduct.AllParts) { if (mcpPart.ProductID == mcpCode) { return(mcpPart); } } return(null); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(null); } }
internal static AssyMcpProduct NewAssyMcpProduct(McpBom entity, ProductDetail prodDetail) { try { AssyMcpProduct mcpProduct = new AssyMcpProduct(); mcpProduct.LineID = entity.LINE_ID; mcpProduct.ProductID = entity.FINAL_PROD_ID; mcpProduct.Process = prodDetail.Process; mcpProduct.ProductDetail = prodDetail; mcpProduct.AllParts = new List <AssyMcpPart>(); mcpProduct.AssyParts = new List <AssyMcpPart>(); return(mcpProduct); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(null); } }
public static AssyMcpProduct GetAssyOutProduct(this Product product) { try { AssyMcpProduct aoProd = null; if (product is AssyMcpPart) { AssyMcpPart part = product as AssyMcpPart; aoProd = part.FinalProduct; } if (product is AssyMcpProduct) { AssyMcpProduct prod = product as AssyMcpProduct; aoProd = prod; } return(aoProd); } catch (Exception e) { WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0} MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name)); return(null); } }
internal static Product FindWipProduct(Wip entity, MicronBEAssyProcess process, MicronBEAssyBEStep step, Mozart.SeePlan.Simulation.EntityState state, out string unpegReason) { Product product = null; unpegReason = string.Empty; #if DEBUG if (entity.PRODUCT_ID == "264153") { Console.WriteLine(); } if (entity.PRODUCT_ID == "264157") { Console.WriteLine(); } #endif int daThroughtCnt = step.DaThroughCount; if (step.StepGroup == Constants.DieAttach && state != EntityState.RUN) { daThroughtCnt = daThroughtCnt - 1;//DA 대기중인 재공은 DA를 진행하지 않은 상태로 판단 } Product wipProduct = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID); if (wipProduct is MicronBEAssyProduct) { product = wipProduct; } else if (wipProduct != null && wipProduct is AssyMcpProduct && daThroughtCnt >= 1) { AssyMcpProduct mcpProduct = wipProduct as AssyMcpProduct; if (daThroughtCnt == mcpProduct.MaxSequence) { product = mcpProduct; } else { AssyMcpPart midPart = FindHelper.FindProduct(entity.LINE_ID, entity.PRODUCT_ID, true, true, daThroughtCnt) as AssyMcpPart; if (midPart != null) { product = midPart; } #if DEBUG if (midPart == null) { Console.WriteLine(); } #endif } } else { //임시로직 - 로직이 정해지먼 재정의 해야함. //초기화시 CompSeq가 확정된 Part를 찾을 수 없기 때문에 대표로 Part를 하나 찾아서 정의를 해야함. ICollection <AssyMcpPart> products = FindHelper.FindAssyInParts(entity.LINE_ID, entity.PRODUCT_ID); if (products != null && products.Count > 0) { product = products.ElementAt(0); } } if (product == null) { if (step.StepID == Constants.LOTSRECEIVED) { unpegReason = "Cannot find McpBom or ProductRoute"; } else { unpegReason = "Cannot find McpBom"; } } return(product); }
/// <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_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); } }