下推时在单据转换插件中获取本位币、汇率类型、汇率信息
@[TOC](目录)
### 1、前提
目标币别与本位币之间需要维护”汇率体系“
### 2、注册单据转换的插件策略
![image.webp](/download/0100f995e856f4304152bddea6e4c14fc3f0.webp)
### 3、Python参考脚本
```python
import clr
clr.AddReference('mscorlib')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.K3.SCM.App')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.K3.BD.Contracts')
clr.AddReference('Kingdee.K3.SCM.Contracts')
from System import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.K3.SCM.App import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.K3.BD.Contracts import *
from Kingdee.K3.BD.Contracts.FIN import *
from Kingdee.K3.SCM.Contracts import *
def AfterConvert(e):
billdatas = e.Result.FindByEntityKey("FBillHead")
for billdata in billdatas:
SetLocalCurrAndExchangeTypeAndExchangeRate(e,billdata)
def SetLocalCurrAndExchangeTypeAndExchangeRate(e,billdata):
fin = billdata["InStockFin"][0]
stockOrgId = billdata["StockOrgId_Id"]
currencyId = fin["SettleCurrId_Id"]
commonService =ServiceHelper.GetService[ICommonService]()
localCurrId = commonService.GetDefaultCurrencyByBizOrgID(this.Context, stockOrgId)
fin["LocalCurrId_Id"] = localCurrId
localCurrIdField = e.TargetBusinessInfo.GetField("FLocalCurrId")
FieldUtils.SetBaseDataFieldValue(this.Context, localCurrIdField, fin, localCurrId)
exchangeTypeId = commonService.GetDefaultExchangeTypeByBizOrgID(this.Context, stockOrgId)
fin["ExchangeTypeId_Id"] = exchangeTypeId
exchangeTypeIdField = e.TargetBusinessInfo.GetField("FExchangeTypeId")
FieldUtils.SetBaseDataFieldValue(this.Context, exchangeTypeIdField, fin, exchangeTypeId)
finCommonService = ServiceFactory.GetService[IFINServiceForCommon](this.Context)
exchangeRate = finCommonService.GetExchangeBusRateAndDecimal(this.Context,localCurrId,currencyId,exchangeTypeId,billdata["CreateDate"],billdata["CreateDate"])
fin["ExchangeRate"] = Math.Round(exchangeRate.Key, exchangeRate.Value)
```
==该示例代码说明见上图,图中有备注==
**其他更多文章入口:**[https://wenku.my7c.com/link/s/lbRPP](https://wenku.my7c.com/link/s/lbRPP)
下推时在单据转换插件中获取本位币、汇率类型、汇率信息
@[TOC](目录)### 1、前提目标币别与本位币之间需要维护”汇率体系“### 2、注册单据转换的插件策略![image.webp](/download/0100f995e856...
点击下载文档
本文2024-09-16 19:01:29发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-25914.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章