套件展开子项物料值更新修复

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

套件展开子项物料值更新修复

# 前因: 在预测单增加了字段,制单的时候,记录对应的物料的订货策略信息. # 异常: ++预测单对应的物料为套件父项,保存的时候套件展开子项物料的订货策略信息等于父项的订货策略 # 分析: 套件展开是单独的功能,此时不会触发物料的值更新事件,而是直接复制的套件父项的数据包 # 解决方法: 增加服务插件,保存后方法判断这个订货策略是不是等于物料上的订货策略信息,如果不是则更新明细行的订货策略 具体代码如下: ``` # 引入clr运行库 # -*- coding: utf-8 -*- import clr # 添加对cloud插件开发的常用组件的引用 clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.DataEntity') clr.AddReference('Kingdee.BOS.Core') clr.AddReference("Kingdee.BOS.Contracts") clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.App.Core') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference('mscorlib') clr.AddReference('Kingdee.K3.SCM.ServiceHelper') # 导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入) from Kingdee.BOS import * from Kingdee.BOS.App.Data import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.DependencyRules import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.Core.Const import * from Kingdee.BOS.Core.DynamicForm import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from Kingdee.BOS.Core.List import * from Kingdee.BOS.Core.List.PlugIn import * from Kingdee.BOS.Core.Metadata.EntityElement import * from Kingdee.BOS.Core.Metadata.FieldElement import * from Kingdee.BOS.Core.Permission import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.BOS.ServiceHelper import * from System import * from System.Data import * from System.Collections.Generic import * from Kingdee.K3.SCM.ServiceHelper import * def EndOperationTransaction(e): for billObj in e.DataEntitys: state = billObj['DocumentStatus'] if state == 'A': entity = billObj["PLN_FORECASTENTRY"] # 明细单据体,ReqEntry为ORM实体表名 for line in entity: product_type = line["ProductType"] # 产品类别 if product_type == '2': # 1套件父项 2套件子项 3非套件 material_id = line['MaterialID']['ID'] order_policy = line['OrderPolicy'] sql = ("""/*dialect*/SELECT FORDERPOLICY FROM t_BD_MaterialPlan WHERE FMATERIALID = '%s' """ % material_id) sql_result = DBUtils.ExecuteDataSet(this.Context, sql) tab = sql_result.Tables[0] new_order_policy = tab.Rows[0]['FORDERPOLICY'] if order_policy != new_order_policy: line.OrderPolicy = new_order_policy ```

套件展开子项物料值更新修复

# 前因:在预测单增加了字段,制单的时候,记录对应的物料的订货策略信息.# 异常:++预测单对应的物料为套件父项,保存的时候套件展开子项物料...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息