|
谭文
发表于 2020-4-13 17:04:30
父流程提交时候同时更新子流程的数据
- // 子流程子表增加SourceObjectId 字段,映射到父流程对应子表数据(一一对应)
- H3.DataModel.BizObject childBizObject = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "子流程表单编码", 子流程bizObjectId, false); //子流程BizObject实例
- List < BizObject > listchildItemObject = new List<BizObject>();
- BizObject[] bizObjects = this.Request.BizObject["父流程子表编码"] as BizObject[]; //父流程子表
-
- foreach(BizObject bizObject in bizObjects)
- {
- H3.DataModel.BizObject sourceObject = null;
- string sourceObjectId = bizObject["SourceObjectId"] + string.Empty;
- if(!string.IsNullOrEmpty(sourceObjectId))
- {
- sourceObject = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "父流程子表编码", sourceObjectId, false);
- }
- BizObject newObject = null;
- if(sourceObject == null)
- {
- //子流程子表已经有数据
- newObject = new H3.DataModel.BizObject(this.Engine, this.Request.Engine.BizObjectManager.GetPublishedSchema("子流程表单编码").GetChildSchema("子流程子表编码"), H3.Organization.User.SystemUserId);
- }
- else
- {
- //子流程子表没有关联的数据(父流程新增的数据)
- newObject = sourceObject;
- }
- newObject["字段1"] = bizObject["字段1"];
- newObject["字段2"] = bizObject["字段2"];
- newObject["sourceObjectId"] = bizObject.ObjectId;
- listObject.Add(newObject);
- }
- childBizObject["子流程子表编码"] = listObject.To
- childBizObject.Update();
复制代码 |
|