using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Kingdee.K3Cloud.Test.Plugin
{
/// <summary>
///
/// </summary>
[HotUpdate]
[Description("调用存储过程")]
public class BillPlugInvokeStoreProcedure : AbstractOperationServicePlugIn
{
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
{
DynamicObject[] dynamicObjects = e.DataEntitys;
string billNo = String.Empty;
long bilId = 0;
//获取单据号,内码
foreach (dynamic dynamicObject in dynamicObjects)
{
bilId = dynamicObject["Id"];
billNo = dynamicObject["BillNo"].ToString();
}
//储存过程名
var procedureName = "P_Sub_OrderToOA";
//储存过程参数
var sqlParameterList = new List<SqlParam>();
sqlParameterList.Add(new SqlParam("@FBillNo", KDDbType.AnsiString, billNo));
DBUtils.ExecuteStoreProcedure(this.Context, procedureName, sqlParameterList);
//操作结果消息
OperateResult operateResult = new OperateResult();
operateResult.Message += string.Format("单据的单据号【{0}】,内码【{1}】。", billNo, bilId);
this.OperationResult.OperateResult.Add(operateResult);
}
}
}
推荐阅读