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
6d260e04
Commit
6d260e04
authored
Aug 14, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化新增发票删除接口
parent
336d2297
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
PayExtension.cs
Src/Extensions/PayExtension.cs
+11
-0
RestfulInvoice.Offset.Deficit.cs
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
+47
-0
No files found.
Src/Extensions/PayExtension.cs
View file @
6d260e04
...
@@ -55,6 +55,7 @@ namespace Kivii.Finances
...
@@ -55,6 +55,7 @@ namespace Kivii.Finances
rtns
.
AmountSplited
=
0
;
rtns
.
AmountSplited
=
0
;
rtns
.
AmountUsed
=
amount
;
rtns
.
AmountUsed
=
amount
;
rtns
.
Summary
=
"收款登记"
;
rtns
.
Summary
=
"收款登记"
;
rtns
.
Remark
=
remark
;
rtns
.
OperateTime
=
payment
.
OperateTime
;
rtns
.
OperateTime
=
payment
.
OperateTime
;
//rtns.OperateTime = DateTime.Now;
//rtns.OperateTime = DateTime.Now;
rtns
.
OperatorName
=
KiviiContext
.
CurrentMember
.
FullName
;
rtns
.
OperatorName
=
KiviiContext
.
CurrentMember
.
FullName
;
...
@@ -137,6 +138,11 @@ namespace Kivii.Finances
...
@@ -137,6 +138,11 @@ namespace Kivii.Finances
settlement
.
Metadata
[
"PayedName"
]
=
payment
.
PayerName
;
settlement
.
Metadata
[
"PayedName"
]
=
payment
.
PayerName
;
settlement
.
Metadata
[
"PayedSerialNumber"
]
=
payment
.
SerialNumber
;
settlement
.
Metadata
[
"PayedSerialNumber"
]
=
payment
.
SerialNumber
;
settlement
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
settlement
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
if
(!
remark
.
IsNullOrEmpty
())
{
settlement
.
Remark
=
remark
;
settlement
.
AddOnlyProperties
(
o
=>
o
.
Remark
);
}
amount
-=
currentAmount
;
amount
-=
currentAmount
;
}
}
...
@@ -273,6 +279,11 @@ namespace Kivii.Finances
...
@@ -273,6 +279,11 @@ namespace Kivii.Finances
settlement
.
Metadata
[
"PayedName"
]
=
accountPayer
.
Name
;
settlement
.
Metadata
[
"PayedName"
]
=
accountPayer
.
Name
;
settlement
.
Metadata
[
"PayedSerialNumber"
]
=
accountPayer
.
SerialNumber
;
settlement
.
Metadata
[
"PayedSerialNumber"
]
=
accountPayer
.
SerialNumber
;
settlement
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
settlement
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
if
(!
remark
.
IsNullOrEmpty
())
{
settlement
.
Remark
=
remark
;
settlement
.
AddOnlyProperties
(
o
=>
o
.
Remark
);
}
amount
-=
currentAmount
;
amount
-=
currentAmount
;
}
}
...
...
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
View file @
6d260e04
...
@@ -190,6 +190,53 @@ namespace Kivii.Finances.Transforms
...
@@ -190,6 +190,53 @@ namespace Kivii.Finances.Transforms
}
}
}
}
[
Api
(
Description
=
"发票删除"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
InvoiceDelete
:
RestfulExecution
<
Invoice
>
{
public
Guid
Kvid
{
get
;
set
;
}
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
if
(
Kvid
==
Guid
.
Empty
&&
Kvids
.
IsNullOrEmpty
())
throw
new
Exception
(
"请传入要作废的发票Kvid!"
);
if
(
Kvids
.
IsNullOrEmpty
())
Kvids
=
new
List
<
Guid
>();
if
(
Kvid
!=
Guid
.
Empty
)
Kvids
.
Add
(
Kvid
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Invoice
>();
var
invoices
=
conn
.
SelectByIds
<
Invoice
>(
Kvids
);
if
(
invoices
.
IsNullOrEmpty
())
throw
new
Exception
(
"未找到所选发票信息!"
);
if
(
invoices
.
Exists
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"存在未作废的发票,请先作废后再删除!"
);
var
offsets
=
conn
.
SelectByIds
<
Invoice
>(
invoices
.
ConvertAll
(
p
=>
p
.
OffsetKvid
));
var
rtns
=
new
RestfulUpdateResponse
<
Invoice
>();
rtns
.
Results
=
new
List
<
Invoice
>();
var
trans
=
conn
.
OpenTransaction
();
try
{
foreach
(
var
item
in
invoices
)
{
conn
.
DeleteById
<
Invoice
>(
item
.
Kvid
);
rtns
.
Results
.
Add
(
item
);
}
foreach
(
var
item
in
offsets
)
{
conn
.
DeleteById
<
Invoice
>(
item
.
Kvid
);
rtns
.
Results
.
Add
(
item
);
}
trans
.
Commit
();
}
catch
(
Exception
ex
)
{
trans
.
Rollback
();
throw
ex
;
}
return
rtns
;
}
}
//[Api(Description = "发票红冲")]
//[Api(Description = "发票红冲")]
//[RequiresAnyRole(SystemRoles.Everyone)]
//[RequiresAnyRole(SystemRoles.Everyone)]
//public class InvoiceDeficit : RestfulExecution<Invoice>
//public class InvoiceDeficit : RestfulExecution<Invoice>
...
...
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