Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
黄奎
mall.oytour.com
Commits
06e0b0cc
Commit
06e0b0cc
authored
Jun 09, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
eb10bb4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
13 deletions
+52
-13
FinanceModule.cs
Mall.WindowsService/Module/FinanceModule.cs
+51
-12
appsettings.json
Mall.WindowsService/appsettings.json
+1
-1
No files found.
Mall.WindowsService/Module/FinanceModule.cs
View file @
06e0b0cc
...
...
@@ -5,6 +5,7 @@ using Mall.Model.Extend.Finance;
using
Mall.Model.Extend.Product
;
using
Mall.Repository.Finance
;
using
Mall.Repository.Product
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -32,6 +33,7 @@ namespace Mall.WindowsService.Module
/// 订单详情
/// </summary>
private
static
RB_Goods_OrderDetailRepository
goodsOrderDetailRepository
=
new
RB_Goods_OrderDetailRepository
();
#
region
收入
/// <summary>
/// 订单收入单据
...
...
@@ -60,7 +62,7 @@ namespace Mall.WindowsService.Module
var
recordModel
=
financeRecordRepository
.
GetList
(
new
Model
.
Extend
.
Finance
.
RB_Finance_Record_Extend
{
TenantId
=
item
.
TenantId
,
MallBaseId
=
item
.
MallBaseId
}).
OrderByDescending
(
x
=>
x
.
CreateDate
).
FirstOrDefault
();
if
(
recordModel
==
null
)
//今天没生成单据
{
if
(
item
.
StartTime
.
Value
.
AddDays
(
item
.
IntervalDay
??
0
).
ToString
(
"yyyy-MM-dd"
).
Equals
(
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd
"
)))
//判断开始时间加上执行周期是否等于当前日期
if
(
Convert
.
ToDateTime
(
item
.
StartTime
.
Value
.
AddDays
(
item
.
IntervalDay
??
0
).
ToString
(
"yyyy-MM-dd 00:00:00"
))
<=
Convert
.
ToDateTime
(
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd 00:00:00
"
)))
//判断开始时间加上执行周期是否等于当前日期
{
startDate
=
item
.
StartTime
.
Value
;
addFinance
=
true
;
...
...
@@ -68,7 +70,7 @@ namespace Mall.WindowsService.Module
}
else
{
if
(
recordModel
.
CreateDate
.
Value
.
AddDays
(
item
.
IntervalDay
??
0
).
ToString
(
"yyyy-MM-dd"
).
Equals
(
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd
"
)))
//判断最近一次执行的时间加上执行周期是否等于当前日期
if
(
Convert
.
ToDateTime
(
recordModel
.
CreateDate
.
Value
.
AddDays
(
item
.
IntervalDay
??
0
).
ToString
(
"yyyy-MM-dd 00:00:00"
))
<=
Convert
.
ToDateTime
(
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd 00:00:00
"
)))
//判断最近一次执行的时间加上执行周期是否等于当前日期
{
startDate
=
recordModel
.
CreateDate
.
Value
;
addFinance
=
true
;
...
...
@@ -91,7 +93,7 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
record
.
Type
=
1
;
record
.
CreateDate
=
System
.
DateTime
.
Now
;
record
.
RecordDetailList
=
new
List
<
RB_Finance_RecordDetail
>();
foreach
(
var
orderGoodsItem
in
goodsDetailList
.
Take
(
2
)
)
foreach
(
var
orderGoodsItem
in
goodsDetailList
)
{
if
(
orderGoodsItem
.
Final_Price
>
0
)
...
...
@@ -100,6 +102,7 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
newOrderGoods
=
orderGoodsItem
;
newOrderGoods
.
FinanceType
=
1
;
result
.
Add
(
newOrderGoods
);
}
if
(
orderGoodsItem
.
FreightMoney
.
HasValue
&&
orderGoodsItem
.
FreightMoney
.
Value
>
0
)
{
...
...
@@ -108,6 +111,27 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
newOrderGoods
.
FinanceType
=
2
;
result
.
Add
(
newOrderGoods
);
}
RB_Finance_RecordDetail
financeRecordDetail
=
new
RB_Finance_RecordDetail
{
ID
=
0
,
RecordId
=
0
,
Type
=
record
.
Type
,
TenantId
=
record
.
TenantId
,
MallBaseId
=
record
.
MallBaseId
,
FinanceId
=
0
,
CreateDate
=
record
.
CreateDate
,
Name
=
orderGoodsItem
.
GoodsName
,
OrderId
=
orderGoodsItem
.
OrderId
??
0
,
OrderDetailId
=
orderGoodsItem
.
Id
,
GoodsPrice
=
((
orderGoodsItem
.
Final_Price
??
0
)
-
(
orderGoodsItem
.
FreightMoney
??
0
)),
FreightMoney
=
orderGoodsItem
.
FreightMoney
,
Unit_Price
=
orderGoodsItem
.
Unit_Price
,
Number
=
orderGoodsItem
.
Number
};
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
}
var
detailList
=
result
.
Select
(
x
=>
new
...
...
@@ -121,9 +145,10 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
var
financeObj
=
new
{
CreateBy
=
Config
.
NetworkDirector
,
IsPublic
=
item
.
IsPublic
,
item
.
IsPublic
,
BType
=
item
.
AccountType
,
AccountId
=
item
.
AccountId
,
WBMoney
=
result
.
Sum
(
x
=>
x
.
Final_Price
??
0
),
RB_Branch_Id
=
Config
.
RB_Branch_Id
,
RemitterName
=
item
.
RemitterName
,
TradeDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
...
...
@@ -137,17 +162,23 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
string
sign
=
EncryptionHelper
.
AesEncrypt
(
JsonHelper
.
Serialize
(
financeObj
),
Config
.
FinanceKey
);
var
resultInfo
=
new
{
msg
=
financeObj
,
MallBaseId
=
item
.
MallBaseId
,
TenantId
=
item
.
TenantId
,
EmpId
=
Config
.
NetworkDirector
,
sign
msg
=
sign
,
};
//byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(JsonHelper.Serialize(financeObj));
//EncryptionHelper.AESEncrypt(data, Config.FinanceKey, "12345678", System.Security.Cryptography.CipherMode.CBC,System.Security.Cryptography.PaddingMode.PKCS7);
string
apiResult
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpPost
(
Config
.
IncomeFinanceApi
,
JsonHelper
.
Serialize
(
resultInfo
),
""
);
JObject
parmsJob
=
JObject
.
Parse
(
apiResult
);
string
resultCode
=
parmsJob
.
GetStringValue
(
"resultCode"
);
int
frid
=
parmsJob
.
GetInt
(
"data"
,
0
);
if
(
resultCode
==
"1"
&&
frid
>
0
)
//新增记录
{
record
.
FinanceId
=
frid
;
int
recordId
=
financeRecordRepository
.
Insert
(
record
);
LogHelper
.
Write
(
"财务单据ID:"
+
recordId
+
"订单数量:"
+
record
.
RecordDetailList
.
Count
());
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
RecordId
=
recordId
);
record
.
RecordDetailList
.
ForEach
(
x
=>
x
.
FinanceId
=
frid
);
flag
=
financeRecordDetailRepository
.
InsertBatch
(
record
.
RecordDetailList
);
}
LogHelper
.
Write
(
apiResult
);
}
}
...
...
@@ -162,5 +193,13 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
return
flag
;
}
#
endregion
#
region
成本
#
endregion
}
}
Mall.WindowsService/appsettings.json
View file @
06e0b0cc
...
...
@@ -33,7 +33,7 @@
"RebornDMC"
:
"reborn_dmc"
,
"IncomeFinanceApi"
:
"http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallIn"
,
//
"FinanceKey"
:
"FinanceMallInsertToERPViitto2020"
,
"FinanceKey"
:
"FinanceMallInsertToERPVi"
,
"FinanceKey"
:
"FinanceMallInsertToERPVi
itto2020
"
,
"RedisSetting"
:
{
"RedisServer"
:
"192.168.2.214"
,
"RedisPort"
:
"6379"
,
...
...
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