物料清单获取最近单价原创
3人赞赏了该文章
108次浏览
编辑于2024年04月17日 17:09:34
import clr 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') clr.AddReference('Newtonsoft.Json') from Kingdee.BOS 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 System.Net import * from System.Text import * from System.IO import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * from Kingdee.BOS.Util import * def DataChanged(e): if e.Field.Key == "FMATERIALIDCHILD": cfmid=this.Model.GetValue("FMATERIALIDCHILD",e.Row); if cfmid is None: return; kfj=this.Model.GetValue("F_kfbj",e.Row); if float(kfj)>0: return; mno=str(cfmid["Number"]); mid=str(cfmid["Id"]); cxsql="select price from v_pur_price_for_bom where fnumber='"+mno+"'"; cxjg=DBServiceHelper.ExecuteDynamicObject(this.Context,cxsql); if cxjg.Count==0: return; dj=cxjg[0][0]; this.Model.SetValue("F_kfbj",dj,e.Row); this.View.InvokeFieldUpdateService("F_kfbj", 0);
create view v_pur_price_for_bom as with t_pur_price_latest as ( select b.fdate,a.FMATERIALID,e.FNUMBER,c.FPRICEUNITID,c.FTAXPRICE,d.FSETTLECURRID,d.FEXCHANGERATE ,row_number() over (partition by e.fnumber order by fdate desc,b.FDOCUMENTSTATUS) as id from t_PUR_POOrderEntry a with(nolock) ,t_PUR_POOrder b with(nolock) ,t_PUR_POOrderEntry_F c with(nolock) ,T_PUR_POORDERFIN d with(nolock) ,T_BD_MATERIAL e with(nolock) where a.fid=b.fid and b.FOBJECTTYPEID = 'PUR_PurchaseOrder' and b.FDOCUMENTSTATUS='C' and c.FENTRYID=a.FENTRYID and d.FENTRYID=a.FENTRYID and e.FMATERIALID = a.FMATERIALID ) select FMATERIALID,FNUMBER,FPRICEUNITID,FTAXPRICE,FEXCHANGERATE,FTAXPRICE*FEXCHANGERATE as price,FSETTLECURRID from t_pur_price_latest where id=1
赞 3
3人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读