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 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; } } } } } } }