|
发表于 2021-3-24 09:58:07
|
显示全部楼层
//定义COM组件接口实现
[ComVisible(true)]
[Guid("dec342ad-acc6-4531-994b-f3259d2a608a")]//工具-创建GUID
[ProgId("U8TestButton.clsButtonLinkCc")]
public class clsButtonLinkCc : U8ButtonInterface.U8Button
{
//获取表体行数
//int BodyRows = Convert.ToInt32(NewLateBinding.LateGet(objVoucher, null, "BodyRows", new object[] { }, null, null, null));
//获取第一行存货编码
//string cinvcode = Convert.ToString(NewLateBinding.LateGet(objVoucher, null, "bodytext", new object[] { 1, "cinvcode" }, null, null, null));
//获取表头客户编码
//string cCusCode = Convert.ToString(NewLateBinding.LateGet(objVoucher, null, "headertext", new object[] { "cCusCode" }, null, null, null));
//设置表体第一行的自定义项13
//NewLateBinding.LateSet(objVoucher, null, "bodytext", new object[] { 1, "cdefine33", cCusCode }, null, null);
//调用控件函数
//NewLateBinding.LateCall(objVoucher,*******************************
//获取objLogin对象中数据库的连接信息:Convert.ToString(NewLateBinding.LateGet(objLogin, null, "UFDataConnstringForNet", new object[0], null, null, null));
//获取单据列表选中行,如果要全部行,将true改为false IXMLDOMDocument2 dombody = (IXMLDOMDocument2)NewLateBinding.LateGet(objVoucher, null, "GetListDom", new object[] { true }, null, null, null); IXMLDOMNode dombodynode = dombody.selectSingleNode("//rs:data");
//调用函数修改第一行含税单价 NewLateBinding.LateCall(objVoucher, null, "SimulateInput", new object[] { 1, 1, "itaxprice", 1111, 0 }, null, null, null, true);
// NewLateBinding.LateCall(objForm, null, "ButtonClick", new object[] { "refresh", "refresh" }, null, null, null, true);
public static ArrayList sbvid_List = new ArrayList();
#region Init
//初始化时
public void Init(ref object objLogin, ref object objForm, ref object objVoucher, ref object msbar)
{ }
//初始化完成时
public void InitEx(ref object uftoolbar, ref object other)
{
return;
}
#endregion
#region SysCommand
//'在执行系统按钮之前调用,Cancel后会不再执行系统方法。
public void BeforeRunSysCommand(ref object objLogin, ref object objForm, ref object objVoucher, ref string sKey, ref object VarentValue, ref bool Cancel, ref string other)
{
Cancel = true;
}
//'在执行系统按钮时调用。
public void RunSysCommand(ref object objLogin,ref object objForm,ref object objVoucher,ref string sKey,ref object VarentValue,ref string other)
{ return; }
//'在执行系统按钮之后调用,Cancel后会不再执行系统方法。
public void AfterRunSysCommand(ref object objLogin, ref object objForm, ref object objVoucher, ref string sKey, ref object VarentValue, ref bool Cancel, ref string other)
{}
#endregion
#region Command
//'在执行自定义按钮之前调用,Cancel后会不再执行系统方法。
public void BeforeRunCommand(ref object objLogin,ref object objForm,ref object objVoucher,ref string sKey,ref object VarentValue,ref string other)
{ return; }
//'在执行自定义按钮之后调用,Cancel后会不再执行系统方法。
public void RunCommand(ref object objLogin,ref object objForm,ref object objVoucher,ref string sKey,ref object VarentValue,ref string other)
{
U8Login.clsLogin u8login = new U8Login.clsLogin();
u8login = objLogin as U8Login.clsLogin;
U8.DbHelperSQL.connectionString = Convert.ToString(NewLateBinding.LateGet(objLogin, null, "UFDataConnstringForNet", new object[0], null, null, null));
if (sKey == "_CUSTDEFBtnStudy1")
{
string cSoCode = "";
string cInvCode = "";
//headText属性设置或返回表头项目的值()
//bodyText属性设置或返回表体项目的值()
//获取表头字段cSoCode的值
cSoCode = Convert.ToString(NewLateBinding.LateGet(objVoucher, null, "headertext", new object[] { "cSoCode" }, null, null, null));
//获取某一行的字段cInvCode的值
cInvCode = Convert.ToString(NewLateBinding.LateGet(objVoucher, null, "bodytext", new object[] { 1, "cinvcode" }, null, null, null));
//赋值给表头字段cSoCode
NewLateBinding.LateSet(objVoucher, null, "headertext", new object[] { "cSoCode", "20210220" }, null, null);
//赋值某一行的字段cInvCode
NewLateBinding.LateSet(objVoucher, null, "bodytext", new object[] { 1, "cInvCode", "01000001" }, null, null);
//模拟赋值,赋值之后可以联动给其他栏目
NewLateBinding.LateCall(objVoucher, null, "SimulateInput", new object[] { 1, 1, "cInvCode", "01000001", 0 }, null, null, null, true);
NewLateBinding.LateCall(objVoucher, null, "SimulateInput", new object[] { 0, 1, "cMemo", "学习", 0 }, null, null, null, true);
} |
|