python-值触发:
import clr
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
from Kingdee.BOS.App.Data import *
# 菜单按钮
def DataChanged(e):
fldKey=e.Field.Key.ToUpperInvariant();#字段标识大写
if(fldKey=="F_WKYC_TEXT1"):#注意:示例代码是不等于,实际应使用等于进行判断
row=e.Row;#字段所在的行号,从0开始,单据头字段为0
oldValue=e.OldValue;#更新前字段值
newValue=e.NewValue;#更新后的字段值
msg=("第[{0}]行字段[{1}]从[{2}]更新成了[{3}]").format(row,fldKey,oldValue,newValue);
index_0 = this.View.Model.GetEntryRowCount("FSaleOrderEntry")
FID = this.View.BillBusinessInfo.GetForm().Id;
for index_1 in range(index_0):
KHLH_1 = this.View.Model.GetValue("F_WKYC_Text1", index_1) # 获取 "F_WKYC_Text1" 的值
FCUSTobject = this.View.Model.GetValue("FCUSTID") # 获取客户ID
if FCUSTobject is None:
this.View.ShowErrMessage("没有获取到客户信息!")
return
FCUSTID = FCUSTobject.Id
sql = ("""/*dialect*/SELECT TOP 1 FMATERIALID,Tsaloe.F_WKYC_Text1,F_WKYC_Text2, F_WKYC_Text3, F_WKYC_Text4, F_WKYC_Combo1, F_WKYC_Combo, F_XJKM_Combo3, F_WKYC_Combo2, F_WKYC_Text6
FROM T_SAL_ORDERENTRY as Tsaloe
inner join T_SAL_ORDER as Tsalo on Tsaloe.FID = Tsalo.FID
WHERE Tsaloe.F_WKYC_Text1 = '{0}' and Tsalo.FCUSTID = {1} and FDOCUMENTSTATUS = 'C' ORDER BY FENTRYID DESC""").format(KHLH_1,FCUSTID);
# 根据条件获取销售订单明细数据信息
SALORDERObjects = DBUtils.ExecuteDataSet(this.Context,sql);
SALORDERObject = SALORDERObjects.Tables[0];
for dr in SALORDERObject.Rows:
FMATERIALID=dr["FMATERIALID"];
this.View.Model.SetValue("FMATERIALID", FMATERIALID, index_1)
F_WKYC_Text2=dr["F_WKYC_Text2"];
this.View.Model.SetValue("F_WKYC_Text2", F_WKYC_Text2, index_1)
F_WKYC_Text3=dr["F_WKYC_Text3"];
this.View.Model.SetValue("F_WKYC_Text3", F_WKYC_Text3, index_1)
F_WKYC_Text4=dr["F_WKYC_Text4"];
this.View.Model.SetValue("F_WKYC_Text4", F_WKYC_Text4, index_1)
F_WKYC_Combo1=dr["F_WKYC_Combo1"];
this.View.Model.SetValue("F_WKYC_Combo1", F_WKYC_Combo1, index_1)
F_WKYC_Combo2=dr["F_WKYC_Combo2"];
this.View.Model.SetValue("F_WKYC_Combo2", F_WKYC_Combo2, index_1)
F_XJKM_Combo3=dr["F_XJKM_Combo3"];
this.View.Model.SetValue("F_XJKM_Combo3", F_XJKM_Combo3, index_1)
F_WKYC_Combo=dr["F_WKYC_Combo"];
this.View.Model.SetValue("F_WKYC_Combo", F_WKYC_Combo, index_1)
F_WKYC_Text6=dr["F_WKYC_Text6"];
this.View.Model.SetValue("F_WKYC_Text6", F_WKYC_Text6, index_1)