动态表单套打数据包
金蝶云社区-Zw814
Zw814
1人赞赏了该文章 1,373次浏览 未经作者许可,禁止转载编辑于2016年08月08日 09:41:26

以下是我为动态表单构建数据包的代码,报的此错应该如何解决
public override void OnPrepareNotePrintData(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.PreparePrintDataEventArgs e)
{
try
{
//BarCodeUtils.SetDynamicBillPrintData(e, Context, "COZ_WALLASSMODEL", SetMeterialBarCodePrintData); //动态表单
//构建新数据包并提供给系统
if (e.DataSourceId.Equals("FBillHead", StringComparison.OrdinalIgnoreCase))
{
DynamicObject notePrintHeadObj = new DynamicObject(e.DynamicObjectType);
notePrintHeadObj["FPROJECTNUMBER"] = "2016-163-001";
notePrintHeadObj["FPROJECTNAME"] = "央视密云拓展基地集装箱房项目";
notePrintHeadObj["FPRODUCTNAME"] = "SMAC地盘总成1420AL";
notePrintHeadObj["FMODEL"] = "直排(G)米黄竹编C12133";
notePrintHeadObj["FBARCODE"] = "1201604080001";
e.DataObjects = new DynamicObject[] { notePrintHeadObj };
}

//构建新数据包并提供给系统
if (e.DataSourceId.Equals("FEntity", StringComparison.OrdinalIgnoreCase))
{
List notePrintEntryRows = new List();
DynamicObjectCollection entrys = this.View.Model.DataObject["FEntity"] as DynamicObjectCollection;
foreach (object entry in entrys)
{
DynamicObject notePrintEntryRow = new DynamicObject(e.DynamicObjectType);
//赋值
notePrintEntryRow["FMATERIALNUMBER"]="dasd";
notePrintEntryRow["FMATERIALNAME"]="asda";
notePrintEntryRow["FNUMBER"] = "3";
notePrintEntryRows.Add(notePrintEntryRow);
}
e.DataObjects = notePrintEntryRows.ToArray();
}
base.OnPrepareNotePrintData(e);
}
catch (Exception ex)
{
this.View.ShowMessage(ex.Message);
}
}