Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
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
data-center-auto
Commits
f113fdd2
Commit
f113fdd2
authored
Mar 11, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
利润计算,记录计算过程
parent
358cd36f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
11 deletions
+82
-11
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+23
-11
dc_base_storage_capacity.cs
AutoTurnOver.Models/dc_base_storage_capacity.cs
+49
-0
dc_report_profit_analysis.cs
AutoTurnOver.Models/dc_report_profit_analysis.cs
+10
-0
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
f113fdd2
...
...
@@ -1227,6 +1227,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
new
transfer_profit_dto
{
field_name
=
"quantity_final_advise"
,
name
=
"实际建议周转数"
,
remarks
=
"历史值:历史跑出来的的周转数,预测值:预测建议数"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"quantity_final_advise_amount"
,
name
=
"实际建议周转金额"
,
remarks
=
"历史值:当天的历史采购金额,预测值:预测周转数*采购单价"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"turnover"
,
name
=
"实际周转数"
,
remarks
=
"(周转天数 * 日均销量)+ 安全库存 "
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"turnover_amount"
,
name
=
"实际周转金额"
,
remarks
=
"实际周转数 * 采购单价"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"freight_price"
,
name
=
"实际周转运费"
,
remarks
=
"周转数 * 实际运费单价"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"freight_unit_price"
,
name
=
"实际运费单价"
,
remarks
=
"移动平均数算法算出来的历史平均调拨费用"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
new
transfer_profit_dto
{
field_name
=
"quantity_final_advise_ocean"
,
name
=
"海运周转数(推荐海运)"
,
remarks
=
"(海运周转天数 * 日均销量)+ 安全库存"
,
days
=
new
List
<
transfer_profit_dto
.
day_dto
>()},
...
...
@@ -1299,10 +1300,10 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
}
var
etime
=
DateTime
.
Now
;
var
this_time
=
btime
.
Valu
e
;
var
this_time
=
etim
e
;
var
now
=
DateTime
.
Now
.
ToDayHome
();
var
index
=
-
23
;
while
(
this_time
.
ToDayHome
()
<=
e
time
.
ToDayHome
())
while
(
btime
.
Value
.
ToDayHome
()
<=
this_
time
.
ToDayHome
())
{
var
this_time_end
=
this_time
.
ToDayEnd
();
// 预测未来
...
...
@@ -1473,8 +1474,13 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
//实际周转金额
modalData
.
turnover_amount
=
modalData
.
turnover
*
modalData
.
unit_price
;
datas
.
FirstOrDefault
(
s
=>
s
.
name
==
"实际周转金额"
).
days
.
Add
(
new
transfer_profit_dto
.
day_dto
{
date
=
this_time
,
val
=
modalData
.
turnover_amount
,
formula
=
$" "
});
modalData
.
turnover_sales_ocean
=
result_ocean
.
turnover_sales
;
modalData
.
quantity_final_advise_ocean
=
(
int
)
Math
.
Round
(
result_ocean
.
turnover_sales
+
result_ocean
.
quantity_safe_inventory
);
datas
.
FirstOrDefault
(
s
=>
s
.
name
==
"海运周转数(推荐海运)"
).
days
.
Add
(
new
transfer_profit_dto
.
day_dto
...
...
@@ -1577,7 +1583,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
});
result_data
.
today_data
=
modalData
;
result_data
.
today_data
=
modalData
.
ToJson
().
ToObj
<
transfer_profit_modal_dto
>()
;
}
else
// 过去
{
...
...
@@ -1659,6 +1665,13 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
date
=
this_time
,
val
=
modalData
.
quantity_final_advise
});
modalData
.
turnover_amount
=
modalData
.
quantity_final_advise
*
modalData
.
unit_price
;
datas
.
FirstOrDefault
(
s
=>
s
.
name
==
"实际周转金额"
).
days
.
Add
(
new
transfer_profit_dto
.
day_dto
{
date
=
this_time
,
val
=
modalData
.
turnover_amount
,
formula
=
$" "
});
modalData
.
quantity_final_advise_amount
=
modalData
.
quantity_final_advise
*
modalData
.
unit_price
;
datas
.
FirstOrDefault
(
s
=>
s
.
name
==
"实际建议周转金额"
).
days
.
Add
(
new
transfer_profit_dto
.
day_dto
{
...
...
@@ -1792,9 +1805,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
}
modalData
.
freight_price_ocean_air_difference
=
modalData
.
freight_price_ocean
-
modalData
.
freight_price_air
;
datas
.
FirstOrDefault
(
s
=>
s
.
name
==
"海运-空运运费差值"
).
days
.
Add
(
new
transfer_profit_dto
.
day_dto
{
...
...
@@ -1822,7 +1832,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
index
++;
this_time
=
this_time
.
AddDays
(
1
);
this_time
=
this_time
.
AddDays
(
-
1
);
}
result_data
.
datas
=
datas
;
...
...
@@ -1883,8 +1893,10 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
// 查询利润数据
var
profit_data
=
TransferProfitList
(
bailun_sku
,
warehouse_code
,
DateTime
.
Now
).
today_data
;
dc_report_profit_analysis
data
=
profit_data
.
ToJson
().
ToObj
<
dc_report_profit_analysis
>();
var
formula_json
=
profit_data
.
ToJson
();
dc_report_profit_analysis
data
=
formula_json
.
ToObj
<
dc_report_profit_analysis
>();
data
.
bailun_sku
=
bailun_sku
;
data
.
formula_json
=
formula_json
;
data
.
warehouse_code
=
warehouse_code
;
data
.
warehouse_type
=
warehouse_data
.
hq_type
;
data
.
country
=
warehouse_data
.
area_name
;
...
...
@@ -1950,7 +1962,7 @@ from dc_base_oms_sku where bailun_sku=@bailun_sku and warehouse_code=@warehouse_
/// </summary>
public
static
void
SynchroCalculationProfitAnalysis
()
{
var
task_name
=
$"SynchroCalculationProfitAnalysis_v
4
"
;
var
task_name
=
$"SynchroCalculationProfitAnalysis_v
5
"
;
var
conn
=
MyMySqlConnection
.
_connection
;
;
// 查询最后一次成功抓取的记录
var
last_task_synchro_log
=
conn
.
QuerySingleOrDefault
<
task_synchro_log
>(
" select * from task_synchro_log where task_name=@task_name and status=1 order by end_time desc limit 1 "
,
new
{
task_name
=
task_name
});
...
...
AutoTurnOver.Models/dc_base_storage_capacity.cs
0 → 100644
View file @
f113fdd2
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models
{
/// <summary>
/// 库容
/// </summary>
public
class
dc_base_storage_capacity
{
public
int
id
{
get
;
set
;
}
public
string
bailun_sku
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
public
DateTime
create_date
{
get
;
set
;
}
public
decimal
stock
{
get
;
set
;
}
public
string
create_user
{
get
;
set
;
}
public
DateTime
update_date
{
get
;
set
;
}
public
string
bailun_sku_warehouse_code
{
get
;
set
;
}
/// <summary>
/// 版本号
/// </summary>
public
int
version
{
get
;
set
;
}
}
public
class
dc_base_storage_capacity_log
{
public
int
id
{
get
;
set
;
}
public
string
bailun_sku
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
public
DateTime
create_date
{
get
;
set
;
}
/// <summary>
/// 实际可用库存
/// </summary>
public
decimal
real_time_stock
{
get
;
set
;
}
public
string
create_user
{
get
;
set
;
}
public
decimal
quantity
{
get
;
set
;
}
public
int
type
{
get
;
set
;
}
public
int
bailun_sku_warehouse_code
{
get
;
set
;
}
}
public
enum
dc_base_storage_capacity_log_enum
{
入库
=
1
,
出库
=
2
,
导入
=
3
}
}
AutoTurnOver.Models/dc_report_profit_analysis.cs
View file @
f113fdd2
...
...
@@ -99,6 +99,11 @@ namespace AutoTurnOver.Models
/// </summary>
[
Description
(
@"实际周转数"
)]
public
decimal
turnover
{
get
;
set
;
}
/// <summary>
/// 实际周转金额
/// </summary>
[
Description
(
@"实际周转金额"
)]
public
decimal
turnover_amount
{
get
;
set
;
}
/// <summary>
/// 实际周转运费
...
...
@@ -281,5 +286,10 @@ namespace AutoTurnOver.Models
public
decimal
ocean_purchase_amount
{
get
;
set
;
}
public
DateTime
update_time
{
get
;
set
;}
/// <summary>
/// 计算过程
/// </summary>
public
string
formula_json
{
get
;
set
;}
}
}
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