- 先看下展示的效果
- 开发说明
2.1 工程中引用COM组件:Microsoft ActiveX Data Objects 2.7 Library,由于U8原生开发的参照控件都是VB6开发的,参照控件中使用了Recordset,因此需要引用该组件
2.2 添加U8RefService.dll的引用,路径为X:\U8SOFT\ufcomsql,X为安装目录,该文件为U8参照对应的引用
2.3 在对应的按钮点击事件实现以下代码
1 U8RefService.IService refService = new U8RefService.IService(); 2 refService.RefType = U8RefService.RefTypes.RefArchive; 3 refService.RefID = "BomQuery";//UAP设计器-参照设计器,参照ID 4 Recordset rds1 = null; 5 Recordset rds2 = null; 6 object obj = LoginProperty.U8Login; 7 string errStr = ""; 8 string sMetaXML = ""; 9 refService.MetaXML = sMetaXML; 10 refService.ShowRefSecond(ref obj, ref rds1, ref rds2, ref errStr); 11 12 if (rds2 != null && rds2.EOF == false) 13 { 14 txttProductCode.Text = rds2.Fields["cinvcode"].Value.ToString(); 15 txttProductName.Text = rds2.Fields["cinvname"].Value.ToString(); 16 txtBomId.Text = rds2.Fields["BomId"].Value.ToString(); 17 if (!string.IsNullOrEmpty(rds2.Fields["version"].Value.ToString()))//如果为空则为替代bom 18 { 19 txtBomVersion.Text = rds2.Fields["version"].Value.ToString(); 20 txtBomVersionDesc.Text = rds2.Fields["versiondesc"].Value.ToString(); 21 } 22 else 23 { 24 txtBomVersion.Text = rds2.Fields["identcode"].Value.ToString(); 25 txtBomVersionDesc.Text = rds2.Fields["identdesc"].Value.ToString(); 26 } 27 }
其中RefID打开UAP直接查询即可