Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
Njzj.Biz.Bocoms.Openapis.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
陶然
Njzj.Biz.Bocoms.Openapis.V4.5
Commits
68854abf
Commit
68854abf
authored
Sep 16, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
6180ebee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
WriteOffJob.cs
WriteOffJob.cs
+35
-8
No files found.
WriteOffJob.cs
View file @
68854abf
...
...
@@ -2,6 +2,7 @@
using
Kivii
;
using
Kivii.Finances.Entities
;
using
Kivii.Linq
;
using
Njzj.Finances.Bocoms.Extensions
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
...
...
@@ -68,16 +69,12 @@ namespace Njzj.Bocoms.Openapis
{
if
(!
preSettlements
.
Exists
(
o
=>
o
.
Kvid
==
kvid
))
notMatchBizKvids
.
Add
(
kvid
);
}
if
(!
notMatchBizKvids
.
IsNullOrEmpty
())
{
var
updateWriteOffs
=
connE
.
From
<
WriteOffResultNotify
>();
updateWriteOffs
=
updateWriteOffs
.
Update
(
o
=>
o
.
Status
);
updateWriteOffs
=
updateWriteOffs
.
Where
(
o
=>
Sql
.
In
(
o
.
BizKvid
,
notMatchBizKvids
));
connE
.
UpdateOnly
(
new
WriteOffResultNotify
{
Status
=
int
.
MaxValue
},
updateWriteOffs
);
}
writeOffs
.
RemoveAll
(
o
=>
Sql
.
In
(
o
.
BizKvid
,
notMatchBizKvids
));
var
matchWriteOffs
=
new
List
<
WriteOffResultNotify
>();
var
breakWriteOffs
=
new
List
<
WriteOffResultNotify
>();
//错误消息队列 要移除的
var
payments
=
new
List
<
Payment
>();
List
<
string
>
serialNumbers
=
new
List
<
string
>();
foreach
(
var
item
in
writeOffs
)
{
if
(
item
.
biz_content
.
bill_wo_state
!=
"03"
)
...
...
@@ -88,6 +85,12 @@ namespace Njzj.Bocoms.Openapis
bool
matched
=
false
;
foreach
(
var
pay
in
item
.
biz_content
.
pay_detail_list
)
{
if
(
pay
.
jnl_write_off_amt
.
IsNullOrEmpty
()
||
pay
.
jnl_write_off_amt
.
ToLower
()
==
"null"
)
{
if
(!
notMatchBizKvids
.
Exists
(
o
=>
o
==
item
.
BizKvid
))
notMatchBizKvids
.
Add
(
item
.
BizKvid
);
matched
=
false
;
break
;
}
var
split
=
pay
.
vch_no
.
Split
(
'-'
);
if
(
split
.
Length
!=
3
)
{
...
...
@@ -102,6 +105,7 @@ namespace Njzj.Bocoms.Openapis
TaskContext
.
Message
=
$"Error:10003,[
{
item
.
BillId
}
]vch_no截取的流水号是空!"
;
continue
;
}
serialNumbers
.
Add
(
serialNumber
);
var
payment
=
connF
.
Single
<
Payment
>(
o
=>
o
.
SerialNumber
==
serialNumber
&&
o
.
OffsetKvid
==
Guid
.
Empty
&&
o
.
Type
==
PaymentType
.
Bank
);
if
(
payment
==
null
)
{
...
...
@@ -111,13 +115,25 @@ namespace Njzj.Bocoms.Openapis
payments
.
Add
(
payment
);
matched
=
true
;
}
if
(
matched
)
matchWriteOffs
.
Add
(
item
);
if
(
matched
)
{
matchWriteOffs
.
Add
(
item
);
}
}
if
(!
notMatchBizKvids
.
IsNullOrEmpty
())
{
var
updateWriteOffs
=
connE
.
From
<
WriteOffResultNotify
>();
updateWriteOffs
=
updateWriteOffs
.
Update
(
o
=>
o
.
Status
);
updateWriteOffs
=
updateWriteOffs
.
Where
(
o
=>
Sql
.
In
(
o
.
BizKvid
,
notMatchBizKvids
));
connE
.
UpdateOnly
(
new
WriteOffResultNotify
{
Status
=
int
.
MaxValue
},
updateWriteOffs
);
}
if
(
matchWriteOffs
.
IsNullOrEmpty
())
{
TaskContext
.
Message
=
$"
{
writeOffs
.
Count
}
条待处理通知,尚未匹配到流水信息!"
;
return
true
;
}
#
endregion
#
region
合并数据库连接
,
并启用事务
IDbTransaction
tranE
=
null
,
tranF
=
null
;
...
...
@@ -240,6 +256,17 @@ namespace Njzj.Bocoms.Openapis
tranF
?.
Rollback
();
throw
ex
;
}
finally
{
if
(!
serialNumbers
.
IsNullOrEmpty
())
{
var
th
=
KiviiContext
.
NewThread
(()
=>
{
serialNumbers
.
AutoBizMark
(
50
,
"智慧记账自动标记"
);
});
th
.
Start
();
}
}
return
true
;
}
...
...
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