Python案例--根据子物料编码查询携带替代方案备注到BOM备注原创
10人赞赏了该文章
75次浏览
编辑于2024年07月24日 10:20:33
import clr clr.AddReference('System') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.DataEntity') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.App') from System import * from System.Collections.Generic import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.Core.DynamicForm import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import * from Kingdee.BOS.Util import* from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import DateTime from System.Data import * from Kingdee.BOS import * from Kingdee.BOS.App.Data import * def AfterBindData(e): entryDC = this.View.Model.DataObject["SlaveRelationEntry"] ct=entryDC.Count for i in range(0,ct): material_id=entryDC[i]["SLAVERELATION_id"]; #this.View.ShowMessage(str(material_id)); orgSQL=("""/*dialect*/select cmaterial_l.FMEMO,cmaterial.FEFFECTDATE from T_ENG_SUBSTITUTEMAINITEMS pmaterial inner join T_ENG_SUBSTITUTESUBITEMS cmaterial on pmaterial.FID=cmaterial.FID inner join T_ENG_SUBSTITUTESUBITEMS_L cmaterial_l on cmaterial.FENTRYID=cmaterial_l.FENTRYID and cmaterial_l.FLOCALEID=2052 where pmaterial.FMaterialID={0} order by cmaterial.FEFFECTDATE """).format(material_id); dataRows=DBUtils.ExecuteDynamicObject(this.Context,orgSQL); for dr in dataRows: this.Model.SetValue("FRP_FChildrenMemo",dr["FMEMO"],i); def DataChanged(e): fldKey=e.Field.Key.ToUpperInvariant();#字段标识大写 if(fldKey=="FSLAVERELATION"):#FSlaveMat row=e.Row; material_obj=this.Model.GetValue("FSLAVERELATION",row); material_id=material_obj["id"]; orgSQL=("""/*dialect*/select cmaterial_l.FMEMO,cmaterial.FEFFECTDATE from T_ENG_SUBSTITUTEMAINITEMS pmaterial inner join T_ENG_SUBSTITUTESUBITEMS cmaterial on pmaterial.FID=cmaterial.FID inner join T_ENG_SUBSTITUTESUBITEMS_L cmaterial_l on cmaterial.FENTRYID=cmaterial_l.FENTRYID and cmaterial_l.FLOCALEID=2052 where pmaterial.FMaterialID={0} order by cmaterial.FEFFECTDATE """).format(material_id); #this.View.ShowMessage(orgSQL); dataRows=DBUtils.ExecuteDynamicObject(this.Context,orgSQL); for dr in dataRows: this.Model.SetValue("FRP_FChildrenMemo",dr["FMEMO"],row);
推荐阅读