Python插件 - 将生产订单二开字段携带至下级订单上

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

Python插件 - 将生产订单二开字段携带至下级订单上

# 借鉴 @Tracy_Huang 老师的代码实现 - 传送门: **[如何将生产订单二开字段携带至下级订单上](https://wenku.my7c.com/article/25976?productLineId=1)** # 目前不足的地方 ## 就是无法获取到FirstOrDefault扩展函数,所以代码做了一些调整! ![1681432046177.webp](/download/0100613077382e2e4cfa93b5d8551b20b35d.webp) # Python代码实现 ```python import clr clr.AddReference("System") clr.AddReference("System.Core") clr.AddReference("Kingdee.BOS") clr.AddReference("Kingdee.BOS.App") clr.AddReference("Kingdee.BOS.Core") clr.AddReference("Kingdee.BOS.DataEntity") clr.AddReference("Kingdee.BOS.ServiceHelper") clr.AddReference("Kingdee.k3.Core") #引入命名空间 from System import * from System.Linq import * from Kingdee.BOS import * from Kingdee.BOS.Util import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.K3.Core.MFG.EntityHelper import * from Kingdee.BOS.ServiceHelper import * #实现 携带数据到下级订单 def AfterCreateModelData(e): obj = this.View.Model.DataObject; moEntryDatas = obj["TreeEntity"]; #获取分录 if moEntryDatas is None: this.View.ShowMessage("TreeEntity不存在"); srcBillType = FirstOrDefault(moEntryDatas)["SrcBillType"].ToString(); if srcBillType == "PRD_MO": moId = FirstOrDefault(moEntryDatas)["SrcBillId"].ToString(); #源单内码 moData = BusinessDataServiceHelper.LoadSingle(this.Context, moId, this.View.Model.BusinessInfo.GetDynamicObjectType()); #源单数据包 srcMoEntryDatas = moData["TreeEntity"]; #源单分录数据 for moEntryData in moEntryDatas: moEntryId = moEntryData["SrcBillEntryId"].ToString(); srcMoEntryData = FirstOrDefault(Where(srcMoEntryDatas,lambda w: w["ID"].ToString()==moEntryId)) if srcMoEntryData is not None: entryText = srcMoEntryData["F_SB"].ToString(); #二开表体字段的属性名 row = int(moEntryData["Seq"]); this.View.Model.SetValue("F_SB", entryText, row - int(1)); #二开表体字段的字段名 def FirstOrDefault(col, fun = lambda x: True): return Enumerable.FirstOrDefault[object](col, Func[object, bool](fun)) def Where(col, fun): return Enumerable.Where[object](col, Func[object, bool](fun)) ``` # 功能实现截图 ![二开单据.webp](/download/0100a86d459eb22d46228791a206f6787948.webp) ![二开1.webp](/download/0100d16944c44f614e399ac9d9172c6fb14a.webp) ![二开2.webp](/download/0100e86168a75b244052836b6937046e5614.webp) # 简单的python开发集合 ### [记录一下python简单的插件开发- beforef7select&基础资料组织 列表只显示用户拥有的组织权限](https://wenku.my7c.com/article/432506265244103680?productLineId=1) ### [记录一下python简单的插件开发- 单元格格式化事件&物料收发汇总格式化仓位编码](https://wenku.my7c.com/article/432502474717361152?productLineId=1) ### [记录一下python简单的插件开发- 菜单按钮事件(表体菜单按钮事件)执行SQL语句](https://wenku.my7c.com/article/433286928398603520) ### [python插件 - 动态 简单账表 通过SQL存储过程输出列实现动态展示](https://wenku.my7c.com/article/433709738048508160?productLineId=1):triangular_flag_on_post: ### [Python插件 - 将生产订单二开字段携带至下级订单上](https://wenku.my7c.com/article/434474741080938240?productLineId=1) :new: ### [Python插件 - 单据转换插件-WebApi下推单据 自定义入参插件](https://wenku.my7c.com/article/445155491019305984?fromAction=POST_ARTICLE&productLineId=1) :pushpin: ### [简单Python插件 - 点击菜单弹窗动态表单录入数据返回父窗体](https://wenku.my7c.com/article/449987803519330560?productLineId=1) :pushpin: ### [Python插件 - 【服务插件】取文本字段值赋值基础资料字段](https://wenku.my7c.com/article/453951446166029312?productLineId=1) ### [Python插件 - 保存、审核、提交 发送请求传输至第三方系统](https://wenku.my7c.com/article/452432069977609216?productLineId=1)
this.View.Model.BusinessInfo是本单元数据啊,怎么用来取源单啊?

Python插件 - 将生产订单二开字段携带至下级订单上

# 借鉴 @Tracy_Huang 老师的代码实现- 传送门: **[如何将生产订单二开字段携带至下级订单上](https://wenku.my7c.com/article/25976?...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息