private void BtnEditObjectPro_Click(object sender, EventArgs e) { if (this.tSCombPObject.Text.Trim() != "") { bool isSelectRecord = true; if (this.dGVObjectProperties.RowCount <= 0) { isSelectRecord = false; } int rowIndex = this.dGVObjectProperties.CurrentCell.RowIndex; if (rowIndex < 0) { isSelectRecord = false; } if (!isSelectRecord) { MessageBox.Show("请选择一条记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } PDM_Params temp = new PDM_Params(); DataType.RelationObjectType obj = GetRelationType(this.tSCombPObject.Text.Trim()); temp.MASTER_TABLE_NAME = sys.NewInstance.GetTableName(obj); temp.PARAMS_DATA_TYPE = this.dGVObjectProperties.CurrentRow.Cells["PARAMS_DATA_TYPE1"].Value.ToString(); temp.PARAMS_NAME = this.dGVObjectProperties.CurrentRow.Cells["PARAMS_NAME1"].Value.ToString(); FrmAddNewProperties addpro = new FrmAddNewProperties(temp); if (addpro.ShowDialog() == DialogResult.OK) { sys.NewInstance.UpdateExtPro(temp, addpro.M_PDM_Params); this.dGVObjectProperties.DataSource = sys.NewInstance.GetDataTableForParams(GetRelationType(this.tSCombPObject.Text.Trim())); } } }
/// <summary> /// 获取指定对象的属性栏位列表 /// </summary> /// <param name="RelationObjectType"></param> /// <returns></returns> public DataTable GetDataTableForParams(DataType.RelationObjectType RelationObjectType) { DataTable dtTemp = null; string MastertableName = GetTableName(RelationObjectType); //StringBuilder stb = new StringBuilder(); // stb.AppendFormat("SELECT PARAMS_NAME,MASTER_TABLE_NAME,PARAMS_DATA_TYPE FROM PDM_Params WHERE MASTER_TABLE_NAME='{0}'",RelationObjectType.ToString()); dtTemp = getDataTableBySql("PARAMS_NAME,MASTER_TABLE_NAME,PARAMS_DATA_TYPE", "WHERE MASTER_TABLE_NAME='" + MastertableName + "'", "PDM_Params"); return(dtTemp); }
/// <summary> /// 获取设定流程对象的title名称 /// </summary> /// <param name="relationObjectType">RelationObjectType</param> /// <returns></returns> public static string GetObjectTitle(DataType.RelationObjectType relationObjectType, string objectKey) { string tableName = DataType.GetTableName(relationObjectType); string objectTitle = ""; switch (relationObjectType) { case DataType.RelationObjectType.Document: { objectTitle = "【文档编号:" + CommonFuns.getDataTableBySql("DOCNO", "WHERE DOCID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; break; } case DataType.RelationObjectType.File: { objectTitle = "【文件名称:" + CommonFuns.getDataTableBySql("DFL_FILE_NAME", " WHERE DFL_ID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; break; } case DataType.RelationObjectType.Material: { objectTitle = "【物料NO:" + CommonFuns.getDataTableBySql("MATERIALNO", " WHERE MATERIALID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; break; } case DataType.RelationObjectType.Product: { objectTitle = "【产品NO:" + CommonFuns.getDataTableBySql("PRODUCTNO", "WHERE PRODUCTLEVEL=1 AND PRODUCTID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; //PRODUCTLEVEL为1的时候表示是产品 break; } case DataType.RelationObjectType.SemiProduct: { objectTitle = "【半成品NO:" + CommonFuns.getDataTableBySql("PRODUCTNO", "WHERE PRODUCTLEVEL=2 AND PRODUCTID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; //PRODUCTLEVEL为2的时候表示是半产品 break; } case DataType.RelationObjectType.Drawing: { objectTitle = "【图纸NO:" + CommonFuns.getDataTableBySql("DOCNO", "WHERE DOCID='" + objectKey + "'", tableName).Rows[0][0].ToString() + "】"; break; } default: { tableName = ""; break; } } return(objectTitle); }
/// <summary> /// 根据RelationObjectType类型获取对应的主表名称及form /// </summary> /// <param name="RelationObjectType"> DataType.RelationObjectTyp</param> /// <returns></returns> public static string GetTableName(DataType.RelationObjectType RelationObjectType) { string tableName = ""; switch (RelationObjectType) { case DataType.RelationObjectType.Document: { tableName = "PDM_DOCUMENT"; break; } case DataType.RelationObjectType.File: { tableName = "DOC_FILE_LIST"; break; } case DataType.RelationObjectType.Material: { tableName = "PDM_MATERAIL"; break; } case DataType.RelationObjectType.Product: { tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为1的时候表示是产品 break; } case DataType.RelationObjectType.SemiProduct: { tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为2的时候表示是半产品 break; } case DataType.RelationObjectType.Drawing: { tableName = "PDM_DRAWING"; //图纸对象 break; } default: { tableName = ""; break; } } return(tableName); }
string flowName = ""; //工作流名称 protected void loadIni() { DataType.RelationObjectType item = (DataType.RelationObjectType)Enum.Parse(typeof(DataType.RelationObjectType), APP.RELATIONOBJECTTYPE, false); string tableName = DataType.GetTableName(item); if (tableName == "") { MessageBox.Show("指定参数错误【RelationObjectType】", "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } else { flowName = WorkFlow.NewInstance.GetWFTemplatesInfoByWFID(APP.WFT_ID).WFT_NAME.ToString(); this.Text = "【" + flowName + "】" + WorkFlow.GetObjectTitle(item, APP.OBJECTKEY); this.txtFlowName.Text = flowName; } CreateFlowGraphicByWFTID(); }
private void BtnAddObjectPro_Click(object sender, EventArgs e) { if (this.tSCombPObject.Text.Trim() != "") { try { DataType.RelationObjectType obj = GetRelationType(this.tSCombPObject.Text.Trim()); FrmAddNewProperties addpro = new FrmAddNewProperties(sys.NewInstance.GetTableName(obj)); if (addpro.ShowDialog() == DialogResult.OK) { this.dGVObjectProperties.DataSource = sys.NewInstance.GetDataTableForParams(GetRelationType(this.tSCombPObject.Text.Trim())); } } catch (Exception ex) { MessageBox.Show("请确认选择正确的对象:" + ex.Message.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }
/// <summary> /// 传参构造方法,创建工作流实例的时候使用 /// </summary> /// <param name="objectKey">对象主键</param> /// <param name="relationObjectType">关联类型</param> /// <param name="wfTemplates">工作流模板ID</param> public StandardFlow(string objectKey, DataType.RelationObjectType relationObjectType, string wfTemplates) { InitializeComponent(); this.CenterToParent(); this.ObjectKey = objectKey; this.RelationObjectType = relationObjectType; this.WfTemplatesID = wfTemplates; this.gpFlowDetail.Visible = false; if (this.ObjectKey == "") { MessageBox.Show("没有指定对象主键【ObjectKey】", "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } this.txtUserPM.Text = CommonFuns.NewInstance.LoginInfo.LoginID; this.txtStatus.Text = "未激活"; this.txtSubject.SelectAll(); loadIni(); // CreateFlowGraphicByWFTID();//绘流程图 // loadIni(); }
/// <summary> /// 获取form /// </summary> /// <param name="RelationObjectType"></param> /// <param name="objectID"></param> /// <returns></returns> public static Form GetDetaiFrm(DataType.RelationObjectType RelationObjectType, string objectID) { Form FrmDetail = null; string tableName = DataType.GetTableName(RelationObjectType); switch (RelationObjectType) { case DataType.RelationObjectType.Document: { IDocumentService _docService = ServiceContainer.GetService <DocumentService>(); HYPDM.WinUI.Document.DocRegForm frm = new Document.DocRegForm(true); frm.Document = _docService.GetDocListByID(objectID)[0]; frm.StartPosition = FormStartPosition.CenterParent; FrmDetail = frm; break; } case DataType.RelationObjectType.File: { //tableName = "DOC_FILE_LIST"; break; } case DataType.RelationObjectType.Material: { //tableName = "PDM_MATERAIL"; HYPDM.WinUI.ProductsAndParts.Material.MaterialConfForm frm = new ProductsAndParts.Material.MaterialConfForm(objectID, 1, true); //2为半成品 1为成品 //IDocumentService _docService = ServiceContainer.GetService<DocumentService>(); //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>(); FrmDetail = frm; frm.StartPosition = FormStartPosition.CenterParent; break; } case DataType.RelationObjectType.Product: { // tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为1的时候表示是产品 HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 1, true); //2为半成品 1为成品 //IDocumentService _docService = ServiceContainer.GetService<DocumentService>(); //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>(); FrmDetail = frm; frm.StartPosition = FormStartPosition.CenterParent; break; } case DataType.RelationObjectType.SemiProduct: { //tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为2的时候表示是半产品 HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 2, true); //2为半成品 1为成品 //IDocumentService _docService = ServiceContainer.GetService<DocumentService>(); //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>(); //frm.Product = m_AllProductService.GetById(objectID); frm.StartPosition = FormStartPosition.CenterParent; FrmDetail = frm; break; } case DataType.RelationObjectType.Drawing: { IDRAWINGService _docService = ServiceContainer.GetService <DRAWINGService>(); HYPDM.WinUI.DrawingDocument.DrawRegForm frm = new DrawingDocument.DrawRegForm(true); frm.Document = _docService.GetDrawObjectDCID(objectID); frm.StartPosition = FormStartPosition.CenterParent; FrmDetail = frm; break; } default: { // tableName = ""; break; } } return(FrmDetail); }