コード例 #1
0
        public virtual async Task <FlowSheet> CreateSheet(FlowInstance instance, FlowForm flowForm)
        {
            var formData = instance.FormData;
            var formKey  = flowForm.FormKey;
            //生成单据
            var flowSheet = new FlowSheet()
            {
                FlowInstanceId = instance.Id,
                SheetName      = instance.InstanceName,
                FormKey        = formKey,
                SheetNature    = SheetNature.正单
            };
            var sheetId = await FlowSheetManager.InsertAndGetIdAsync(flowSheet);

            return(flowSheet);
        }
コード例 #2
0
        public async Task CreateRevertSheet(FlowSheet flowSheet, string revertReason)
        {
            //产生新的流程实例
            var instance    = flowSheet.FlowInstance;
            var newInstance = new FlowInstance()
            {
                InstanceName   = instance.InstanceName,
                FormContent    = instance.FormContent,
                FormData       = instance.FormData,
                FlowFormId     = instance.FlowFormId,
                FormType       = instance.FormType,
                InstanceStatus = instance.InstanceStatus,
                IsActive       = true,
                Code           = Common.Fun.ConvertToTimeStamp(DateTime.Now).ToString()
            };
            var newInstanceId = await FlowInstanceManager.InsertAndGetIdAsync(newInstance);

            //生成新的单据
            var newFlowSheet = new FlowSheet()
            {
                UnitId         = flowSheet.UnitId,
                FlowInstanceId = newInstanceId,
                SheetSN        = FlowSheetManager.GenerateSheetSN(flowSheet.FormKey),
                SheetName      = newInstance.InstanceName,
                FormKey        = flowSheet.FormKey,
                SheetNature    = SheetNature.冲红,
                RelSheetId     = flowSheet.Id,
                RevertReason   = revertReason,
                Property       = flowSheet.Property
            };

            newFlowSheet.SheetDate = flowSheet.SheetDate;
            newFlowSheet.Remarks   = flowSheet.Remarks;
            var newSheetId = await FlowSheetManager.InsertAndGetIdAsync(newFlowSheet);

            //设置旧单据状态
            flowSheet.SheetNature  = SheetNature.被冲红;
            flowSheet.RelSheetId   = newSheetId;
            flowSheet.RevertReason = revertReason;

            await HandleRevert(newFlowSheet);
        }