Python_明细自定义按钮锁定/解锁选中明细行字段原创
金蝶云社区-区区不才
区区不才
47人赞赏了该文章 208次浏览 未经作者许可,禁止转载编辑于2024年05月20日 10:16:24
import clr
clr.AddReference("System")
clr.AddReference("System.Core")
clr.AddReference("Kingdee.BOS") 
clr.AddReference("Kingdee.BOS.Core") 
clr.AddReference("Kingdee.BOS.Contracts") 
from Kingdee.BOS.Util import * 
from Kingdee.BOS.Core.Report.PlugIn.Args import *
from Kingdee.BOS.Core.Report.PlugIn import * 
from System import * 
from System.ComponentModel import *
from System.Linq import * 

def EntryBarItemClick(e):#EntryBarItemClick 表体菜单按钮事件、【BarItemClick】菜单按钮事件
	if e.BarItemKey.Equals("SYKA_tbButton_2", StringComparison.OrdinalIgnoreCase):#锁定字段
    	        rowIndex=this.View.Model.GetEntryCurrentRowIndex("FEntity");#获取当前所在行号
    	        this.View.GetFieldEditor("FInspectQty",rowIndex).Enabled=False;
		this.View.GetFieldEditor("FQualifiedQty",rowIndex).Enabled=False;
		this.View.GetFieldEditor("FUnqualifiedQty",rowIndex).Enabled=False;
		this.View.GetFieldEditor("FColorDiffRange",rowIndex).Enabled=False;
		this.View.GetFieldEditor("FDoorWidth",rowIndex).Enabled=False;
		this.View.GetFieldEditor("FQualityDescription",rowIndex).Enabled=False;
	if e.BarItemKey.Equals("SYKA_tbButton_3", StringComparison.OrdinalIgnoreCase):#解锁字段
    	        rowIndex=this.View.Model.GetEntryCurrentRowIndex("FEntity");
    	        this.View.GetFieldEditor("FInspectQty",rowIndex).Enabled=True;
		this.View.GetFieldEditor("FQualifiedQty",rowIndex).Enabled=True;
		this.View.GetFieldEditor("FUnqualifiedQty",rowIndex).Enabled=True;
		this.View.GetFieldEditor("FColorDiffRange",rowIndex).Enabled=True;
		this.View.GetFieldEditor("FDoorWidth",rowIndex).Enabled=True;
		this.View.GetFieldEditor("FQualityDescription",rowIndex).Enabled=True;
		this.View.GetFieldEditor("F_SYKA_HXWYL",rowIndex).Enabled=True;

效果展示:


image.png


image.png

赞 47