Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
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
bltdc
DataCenter_Core2.1_20190520
Commits
999b2f6b
Commit
999b2f6b
authored
Aug 25, 2021
by
zhouminghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4953d4ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
FinanceService.cs
Bailun.DC.Services/WebApiService/FinanceService.cs
+26
-20
Services.cs
Bailun.DC.SyncMonthSalesProfitNew/Services.cs
+1
-1
No files found.
Bailun.DC.Services/WebApiService/FinanceService.cs
View file @
999b2f6b
...
...
@@ -1210,69 +1210,71 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
+
oldData
.
cost_meirongmj
+
oldData
.
cost_fuzhuang
+
oldData
.
cost_other
,
2
);
//平台费用
//oldData.fee_ad = Math.Round(SyncMonthProfitFeePlatformFeeSummary(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "广告及宣传费" }), 2);
//oldData.fee_ad = Math.
Abs(Math.
Round(SyncMonthProfitFeePlatformFeeSummary(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "广告及宣传费" }), 2)
) * (-1)
;
Console
.
WriteLine
(
"开始统计平台费用"
);
oldData
.
fee_ad
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"广告及宣传费"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_fba
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"佣金及平台费-亚马逊FBA"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nofba
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"佣金及平台费-亚马逊非FBA"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_ebay
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"佣金及平台费-Ebay"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_ohtre
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"佣金及平台费-其他平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
//总平台费
oldData
.
fee_platform
=
Math
.
Round
(
oldData
.
fee_ad
+
oldData
.
fee_fba
+
oldData
.
fee_nofba
+
oldData
.
fee_ebay
+
oldData
.
fee_ohtre
,
2
);
//物流仓储费用
Console
.
WriteLine
(
"开始统计物流仓储费用"
);
oldData
.
fee_logistics_first
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"头程运输-平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nologistics_first
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"头程运输-非平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_logistics_tail
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"尾程物流费-平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nologistics_tail
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"尾程物流费-非平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_logistics_direct
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"直邮物流费-平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nologistics_direct
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"直邮物流费-非平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_storage
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"仓储费-平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nostorage
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"仓储费-非平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
//总物流仓储费
oldData
.
fee_logistics_storage
=
Math
.
Round
(
oldData
.
fee_logistics_first
+
oldData
.
fee_nologistics_first
+
oldData
.
fee_logistics_tail
+
oldData
.
fee_nologistics_tail
+
oldData
.
fee_logistics_direct
+
oldData
.
fee_nologistics_direct
+
oldData
.
fee_storage
+
oldData
.
fee_nostorage
,
2
);
Console
.
WriteLine
(
"开始统计加:营业外收入"
);
//加:营业外收入
oldData
.
incoming_non_operating
=
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"营业外收入"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
);
//减:营业外支出
oldData
.
pay_non_operating
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"营业外支出"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
.
HasValue
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
//销售费用-税金
//oldData.fee_sales_taxes = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "税金" })
// .Where(m => m.AmountValRmb
!= null
).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
// .Where(m => m.AmountValRmb
.HasValue
).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//其中:歌戈儿收入
var
operating
=
GetMonthProfitFeeManagementCostDetail
(
time
,
"其中:歌戈儿收入"
).
Data
;
oldData
.
incoming_gogirl
=
Math
.
Abs
(
Math
.
Round
(
operating
.
Count
==
0
?
0
:
operating
.
Last
().
AmountRmb
.
Value
,
2
));
...
...
@@ -1281,6 +1283,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
var
among_other
=
GetMonthProfitFeeManagementCostDetail
(
time
,
"其中:其他收入"
).
Data
;
oldData
.
among_other_income
=
Math
.
Abs
(
Math
.
Round
(
among_other
.
Count
==
0
?
0
:
among_other
.
Last
().
AmountRmb
.
Value
,
2
));
//管理成本
Console
.
WriteLine
(
"开始统计管理成本"
);
var
bl_xg
=
GetMonthProfitFeeManagementCostDetail
(
time
,
"香港百伦科技有限公司"
).
Data
;
var
bl_gz
=
GetMonthProfitFeeManagementCostDetail
(
time
,
"广州百伦供应链科技有限公司"
).
Data
;
var
meijia
=
GetMonthProfitFeeManagementCostDetail
(
time
,
"广州歌戈儿生活科技有限公司"
).
Data
;
...
...
@@ -1310,6 +1313,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
//oldData.profit_sales = Math.Round(GetMonthSalesProfitDetail(new MonthProfitOrderDetailPageInputDto { Month = time }, false)
//.Data.Data.Sum(x => x.sale_profit), 2);
Console
.
WriteLine
(
"开始统计销售费用数据"
);
//销售费用合计》平台费用+物流仓储费+税金
oldData
.
fee_sales_count
=
Math
.
Round
(
Math
.
Abs
(
oldData
.
fee_platform
)
+
Math
.
Abs
(
oldData
.
fee_logistics_storage
)
+
Math
.
Abs
(
oldData
.
fee_sales_taxes
),
2
);
//销售利润》总销售额-总成本-销售费用合计
...
...
@@ -1327,7 +1331,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
//财务费用
oldData
.
fee_finance
=
Math
.
Abs
(
oldData
.
fee_finance
*
(-
1
));
//保存
Console
.
WriteLine
(
"统计完成"
);
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
ConnectionState
.
Closed
)
...
...
@@ -1437,10 +1441,12 @@ AND platform_type = '{item.platform_type}' AND financecategoryname = '{item.fina
{
item
.
id
=
exist
;
cn
.
Update
(
item
);
Console
.
WriteLine
(
$"
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
触发了更新操作"
);
}
else
{
cn
.
Insert
(
item
);
Console
.
WriteLine
(
$"
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
触发了新增操作"
);
}
}
}
...
...
Bailun.DC.SyncMonthSalesProfitNew/Services.cs
View file @
999b2f6b
...
...
@@ -29,7 +29,7 @@ namespace Bailun.DC.SyncMonthSalesProfitNew
try
{
var
now
=
DateTime
.
Now
;
if
(
now
.
Hour
==
1
3
)
if
(
now
.
Hour
==
1
4
)
{
Console
.
WriteLine
(
"同步月利润销售报告开始启动 "
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
var
result
=
Init
();
...
...
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