示例#1
0
 public void OnAction_RTD_RtsPlanningLot(IPersistContext context)
 {
 }
示例#2
0
        /// <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));
            }
        }