Python表单插件实现单据体上移下移原创
金蝶云社区-小小的梦
小小的梦
68人赞赏了该文章 519次浏览 未经作者许可,禁止转载编辑于2024年06月17日 17:30:37

Python表单插件实现单据体上移下移的源码

def EntryBarItemClick(e):
    if e.BarItemKey == "tbMoveUp":
        upMoveDown();
    elif e.BarItemKey == "tbMoveDown":
        upMoveDown(False);
def upMoveDown(isMoveUp=True,entryKey='FEntity'):
	entryEntity = this.View.BusinessInfo.GetEntryEntity(entryKey);
	entityDataObject = this.View.Model.GetEntityDataObject(entryEntity);
	rowIndex = this.View.Model.GetEntryCurrentRowIndex(entryKey);
	length=len(entityDataObject);
	if isMoveUp:
		if (rowIndex==0):
			return;
		else:
			movindex=rowIndex-1;
	else:
		if (rowIndex==length-1):
			return;
		else:
			movindex=rowIndex+1;
	this.View.SetEntityFocusRow(entryKey, movindex);
	this.View.Model.CopyEntryRow(entryKey,rowIndex,-1);
	this.View.Model.CopyEntryRow(entryKey,movindex,-1);
	Entity = this.View.BusinessInfo.GetEntryEntity(entryKey);
	Object = this.View.Model.GetEntityDataObject(Entity);
	lgt=len(Object);
	initDir=["Seq","BeginInit","DataEntityState","EndInit","Equals","Events","GetDataEntityType","GetHashCode","GetType","Initialized","IsInitialized","MemberwiseClone","OnInitialized","OnPropertyChanged","OnPropertyChanging","Parent","PropertyChanged","PropertyChanging","ReferenceEquals","ToString","__class__","__delattr__","__doc__","__format__","__getattribute__","__hash__","__init__","__new__","__reduce__","__reduce_ex__","__repr__","__setattr__","__sizeof__","__str__","__subclasshook__"]
	dirs = dir(Object[lgt-1]);
	for key in dirs:
		if key not in initDir:
			this.View.Model.SetValue(key,Object[lgt-1][key],rowIndex);
	dirs = dir(Object[lgt-2]);
	for key in dirs:
		if key not in initDir:
			this.View.Model.SetValue(key,Object[lgt-2][key],movindex);
	this.View.Model.DeleteEntryRow(entryKey,lgt-1);
	this.View.Model.DeleteEntryRow(entryKey,lgt-2);
def createRow(key,lans,bat=True):
	entity = this.View.BusinessInfo.GetEntity(key);
	entryDy = this.View.Model.GetEntityDataObject(entity);
	entryLen=len(entryDy);
	if entryLen<lans and bat:
		this.Model.BatchCreateNewEntryRow(key,lans-entryLen);
	else:
		lens=int(entryLen/10);
		lens=lens if lens>10 else 10;
		for i in range(lens):
			for j in range(lans,entryLen+1):
				this.Model.DeleteEntryRow(key, j);


图标赞 68
68人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!