|
这里给一段 子表生成主表的代码 也就是复制子表的数据到主表,首先获取子表的各个字段值,官方教程链接(https://help.h3yun.com/channels/3.html#%E5%90%8E%E7%AB%AF%E4%BB%A3%E7%A0%81)
H3.DataModel.BizObject[] details = (H3.DataModel.BizObject[])this.Request.BizObject["D00002SalesOrderDetail"]; //获取子表属性并强制转换为对象数组D00002SalesOrderDetail为子表编码
if(details != null && details.Length > 0)
{
foreach(H3.DataModel.BizObject detail in details)
{
string zz = detail["F0000001"] + string.Empty; //获取子表中F0000001的字段值
//然后创建主表,官方教程链接(https://help.h3yun.com/channels/3.html#%E4%B8%9A%E5%8A%A1%E5%AF%B9%E8%B1%A1)
H3.DataModel.BizObjectSchema schema =this.Request.Engine.BizObjectManager.GetPublishedSchema("D000024FeeReimbursement170801");
H3.DataModel.BizObject obj = new H3.DataModel.BizObject(this.Request.Engine, schema, this.Request.UserContext.UserId); //主表对象
obj.CreatedBy = this.Request.UserContext.UserId;
obj["F0000002"] = zz ;//将获取到的zz赋值给主表的字段F0000002
obj["FeeTotal"] = "其他";
obj["F0000006"] = "其他";
obj["tuanjian"] = "其他";obj.Status = H3.DataModel.BizObjectStatus.Effective;//设置主表生效
obj.Create();//将业务对象创建到数据库中
}
}
|
|