主表单关联目标表单进行赋值操作
//和OnLoad平级,为重写方法 protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.WorkflowInstanceState newState) { //流程审批结束事件(先执行业务规则,在执行该方法)。 if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished) { // string activity = this.Request.ActivityCode; // string userId = this.Request.UserContext.UserId; //只在流程结束执行,自动在入库单填充数据 // if(this.Request.BizObject.actionName == "Submit" && activity == "ActivityEnd") //{ //办公耗材入库单的构建schema H3.DataModel.BizObjectSchema schema = this.Request.Engine.BizObjectManager.GetPublishedSchema("D1505165b8d9780f9e349ab90537f34db37d255"); //new办公耗材入库单一个对象 H3.DataModel.BizObject targetBo = new H3.DataModel.BizObject(this.Engine, schema, this.Request.UserContext.UserId); //获取到采购申请单子表的对象 H3.DataModel.BizObject[] childBo2 = (H3.DataModel.BizObject[]) this.Request.BizObject["D150516shoppingList"]; if(childBo2 != null && childBo2.Length > 0) { //加一个list集合,将数据天聪至集合中 List<H3.DataModel.BizObject> childList = new List<H3.DataModel.BizObject>(); //获取到采购申请单的对象 H3.DataModel.BizObject targetBo2 = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D150516purchasingApplication", this.Request.BizObjectId, false); foreach(H3.DataModel.BizObject child in childBo2) { //获取到办公耗材入库单子表的对象 H3.DataModel.BizObject childBo = new H3.DataModel.BizObject(this.Request.Engine, schema.GetChildSchema("D150516storageTime"), this.Request.UserContext.UserId); //办公耗材入库单的办公耗材采购申请单号对应采购申请单的办公耗材采购申请单号 targetBo["godown"] = this.Request.BizObjectId + string.Empty; //采购日期 targetBo["purchaseTime"] = this.Request.BizObject["time"] + string.Empty; //总金额 targetBo["totalMoney"] = this.Request.BizObject["totalAmount"] + string.Empty; //物料名称 childBo["joinMaterial"] = child["materialName"] + string.Empty; //类别 childBo["kind"] = child["kind"] + string.Empty; //一级类别 childBo["categoryName1"] = child["categoryName1"] + string.Empty; //二级类别 childBo["categoryName2"] = child["categoryNamecategoryName2"] + string.Empty; //区域 childBo["dictionaryState"] = child["address"] + string.Empty; //编码 childBo["coding"] = child["coding"] + string.Empty; //单价 childBo["price"] = child["price"] + string.Empty; //数量 childBo["number"] = child["number"] + string.Empty; //计量单位 childBo["measureUnit"] = child["measuringUnit"] + string.Empty; //规格型号 childBo["model"] = child["specifications"] + string.Empty; //总价 childBo["totalPrices"] = child["totalPrice"] + string.Empty; //供应商 childBo["joinPersonnel"] = child["joinPersonnel"] + string.Empty; //将数据添加到子表 childList.Add(childBo); } //存入子表数据 格式为H3.DataModel.BizObject[] targetBo["D150516storageTime"] = childList.ToArray(); //目标表单创建 targetBo.Create(); } } // } base.OnWorkflowInstanceStateChanged(oldState, newState); }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· 地球OL攻略 —— 某应届生求职总结