private async void bLoadLeds_Click(object sender, EventArgs e) { pbLedLoad.Visible = true; await ComponentsFromGraffiti.RefreshDataFromDb(); await LedUsedInOrder.LoadLeds(SelectedOrder.selectedOrder.orderNo); pbLedLoad.Visible = false; bAddLeds.Visible = true; LedUsedInOrder.UpdateLedSummary(); ComponentsAvailability.FillOutGrid(); }
//private static void GetReelsForLotFromDb(string orderNo) //{ // ledReelsForCurrentOrderList.Clear(); // DataTable sqlTable = MST.MES.SqlOperations.SparingLedInfo.GetReelsForLot(orderNo); // List<LedInfo> led12NcIdList = new List<LedInfo>(); // foreach (DataRow row in sqlTable.Rows) // { // string nc12 = row["NC12"].ToString(); // string id = row["ID"].ToString(); // if (led12NcIdList.Select(i => i.Id + i.Nc12).Contains(id + nc12)) continue; // led12NcIdList.Add(new LedInfo(nc12, id)); // ledReelsForCurrentOrderList.Add(new LedReelsInCurrentOrderStruct // { // Id = id, // Nc12 = nc12 // }); // } // var detailedLedInfo = MST.MES.SqlOperations.SparingLedInfo.GetInfoForMultiple12NC_ID(led12NcIdList.ToArray()); // //Tara,NC12,ID,Ilosc,ZlecenieString,Data_Czas,Tara,Partia,Z_RegSeg // for (int r = detailedLedInfo.Rows.Count - 1; r >= 0; r--) // { // string nc12 = detailedLedInfo.Rows[r]["NC12"].ToString(); // string id = detailedLedInfo.Rows[r]["ID"].ToString(); // var ledFromList = ledReelsForCurrentOrderList.Where(l => l.Nc12 == nc12 & l.Id == id).First(); // if (!string.IsNullOrWhiteSpace(ledFromList.BinLetter)) continue; // string currentOrderNo = detailedLedInfo.Rows[r]["ZlecenieString"].ToString(); // int qty = int.Parse(detailedLedInfo.Rows[r]["Ilosc"].ToString()); // string binLetter = detailedLedInfo.Rows[r]["Tara"].ToString(); // ledFromList.Qty = qty; // ledFromList.CurrentOrder = currentOrderNo; // ledFromList.BinLetter = binLetter; // } //} private static void GetReelsForLotFromGraffiti(string orderNo) { LedsUsedInCurrentOrderContainer.ledReelsForCurrentOrderList.Clear(); var componentsOnElec = ComponentsFromGraffiti.GetComponentsDataInLocationPrefix("EL2."); var reelForThisOrder = componentsOnElec.Where(r => r.ConnectedToOrder.ToString() == orderNo) .Where(c => c.Nc12.StartsWith("4010460") || c.Nc12.StartsWith("4010560")); LedsUsedInCurrentOrderContainer.ledReelsForCurrentOrderList = reelForThisOrder.ToList(); //foreach (var reel in reelForThisOrder) //{ // led12NcIdList.Add(new LedInfo(reel.Nc12, reel.Id)); // LedsUsedInCurrentOrderContainer.ledReelsForCurrentOrderList.Add(new LedReelsInCurrentOrderStruct // { // Id = reel.Id, // Nc12 = reel.Nc12_Formated_Rank, // Collective = reel.Nc12, // Qty = (int)reel.Quantity, // CurrentOrder = reel.ConnectedToOrder.ToString() // }); //} }