/// <summary> /// 检查文件是否在PDM中 /// </summary> private bool CheckInPDM(string fileName) { //PDM根目录 string rootpath = PDMHelper.LoginPDM(); if (rootpath.Length > 0 && fileName.Length > 0) { if (fileName.Contains(rootpath))//判断文件是否是PDM中文件 { //获取文件在PDM中的ID Globals.FileID = PDMHelper.GetFileID(fileName).ToString(); return(true); } else { this.lblErrorInfo.Text = "请先将文件保存至PDM!"; return(false); } } else { this.lblErrorInfo.Text = "请先将文件保存至PDM!"; return(false); } }
/// <summary> /// 初始化全局变量(即Globals中的变量) /// </summary> private void InitializeGlobalsVariables() { //获取SolidWorks文件名及文件ID Globals.FileName = swAppHelper.GetFileName(); Globals.FileID = PDMHelper.GetFileID(Globals.FileName).ToString(); //获取PDM登录信息 Globals.PDM_UserID = PDMHelper.GetLoginID(); Globals.PDM_UserAccount = PDMHelper.GetLoginUserName(); Globals.PDM_UserFullName = PDMHelper.GetLoginFullName(); }
/// <summary> /// 构造方法 /// </summary> public frmDrawingCode() { InitializeComponent(); try { #region 拉框数据初始化 this.cboDrawingClass.SelectedIndexChanged -= new System.EventHandler(this.cboDrawingClass_SelectedIndexChanged); //初始化图号分类下拉框 List <DrawingClassModel> dclasslist = objDrawingService.GetDrawingClass(); this.cboDrawingClass.DataSource = dclasslist; this.cboDrawingClass.ValueMember = "DrawingClassId"; this.cboDrawingClass.DisplayMember = "DrawingClassName"; this.cboDrawingClass.SelectedIndex = -1; //初始化主单位下拉框 List <UnitModel> unitlist = objDrawingService.GetUnit(); this.cboUnit.DataSource = unitlist; this.cboUnit.ValueMember = "UnitCode"; this.cboUnit.DisplayMember = "UnitName"; this.cboUnit.SelectedIndex = -1; ////初始化采购分类下拉框 //List<PurchaseTypeModel> purchaselist = objDrawingService.GetPurchaseType(); //this.cboPurchaseType.DataSource = purchaselist; //this.cboPurchaseType.ValueMember = "PurchaseTypeId"; //this.cboPurchaseType.DisplayMember = "PurchaseTypeName"; //this.cboPurchaseType.SelectedIndex = -1; //初始化选型分类下拉框 List <SelectionTypeModel> selectionlist = objDrawingService.GetSelectionType(); this.cboSelectionType.DataSource = selectionlist; this.cboSelectionType.ValueMember = "SelectionTypeId"; this.cboSelectionType.DisplayMember = "SelectionTypeName"; this.cboSelectionType.SelectedIndex = -1; this.cboDrawingClass.SelectedIndexChanged += new System.EventHandler(this.cboDrawingClass_SelectedIndexChanged); #endregion //获取文件名及文件ID Globals.FileName = swAppHelper.GetFileName(); Globals.FileID = PDMHelper.GetFileID(Globals.FileName).ToString(); this.btnAddMaterial.Enabled = true;//启动提交数据按钮 ShowPDMInfo(); DefaultWorking(); } catch (Exception ex) { Msg.ShowError(ex.Message); } }