AB窗口传参数回写

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

AB窗口传参数回写

感谢周老师指点,有需要的拿走不谢

A窗口传参至B窗口

import clr

#添加对cloud插件开发的常用组件的引用
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.DataEntity')
clr.AddReference('Kingdee.BOS.Contracts')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DependencyRules import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from Kingdee.BOS.Contracts import *
from Kingdee.BOS.DataEntity import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.Util import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *

def ChildFromClosed(obj):
    dic= obj.ReturnData; 
    #解析数据并写入单据体
    #billObj=this.Model.DataObject;
    #objstr=JsonUtil.Serialize(dic);
    #this.View.ShowMessage(objstr);
    ii=this.View.Model.GetEntryRowCount("FEntity");
    if ii==1:ii=0;
    aa=dic.Count;
    this.View.Model.BatchCreateNewEntryRow("FEntity",aa);
    i=0;
    for xz in dic:
        this.View.Model.SetValue("FMaterialId",xz["Id"],ii+i);
        i=i+1;
    this.View.UpdateView();
    return;
    
def ButtonClick(e):
    if e.Key.upper()=='F_X_BUTTON_QD':
        qdwl=this.Model.GetValue("F_XVKJ_Base_apv");
        wlzz=this.Model.GetValue("FPickOrgId");
        #objstr=JsonUtil.Serialize(this.Model.DataObject);
        #this.View.ShowMessage(objstr);
        if qdwl is None:return
        useOrgId = wlzz["Id"];
        mtrlId = qdwl["Id"];
        dic=[];#創建空列表
        dynamicFormShowParameter = DynamicFormShowParameter();
        guid = str(Guid.NewGuid());
        dynamicFormShowParameter.PageId=guid;
        dynamicFormShowParameter.FormId="ENG_BomQueryForward2";#动态表单子页面FormID
        dynamicFormShowParameter.CustomComplexParams.Add("DIC", dic);#将构建好的参数传入子页面,参数标识是"DIC"
        dynamicFormShowParameter.CustomComplexParams.Add("FMaterialId", str(mtrlId));
        dynamicFormShowParameter.CustomComplexParams.Add("FUseOrgId", str(useOrgId));
        dynamicFormShowParameter.CustomComplexParams.Add("fhlb", "1");
        this.View.ShowForm(dynamicFormShowParameter, Action[FormResult](ChildFromClosed));#弹出动态表单

B窗口返回数据给A窗口并解析至相关控件上

#引入clr运行库
import clr
#添加对cloud插件开发的常用组件的引用
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')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Util import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *

def ButtonClick(e):
    key=e.Key.ToUpper();
    if(key=="F_XV_Button_83g".ToUpper()):
        dic=[];
        fhlb=this.View.OpenParameter.GetCustomParameter("fhlb"); 
        if str(fhlb)<>"1":this.View.Close();
        billObj = this.Model.DataObject;
        mxObj=billObj["BomChild"];
        for obj in mxObj:
            xz=str(obj["F_XV_CheckBox_qtr"]);
            if xz=="True":
                data={"Id":obj["MaterialId"]["Id"],"Number":obj["MaterialId"]["Number"],"Checked":xz};
                dic.append(data);
        #objstr=JsonUtil.Serialize(dic);
        #this.View.ShowMessage(objstr);
        if dic.Count==0:this.View.ShowWarnningMessage("你没有选择数据");
        this.View.ReturnToParentWindow(dic);#将构建的列表数据返回父页面
        this.View.Close();



修改一下,去除多余空行。

import clr

#添加对cloud插件开发的常用组件的引用
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.DataEntity')
clr.AddReference('Kingdee.BOS.Contracts')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DependencyRules import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from Kingdee.BOS.Contracts import *
from Kingdee.BOS.DataEntity import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.Util import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *

def ChildFromClosed(obj):
    dic= obj.ReturnData; 
    #解析数据并写入单据体
    #billObj=this.Model.DataObject;
    #objstr=JsonUtil.Serialize(dic);
    #this.View.ShowMessage(objstr);
    ii=this.View.Model.GetEntryRowCount("FEntity");
    aa=dic.Count;
    if ii==1:
        ii=0;
        aa=aa-1;
    this.View.Model.BatchCreateNewEntryRow("FEntity",aa);
    i=0;
    for xz in dic:
        this.View.Model.SetValue("FMaterialId",xz["Id"],ii+i);
        i=i+1;
    this.View.UpdateView();
    return;
    
def ButtonClick(e):
    if e.Key.upper()=='F_XVKJ_BUTTON_QD':
        qdwl=this.Model.GetValue("F_XVKJ_Base_apv");
        wlzz=this.Model.GetValue("FPickOrgId");
        #objstr=JsonUtil.Serialize(this.Model.DataObject);
        #this.View.ShowMessage(objstr);
        if qdwl is None:return
        useOrgId = wlzz["Id"];
        mtrlId = qdwl["Id"];
        dic=[];#創建空列表
        dynamicFormShowParameter = DynamicFormShowParameter();
        guid = str(Guid.NewGuid());
        dynamicFormShowParameter.PageId=guid;
        dynamicFormShowParameter.FormId="ENG_BomQueryForward2";#动态表单子页面FormID
        dynamicFormShowParameter.CustomComplexParams.Add("DIC", dic);#将构建好的参数传入子页面,参数标识是"DIC"
        dynamicFormShowParameter.CustomComplexParams.Add("FMaterialId"str(mtrlId));
        dynamicFormShowParameter.CustomComplexParams.Add("FUseOrgId"str(useOrgId));
        dynamicFormShowParameter.CustomComplexParams.Add("fhlb""1");
        this.View.ShowForm(dynamicFormShowParameter, Action[FormResult](ChildFromClosed));#弹出动态表单

AB窗口传参数回写

感谢周老师指点,有需要的拿走不谢A窗口传参至B窗口import clr#添加对cloud插件开发的常用组件的引用clr.AddReference('System')clr.AddRef...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息