是否可以为 2 个 formDataSourceStr 创建 1 个事件处理程序? X++
Is it possible to create 1 event handler for 2 formDataSourceStr? X++
换题。如何覆盖 purchcreateorder 中正确修改的字段?现在它可以编译,但值仍然没有显示在我的表单中。
[ExtensionOf(formdatasourcestr(PurchCreateOrder, PurchTable))]
final class PurchCreateOrderGetDefAdress_Extension
{
[DataField]
class OrderAccount
{
void modified()
{
element.orderAccountModified();
InventLocation inventlocation;
UserInfoSz usrsz;
PurchTable purchtable;
FormDataSource ds;
FormDataObject df =any2Object(this) as FormDataObject;
next Modified();
ds = df.datasource();
PurchTable = Ds.cursor();
select InventLocation where InventLocation.inventsiteid == usrsz.InventSiteId && inventlocation.DefaultShipMaintenanceLoc == 'out';
purchtabke.orderaccount = '11111111111111111111';
purchtable.inventsiteid = 'ILA-LOG-01';// InventLocation.inventsiteid;
purchtable.inventlocationid = InventLocation.InventLocationId;
purchtable.DeliveryName = 'sasasasa';
//purchTable_ds.refresh();
}
}
为了避免代码重复,请在事件处理程序中创建一个静态方法 class 并将代码放在那里
public static void initLogisticsPostalAddress(...parameters...)
{
put your logic here
}
然后在两个事件中调用此方法:
[FormDataSourceEventHandler(formDataSourceStr(PurchCreateOrder, PurchTable), FormDataSourceEventType::initvalue)]
public static void PurchTable_Oninitvalue(FormDataSource sender, FormDataSourceEventArgs e)
{
PurchCreateOrderEH::initLogisticsPostalAddress(...parameters...);
}
换题。如何覆盖 purchcreateorder 中正确修改的字段?现在它可以编译,但值仍然没有显示在我的表单中。
[ExtensionOf(formdatasourcestr(PurchCreateOrder, PurchTable))]
final class PurchCreateOrderGetDefAdress_Extension
{
[DataField]
class OrderAccount
{
void modified()
{
element.orderAccountModified();
InventLocation inventlocation;
UserInfoSz usrsz;
PurchTable purchtable;
FormDataSource ds;
FormDataObject df =any2Object(this) as FormDataObject;
next Modified();
ds = df.datasource();
PurchTable = Ds.cursor();
select InventLocation where InventLocation.inventsiteid == usrsz.InventSiteId && inventlocation.DefaultShipMaintenanceLoc == 'out';
purchtabke.orderaccount = '11111111111111111111';
purchtable.inventsiteid = 'ILA-LOG-01';// InventLocation.inventsiteid;
purchtable.inventlocationid = InventLocation.InventLocationId;
purchtable.DeliveryName = 'sasasasa';
//purchTable_ds.refresh();
}
}
为了避免代码重复,请在事件处理程序中创建一个静态方法 class 并将代码放在那里
public static void initLogisticsPostalAddress(...parameters...)
{
put your logic here
}
然后在两个事件中调用此方法:
[FormDataSourceEventHandler(formDataSourceStr(PurchCreateOrder, PurchTable), FormDataSourceEventType::initvalue)]
public static void PurchTable_Oninitvalue(FormDataSource sender, FormDataSourceEventArgs e)
{
PurchCreateOrderEH::initLogisticsPostalAddress(...parameters...);
}