Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Biz.Finances.V2.0
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Kivii.Biz.Finances.V2.0
Commits
a4dab277
Commit
a4dab277
authored
Sep 06, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
e75d3231
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
PaymentExtension.cs
Src/Extensions/PaymentExtension.cs
+1
-1
RestfulPayment.UnBiz.Refund.cs
Src/Transforms/RestfulPayment.UnBiz.Refund.cs
+6
-3
No files found.
Src/Extensions/PaymentExtension.cs
View file @
a4dab277
...
@@ -282,7 +282,7 @@ namespace Kivii.Finances
...
@@ -282,7 +282,7 @@ namespace Kivii.Finances
}
}
//var amountInvoiced = conn.Scalar<Payment, decimal>(o => Sql.Sum(o.AmountInvoice), p => p.ParentKvid == payment.Kvid && p.OffsetKvid == Guid.Empty);
//var amountInvoiced = conn.Scalar<Payment, decimal>(o => Sql.Sum(o.AmountInvoice), p => p.ParentKvid == payment.Kvid && p.OffsetKvid == Guid.Empty);
var
amountSplit
=
conn
.
Scalar
<
Payment
,
decimal
>(
o
=>
Sql
.
Sum
(
o
.
Amount
),
p
=>
p
.
ParentKvid
==
payment
.
Kvid
&&
Sql
.
In
(
p
.
Type
,
PaymentType
.
Assign
,
PaymentType
.
Split
)
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
var
amountSplit
=
conn
.
Scalar
<
Payment
,
decimal
>(
o
=>
Sql
.
Sum
(
o
.
Amount
),
p
=>
p
.
ParentKvid
==
payment
.
Kvid
&&
Sql
.
In
(
p
.
Type
,
PaymentType
.
Assign
,
PaymentType
.
Split
,
PaymentType
.
UnBiz
,
PaymentType
.
Refund
)
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
Payment
parentPayment
=
null
;
Payment
parentPayment
=
null
;
if
(
payment
.
ParentKvid
!=
Guid
.
Empty
)
parentPayment
=
conn
.
SingleById
<
Payment
>(
payment
.
ParentKvid
);
if
(
payment
.
ParentKvid
!=
Guid
.
Empty
)
parentPayment
=
conn
.
SingleById
<
Payment
>(
payment
.
ParentKvid
);
IDbTransaction
trans
=
null
;
//事务,如果外部来了Connection,不生成事务
IDbTransaction
trans
=
null
;
//事务,如果外部来了Connection,不生成事务
...
...
Src/Transforms/RestfulPayment.UnBiz.Refund.cs
View file @
a4dab277
...
@@ -32,7 +32,9 @@ namespace Kivii.Finances.Transforms
...
@@ -32,7 +32,9 @@ namespace Kivii.Finances.Transforms
if
(
payment
.
AmountSplited
==
payment
.
Amount
)
throw
new
Exception
(
"无剩余收款可操作!"
);
if
(
payment
.
AmountSplited
==
payment
.
Amount
)
throw
new
Exception
(
"无剩余收款可操作!"
);
if
(
payment
.
AmountSplited
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"操作金额超出范围!"
);
if
(
payment
.
AmountSplited
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"操作金额超出范围!"
);
//if (payment.AmountInvoice > 0) throw new Exception("已开票,无法非业务处理!");
//if (payment.AmountInvoice > 0) throw new Exception("已开票,无法非业务处理!");
if
(
payment
.
AmountUsed
>
0
)
throw
new
Exception
(
"已使用金额,无法非业务处理!"
);
if
(
payment
.
Amount
-
payment
.
AmountUsed
<
Amount
)
throw
new
Exception
(
"已使用金额,无法非业务处理!"
);
var
amountSplit
=
conn
.
Scalar
<
Payment
,
decimal
>(
o
=>
Sql
.
Sum
(
o
.
Amount
),
p
=>
p
.
ParentKvid
==
payment
.
Kvid
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
if
(
amountSplit
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"认领金额超出范围!"
);
var
split
=
payment
.
UnBizSplit
(
Amount
,
PaymentType
.
UnBiz
,
Remark
);
var
split
=
payment
.
UnBizSplit
(
Amount
,
PaymentType
.
UnBiz
,
Remark
);
...
@@ -239,8 +241,9 @@ namespace Kivii.Finances.Transforms
...
@@ -239,8 +241,9 @@ namespace Kivii.Finances.Transforms
if
(
payment
.
AmountSplited
==
payment
.
Amount
)
throw
new
Exception
(
"无剩余收款可操作!"
);
if
(
payment
.
AmountSplited
==
payment
.
Amount
)
throw
new
Exception
(
"无剩余收款可操作!"
);
if
(
payment
.
AmountSplited
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"操作金额超出范围!"
);
if
(
payment
.
AmountSplited
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"操作金额超出范围!"
);
//if (payment.AmountInvoice > 0) throw new Exception("已开票,无法退款处理!");
//if (payment.AmountInvoice > 0) throw new Exception("已开票,无法退款处理!");
if
(
payment
.
AmountUsed
>
0
)
throw
new
Exception
(
"已使用金额,无法退款处理!"
);
if
(
payment
.
Amount
-
payment
.
AmountUsed
<
Amount
)
throw
new
Exception
(
"已使用金额,无法退款处理!"
);
var
amountSplit
=
conn
.
Scalar
<
Payment
,
decimal
>(
o
=>
Sql
.
Sum
(
o
.
Amount
),
p
=>
p
.
ParentKvid
==
payment
.
Kvid
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
if
(
amountSplit
+
Amount
>
payment
.
Amount
)
throw
new
Exception
(
"认领金额超出范围!"
);
var
split
=
payment
.
UnBizSplit
(
Amount
,
PaymentType
.
Refund
,
Remark
);
var
split
=
payment
.
UnBizSplit
(
Amount
,
PaymentType
.
Refund
,
Remark
);
#
region
记录日志
#
region
记录日志
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment