通过创建单据视图方式触发生产订单批量生成序列号
/// <summary>
/// 创建单据视图
/// </summary>
/// <param name="ctx"></param>
/// <param name="formId"></param>
/// <param name="layoutId"></param>
/// <param name="pkId"></param>
/// <returns></returns>
private static BillView CreateBillView(Context ctx, string formId, string layoutId = null, object pkId = null)
{
var meta = (FormMetadata) Kingdee.BOS.ServiceHelper.MetaDataServiceHelper.Load(ctx, formId); //单据唯一标识
var form = meta.BusinessInfo.GetForm();
var param = new BillOpenParameter(formId, layoutId);
param.Context = ctx;
param.FormMetaData = meta;
if (pkId != null && !string.IsNullOrWhiteSpace(pkId.ToString()))
{
param.Status = OperationStatus.EDIT;
param.InitStatus = OperationStatus.EDIT;
param.PkValue = pkId; //单据主键内码FID
}
else
{
param.Status = OperationStatus.ADDNEW;
param.InitStatus = OperationStatus.ADDNEW;
}
param.SetCustomParameter("formID", form.Id);
param.SetCustomParameter("PlugIns", form.CreateFormPlugIns()); //插件实例模型
param.SetCustomParameter("ShowConfirmDialogWhenChangeOrg", false);
param.NetCtrlDisable = true; // 禁用网控
var provider = form.GetFormServiceProvider();
var billview = (BillView) provider.GetService(typeof(IDynamicFormView));
//var type = Type.GetType("Kingdee.BOS.Web.Import.ImportBillView,Kingdee.BOS.Web");
//var billview2 = (BillView)Activator.CreateInstance(type);
billview.Initialize(param, provider); //初始化
billview.LoadData(); //加载单据数据
return billview;
}
//示例代码
var billView = CreateBillView(this.Context, "PRD_MO", 生产订单内码);
billView.InvokeFormOperation("GenSerialOnBill");//生成序列号操作代码
通过创建单据视图方式触发生产订单批量生成序列号
本文2024-09-16 19:09:11发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-26740.html