问题的改变。如何在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();
}
}
为了避免代码重复,请在事件处理程序类中创建一个静态方法,然后将代码放在此处
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中更改PurchTable_orderaccount之后,我也希望保留它们。现在,当我选择一个订单帐户时,我的初始化值将被替换。我该如何预防呢?
为什么不将初始化逻辑放在数据源字段的
modified
方法中OrderAccount
而不是Oninitvalue
事件中?现在尝试过,但是我的价值观没有出现。在我的帖子中编辑了代码
好吧,我明白了。忘了我可以在字段上使用事件。因此,我创建了一个onmodified事件处理程序,无论我的值是否正在更新。最后但仍然。您能说我如何从采购表中选择交货名称,inventsiteid和inventlocationid吗?每次尝试,我一无所获。而从purch中按purch分组选择firstonly InventSiteId,InventLocationId,DeliveryPostalAddress,DeliveryName。purch.InventSiteId== usrsz.InventSiteId && purch.InventLocationId!= null && purch.InventSiteId!= null