private void NewLotForm_Load(object sender, EventArgs e) { // comboBoxOperator.Items.AddRange(SqlOperations.GetLastOperators()); comboBoxOperator.Items.AddRange(SqlOperations.GetOperatorsArray(30)); //Stencil QR reading radioButtonCurrentStencil.Visible = true; //radioButtonCurrentStencil.Checked = true; radioButtonNewStencil.Visible = true; //string previousStencil = ""; //foreach (DataGridViewRow row in grid.Rows) //{ // DataGridViewCheckBoxCell ch = (DataGridViewCheckBoxCell)row.Cells["ColumnSaved"]; // if ((bool)ch.Value == true) // { // previousStencil = row[""] // } //} }
private void timerLedLeftSave_Tick(object sender, EventArgs e) { if (ledLeftSaveBuffer.Count > 0 & !saveLedLeftWorking) { saveLedLeftWorking = true; new Thread(() => { Thread.CurrentThread.IsBackground = true; List <int> indexToDelete = new List <int>(); if (SqlOperations.UpdateLedLeftovers(ledLeftSaveBuffer[0])) { ledLeftSaveBuffer.RemoveAt(0); } saveLedLeftWorking = false; }).Start(); } }
private void textBoxRankBQr_KeyDown_1(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { currentLedReel = SqlOperations.GetLedDataFromSparing(textBoxRankBQr.Text.ToUpper()); if (currentLedReel.ID != "error") { dataGridViewRankB.Rows.Add(currentLedReel.NC12, currentLedReel.ID, currentLedReel.Rank, currentLedReel.Ilosc, currentLedReel.ZlecenieString); CheckIfCorrectLed(); foreach (DataGridViewColumn col in dataGridViewRankB.Columns) { col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } textBoxRankBQr.Text = ""; textBoxRankAQr.Focus(); labelRankBLoaded.Text += Environment.NewLine + currentLedReel.Rank; CountQtyProductToManufacture(); CheckIfFormDataComplete(); } } }
private void MstSaveOrder_Click(object sender, EventArgs e) { if (currentMstOrder.OrderNumber.Trim() != "") { timerMstUpdate.Enabled = false; using (FinishMstOrder finishForm = new FinishMstOrder(ref currentMstOrder, smtLine)) { if (finishForm.ShowDialog() == DialogResult.OK) { if (currentMstOrder.RecordId > 0) { SqlOperations.UpdateCurrentMstOrderQuantity(currentMstOrder.MadeQty, currentMstOrder.RecordId); } else { SqlOperations.SaveRecordToDb(currentMstOrder.DateStart, DateTime.Now, smtLine, currentMstOrder.Oper, currentMstOrder.OrderNumber, currentMstOrder.Nc10, currentMstOrder.MadeQty.ToString(), "0", "0", "check", "", currentMstOrder.Stencil, "MST", 0); } double efficiency = Math.Round(EfficiencyCalculation.CalculateEfficiency(currentMstOrder.DateStart, DateTime.Now, currentMstOrder.Nc10, currentMstOrder.MadeQty, true) * 100, 0); dataGridViewMstOrders.Rows.Insert(0, currentMstOrder.DateStart, DateTime.Now, currentMstOrder.OrderNumber, currentMstOrder.Nc10.Insert(4, " ").Insert(8, " "), currentMstOrder.MadeQty, efficiency + "%", currentMstOrder.ModelName); currentMstOrder = new CurrentMstOrder("Brak", "Brak", 0, 0, DateTime.Now, "Brak", "0000000000", DateTime.Now, 0, 0, 0, 0, new List <ledReelData>(), "Brak", 0, 0); dataGridViewMstLedReels.Rows.Clear(); dataGridViewLedTrash.Rows.Clear(); UpdateMstLabels(); DgvTools.CleanUpMstDgv(dataGridViewMstOrders); var eff = Math.Round(MstCurrentShiftEfficiency.CalculateCurrentShiftEff(currentMstOrder, dataGridViewMstOrders), 0); angularGauge1.Value = Math.Min(100, eff); labelCurrentShiftEfficiency.Text = $"Wydajność aktualnej zmiany: {eff}%"; } else { timerMstUpdate.Enabled = true; } } } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (textBoxRankAQr.Text.Split('\t').Length > 5) { currentLedReel = SqlOperations.GetLedDataFromSparing(textBoxRankAQr.Text.ToUpper()); if (currentLedReel.ID != "error") { dataGridViewRankA.Rows.Add(currentLedReel.NC12, currentLedReel.ID, currentLedReel.Rank, currentLedReel.Ilosc, currentLedReel.ZlecenieString); foreach (DataGridViewColumn col in dataGridViewRankA.Columns) { col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } textBoxRankAQr.Text = ""; CheckIfCorrectLed(); textBoxRankBQr.Focus(); labelRankALoaded.Text += Environment.NewLine + currentLedReel.Rank; string ledFamily = currentLedReel.NC12; if (!labelLed12NC.Text.Contains(ledFamily)) { labelLed12NC.Text += " " + ledFamily; } CountQtyProductToManufacture(); CheckIfFormDataComplete(); } } else { textBoxRankAQr.Text = ""; MessageBox.Show("Niewłaściwy kod QR!"); } } }
private void EfficiencyTick2() { if (dataGridViewLg.Rows.Count > 0) { int lotsThisShift = EfficiencyTools.HowManyLotsThisShift(dataGridViewLg); if (lotsThisShift > 0) { Tools.dateShiftNo shiftStart = Tools.whatDayShiftIsit(DateTime.Now); double minutesFromShiftStart = (DateTime.Now - shiftStart.date).TotalMinutes; double lotsPerShift = (480 * (double)lotsThisShift) / minutesFromShiftStart; double efficiency = Math.Round(lotsPerShift / normLotsPerShift * 100, 1); labelWasteLed.Text = "Odpad diody LED: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[0] + "%"; labelModuleWaste.Text = "Odpad modułów: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[1] + "%"; labelLotsThisShift.Text = "LOTy od początku zmiany: " + lotsThisShift; labelEfficiency.Text = "Wydajność: " + efficiency + "%"; bool debugOff = true; #if DEBUG debugOff = false; #endif if (debugOff) { if (DateTime.Now.Minute == 0 || DateTime.Now.Minute == 30) { Charting.DrawEfficiencyChart(pbChart, (float)efficiency); } } else { Charting.DrawEfficiencyChart(pbChart, (float)efficiency); } } else { labelWasteLed.Text = "Odpad diody LED: -"; labelModuleWaste.Text = "Odpad modułów: "; labelLotsThisShift.Text = "LOTy od początku zmiany: -"; labelEfficiency.Text = "Wydajność: -"; } if (dataGridViewLg.Rows.Count > 2) { EfficiencyTools.QuantityDictionaryToGrid(dataGridView3DaysInfo, EfficiencyTools.quantityPerDayPerShift(SqlOperations.GetSmtRecordsFromDbQuantityOnly(5, smtLine))); Charting.DrawDayByDayEfficiency(dataGridView3DaysInfo, pictureBoxShifts); } } }
private void EfficiencyTick() { if (dataGridViewLg.Rows.Count > 0) { var eff = Math.Round(LgCurrentShiftEfficiency.CalculateCurrentShiftEff(dataGridViewLg), 0); int lotsThisShift = EfficiencyTools.HowManyLotsThisShift(dataGridViewLg); if (eff > 0) { labelWasteLed.Text = "Odpad diody LED: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[0] + "%"; labelModuleWaste.Text = "Odpad wyrobów: " + EfficiencyTools.CalculateLedDiodeWasteLevel(dataGridViewLg, normPerModel)[1] + "%"; labelLotsThisShift.Text = "LOTy od początku zmiany: " + lotsThisShift; labelEfficiency.Text = "Wydajność: " + eff + "%"; bool debugOff = true; #if DEBUG debugOff = false; #endif if (debugOff) { if (DateTime.Now.Minute == 0 || DateTime.Now.Minute == 30) { Charting.DrawEfficiencyChart(pbChart, (float)eff); } } else { Charting.DrawEfficiencyChart(pbChart, (float)eff); } } else { labelWasteLed.Text = "Odpad diody LED: -"; labelModuleWaste.Text = "Odpad modułów: "; labelLotsThisShift.Text = "LOTy od początku zmiany: -"; labelEfficiency.Text = "Wydajność: -"; } if (dataGridViewLg.Rows.Count > 2) { EfficiencyTools.QuantityDictionaryToGrid(dataGridView3DaysInfo, EfficiencyTools.quantityPerDayPerShift(SqlOperations.GetSmtRecordsFromDbQuantityOnly(2, smtLine))); Charting.DrawDayByDayEfficiency(dataGridView3DaysInfo, pictureBoxShifts); } UpdateCurrentModelEffNorm();//remove } }
private void LoadMstOrdersFromDb(int recordsQuantity) { var nc = MST.MES.SqlOperations.ConnectDB.Nc12ToModelFullDict(); DataTable sqlTable = SqlOperations.GetMstSmtRecordsFromDb(recordsQuantity, smtLine); var smto = MST.MES.SqlDataReaderMethods.SMT.GetOneOrder(""); dataGridViewMstOrders.Columns["MstOrdersStart"].DefaultCellStyle.Format = "HH:mm dd-MMM"; dataGridViewMstOrders.Columns["MstOrdersEnd"].DefaultCellStyle.Format = "HH:mm dd-MMM"; List <EfficiencyCalculation.OrderDataForEfficiencyStructure> ordersEff = new List <EfficiencyCalculation.OrderDataForEfficiencyStructure>(); if (sqlTable.Rows.Count > 0) { HashSet <string> nc12ToModelList = new HashSet <string>(); foreach (DataRow row in sqlTable.Rows) { DateTime startDate = DateTime.Parse(row["DataCzasStart"].ToString().Trim()); DateTime endDate = DateTime.Parse(row["DataCzasKoniec"].ToString().Trim()); string nc10 = row["Model"].ToString(); double qty = 0; string orderNo = row["NrZlecenia"].ToString(); double efficiency = 0; if (double.TryParse(row["IloscWykonana"].ToString(), out qty)) { efficiency = Math.Round(EfficiencyCalculation.CalculateEfficiency(startDate, endDate, nc10, qty, true) * 100, 0); } string name = nc.ContainsKey(nc10 + "00") ? nc[nc10 + "00"] : nc10; dataGridViewMstOrders.Rows.Insert(0, startDate, endDate, orderNo, nc10.Insert(4, " ").Insert(8, " "), qty, efficiency + "%", name); nc12ToModelList.Add(nc10 + "00"); ordersEff.Add(new EfficiencyCalculation.OrderDataForEfficiencyStructure() { start = startDate, end = endDate, qty = qty, modelId = nc10 }); var owningShift = DateTools.GetOrderOwningShift(startDate, endDate); var currentShift = DateTools.whatDayShiftIsit(DateTime.Now); //1878856 if (orderNo == "1878856") { ; } if (owningShift.fixedDate != currentShift.fixedDate) { if (owningShift.fixedDate.Date == currentShift.fixedDate.Date) { DgvTools.ColorDgvRow(dataGridViewMstOrders.Rows[0], Color.LightGray); } else { DgvTools.ColorDgvRow(dataGridViewMstOrders.Rows[0], Color.Silver); } } } //Dictionary<string, string> nc12toName = SqlOperations.nc12ToModelDict(nc12ToModelList.ToArray()); //foreach (DataGridViewRow row in dataGridViewMstOrders.Rows) //{ // string nc12 = row.Cells["Column12NC"].Value.ToString().Replace(" ","") + "00"; // row.Cells["ColumnName"].Value = nc12toName[nc12]; //} DgvTools.AutoSizeColumns(dataGridViewMstOrders, DataGridViewAutoSizeColumnMode.AllCells); EfficiencyRecordsForOrdersHistory.FillOutListView(lVMstEfficiencyRecord, ordersEff); } var eff = Math.Round(MstCurrentShiftEfficiency.CalculateCurrentShiftEff(currentMstOrder, dataGridViewMstOrders), 0); angularGauge1.Value = Math.Min(100, eff); labelCurrentShiftEfficiency.Text = $"Wydajność aktualnej zmiany: {eff}%"; }
private void LoadLgRecordsFromDb() { suspendCellVelueChangedEvent = true; //DataCzasStart,DataCzasKoniec,LiniaSMT,OperatorSMT,NrZlecenia,Model,IloscWykonana,NGIlosc,ScrapIlosc,Kontrola1szt,KoncowkiLED DataTable sqlTable = SqlOperations.GetLgSmtRecordsFromDb(22, smtLine); List <string> lotsList = new List <string>(); foreach (DataRow row in sqlTable.Rows) { lotsList.Add(row["NrZlecenia"].ToString().Trim()); } Dictionary <string, string[]> lotToRankABQty = SqlOperations.lotToRankABQty(lotsList.ToArray()); //dataGridView1.SuspendLayout(); foreach (DataRow row in sqlTable.Rows) { string model = row["Model"].ToString(); if (model[2] == '-') { if (lotToRankABQty.ContainsKey(row["NrZlecenia"].ToString())) { dataGridViewLg.Rows.Insert(0); string lotNo = row["NrZlecenia"].ToString().Trim(); string stencil = row["StencilQR"].ToString(); LedLeftovers ledLeft = CreateLedLeftovers(row["KoncowkiLED"].ToString(), lotNo, lotToRankABQty); DataGridViewCheckBoxCell chbCell = (DataGridViewCheckBoxCell)dataGridViewLg.Rows[0].Cells[0]; chbCell.Value = true; dataGridViewLg.Rows[0].Cells[1].Value = lotNo; string connQty = Tools.GetNumberOfConnectors(row["Model"].ToString().Trim()); dataGridViewLg.Rows[0].Cells[3].Value = connQty; if (connQty == "4") { dataGridViewLg.Rows[0].Cells[3].Style.ForeColor = Color.White; dataGridViewLg.Rows[0].Cells[3].Style.BackColor = Color.DarkCyan; } dataGridViewLg.Rows[0].Cells[2].Value = row["Model"].ToString().Trim(); //dataGridView1.Rows[0].Cells[4].Value = kontrola pierwszej dataGridViewLg.Rows[0].Cells[5].Value = lotToRankABQty[lotNo][2]; dataGridViewLg.Rows[0].Cells[6].Value = ledLeft.RankA[0].Nc12; dataGridViewLg.Rows[0].Cells[7].Value = lotToRankABQty[lotNo][0]; dataGridViewLg.Rows[0].Cells[8].Value = lotToRankABQty[lotNo][1]; dataGridViewLg.Rows[0].Cells[9].Value = row["IloscWykonana"].ToString().Trim(); dataGridViewLg.Rows[0].Cells[10].Value = row["NGIlosc"].ToString().Trim(); dataGridViewLg.Rows[0].Cells[11].Value = row["ScrapIlosc"].ToString().Trim(); dataGridViewLg.Rows[0].Cells[12].Tag = ledLeft; dataGridViewLg.Rows[0].Cells[12].Value = "OK"; dataGridViewLg.Rows[0].Cells[13].Value = DateTime.Parse(row["DataCzasStart"].ToString().Trim()); dataGridViewLg.Rows[0].Cells[14].Value = DateTime.Parse(row["DataCzasKoniec"].ToString().Trim()); Color cellColor = Tools.GetShiftColor((DateTime)row["DataCzasKoniec"]); dataGridViewLg.Rows[0].Cells[13].Style.BackColor = cellColor; dataGridViewLg.Rows[0].Cells[14].Style.BackColor = cellColor; dataGridViewLg.Rows[0].Cells[15].Style.BackColor = cellColor; dataGridViewLg.Rows[0].Cells[15].Value = row["OperatorSMT"].ToString().Trim(); dataGridViewLg.Rows[0].Cells[16].Value = stencil; } } } Tools.AutoSizeColumnsWidth(dataGridViewLg); //dataGridView1.ResumeLayout(); if (dataGridViewLg.Rows.Count > 0) { dataGridViewLg.CurrentCell = dataGridViewLg.Rows[0].Cells[0]; } suspendCellVelueChangedEvent = false; }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!suspendCellVelueChangedEvent) { int ngIndex = dataGridViewLg.Columns.IndexOf(dataGridViewLg.Columns["Ng"]); int scrapIndex = dataGridViewLg.Columns.IndexOf(dataGridViewLg.Columns["Scrap"]); // Debug.WriteLine("Cell value changed: " + e.RowIndex + " " + e.ColumnIndex); //calculate good qty if (dataGridViewLg.Rows.Count > 0 & (e.ColumnIndex == ngIndex || e.ColumnIndex == scrapIndex)) { int rowIndex = e.RowIndex; DataGridViewCell ngCell = dataGridViewLg.Rows[rowIndex].Cells["Ng"]; DataGridViewCell scrapCell = dataGridViewLg.Rows[rowIndex].Cells["Scrap"]; double ngValue = -9999; double scrapValue = -9999; if (ngCell.Value != null) { if (!(double.TryParse(ngCell.Value.ToString(), out ngValue))) { dataGridViewLg.Rows[e.RowIndex].Cells[ngIndex].Value = null; ngValue = -9999; } else { //ng ,0 will be 0 dataGridViewLg.Rows[e.RowIndex].Cells[ngIndex].Value = ngValue; } } if (dataGridViewLg.Columns["Scrap"].Visible) { if (scrapCell.Value != null) { if (!(double.TryParse(scrapCell.Value.ToString(), out scrapValue))) { dataGridViewLg.Rows[e.RowIndex].Cells[scrapIndex].Value = null; scrapValue = -9999; } } } else { scrapValue = 0; } if (ngValue > -9999 & scrapValue > -9999 & dataGridViewLg.Rows[e.RowIndex].Cells["ColumnQty"].Value != null) { double orderedQty = double.Parse(dataGridViewLg.Rows[e.RowIndex].Cells["ColumnQty"].Value.ToString()); double goodQty = orderedQty - ngValue - scrapValue; dataGridViewLg.Rows[e.RowIndex].Cells["goodQty"].Value = goodQty; } else { dataGridViewLg.Rows[e.RowIndex].Cells["goodQty"].Value = ""; } } //saving finished LOT foreach (DataGridViewRow row in dataGridViewLg.Rows) { //Debug.WriteLine("Checking chkBox row:" + row.Index + " " + Convert.ToBoolean(row.Cells["ColumnSaved"].Value)); if (!Convert.ToBoolean(row.Cells["ColumnSaved"].Value)) { if (IsRowReadyToBeSaved(row)) { //Debug.WriteLine("Saving row:" + row.Index); DataGridViewCheckBoxCell ch = (DataGridViewCheckBoxCell)row.Cells["ColumnSaved"]; suspendCellVelueChangedEvent = true; lotFinished(ch, row.Index); suspendCellVelueChangedEvent = false; DateTime startDate = (DateTime)row.Cells["StartDate"].Value; DateTime endDate = (DateTime)row.Cells["EndDate"].Value; string firstPieceCheck = ""; string stencil = Tools.getCellValue(row.Cells["Stencil"]); LedLeftovers ledLeftovers = (LedLeftovers)row.Cells["ColumnButtonLed"].Tag; double totalLedsUsed = 0; string leftovers = ledLeftovers.RankA[0].ID + ":" + ledLeftovers.RankA[0].Nc12 + ":" + ledLeftovers.RankA[0].QtyLeft + "|" + ledLeftovers.RankB[0].ID + ":" + ledLeftovers.RankB[0].Nc12 + ":" + ledLeftovers.RankB[0].QtyLeft; for (int i = 0; i < ledLeftovers.RankA.Count; i++) { totalLedsUsed += ledLeftovers.RankA[i].StartQty - ledLeftovers.RankA[i].QtyLeft; totalLedsUsed += ledLeftovers.RankB[i].StartQty - ledLeftovers.RankB[i].QtyLeft; if (i > 0) { leftovers += "#" + ledLeftovers.RankA[i].ID + ":" + ledLeftovers.RankA[i].Nc12 + ":" + ledLeftovers.RankA[i].QtyLeft + "|" + ledLeftovers.RankB[i].ID + ":" + ledLeftovers.RankB[i].Nc12 + ":" + ledLeftovers.RankB[i].QtyLeft; } } if (row.Cells["ColumnQualityCheck"].Tag != null) { firstPieceCheck = row.Cells["ColumnQualityCheck"].Tag.ToString(); } string scrap = "0"; if (dataGridViewLg.Columns["Scrap"].Visible) { scrap = row.Cells["Scrap"].Value.ToString(); } SqlOperations.SaveRecordToDb( startDate, endDate, smtLine, row.Cells["Operator"].Value.ToString(), row.Cells["ColumnLot"].Value.ToString(), row.Cells["ColumnModel"].Value.ToString(), row.Cells["goodQty"].Value.ToString(), row.Cells["Ng"].Value.ToString(), scrap, firstPieceCheck, leftovers, stencil, "LG", totalLedsUsed); // Debug.WriteLine("Saved"); DgvTools.CleanUpLgiDgv(dataGridViewLg); } } } dataGridViewLg.HorizontalScrollingOffset = 0; } }
private void ChangeOverConfirmationCard_Load(object sender, EventArgs e) { string[][] technInsp = SqlOperations.GetTechnicianInspector(30); comboBoxInspect.Items.AddRange(technInsp[0]); comboBoxTechn.Items.AddRange(technInsp[1]); }
private void textBoxLotNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return & textBoxLotNo.Text.Trim() != "") { if (!int.TryParse(textBoxLotNo.Text, out int b)) { textBoxLotNo.Text = ""; MessageBox.Show("Nieprawidłowy numer zlecenia"); return; } bool debug = false; #if DEBUG debug = true; #endif if (!SqlOperations.IsLotAlreadyInDb(textBoxLotNo.Text) || debug) { currentLotData = SqlOperations.GetLotData(textBoxLotNo.Text); if (currentLotData.Model.Length > 0) { labelModel.Text = "Model: " + currentLotData.Model; labelOrderedQty.Text = "Ilość " + currentLotData.OrderedQty.ToString(); labelRankA.Text = "Rank A" + Environment.NewLine + currentLotData.RankA; labelRankB.Text = "Rank B" + Environment.NewLine + currentLotData.RankB; string expectedMiraeProgram = currentLotData.Model.Remove(6, 1).Insert(6, "X"); if (checkMirae) { labelMiraeProgram.Text = "Mirae program: " + currentMiraeProgram; } else { labelMiraeProgram.Text = ""; } if (currentMiraeProgram == expectedMiraeProgram || !checkMirae) { labelMiraeProgram.Text = labelMiraeProgram.Text + " OK"; textBoxRankAQr.Visible = true; textBoxRankBQr.Visible = true; textBoxRankAQr.Focus(); } else { labelMiraeProgram.Text = labelMiraeProgram.Text + Environment.NewLine + " ZŁY PROGRAM!"; labelMiraeProgram.ForeColor = Color.Red; labelMiraeProgram.Font = new Font(labelMiraeProgram.Font, FontStyle.Bold); } ledRanksQty = SqlOperations.MaxRankQty(currentLotData.Model); labelLedQty.Text = "RankA=" + ledRanksQty.Item1 + " RankB=" + ledRanksQty.Item2; labelLotData.Text = "Dane zlecenia nr. " + textBoxLotNo.Text; textBoxRankAQr.Focus(); } else { labelModel.Text = "Brak zlecenia w bazie danych"; labelOrderedQty.Text = ""; labelRankA.Text = ""; labelRankB.Text = ""; textBoxRankAQr.Visible = false; textBoxRankBQr.Visible = false; } string prevModel = ""; if (grid.Rows.Count > 0) { prevModel = Tools.getCellValue(grid.Rows[0].Cells["ColumnModel"]); if (prevModel != "") { if (prevModel == currentLotData.Model) { string stencil = Tools.getCellValue(grid.Rows[0].Cells["Stencil"]); if (stencil.Trim() != "") { radioButtonCurrentStencil.Enabled = true; radioButtonCurrentStencil.Checked = true; radioButtonCurrentStencil.Text = "Aktualny:" + Environment.NewLine + stencil; radioButtonCurrentStencil.Tag = stencil; } } } } } else { MessageBox.Show("Ten LOT jest już w bazie danych"); } } }
public static Dictionary <string, EfficiencyStructure> CreateEfficiency() { Dictionary <string, EfficiencyStructure> result = new Dictionary <string, EfficiencyStructure>(); DataTable mesModels = SqlOperations.GetMesModels(); //MODEL_ID,A_PKG_QTY,B_PKG_QTY,CCT_CODE,SMT_Carrier_QTY foreach (DataRow row in mesModels.Rows) { string model = row["MODEL_ID"].ToString().Replace("LLFML", ""); string modelType = model.Split('-')[0]; //K2, K1, G2, G1.... string modelFamily = model.Substring(0, 6) + "XXX" + model.Substring(9, 1); if (result.ContainsKey(modelFamily)) { continue; } int rankAQty = int.Parse(row["A_PKG_QTY"].ToString()); int rankBQty = int.Parse(row["B_PKG_QTY"].ToString()); int CCT = int.Parse(row["CCT_CODE"].ToString()); int pcbPerCarrier = int.Parse(row["SMT_Carrier_QTY"].ToString()); if (pcbPerCarrier < 5) //less than 5 is square (given carrier for testing purposes) { pcbPerCarrier = 1; } int ledQty = Math.Max(rankAQty, rankBQty) * 2; int connQty = 2; if (modelType == "K2" || modelType == "G2") { if (!IsOdd(CCT)) { connQty = 4; } } int length = 600; switch (modelType) { case "22": length = 250; break; case "33": length = 270; break; case "32": length = 272; break; case "53": length = 540; break; } //EfficiencyStructure newItem = new EfficiencyStructure() // result.Add(modelFamily, ) } return(result); }