Python版上 单据体上移下移功能原创
金蝶云社区-htv
htv
84人赞赏了该文章 331次浏览 未经作者许可,禁止转载编辑于2024年07月12日 16:33:43


import clr
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
clr.AddReference('Newtonsoft.Json')

from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Util import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from System.Net import *
from System.Text import *
from System.IO import *
from Kingdee.BOS.Core.Bill.PlugIn import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *


def EntryBarItemClick(e):
    entityKey="FEntity";
    if e.BarItemKey=='u_up':
        index = this.View.Model.GetEntryCurrentRowIndex(entityKey);
        if index == 0:
            return;
        currRowData = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity(entityKey), index);#当前行数据
        lastRowData = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity(entityKey), index - 1);#上一行数据
        #objstr=JsonUtil.Serialize(currRowData);
        #this.View.ShowMessage(objstr);
        currRowData["Seq"] = index;
        lastRowData["Seq"] = index + 1;
        this.View.UpdateView(entityKey);
        this.View.GetControl(entityKey).SetFocusRowIndex(index - 1);
        
    if e.BarItemKey=='u_down':
        index=this.View.Model.GetEntryCurrentRowIndex(entityKey);
        if index == this.View.Model.GetEntryRowCount(entityKey) - 1: return;
        currRowData = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity(entityKey), index);#当前行数据
        nextRowData = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity(entityKey), index + 1);#下一行数据
        currRowData["SEQ"] = index + 2;
        nextRowData["SEQ"] = index + 1;
        this.View.UpdateView(entityKey);
        this.View.GetControl(entityKey).SetFocusRowIndex(index + 1);

相关信息来源于此贴。

https://vip.kingdee.com/article/172348459364982272?share_fromuid=2147401710&productLineId=1&isKnowledge=2


赞 84