python判断DynamicObject对象是否为空,怎么报错啊
金蝶云社区-云社区用户447J1234
云社区用户447J1234
1人赞赏了该文章 2,820次浏览 未经作者许可,禁止转载编辑于2015年05月12日 13:21:33

我想在检验单上做,判断单据加载的时候是否有序列号,如果有就把第一个序列号写到,主单据体的一个字段。
可是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);