//和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)
        {
            //库存单的构建schema
            H3.DataModel.BizObjectSchema schema = this.Request.Engine.BizObjectManager.GetPublishedSchema("D150516Schrygddhktx2lwxq4squp2zl2");
            //new 一个库存单的对象
            H3.DataModel.BizObject targetBo = new H3.DataModel.BizObject(this.Engine, schema, this.Request.UserContext.UserId);

            //获取到入库单子表的数组对象
            H3.DataModel.BizObject[] childBo = (H3.DataModel.BizObject[]) this.Request.BizObject["D150516storageTime"];
            if(childBo != null && childBo.Length > 0)
            {
                //更新库存
                string sql = "UPDATE i_D150516Schrygddhktx2lwxq4squp2zl2 a JOIN i_D150516storageTime b ON a.joinMaterial = b.joinMaterial and a.address = b.dictionaryState SET a.inventoryMains = a.inventoryMains + b.number where " +
                    " b.parentobjectid = '" + this.Request.BizObjectId + "'";

                this.Engine.Query.QueryTable(sql, null);
                base.OnWorkflowInstanceStateChanged(oldState, newState);

            }
        }
    }

 简易版入库数量相加相减

 

 

posted on 2022-04-18 17:53  天涯何  阅读(51)  评论(0编辑  收藏  举报