public ICollection <ShoeComponent> GetModelComponents(string _shoeModel) { try { List <ShoeComponent> results = new List <ShoeComponent>(); var modelComponents = GetShoeModel(_shoeModel).ModelComponents; int i = 0; foreach (var item in modelComponents) { i++; ShoeComponent component = GetShoeComponent(ShareFuncs.GetInt(item.ShoeComponent_Id)); CuttingType cuttype = GetCuttingType(ShareFuncs.GetInt(item.CuttingType_Id)); component.CuttingType = cuttype; component.Index = i; component.AddToEkanban = true; results.Add(component); } return(results); } catch { return(null); } }
// handle update component to database private void Handle_CuttingComponents(DataTable table, bool auto_cut) { string Select_ModelName = ""; int initial_row = 4; string cutting_type = "auto"; if (!auto_cut) { cutting_type = "beam"; initial_row = 2; unblock.TotalModel2 = 0; } else { unblock.TotalModel1 = 0; } BeginInvoke(new MethodInvoker(() => { lb_Exeption2.Text = "..."; progressBar2.Value = 0; progressBar2.Maximum = table.Rows.Count - initial_row; })); for (int i = initial_row; i < table.Rows.Count; i++) { BeginInvoke(new MethodInvoker(() => { progressBar2.Value++; lb_TotalModel1.Text = unblock.TotalModel1.ToString(); lb_TotalModel2.Text = unblock.TotalModel2.ToString(); })); var row = table.Rows[i]; object model_name = row[1]; // model name column object model = row[2]; // model column object first_component_cell = row[5]; // first column of parts object samemodel = row[4]; // first column of parts object articleCell = row[5]; if (model_name != null) { if (model_name.ToString() != "") { Select_ModelName = model_name.ToString(); } } if (model != null && model.ToString() != "") { ShoeModel Select_Model = new ShoeModel { Model_Number = model.ToString().Trim().ToUpper(), Model_Name = Select_ModelName.Trim().ToUpper() }; Select_Model = unblock.ComponentQuery.GetAndAddShoeModel(Select_Model); if (Select_Model == null) { continue; } if (auto_cut) { unblock.TotalModel1++; } else { unblock.TotalModel2++; } if (first_component_cell != null && first_component_cell.ToString() != "") { List <ShoeComponent> Select_Components = new List <ShoeComponent>(); for (int c = 0; c < 30; c++) { if (row[c + 5] != null) { string cellvalue = row[c + 5].ToString().Trim(); // break out from the for loop if (cellvalue == "" || cellvalue == " " || cellvalue == " " || cellvalue.IndexOf(" ") > -1) { break; } ShoeComponent shoeComponent = unblock.ComponentQuery.GetAndAddShoeComponent(cellvalue.Trim()); if (shoeComponent != null) { Select_Components.Add(shoeComponent); } } } CuttingType ctype = unblock.ComponentQuery.GetCuttingType(cutting_type); if (Select_Components.Count > 0) { foreach (ShoeComponent c in Select_Components) { unblock.ComponentQuery.AddNewModelComponent(Select_Model.Id, c.Id, ctype.id); } } } } BeginInvoke(new MethodInvoker(() => { lb_Exeption2.Text = $"{progressBar2.Value * 100 / progressBar2.Maximum} %"; })); } }
internal void SetCuttingType(CuttingType cutting) { cuttingType = cutting; InvalidateVisual(); }