Commit 44122079 by 陶然

优化

parent 64a26bb1
......@@ -265,7 +265,7 @@ namespace Kivii.Finances.Transforms
(Payments.Sum(o => o.Amount) != Items.Sum(o => o.Amount)).ThrowIfTrue("到账开票金额和发票金额不一致!");
}
var conn = KiviiContext.GetOpenedDbConnection<Invoice>();
var exists = conn.Select<Invoice>(o => Sql.In(o.SerialNumber, Items.ConvertAll(p => p.SerialNumber)));
//var exists = conn.Select<Invoice>(o => Sql.In(o.SerialNumber, Items.ConvertAll(p => p.SerialNumber)));
//(conn.Exists<Invoice>(o => Sql.In(o.SerialNumber, Items.ConvertAll(p => p.SerialNumber)))).ThrowIfTrue("存在重复录入的发票信息");
List<Payment> preCorrelatingPayments = new List<Payment>();
......@@ -299,7 +299,7 @@ namespace Kivii.Finances.Transforms
foreach (var info in Items)
{
//重复的发票,如果传了对应到账,那重复的发票就要抛异常,否则跳过
if(!exists.IsNullOrEmpty() && exists.Exists(o => o.SerialNumber == info.SerialNumber))
if (conn.Exists<Invoice>(o => o.SerialNumber == info.SerialNumber))
{
if (!Payments.IsNullOrEmpty()) throw new Exception($"存在重复录入的发票信息:{info.SerialNumber}");
else continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment