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
6cfc2f2c
Commit
6cfc2f2c
authored
Aug 16, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复发票删除bug
parent
aa31e884
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
InvoiceExtension.cs
Src/Extensions/InvoiceExtension.cs
+2
-2
RestfulInvoice.Offset.Deficit.cs
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
+11
-2
No files found.
Src/Extensions/InvoiceExtension.cs
View file @
6cfc2f2c
...
...
@@ -30,8 +30,8 @@ namespace Kivii.Finances
offsetInvoice
.
BizKvid
=
Guid
.
Empty
;
offsetInvoice
.
BizType
=
string
.
Empty
;
offsetInvoice
.
Kvid
=
newInvoiceKvid
;
offsetInvoice
.
RootKvid
=
newInvoiceKvid
;
offsetInvoice
.
ParentKvid
=
Guid
.
Empty
;
//
offsetInvoice.RootKvid = newInvoiceKvid;
//
offsetInvoice.ParentKvid = Guid.Empty;
offsetInvoice
.
SerialNumber
=
invoice
.
SerialNumber
.
IsNullOrEmpty
()
?
""
:
(
"-"
+
invoice
.
SerialNumber
);
offsetInvoice
.
Remark
=
$"
{
remark
}
"
;
offsetInvoice
.
Amount
=
0
-
offsetInvoice
.
Amount
;
//反向值
...
...
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
View file @
6cfc2f2c
...
...
@@ -208,10 +208,12 @@ namespace Kivii.Finances.Transforms
var
invoices
=
conn
.
SelectByIds
<
Invoice
>(
Kvids
);
if
(
invoices
.
IsNullOrEmpty
())
throw
new
Exception
(
"未找到所选发票信息!"
);
if
(
invoices
.
Exists
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"存在未作废的发票,请先作废后再删除!"
);
var
relationInvoices
=
conn
.
Select
<
Invoice
>(
o
=>
Sql
.
In
(
o
.
ParentKvid
,
invoices
.
ConvertAll
(
p
=>
p
.
Kvid
))
&&
o
.
Type
==
"Relation"
);
var
offsets
=
conn
.
SelectByIds
<
Invoice
>(
invoices
.
ConvertAll
(
p
=>
p
.
OffsetKvid
));
var
deletes
=
new
List
<
Guid
>();
if
(!
offset
s
.
IsNullOrEmpty
())
if
(!
invoice
s
.
IsNullOrEmpty
())
{
foreach
(
var
item
in
invoices
)
{
...
...
@@ -225,6 +227,13 @@ namespace Kivii.Finances.Transforms
deletes
.
AddIfNotExists
(
item
.
Kvid
);
}
}
if
(!
relationInvoices
.
IsNullOrEmpty
())
{
foreach
(
var
item
in
relationInvoices
)
{
deletes
.
AddIfNotExists
(
item
.
Kvid
);
}
}
var
rtns
=
new
RestfulDeleteResponse
<
Guid
>();
rtns
.
Results
=
new
List
<
Guid
>();
...
...
@@ -233,7 +242,7 @@ namespace Kivii.Finances.Transforms
{
foreach
(
var
kvid
in
deletes
)
{
conn
.
Delete
ById
<
Invoice
>(
kvid
);
conn
.
Delete
<
Invoice
>(
o
=>
o
.
Kvid
==
kvid
);
rtns
.
Results
.
Add
(
kvid
);
}
...
...
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