public bool CheckBill(List<string> BillNumbers, IEdmVault7 vault, EdmCmdData file) { for (int i = 0; i < BillNumbers.Count; i++) { bool exists = DataList.PartExists(BillNumbers[i]); if (!exists) { string Config; IEdmFile7 Part = FindPartinVault(vault, BillNumbers[i], out Config); if (Part != null) { try { GetItemInfo(file, vault, Part, ""); } catch (Exception ex) { MessageBox.Show(ex.Message + "\nAn error has occured with this item. Check its properties to ensure no errors and try again","Error!",MessageBoxButtons.OK,MessageBoxIcon.Error); } } else { DialogResult DR = MessageBox.Show("File not found in vault.\nDo you want to manually add this item?", "Part Not Found!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { Item_Master IM = new Item_Master(); IM.ShowDialog(); } else return false; } } } return true; }
public DialogResult GetItemInfo(EdmCmdData file, IEdmVault7 vault, IEdmFile7 Part, string selected_config) { IEdmEnumeratorVariable5 var; object partnum_val; object desc_val = ""; object weight_val; object product_val; object class_val; object type_val; object planner_val; if (UpdateItemRef(file,Part, vault)) { try { var = Part.GetEnumeratorVariable(); decimal weight_fallback = 0; if (selected_config == "" || selected_config == null) selected_config = DetermineConfig(Part, vault, file, ""); if (selected_config != "") { var.GetVar("Number", selected_config, out partnum_val); if (partnum_val.ToString().Contains("201")) { DialogResult DR = MessageBox.Show("Part number identified as a frame. Do you want to use the Customer/Model instead of SolidWorks description custom property?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { object cust_val; var.GetVar("Customer", selected_config, out cust_val); object model_val; var.GetVar("Model", selected_config, out model_val); desc_val = "FRAME " + cust_val.ToString() + " " + model_val.ToString(); } else var.GetVar("Description", selected_config, out desc_val); } else var.GetVar("Description", selected_config, out desc_val); var.GetVar("Brand", selected_config, out planner_val); var.GetVar("Product", selected_config, out product_val); var.GetVar("Class", selected_config, out class_val); var.GetVar("Type", selected_config, out type_val); //Weight is typically @ config var.GetVar("NetWeight", selected_config, out weight_val); if (weight_val == null) var.GetVar("NetWeight", selected_config, out weight_val); if (weight_val != null) decimal.TryParse(weight_val.ToString(), out weight_fallback); if (product_val == null) product_val = ""; if (class_val == null) class_val = ""; if (desc_val == null) desc_val = ""; if (partnum_val != null) { Epicor_Integration.Item_Master item = new Item_Master(partnum_val.ToString(), desc_val.ToString(), weight_fallback, product_val.ToString(), class_val.ToString(), type_val.ToString(), planner_val.ToString()); item.ShowDialog(); return item.DialogResult; } else { //Not necessary anymore //MessageBox.Show("Part number was a null value!\n\nEnsure that custom properties are completely filled out.", "Missing Properties!", MessageBoxButtons.OK, MessageBoxIcon.Hand); return DialogResult.Cancel; } } else return DialogResult.Cancel; } catch (Exception ex) { MessageBox.Show(ex.Message + "\nPlease check the datacard to ensure that all fields are filled in the file.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return DialogResult.Cancel; } } else return DialogResult.Cancel; }
//, List<string> BillNumbers, List<string> _BillQty, out List<string> BillQty) public void ProcessBill(IEdmVault7 vault, EdmCmdData file) { for (int i = 0; i < Bill.Count; i++) { if (DataList.PartExists(Bill[i].ToString())) { /*Part exists and we are good*/} else { if (PartExistsSW(vault, Bill[i].ToString())) { //Get it, Add it string Config = null; IEdmFile7 Part = FindPartinVault(vault, Bill[i].ToString(), out Config); DialogResult Dr = GetItemInfo(file, vault, Part, ""); if (Dr == DialogResult.Cancel) Bill.RemoveAt(i); } else { DialogResult Dr = MessageBox.Show(Bill[i].ToString() + " was not found in the vault/Epicor database. Do you want to manually add it?", "Missing Item!", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (Dr == DialogResult.Yes) { //Blank item master Item_Master IM = new Item_Master(Bill[i].ToString(), "", 0); IM.ShowDialog(); if (IM.DialogResult == DialogResult.Cancel) Bill.RemoveAt(i); } else { //Remove from the bill to proceed Bill.RemoveAt(i); } } } } }
public List<string> ProcessBill(IEdmVault7 vault, List<string> BillNumbers, List<string> _BillQty, out List<string> BillQty, string Path) { for (int i = 0; i < BillNumbers.Count; i++) { if (DataList.PartExists(BillNumbers[i])) { /*Part exists and we are good*/} else { if (PartExistsSW(vault, BillNumbers[i])) { //Get it, Add it string Config = null; IEdmFile7 Part = FindPartinVault(vault, BillNumbers[i], out Config); DialogResult Dr = GetItemInfobyPath(vault, Part, Path); if (Dr == DialogResult.Cancel) BillNumbers.RemoveAt(i); } else { DialogResult Dr = MessageBox.Show(BillNumbers[i] + " was not found in the vault/Epicor database. Do you want to manually add it?", "Missing Item!", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (Dr == DialogResult.Yes) { //Blank item master Item_Master IM = new Item_Master(BillNumbers[i], "", 0); IM.ShowDialog(); if (IM.DialogResult == DialogResult.Cancel) BillNumbers.RemoveAt(i); } else { //Remove from the bill to proceed BillNumbers.RemoveAt(i); } } } } BillQty = _BillQty; return BillNumbers; }
public DialogResult GetItemInfobyPath(IEdmVault7 vault, IEdmFile7 Part, string Path) { IEdmEnumeratorVariable5 var; string selected_config; object partnum_val; object desc_val; object weight_val; object product_val; object class_val; object type_val; object planner_val; if (UpdateItemRef(Part, vault, Path)) { var = Part.GetEnumeratorVariable(); decimal weight_fallback = 0; selected_config = DetermineConfig(Part, vault, null); var.GetVar("Number", selected_config, out partnum_val); var.GetVar("Description", selected_config, out desc_val); var.GetVar("Product", selected_config, out product_val); var.GetVar("Class", selected_config, out class_val); var.GetVar("Type", selected_config, out type_val); var.GetVar("Planner", selected_config, out planner_val); //Weight is typically @ config var.GetVar("NetWeight", selected_config, out weight_val); if (weight_val == null) var.GetVar("NetWeight", selected_config, out weight_val); if (weight_val != null) decimal.TryParse(weight_val.ToString(), out weight_fallback); if (partnum_val != null) { Epicor_Integration.Item_Master item = new Item_Master(partnum_val.ToString(), desc_val.ToString(), weight_fallback, product_val.ToString(), class_val.ToString(), type_val.ToString(), planner_val.ToString()); item.ShowDialog(); return item.DialogResult; } else { //Not necessary anymore //MessageBox.Show("Part number was a null value!\n\nEnsure that custom properties are completely filled out.", "Missing Properties!", MessageBoxButtons.OK, MessageBoxIcon.Hand); return DialogResult.Cancel; } } else return DialogResult.Cancel; }
public void OpenItemMaster() { ModelDoc2 ModDoc = (ModelDoc2)SwApp.ActiveDoc; ConfigurationManager SWConfMgr = ModDoc.ConfigurationManager; Configuration SwConf = SWConfMgr.ActiveConfiguration; Component2 Comp2 = (Component2)SwConf.GetRootComponent(); string partnum = ModDoc.GetTitle(); string desc = ModDoc.GetCustomInfoValue(ModDoc.ConfigurationManager.ActiveConfiguration.Description.ToString(), "Description"); decimal weight = ModDoc.GetMassProperties()[5]; Item_Master I_M = new Item_Master(partnum, desc, weight); I_M.ShowDialog(); }
private void item_btn_Click(object sender, EventArgs e) { string desc = SWHelper.GetCurrentDescription(filedir_txt.Text, pnum_txt.Text); decimal weight = SWHelper.GetCurrentWeight(filedir_txt.Text, pnum_txt.Text); Item_Master IM = new Item_Master(pnum_txt.Text, desc, weight); IM.ShowDialog(); IM.Dispose(); }