private IQueryResult Create(string content, ref string expr, IEntitiesSerializer serializer) { var currency = Parsing.Token(ref expr, false); var baseCurrency = Parsing.Token(ref expr, false); var lst = new List <Voucher>(); while (!string.IsNullOrWhiteSpace(expr)) { var date = Parsing.UniqueTime(ref expr); if (!date.HasValue) { var dayF = ParsingF.DoubleF(ref expr); var day = (int)dayF; // ReSharper disable once CompareOfFloatsByEqualityOperator if (day != dayF) { throw new ApplicationException("非整数日期"); } date = ClientDateTime.Today.Day < day ? ClientDateTime.Today.AddMonths(-1).AddDays(day - ClientDateTime.Today.Day) : ClientDateTime.Today.AddDays(day - ClientDateTime.Today.Day); } var from = ParsingF.DoubleF(ref expr); var to = ParsingF.DoubleF(ref expr); var voucher = new Voucher { Date = date.Value, Details = new List <VoucherDetail> { new VoucherDetail { Currency = baseCurrency, Title = 2241, SubTitle = 01, Content = content, Fund = -to }, new VoucherDetail { Currency = baseCurrency, Title = 3999, Fund = to }, new VoucherDetail { Currency = currency, Title = 3999, Fund = -from }, from >= 0 ? new VoucherDetail { Currency = currency, Title = 2241, SubTitle = 01, Content = content, Fund = from } : new VoucherDetail { Currency = currency, Title = 6603, Fund = from } } }; Accountant.Upsert(voucher); lst.Add(voucher); } if (lst.Any()) { return(new DirtyText(serializer.PresentVouchers(lst))); } return(new PlainSucceed()); }