public ResultDataAssyPart(ResultData resultData, UIProduct product)
        {
            this.ResultData = resultData;
            this.Product    = product;

            if (resultData.Product != null && resultData.Product.Process != null)
            {
                this.DAStep = resultData.Product.Process.FindDaStep(product.CompSeq);
            }

            if (product.Prevs.Count > 0)
            {
                for (int i = 0; i < product.Prevs.Count; i++)
                {
                    UIProduct prev = product.Prevs[i];

                    WaferProductNames += prev.ProductDetail.ProductName;

                    if (i + 1 < product.Prevs.Count)
                    {
                        WaferProductNames += ", ";
                    }
                }
            }
        }
Beispiel #2
0
        private Bar CreateBar(UIProduct prod, int depth)
        {
            Bar bar = new Bar(prod);

            bar.Focusable = true;
            bar.Depth     = depth;

            TextBlock textBlock = CreateProductTextBlock(prod);

            SolidColorBrush brush = null;

            if (prod.IsWaferPart)
            {
                brush = System.Windows.Media.Brushes.SkyBlue;
            }
            else if (prod.IsMidPart)
            {
                brush = System.Windows.Media.Brushes.Orange;
            }
            else if (prod.IsMcpPart)
            {
                brush = System.Windows.Media.Brushes.ForestGreen;
            }
            else
            {
                brush = System.Windows.Media.Brushes.Red;
            }

            System.Windows.Shapes.Rectangle rec = CreateRectangle(brush);

            bar.Rectangle = rec;
            bar.TextBlock = textBlock;

            bar.Children.Add(rec);
            bar.Children.Add(textBlock);

            GradientStop        start = new GradientStop(System.Windows.Media.Colors.White, 0.7);
            GradientStop        end   = new GradientStop(brush.Color, 1);
            LinearGradientBrush gb    = new LinearGradientBrush(new GradientStopCollection()
            {
                start, end
            }, 90);

            bar.OriginalColor           = gb;
            bar.OriginalSolidColorBursh = brush;

            bar.Rectangle.Fill = bar.OriginalColor;

            bar.MouseEnter           += MouseEnter;
            bar.MouseLeave           += MouseLeave;
            bar.MouseLeftButtonDown  += MouseLeftButtonDown;
            bar.MouseRightButtonDown += MouseRightButtonDown;
            bar.MouseLeftButtonUp    += MouseLeftButtonUp;
            bar.PreviewMouseMove     += PreviewMouseMove;

            return(bar);
        }
Beispiel #3
0
 public Bar(UIProduct product)
 {
     NextBarList     = new Dictionary <Tuple <string, string, bool, bool, int>, Bar>();
     PrevBarList     = new Dictionary <Tuple <string, string, bool, bool, int>, Bar>();
     LineList        = new Dictionary <Bar, Tuple <System.Windows.Shapes.Line, ToTextBlock> >();
     AltProdBar      = new Dictionary <int, Bar>();
     AltLineList     = new Dictionary <Bar, Tuple <System.Windows.Shapes.Path, TextBlock> >();
     PrevAltLineList = new Dictionary <Bar, Tuple <System.Windows.Shapes.Path, TextBlock> >();
     Product         = product;
     Key             = product.Key;
 }
Beispiel #4
0
        // Buys the product, if the product exists and the funds allow for it
        public bool BuyProduct(int _id, UIProduct.BuyType buyType)
        {
            Debug.Log("BuyProduct(id) " + _id);
            ProductInfo product   = GetProductInfo(_id);
            UIProduct   uiProduct = GetUIProductById(_id);

            if (product != null && uiProduct != null)
            {
                if (((!IsOwned(_id) && buyType == UIProduct.BuyType.nonConsumable) || buyType == UIProduct.BuyType.consumable) && uiProduct.price <= ProgressManager.GetProgress().starsOwned)
                {
                    ProgressManager.GetProgress().AddStarsToWallet(-uiProduct.price);

                    productInfos.Find(x => x.id == _id).owned = true;
                    EquipProduct(_id);

                    // Khajiit has Wares
                    Social.ReportProgress("CgkIqIqqjZYFEAIQBg", 100.0f, (bool success) =>
                    {
                        //if (success)
                        //Main.onAchievementUnlock.Invoke();
                    });

                    bool everythingBought = true;

                    // check if all 15 pruducts are bought to unlock the shoplifter achievement
                    foreach (ProductInfo p in productInfos)
                    {
                        if (p.owned == false)
                        {
                            everythingBought = false;
                            break;
                        }
                    }

                    if (everythingBought)
                    {
                        // Shoplifter
                        Social.ReportProgress("CgkIqIqqjZYFEAIQEA", 100.0f, (bool _success) =>
                        {
                            if (_success)
                            {
                                Main.onAchievementUnlock.Invoke();
                            }
                        });
                    }
                    ProgressManager.SaveProgressData();
                    return(true);
                }
                return(false);
            }
            return(false);
        }
Beispiel #5
0
        public VMProduct(VMMain VMMain, UIProduct View)
        {
            this.View           = View;
            this.View.ViewModel = this;
            this.VMMain         = VMMain;


            // load products in lists
            getDataFromDb();

            // load selected client detail to listView and textboxes
            loadProductDetail((Product)View.getLboxProduct().SelectedValue);
        }
Beispiel #6
0
 public void switchToProduct()
 {
     if (User != null)
     {
         if (UIProduct == null)
         {
             UIProduct = new UIProduct();
             VMProduct = new VMProduct(this, UIProduct);
         }
         UIMainForm.getPnUserControl().Controls.Clear();
         UIMainForm.getPnUserControl().Controls.Add(UIProduct);
     }
     else
     {
         switchToLogin();
     }
 }
Beispiel #7
0
        private static void CollectAltProdInfoData()
        {
            foreach (var info in _resultDataContext.ModelContext.AltProductInfo)
            {
                UIProduct orgProd = FindProduct(info.LINE_ID, info.ORG_PROD_ID);
                if (orgProd == null)
                {
                    continue;
                }

                UIProduct altProd = FindProduct(info.LINE_ID, info.ALT_PROD_ID);
                if (altProd == null)
                {
                    continue;
                }

                if (orgProd.AltProductInfos.ContainsKey(info.PRIORITY) == false)
                {
                    orgProd.AltProductInfos.Add(info.PRIORITY, altProd);
                }
            }
        }
Beispiel #8
0
        private static void CollectBinSplitInfoData()
        {
            foreach (var info in _resultDataContext.ModelContext.BinSplitInfo)
            {
                UIProduct fromProd = FindProduct(info.LINE_ID, info.FROM_PROD_ID);
                if (fromProd == null)
                {
                    continue;
                }

                UIProduct toProd = FindProduct(info.LINE_ID, info.TO_PROD_ID);
                if (toProd == null)
                {
                    continue;
                }

                UIBinSplitInfo binInfo = new UIBinSplitInfo(fromProd, toProd, info.PORTION, info.GRADE, info.BIN_RANK);

                if (fromProd.BinSplitInfos.ContainsKey(toProd) == false)
                {
                    fromProd.BinSplitInfos.Add(toProd, binInfo);
                }
            }
        }
Beispiel #9
0
        private TextBlock CreateProductTextBlock(UIProduct product)
        {
            string text = this.radioButtonProductID.Checked ? product.ProductID : product.ProductName;

            return(CreateTextBlock(text));
        }
Beispiel #10
0
        private static void CollectProductRouteData()
        {
            _resultDataContext.ModelContext.McpBom.OrderBy(x => x.COMP_SEQ);

            Dictionary <Tuple <string, string>, List <UIProduct> > assyInProdList = new Dictionary <Tuple <string, string>, List <UIProduct> >();

            foreach (var info in _resultDataContext.ModelContext.McpBom)
            {
                Tuple <string, string, bool, bool, int> prodKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.FINAL_PROD_ID, false, false, 1);

                UIProduct mcpProduct;
                if (ProductInfos.TryGetValue(prodKey, out mcpProduct) == false)
                {
                    mcpProduct = new UIProduct(info.LINE_ID, info.FINAL_PROD_ID, info.FINAL_PROD_NAME, false, false, 1);

                    ProductInfos.Add(prodKey, mcpProduct);
                }

                if (mcpProduct.CompSeq < info.COMP_SEQ)
                {
                    mcpProduct.CompSeq = info.COMP_SEQ;
                }
            }

            List <UIProduct> assyList = new List <UIProduct>();

            foreach (var info in _resultDataContext.ModelContext.McpBom)
            {
                Tuple <string, string, bool, bool, int> mcpProductKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.FINAL_PROD_ID, false, false, 1);
                UIProduct mcpProduct;
                if (ProductInfos.TryGetValue(mcpProductKey, out mcpProduct))
                {
#if DEBUG
                    if (info.FINAL_PROD_ID == "318173")
                    {
                        Console.WriteLine();
                    }
#endif
                    Tuple <string, string, bool, bool, int> ainKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.ASSY_IN_PROD_ID, true, false, info.COMP_SEQ);

                    UIProduct ainProd;
                    if (ProductInfos.TryGetValue(ainKey, out ainProd) == false)
                    {
                        ainProd        = new UIProduct(info.LINE_ID, info.ASSY_IN_PROD_ID, info.ASSY_IN_PROD_NAME, true, false, info.COMP_SEQ, info.COMP_QTY);
                        ainProd.StepID = info.STEP_ID;

                        ProductInfos.Add(ainKey, ainProd);

                        Tuple <string, string> aKey = new Tuple <string, string>(info.LINE_ID, info.ASSY_IN_PROD_ID);
                        List <UIProduct>       ainList;
                        if (assyInProdList.TryGetValue(aKey, out ainList) == false)
                        {
                            assyInProdList.Add(aKey, ainList = new List <UIProduct>());
                        }

                        ainList.Add(ainProd);
                    }

                    ainProd.FinalProducts.Add(mcpProduct);

                    if (mcpProduct.AssyParts.Contains(ainProd) == false)
                    {
                        mcpProduct.AssyParts.Add(ainProd);
                    }

                    UIProduct nextProd = null;
                    if (mcpProduct.CompSeq > info.COMP_SEQ)
                    {
                        Tuple <string, string, bool, bool, int> midKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.TO_PROD_ID, true, true, info.COMP_SEQ);
                        UIProduct midProd;
                        if (ProductInfos.TryGetValue(midKey, out midProd) == false)
                        {
                            midProd = new UIProduct(info.LINE_ID, info.TO_PROD_ID, info.TO_PROD_NAME, true, true, info.COMP_SEQ);
                            ProductInfos.Add(midKey, midProd);
                        }

                        midProd.Prevs.Add(ainProd);
                        ainProd.Nexts.Add(midProd);

                        nextProd = midProd;
                    }
                    else
                    {
                        mcpProduct.Prevs.Add(ainProd);
                        ainProd.Nexts.Add(mcpProduct);

                        nextProd = mcpProduct;
                    }

                    Tuple <string, string, bool, bool, int> prevMidKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.FROM_PROD_ID, true, true, info.COMP_SEQ - 1);

                    UIProduct prevMidProd = FindProduct(info.LINE_ID, info.FROM_PROD_ID, true, true, info.COMP_SEQ - 1);
                    if (prevMidProd != null)
                    {
                        prevMidProd.Nexts.Add(nextProd);
                        prevMidProd.StepID = info.STEP_ID;
                        nextProd.Prevs.Add(prevMidProd);
                    }
                }
            }

            foreach (var info in _resultDataContext.ModelContext.ProductRoute)
            {
                Tuple <string, string, bool, bool, int> fromKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.FROM_PROD_ID, false, false, 1);
                UIProduct fromProd;
                if (ProductInfos.TryGetValue(fromKey, out fromProd) == false)
                {
                    fromProd             = new UIProduct(info.LINE_ID, info.FROM_PROD_ID, info.FROM_PROD_NAME, false, false, 1);
                    fromProd.IsWaferPart = true;

                    ProductInfos.Add(fromKey, fromProd);
                }

                fromProd.StepID = info.STEP_ID;

                List <UIProduct> ainList;
                if (assyInProdList.TryGetValue(new Tuple <string, string>(info.LINE_ID, info.TO_PROD_ID), out ainList))
                {
                    foreach (UIProduct ainProd in ainList)
                    {
                        fromProd.Nexts.Add(ainProd);
                        ainProd.Prevs.Add(fromProd);
                    }
                }
                else
                {
                    Tuple <string, string, bool, bool, int> toKey = new Tuple <string, string, bool, bool, int>(info.LINE_ID, info.TO_PROD_ID, false, false, 1);

                    UIProduct toProd;
                    if (ProductInfos.TryGetValue(toKey, out toProd) == false)
                    {
                        toProd = new UIProduct(info.LINE_ID, info.TO_PROD_ID, info.TO_PROD_NAME, false, false, 1);

                        ProductInfos.Add(toKey, toProd);
                    }

                    fromProd.Nexts.Add(toProd);
                    toProd.Prevs.Add(fromProd);
                }
            }
        }
Beispiel #11
0
 private void ProductEquipped(UIProduct product)
 {
     soundPlayer.PlaySingle(buttonClickSound);
 }
Beispiel #12
0
 private void ProductPurchased(UIProduct product)
 {
     soundPlayer.PlaySingle(purchaseSound);
 }
Beispiel #13
0
 // event listener
 private void BuyFail(UIProduct product)
 {
     PlayUnvalidSound();
 }
        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 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;
                                }
                            }
                        }
                    }
                }
            }
        }