public delegate void OrderProcessmethod(VoidOrderInput input, Action callback); public List<OrderProcessmethod> _voidProcessorList { get; set; } _voidProcessorList.Add(VoidInsuranceInfo); _voidProcessorList.Add(VoidFinianceInfo); _voidProcessorList.Add(VoidOrderRollBackInventory); _voidProcessorList.Add(VoidOrderInfo); _voidProcessorList.ForEach(item => { item.Invoke(input, () => { }); }); private void VoidInsuranceInfo(VoidOrderInput input, Action callback) { CancelInsuranceRequestDto resuest = new CancelInsuranceRequestDto() { OrderNumber = input.OrderNumber, CancelReason = "订单作废,申请作废保险申请单!", OperatorUserId = Convert.ToInt32(ConstValue.OperatorUserId) }; var result = AsyncHelper.RunSync(() => _webServiceHelper.PostAsync<AjaxResponse>(ConstValue.BackendServiceBaseUrls, string.Format("/Tesla/api/Insurance/PostOrderCanceledToCancelInsuranceRequest", resuest))); if (!result.Success) { throw new BusinessException("F00004", string.Format("调用采销回滚库存接口失败,服务地址:{0},错误信息:{1}", ConstValue.BackendServiceBaseUrls + "/Tesla/api/Insurance/PostOrderCanceledToCancelInsuranceRequest" , result.Error.Message)); } else { callback(); } }
同样输入输出的方法可以放到同一个执行序列里面,用于连续的Check,其中 有一部不满足就抛出异常。