获取信用余额
二开案例,在单据上获取到客户的信用余额显示在单据字段上,方案如下:
第一步:在BOS单据上增加相应的信用余额字段;
第二步:确定一个取数触发点,可以是一个按钮,新增表单插件,在插件中用代码实现按钮取数逻辑,代码取数的时候,可以调用信用状况查询的服务方法,取数插件代码如下,分别引用Kingdee.K3.Core.dll、Kingdee.K3.SCM.WebApi.ServicesStub.dll俩个组件类:
APIQCreditInfoArgs args = new APIQCreditInfoArgs();
args.OrgNumber = porgNumber;
args.DeptNumber = pdeptNumber;
args.ObjectType = pobjectType;
args.ObjectNumberFrom = pobjectNumberFrom;
args.ObjectNumberTo = pobjectNumberTo;
DynamicObjectCollection creditinfos = Kingdee.K3.SCM.ServiceHelper.CreditServiceHelper.GetAPICreditInfo(ctx, args);
foreach (DynamicObject creditdata in creditinfos)
{
string orgNumber = Convert.ToString(creditdata["FORGNUMBER"]);
string objectType = Convert.ToString(creditdata["FOBJECTTYPE"]);
string deptNumber = Convert.ToString(creditdata["FDEPTNUMBER"]);
string objectNumber = Convert.ToString(creditdata["FOBJECTNUMBER"]);
string currencyName = Convert.ToString(creditdata["FCURRENCYNAME"]);
decimal creditamount = Convert.ToDecimal(creditdata["FCREDITAMOUNT"]); //信用余额
decimal tmpcreditamount = Convert.ToDecimal(creditdata["FTEMPCREDITAMOUNT"]);
decimal credituseamount = Convert.ToDecimal(creditdata["FUSECREDITAMOUNT"]);
decimal creditbal = Convert.ToDecimal(creditdata["FCREDITBALANCE"]);
long overdays = Convert.ToInt64(creditdata["FOCCUPYOVERDAYS"]);
decimal overcredit = Convert.ToDecimal(creditdata["FOCCUPYOVERCREDIT"]);
string custNumber = Convert.ToString(creditdata["FCUSTNUMBER"]);
string salerNumber = Convert.ToString(creditdata["FSALERNUMBER"]);
string salegroupNumber = Convert.ToString(creditdata["FSALEGROUPNUMBER"]);
long creditoverdays = Convert.ToInt64(creditdata["FOVERDAYS"]);
decimal creditoveramount = Convert.ToDecimal(creditdata["FOVERAMOUNT"]);
decimal creditlimitamount = Convert.ToDecimal(creditdata["FLIMITAMOUNT"]);
long tmpcreditoverdays = Convert.ToInt64(creditdata["FTEMPOVERDAYS"]);
decimal tmpcreditoveramount = Convert.ToDecimal(creditdata["FTEMPOVERAMOUNT"]);
decimal tmpcreditlimitamount = Convert.ToDecimal(creditdata["FTEMPLIMITAMOUNT"]);
}
其中,Kingdee.K3.SCM.ServiceHelper.CreditServiceHelper.GetAPICreditInfo这个方法为取信用余额数据的服务方法:FCREDITAMOUNT为信用余额的值
第三步:将第二步取到的信用余额显示到页面上即可:
注意:这里取到的信用余额是一个瞬时值,并不能作为审核的时候信用余额的判断。
获取信用余额
本文2024-09-16 18:04:55发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-19825.html