通过创建单据视图方式触发生产订单批量生成序列号

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:4

通过创建单据视图方式触发生产订单批量生成序列号

/// <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");//生成序列号操作代码


通过创建单据视图方式触发生产订单批量生成序列号

/// <summary>/// 创建单据视图/// </summary>/// <param name="ctx"></param>/// <param name="formId"></param>/// <param name...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息