封装
金蝶云社区-Zw814
Zw814
1人赞赏了该文章 571次浏览 未经作者许可,禁止转载编辑于2016年04月29日 09:50:32

public override void AfterBarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.AfterBarItemClickEventArgs e)
{
base.AfterBarItemClick(e);

string printType = "preview";
List printInfoList = new List();
PrintJobItem printInfoItem = new PrintJobItem();
//printInfoItem.BillId = "10008";
printInfoItem.FormId = this.View.BillBusinessInfo.GetForm().Id; //"b0e951bdfce74bf1befa9d56b8da546d";// this.View.BillBusinessInfo.GetForm().Id;
printInfoItem.TemplateId = "8c0b6bee-b88b-4443-ad18-dc0aa15ae157";
printInfoItem.SortString = "";//对单据体内容排序,一般为null就可以了
printInfoList.Add(printInfoItem);
string key = Guid.NewGuid().ToString();
//pp.Session[key] = printInfoList;
this.View.Session[key] = printInfoList;
JSONObject jsonObj = new JSONObject();
jsonObj.Put("pageID",this.View.PageId);//"b0e951bdfce74bf1befa9d56b8da546d");// this.View.PageId);
jsonObj.Put("printJobId", key);
jsonObj.Put("action",printType);//预览--printType赋值为"preview";打印--printType赋值为"print"
//if (预览)
string action = "printPreview";
jsonObj.Put("printBarName", null);
//if (打印)
//{
//string action = "print";
//jsonObj.Put("printerAddress", "");//可以指定打印机地址也可以不指定.
//}
//pp.AddAction(action, jsonObj);
this.View.AddAction(action, jsonObj);
}

请问这段代码应该怎么做一个简答的封装