Beispiel #1
0
        public static Dictionary <Tuple <string, string>, UIProductDetail> LoadProductDetail(ResultDataContext resultDataContext, Dictionary <Tuple <string, string>, UIProcess> processList, bool isProductName = false)
        {
            Dictionary <Tuple <string, string>, UIProductDetail> productDetailList = new Dictionary <Tuple <string, string>, UIProductDetail>();

            foreach (ProductMaster info in resultDataContext.ModelContext.ProductMaster)
            {
                Tuple <string, string> key = null;

                if (isProductName == false)
                {
                    key = new Tuple <string, string>(info.LINE_ID, info.PRODUCT_ID);
                }
                else
                {
                    key = new Tuple <string, string>(info.LINE_ID, info.PRODUCT_NAME);
                }

                UIProcess process = FindProcess(info.LINE_ID, info.PROCESS_ID, processList);

                UIProductDetail productDetail;
                if (productDetailList.TryGetValue(key, out productDetail) == false)
                {
                    productDetail = new UIProductDetail(info, process);
                    productDetailList.Add(key, productDetail);
                }
            }

            return(productDetailList);
        }
Beispiel #2
0
 public RowInfo(UIProductDetail productDetail, int baseCompQty, decimal demandQty, decimal actQty, decimal totalRemainQty)
 {
     this.ProductDetail  = productDetail;
     this.BaseCompQty    = baseCompQty;
     this.DemandQty      = demandQty;
     this.ActQty         = actQty;
     this.TotalRemainQty = totalRemainQty;
 }
Beispiel #3
0
        private void buttonView_Click(object sender, EventArgs e)
        {
            ClearMainView();

            string lineID = this.comboBoxLine.Text;

            string productID = this.comboBoxProduct.Text;

            if (lineID == null || productID == null)
            {
                return;
            }

            if (radioButtonProductName.Checked)
            {
                UIProductDetail productDetail = FindProductDetail(lineID, productID);
                if (productDetail != null)
                {
                    productID = productDetail.ProductID;
                }
            }

#if DEBUG
            if (productID == "369350")
            {
                Console.WriteLine();
            }
#endif

            Tuple <string, string, bool, bool, int> key = new Tuple <string, string, bool, bool, int>(lineID, productID, false, false, 1);

            Dictionary <Tuple <string, string, bool, bool, int>, Bar> barList = new Dictionary <Tuple <string, string, bool, bool, int>, Bar>();

            double maxWidth  = 0;
            double maxHeidth = 0;

            Bar       firstBar = null;
            UIProduct prod;
            if (_prodInfos.TryGetValue(key, out prod))
            {
                Bar bar = CreateBar(prod, 0);
                firstBar = bar;

                if (barList.ContainsKey(bar.Key) == false)
                {
                    barList.Add(bar.Key, bar);
                }

                GetBars(bar, bar.Depth - 1, barList, true);
                GetBars(bar, bar.Depth + 1, barList, false);

                //List<Bar> list = new List<Bar>(barList.Values);

                //foreach (Bar info in list)
                //{
                //    GetBars(info, info.Depth - 1, barList, true);
                //    GetBars(info, info.Depth + 1, barList, false);
                //}

                List <Bar> resultBarList = new List <Bar>(barList.Values);

                SetReCalcDepth(resultBarList);

                SortBarList(resultBarList);

                SetAltProdBar(barList);

                DrawBar(resultBarList, out maxWidth, out maxHeidth);

                DrawLine(resultBarList);

                DrawAltLine(resultBarList);
            }

            ReSizeCanvas(firstBar, maxWidth, maxHeidth);
        }
        private void CollectPegWip(Dictionary <Tuple <string, string>, ResultData> resultDatas)
        {
            string lotsReceived = "LOTS RECEIVED";
            string run          = "RUN";
            string dieAttach    = "DIE ATTACH";

            foreach (PegHistory info in this._resultDataContext.PegHistory)
            {
                UIProductDetail productDetail = FindProductDetail(info.LINE_ID, info.PRODUCT_ID);
                UIStep          step          = productDetail.Process.FindStep(info.STEP_ID);
                UIProduct       moProduct     = FindProduct(info.LINE_ID, info.MO_PRODUCT_ID);
                UIProduct       product       = FindProduct(info.LINE_ID, info.PRODUCT_ID);

                UIProduct wipProduct = null;

                int daThroughCount = step.DaThroughCount;

                if (step.StepGroup == dieAttach && info.LOT_STATE != run)
                {
                    daThroughCount = daThroughCount - 1;
                }

                if (product != null)
                {
                    if (product.StepID == lotsReceived)
                    {
                        wipProduct = product;
                    }
                    else if (product.MaxSequence == daThroughCount)
                    {
                        wipProduct = product;
                    }
                    else if (daThroughCount > 0)
                    {
                        wipProduct = FindProduct(info.LINE_ID, info.PRODUCT_ID, true, true, daThroughCount);
                    }
                    else
                    {
                        wipProduct = FindProduct(info.LINE_ID, info.PRODUCT_ID, true, false, 1);
                    }
                }
                else
                {
                    wipProduct = FindProduct(info.LINE_ID, info.PRODUCT_ID, true, false, info.COMP_SEQ);
                }

#if DEBUG
                if (wipProduct == null)
                {
                    Console.WriteLine();
                }

                if (info.MO_PRODUCT_ID == "227128")
                {
                    Console.WriteLine();
                }
#endif

                Tuple <string, string> resultKey = new Tuple <string, string>(info.LINE_ID, info.MO_PRODUCT_ID);
                ResultData             resultData;
                if (resultDatas.TryGetValue(resultKey, out resultData))
                {
                    if (moProduct == wipProduct)
                    {
                        foreach (UIProduct inProd in wipProduct.AssyParts)
                        {
                            ResultDataAssyPart rdap;
                            if (resultData.AssyInResultData.TryGetValue(inProd.CompSeq, out rdap) == false)
                            {
                                rdap = new ResultDataAssyPart(resultData, inProd);
                                resultData.AssyInResultData.Add(inProd.CompSeq, rdap);
                            }

                            if (step.Categroy == UIStepCategory.EPE)
                            {
                                rdap.EPEWipQty += info.PEG_QTY;
                            }
                            else if (step.Categroy == UIStepCategory.CR2)
                            {
                                rdap.CR2WipQty += info.PEG_QTY * rdap.Product.CompQty;
                            }
                            else
                            {
                                //이런 재공 있으면 이상 Data
                                Console.WriteLine();
                            }
                        }
                    }
                    else if (wipProduct.IsMidPart)
                    {
                        foreach (UIProduct inProd in moProduct.AssyParts)
                        {
                            ResultDataAssyPart rdap;
                            if (resultData.AssyInResultData.TryGetValue(inProd.CompSeq, out rdap) == false)
                            {
                                rdap = new ResultDataAssyPart(resultData, inProd);
                                resultData.AssyInResultData.Add(inProd.CompSeq, rdap);
                            }

                            if (inProd.CompSeq <= wipProduct.CompSeq)
                            {
                                if (step.Categroy == UIStepCategory.EPE)
                                {
                                    //MidPart인데 EPE재공으로 집계될 수 없음. 확인후 조치필요
                                    Console.WriteLine();
                                }
                                else if (step.Categroy == UIStepCategory.CR2)
                                {
                                    rdap.CR2WipQty += info.PEG_QTY * rdap.Product.CompQty;
                                }
                                else
                                {
                                    //이런 재공 있으면 이상 Data
                                    Console.WriteLine();
                                }
                            }
                        }
                    }
                    else
                    {
                        ResultDataAssyPart rdap;
                        if (resultData.AssyInResultData.TryGetValue(wipProduct.CompSeq, out rdap) == false)
                        {
                            rdap = new ResultDataAssyPart(resultData, wipProduct);
                            resultData.AssyInResultData.Add(wipProduct.CompSeq, rdap);
                        }

                        if (step.Categroy == UIStepCategory.EPE)
                        {
                            //이상 Data - 확인후 조치필요
                            Console.WriteLine();
                        }
                        else if (step.Categroy == UIStepCategory.CR2)
                        {
                            rdap.CR2WipQty += info.PEG_QTY;
                        }
                        else if (step.Categroy == UIStepCategory.CR1)
                        {
                            rdap.CR1WipQty += info.PEG_QTY;
                        }
                        else if (step.Categroy == UIStepCategory.STOCK && wipProduct.IsWaferPart == false)
                        {
                            rdap.StockWipQty += info.PEG_QTY;
                        }
                        else
                        {
                            rdap.NoKitQty += info.PEG_QTY;
                        }
                    }
                }
            }
        }
        private void CollectionResultData(Dictionary <Tuple <string, string>, ResultData> resultDatas)
        {
            string all = " (ALL)";
            Dictionary <Tuple <string, string, string>, DateTime> cutOffInfos = new Dictionary <Tuple <string, string, string>, DateTime>();

            HashSet <string> lineList         = new HashSet <string>();
            string           planView         = string.Empty;
            HashSet <string> designIDList     = new HashSet <string>();
            HashSet <string> productList      = new HashSet <string>();
            string           queryProductID   = this.textBoxProductID.Text;
            string           queryProductName = this.textBoxProductName.Text;

            foreach (object line in this.checkedComboBoxLineID.CheckedItems)
            {
                lineList.Add(line.ToString());
            }

            planView = this.comboBoxPlanView.SelectedItem.ToString();

            foreach (object design in this.checkedComboBoxDesignID.CheckedItems)
            {
                designIDList.Add(design.ToString());
            }


            foreach (UIProduct product in _prodInfos.Values)
            {
                if (product.ProductDetail == null)
                {
                    continue;
                }

                if (designIDList.Contains(product.ProductDetail.DesignID) == false)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(queryProductID) == false)
                {
                    if (LikeUtility.Like(product.ProductID, queryProductID) == false)
                    {
                        continue;
                    }
                }

                if (string.IsNullOrEmpty(queryProductName) == false)
                {
                    if (LikeUtility.Like(product.ProductDetail.ProductName, queryProductName) == false)
                    {
                        continue;
                    }
                }

                productList.Add(product.ProductID);
            }

            foreach (StepTarget target in _resultDataContext.StepTarget)
            {
                if (planView != all && planView.CompareTo(target.WEEK_NO) < 0)
                {
                    continue;
                }

                if (target.SEQUENCE > 1)
                {
                    continue;
                }

                Tuple <string, string, string> targetKey = new Tuple <string, string, string>(target.LINE_ID, target.MO_PRODUCT_ID, target.PRODUCT_ID);

                if (cutOffInfos.ContainsKey(targetKey) == false)
                {
                    cutOffInfos.Add(targetKey, target.TARGET_DATE);
                }
                else
                {
                    if (cutOffInfos[targetKey] < target.TARGET_DATE)
                    {
                        cutOffInfos[targetKey] = target.TARGET_DATE;
                    }
                }
            }

            foreach (Demand demand in _resultDataContext.ModelContext.Demand)
            {
#if DEBUG
                if (demand.PRODUCT_ID == "319346")
                {
                    Console.WriteLine();
                }
#endif
                if (lineList.Contains(demand.LINE_ID) == false)
                {
                    continue;
                }

                if (planView != all && planView.CompareTo(demand.WEEK_NO) < 0)
                {
                    continue;
                }

                if (productList.Contains(demand.PRODUCT_ID) == false)
                {
                    continue;
                }

                Tuple <string, string> key = new Tuple <string, string>(demand.LINE_ID, demand.PRODUCT_ID);

                UIProductDetail productDetail = FindProductDetail(demand.LINE_ID, demand.PRODUCT_ID);

                ResultData resultData;
                if (resultDatas.TryGetValue(key, out resultData) == false)
                {
                    resultData           = new ResultData();
                    resultData.Product   = FindProduct(demand.LINE_ID, demand.PRODUCT_ID);
                    resultData.ProductID = demand.PRODUCT_ID;
                    resultData.LineID    = demand.LINE_ID;
                    if (productDetail != null)
                    {
                        resultData.ProductName = productDetail.ProductName;
                    }

                    if (resultData.Product != null)
                    {
                        resultData.Process = resultData.Product.Process != null ? resultData.Product.Process.DAWBProcess : string.Empty;

                        foreach (UIProduct inProd in resultData.Product.AssyParts)
                        {
                            if (resultData.AssyInResultData.ContainsKey(inProd.CompSeq) == false)
                            {
                                ResultDataAssyPart rdap = new ResultDataAssyPart(resultData, inProd);

                                Tuple <string, string, string> cutOffKey = new Tuple <string, string, string>(resultData.LineID, resultData.ProductID, rdap.Product.ProductID);

                                if (cutOffInfos.ContainsKey(cutOffKey))
                                {
                                    rdap.CutOffDate = cutOffInfos[cutOffKey];
                                }

                                resultData.AssyInResultData.Add(inProd.CompSeq, rdap);
                            }
                        }
                    }

                    resultDatas.Add(key, resultData);
                }

                resultData.DemandQty += demand.QTY;
            }
        }
        private void CollectUnpegWip(Dictionary <Tuple <string, string>, ResultData> resultDatas)
        {
            string excess       = "EXCESS";
            string lotsReceived = "LOTS RECEIVED";
            string dieAttach    = "DIE ATTACH";
            string run          = "RUN";

            foreach (UnPegHistory info in _resultDataContext.UnPegHistory)
            {
                if (info.REASON != excess)
                {
                    continue;
                }

#if DEBUG
                if (info.PRODUCT_ID == "284231")
                {
                    Console.WriteLine();
                }
#endif

                UIProductDetail productDetail = FindProductDetail(info.LINE_ID, info.PRODUCT_ID);
                UIStep          step          = productDetail.Process.FindStep(info.STEP_ID);
                UIProduct       product       = FindProduct(info.LINE_ID, info.PRODUCT_ID);

                UIProduct wipProduct = null;

                int daThroughCount = step.DaThroughCount;

                if (step.StepGroup == dieAttach && info.LOT_STATE != run)
                {
                    daThroughCount = daThroughCount - 1;
                }

                if (product != null)
                {
                    if (product.StepID == lotsReceived)
                    {
                        wipProduct = product;
                    }
                    else if (product.MaxSequence == daThroughCount)
                    {
                        wipProduct = product;
                    }
                    else if (daThroughCount > 0)
                    {
                        wipProduct = FindProduct(info.LINE_ID, info.PRODUCT_ID, true, true, daThroughCount);
                    }
                    else
                    {
                        wipProduct = FindProduct(info.LINE_ID, info.PRODUCT_ID, true, false, 1);
                    }
                }
                else
                {
                    foreach (UIProduct prod in _prodInfos.Values)
                    {
                        if (prod.ProductID == info.PRODUCT_ID && prod.LineID == info.LINE_ID)
                        {
                            wipProduct = prod;
                            break;
                        }
                    }
                }

                if (wipProduct == null)
                {
                    continue;
                }

#if DEBUG
                if (wipProduct == null)
                {
                    Console.WriteLine();
                }
#endif

                if (wipProduct.IsWaferPart)
                {
                    foreach (ResultData result in resultDatas.Values)
                    {
                        foreach (ResultDataAssyPart rdap in result.AssyInResultData.Values)
                        {
                            if (wipProduct.Nexts.Contains(rdap.Product))
                            {
                                rdap.NoKitQty += info.UNPEG_QTY;
                            }
                        }
                    }
                }
                else if (wipProduct.IsMcpPart == false)
                {
                    Tuple <string, string> key = new Tuple <string, string>(wipProduct.LineID, wipProduct.ProductID);

                    ResultData result;
                    if (resultDatas.TryGetValue(key, out result))
                    {
                        foreach (UIProduct inProd in result.Product.AssyParts)
                        {
                            ResultDataAssyPart rdap;
                            if (result.AssyInResultData.TryGetValue(inProd.CompSeq, out rdap) == false)
                            {
                                rdap = new ResultDataAssyPart(result, inProd);
                                result.AssyInResultData.Add(inProd.CompSeq, rdap);
                            }

                            if (step.Categroy == UIStepCategory.EPE)
                            {
                                rdap.EPEWipQty += info.UNPEG_QTY;
                            }
                            else if (step.Categroy == UIStepCategory.CR2)
                            {
                                rdap.CR2WipQty += info.UNPEG_QTY * rdap.Product.CompQty;
                            }
                            else
                            {
                                //이런 재공 있으면 이상 Data
                                Console.WriteLine();
                            }
                        }
                    }
                }
                else if (wipProduct.IsMidPart)
                {
                    Tuple <string, string> key = new Tuple <string, string>(wipProduct.LineID, wipProduct.ProductID);

                    ResultData result;
                    if (resultDatas.TryGetValue(key, out result))
                    {
                        foreach (UIProduct inProd in result.Product.AssyParts)
                        {
                            ResultDataAssyPart rdap;
                            if (result.AssyInResultData.TryGetValue(inProd.CompSeq, out rdap) == false)
                            {
                                rdap = new ResultDataAssyPart(result, inProd);
                                result.AssyInResultData.Add(inProd.CompSeq, rdap);
                            }

                            if (inProd.CompSeq <= wipProduct.CompSeq)
                            {
                                if (step.Categroy == UIStepCategory.EPE)
                                {
                                    //MidPart인데 EPE재공으로 집계될 수 없음. 확인후 조치필요
                                    Console.WriteLine();
                                }
                                else if (step.Categroy == UIStepCategory.CR2)
                                {
                                    rdap.CR2WipQty += info.UNPEG_QTY * rdap.Product.CompQty;
                                }
                                else
                                {
                                    //이런 재공 있으면 이상 Data
                                    Console.WriteLine();
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (UIProduct prod in wipProduct.FinalProducts)
                    {
                        Tuple <string, string> key = new Tuple <string, string>(prod.LineID, prod.ProductID);
                        ResultData             result;
                        if (resultDatas.TryGetValue(key, out result))
                        {
                            foreach (ResultDataAssyPart rdap in result.AssyInResultData.Values)
                            {
                                if (rdap.Product.ProductID != wipProduct.ProductID)
                                {
                                    continue;
                                }

                                if (step.Categroy == UIStepCategory.EPE)
                                {
                                    //이상 Data - 확인후 조치필요
                                    Console.WriteLine();
                                }
                                else if (step.Categroy == UIStepCategory.CR2)
                                {
                                    rdap.CR2WipQty += info.UNPEG_QTY;
                                }
                                else if (step.Categroy == UIStepCategory.CR1)
                                {
                                    rdap.CR1WipQty += info.UNPEG_QTY;
                                }
                                else if (step.Categroy == UIStepCategory.STOCK && wipProduct.IsWaferPart == false)
                                {
                                    rdap.StockWipQty += info.UNPEG_QTY;
                                }
                                else
                                {
                                    rdap.NoKitQty += info.UNPEG_QTY;
                                }
                            }
                        }
                    }
                }
            }
        }