以上调用保存服务报错 红的 部分
OperateOption saveOption = OperateOption.Create();
var bussnessInfo = Kingdee.BOS.ServiceHelper.MetaDataServiceHelper.GetFormMetaData(this.Context, "PRD_PickMtrl").BusinessInfo;
var billDynamicObjectType = bussnessInfo.GetDynamicObjectType();
DynamicObject billobj = new DynamicObject(billDynamicObjectType);
//生产组织
//获取生产组织数据包
DynamicObject[] objSCZZ = BusinessDataServiceHelper.Load(
this.Context,
new object[] { 1 },
(MetaDataServiceHelper.Load(this.Context, "ORG_ORGANIZATIONS") as FormMetadata).
BusinessInfo.GetDynamicObjectType());
billobj["PRDORGID_ID"] = 1;
billobj["PRDORGID"] = objSCZZ[0];
//获取发料组织数据包
DynamicObject[] objFLZZ = BusinessDataServiceHelper.Load(
this.Context,
new object[] { 1 },
(MetaDataServiceHelper.Load(this.Context, "ORG_ORGANIZATIONS") as FormMetadata).
BusinessInfo.GetDynamicObjectType());
billobj["StockOrgId_ID"] = 1;
billobj["StockOrgId"] = objFLZZ[0];
//单据时间
billobj["Date"] = DateTime.Now;
单据类型
DynamicObject[] objbilltype = BusinessDataServiceHelper.Load(
this.Context,
new object[] { "123f39178eb2424c8449f992e1fff1ee" },
(MetaDataServiceHelper.Load(this.Context, "BOS_BILLTYPE") as FormMetadata).
BusinessInfo.GetDynamicObjectType());
billobj["BillType_ID"] = "123f39178eb2424c8449f992e1fff1ee";
billobj["BillType"] = objbilltype[0];
IOperationResult RS = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.Save(this.Context, bussnessInfo, billobj);
// this.View.ShowMessage( RS.OperateResult)
if (RS.IsSuccess == false)
{
string rs = string.Empty;
foreach (var a in RS.ValidationErrors)
{
rs= a.Message+" ;"+rs;
}
this.View.ShowMessage(rs);
}
以上只是构建了一个字段的数据包,而且一个一个构建很麻烦,有没有简便方法???
推荐阅读