Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Third.Finances.Seeyon.V4.5
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.Third.Finances.Seeyon.V4.5
Commits
0f8e711c
Commit
0f8e711c
authored
Oct 16, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
7562303f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
1 deletion
+115
-1
BillApply.cs
Src/Entities/BillApply.cs
+115
-1
No files found.
Src/Entities/BillApply.cs
View file @
0f8e711c
...
...
@@ -3,6 +3,7 @@ using Kivii.Finances.Entities;
using
Kivii.Finances.Seeyon.Extensions
;
using
Kivii.Linq
;
using
Kivii.Seeyon
;
using
Kivii.Seeyon.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -72,6 +73,67 @@ namespace Kivii.Finances.Seeyon.Entities
return
rtns
;
}
public
object
OnGetApplyResult
(
List
<
Guid
>
Kvids
,
object
Result
,
string
Message
)
{
if
(
Kvids
.
IsNullOrEmpty
())
throw
new
Exception
(
"缺少业务编号!"
);
if
(
Result
==
null
)
throw
new
Exception
(
"缺少审批结果信息"
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
InvoiceApply
>();
var
rtns
=
new
RestfulExecutionResponse
<
InvoiceApply
>();
rtns
.
Results
=
new
List
<
InvoiceApply
>();
var
applys
=
conn
.
SelectByIds
<
InvoiceApply
>(
Kvids
);
if
(
applys
.
IsNullOrEmpty
())
throw
new
Exception
(
"未找到此业务信息!"
);
//var apply = conn.SingleById<InvoiceApply>(Kvids);
//if (apply == null) throw new Exception("未找到此业务信息!");
var
result
=
Result
.
ToString
();
foreach
(
var
apply
in
applys
)
{
if
(
apply
.
Metadata
.
IsNullOrEmpty
())
apply
.
Metadata
=
new
Dictionary
<
string
,
string
>();
EntityLog
<
InvoiceApply
>
log
=
null
;
if
(
result
==
"审批通过"
)
{
apply
.
Metadata
[
"SeeyonResult"
]
=
result
;
apply
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
if
(
apply
.
Status
==
(
int
)
InvoiceApplyStatus
.
ProcessAdoption
)
{
apply
.
Status
=
(
int
)
InvoiceApplyStatus
.
FinancialApproval
;
apply
.
AddOnlyProperties
(
o
=>
o
.
Status
);
log
=
new
EntityLog
<
InvoiceApply
>();
log
.
OwnerKvid
=
apply
.
Kvid
;
log
.
Title
=
"账单借票"
;
log
.
Type
=
"流转"
;
log
.
Summary
=
"OA审批通过,可进行开票"
;
log
.
Remark
=
Message
;
log
.
CreatorName
=
"OA审批"
;
}
}
else
if
(
result
==
"审批不通过"
)
{
apply
.
Metadata
[
"SeeyonResult"
]
=
result
;
apply
.
Metadata
[
"SeeyonMessage"
]
=
Message
;
apply
.
AddOnlyProperties
(
o
=>
o
.
Metadata
);
if
(
apply
.
Status
==
(
int
)
InvoiceApplyStatus
.
ProcessAdoption
)
{
apply
.
Status
=
(
int
)
InvoiceApplyStatus
.
ApplyReject
;
apply
.
AddOnlyProperties
(
o
=>
o
.
Status
);
log
=
new
EntityLog
<
InvoiceApply
>();
log
.
OwnerKvid
=
apply
.
Kvid
;
log
.
Title
=
"账单借票"
;
log
.
Type
=
"流转"
;
log
.
Summary
=
"OA审批不通过,驳回了账单借票审批"
;
log
.
Remark
=
Message
;
log
.
CreatorName
=
"OA审批"
;
}
}
if
(
log
!=
null
)
conn
.
Insert
(
log
);
if
(!
apply
.
OnlyProperties
.
IsNullOrEmpty
())
{
conn
.
UpdateOnly
(
apply
);
rtns
.
Results
.
Add
(
apply
);
}
}
return
rtns
;
}
public
object
OnSubmitApplyForm
<
T
>(
Guid
Kvid
)
{
Kvid
.
ThrowIfEmpty
(
"请传入要申请的账单借票信息!"
);
...
...
@@ -107,8 +169,60 @@ namespace Kivii.Finances.Seeyon.Entities
public
object
OnSubmitApplyForm
<
T
>(
T
form
)
{
return
null
;
form
.
ThrowIfNull
(
"请传入借票信息!"
);
var
formApply
=
form
as
BillApply
;
formApply
.
ThrowIfNull
(
"传入的借票信息不能为空!"
);
var
kvids
=
formApply
.
Kvids
;
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
InvoiceApply
>();
var
applys
=
conn
.
SelectByIds
<
InvoiceApply
>(
kvids
);
applys
.
ThrowIfNullOrEmpty
(
"未找到借票信息!"
);
if
(
applys
.
Exists
(
o
=>
o
.
Status
>
(
int
)
InvoiceApplyStatus
.
ProcessAdoption
))
throw
new
Exception
(
"当前账单借票非待审批状态,无法申请审批!"
);
var
groupPayer
=
applys
.
GroupBy
(
a
=>
a
.
PayerName
);
if
(
groupPayer
.
Count
()
!=
1
)
throw
new
Exception
(
"不允许多个借票抬头同时申请!"
);
var
applySum
=
new
InvoiceApply
();
applySum
.
PopulateWith
(
applys
[
0
]);
applySum
.
Amount
=
applys
.
Sum
(
a
=>
a
.
Amount
);
applySum
.
Remark
=
applys
[
0
].
Remark
;
var
applyForm
=
applySum
.
ConvertToForm
();
var
bizKvids
=
applys
.
ConvertAll
(
o
=>
o
.
Kvid
);
var
strBizKvids
=
string
.
Join
(
","
,
bizKvids
);
applyForm
.
业务编号
=
strBizKvids
;
var
session
=
KiviiContext
.
Request
.
GetSession
();
var
client
=
new
JsonServiceClient
(
Configs
.
BaseUrl
);
var
resp
=
client
.
RequestBillForm
(
applyForm
,
session
);
if
(
resp
.
code
!=
"0"
)
throw
new
Exception
(
$"OA接口调用失败,原因:
{
resp
.
message
}
"
);
var
rtns
=
new
RestfulUpdateResponse
<
InvoiceApply
>();
rtns
.
Results
=
new
List
<
InvoiceApply
>();
foreach
(
var
apply
in
applys
)
{
apply
.
BizId
=
resp
.
data
.
subject
;
apply
.
AddOnlyProperties
(
o
=>
o
.
BizId
);
apply
.
BizType
=
typeof
(
BillApply
).
FullName
;
apply
.
AddOnlyProperties
(
o
=>
o
.
BizType
);
apply
.
Status
=
(
int
)
InvoiceApplyStatus
.
ProcessAdoption
;
apply
.
AddOnlyProperties
(
o
=>
o
.
Status
);
conn
.
UpdateOnly
(
apply
);
var
_log
=
new
EntityLog
<
InvoiceApply
>();
_log
.
OwnerKvid
=
apply
.
Kvid
;
_log
.
Title
=
"账单借票"
;
_log
.
Type
=
"流转"
;
_log
.
Summary
=
$"提交了账单借票,审批将在OA执行"
;
conn
.
Insert
(
_log
);
rtns
.
Results
.
Add
(
apply
);
}
return
rtns
;
}
[
Ignore
]
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
}
public
class
RequestForm_InvoiceApply
...
...
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