我想在检验单上做,判断单据加载的时候是否有序列号,如果有就把第一个序列号写到,主单据体的一个字段。
可是if lContactId !=NULL:#判断报错,lContactId是一个DynamicObject对象。
import clr
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.Contracts')
from Kingdee.BOS.Core.BusinessFlow.PlugIn import *
from Kingdee.BOS.Core.Bill.PlugIn import *
from Kingdee.BOS.Core.Metadata.EntityElement import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
def OnLoad(e):
#if (this.View.Model.GetValue("FDocumentStatus").ToString() == "Z"):
entryEntity = this.View.BusinessInfo.GetEntryEntity("FEntity");
docCustomerContactIds = this.View.Model.GetEntityDataObject(entryEntity);
iFlag=this.View.Model.GetEntryRowCount("FEntity");
for i in range(0, iFlag):
objParentEntity = this.View.Model.GetEntityDataObject(entryEntity, i);
colSubEntity = objParentEntity["PolicyDetail"];
if colSubEntity.Count>0:
lContactId= colSubEntity[0]["SerialId"];
if lContactId !=NULL:#判断报错
this.View.Model.SetValue("FSerialText",lContactId[2].ToString(), i);
推荐阅读