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
d039a180
Commit
d039a180
authored
Sep 21, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账单创建接口优化不可重复建
parent
2a7b2168
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
RestfulBill.cs
Src/Transforms/RestfulBill.cs
+14
-2
No files found.
Src/Transforms/RestfulBill.cs
View file @
d039a180
...
@@ -28,11 +28,23 @@ namespace Kivii.Finances.Transforms
...
@@ -28,11 +28,23 @@ namespace Kivii.Finances.Transforms
conn
.
InitEntityType
<
Bill
>();
conn
.
InitEntityType
<
Bill
>();
conn
.
InitEntityType
<
BillDetail
>();
conn
.
InitEntityType
<
BillDetail
>();
var
settlements
=
conn
.
SelectByIds
<
Settlement
>(
SettlementKvids
);
var
query
=
conn
.
From
<
Settlement
>();
query
.
Where
(
o
=>
Sql
.
In
(
o
.
Kvid
,
SettlementKvids
));
query
.
Select
(
o
=>
new
{
o
.
SerialNumber
,
o
.
Kvid
,
o
.
Amount
,
o
.
Currency
,
o
.
Type
,
o
.
Summary
,
o
.
Remark
});
var
settlements
=
conn
.
Select
(
query
);
if
(
settlements
==
null
)
throw
new
Exception
(
"无对应数据导出!"
);
if
(
settlements
==
null
)
throw
new
Exception
(
"无对应数据导出!"
);
(
settlements
.
Exists
(
o
=>
o
.
Currency
!=
Item
.
Currency
)).
ThrowIfTrue
(
"存在于账单不一致的货币单位不可制作!"
);
(
settlements
.
Exists
(
o
=>
o
.
Currency
!=
Item
.
Currency
)).
ThrowIfTrue
(
"存在于账单不一致的货币单位不可制作!"
);
if
(
Item
.
Amount
!=
settlements
.
Sum
(
o
=>
o
.
Amount
))
throw
new
Exception
(
"账单金额不等于选择的结算金额之和!"
);
if
(
Item
.
Amount
!=
settlements
.
Sum
(
o
=>
o
.
Amount
))
throw
new
Exception
(
"账单金额不等于选择的结算金额之和!"
);
if
(
conn
.
Exists
<
BillDetail
>(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
BizKvid
,
settlements
.
ConvertAll
(
p
=>
p
.
Kvid
))))
throw
new
Exception
(
"此结算已有账单,不可重复制作账单!"
);
var
rtns
=
new
RestfulCreateResponse
<
Bill
>();
var
rtns
=
new
RestfulCreateResponse
<
Bill
>();
rtns
.
Results
=
new
List
<
Bill
>();
rtns
.
Results
=
new
List
<
Bill
>();
...
...
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