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
d08eb7ff
Commit
d08eb7ff
authored
Aug 04, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
58c639f7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
329 additions
and
31 deletions
+329
-31
ApiUtility.cs
AutoTurnOver.DB/ApiUtility.cs
+12
-12
report_cash_flow_forecast_dao.cs
AutoTurnOver.DB/report_cash_flow_forecast_dao.cs
+0
-0
LmsShipLogisticsDto.cs
AutoTurnOver.Models/ApiDto/LmsShipLogisticsDto.cs
+5
-0
api_logistic_query_input_dto.cs
AutoTurnOver.Models/ApiDto/api_logistic_query_input_dto.cs
+8
-3
dc_report_cash_flow_forecast_task.cs
...rnOver.Models/Report/dc_report_cash_flow_forecast_task.cs
+91
-2
AverageTargetBackgrounService.cs
...r.Purchase.AverageTarget/AverageTargetBackgrounService.cs
+21
-0
Program.cs
AutoTurnOver.Purchase.AverageTarget/Program.cs
+1
-1
appsettings.dev.json
AutoTurnOver.Purchase.AverageTarget/appsettings.dev.json
+2
-1
appsettings.json
AutoTurnOver.Purchase.AverageTarget/appsettings.json
+2
-1
appsettings.prod.json
AutoTurnOver.Purchase.AverageTarget/appsettings.prod.json
+3
-1
ForecastTaskServices.cs
AutoTurnOver.Services/ForecastTaskServices.cs
+78
-0
CommonController.cs
AutoTurnOver/Controllers/CommonController.cs
+13
-10
ForecastTaskController.cs
AutoTurnOver/Controllers/ForecastTaskController.cs
+93
-0
No files found.
AutoTurnOver.DB/ApiUtility.cs
View file @
d08eb7ff
...
...
@@ -114,28 +114,28 @@ namespace AutoTurnOver.DB
try
{
var
parameter_str
=
$"?LineCodes=
{
data
.
LineCodes
}
"
;
parameter_str
+=
$"endCountries=
{
data
.
endCountries
}
"
;
parameter_str
+=
$"Long=
{
data
.
Long
}
"
;
parameter_str
+=
$"width=
{
data
.
width
}
"
;
parameter_str
+=
$"high=
{
data
.
high
}
"
;
parameter_str
+=
$"weightKg=
{
data
.
weightKg
}
"
;
parameter_str
+=
$"startPoint=
{
data
.
startPoint
}
"
;
parameter_str
+=
$"
warehouseNo=
{
data
.
warehouseNo
}
"
;
parameter_str
+=
$"
&
endCountries=
{
data
.
endCountries
}
"
;
parameter_str
+=
$"
&
Long=
{
data
.
Long
}
"
;
parameter_str
+=
$"
&
width=
{
data
.
width
}
"
;
parameter_str
+=
$"
&
high=
{
data
.
high
}
"
;
parameter_str
+=
$"
&
weightKg=
{
data
.
weightKg
}
"
;
parameter_str
+=
$"
&
startPoint=
{
data
.
startPoint
}
"
;
//parameter_str += $"&
warehouseNo={data.warehouseNo}";
//parameter_str += $"orderPriceCNY={data.orderPriceCNY}";
parameter_str
+=
$"platform=
{
data
.
platform
}
"
;
parameter_str
+=
$"Site=
{
data
.
Site
}
"
;
parameter_str
+=
$"
&
platform=
{
data
.
platform
}
"
;
parameter_str
+=
$"
&
Site=
{
data
.
Site
}
"
;
//查询采购建议明细
string
url
=
ConfigHelper
.
GetValue
(
"ApiLogisticsGetFilterLogisticsAssignLine"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
GET
,
parameter_str
,
timeout
:
1000
*
60
*
60
*
24
);
string
resultStr
=
HttpHelper
.
Request
(
url
+
parameter_str
,
RequestType
.
GET
,
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
api_logistic_query_result_dto
>();
if
(
result
==
null
||
result
.
successLines
==
null
||
result
.
successLines
.
Count
<=
0
)
if
(
result
==
null
||
result
.
Data
==
null
||
result
.
Data
.
successLines
==
null
||
result
.
Data
.
successLines
.
Count
<=
0
)
{
throw
new
Exception
(
"未查询到物流费用"
);
}
else
{
return
result
.
successLines
[
0
];
return
result
.
Data
.
successLines
[
0
];
}
}
catch
(
Exception
ex
)
...
...
AutoTurnOver.DB/report_cash_flow_forecast_dao.cs
View file @
d08eb7ff
This diff is collapsed.
Click to expand it.
AutoTurnOver.Models/ApiDto/LmsShipLogisticsDto.cs
View file @
d08eb7ff
...
...
@@ -13,6 +13,11 @@ namespace AutoTurnOver.Models.ApiDto
public
string
Line_Name
{
get
;
set
;
}
public
string
Company_Code
{
get
;
set
;
}
public
string
Company_Name
{
get
;
set
;
}
/// <summary>
/// 1-直邮 2-海外 3-头程
/// </summary>
public
string
Start_Point
{
get
;
set
;
}
}
public
class
LmsResultDto
<
T
>
...
...
AutoTurnOver.Models/ApiDto/api_logistic_query_input_dto.cs
View file @
d08eb7ff
...
...
@@ -131,15 +131,20 @@ namespace AutoTurnOver.Models.ApiDto
{
public
bool
Success
{
get
;
set
;
}
public
string
ErrorMessage
{
get
;
set
;
}
public
string
Data
{
get
;
set
;
}
public
data_dto
Data
{
get
;
set
;
}
public
List
<
line_dto
>
successLines
{
get
;
set
;
}
public
class
data_dto
{
public
List
<
line_dto
>
successLines
{
get
;
set
;
}
public
List
<
line_dto
>
failLines
{
get
;
set
;
}
}
public
class
line_dto
{
public
string
Line_Code
{
get
;
set
;
}
public
string
LineName
{
get
;
set
;
}
public
decimal
FootFee
{
get
;
set
;
}
public
decimal
TotalPrices
{
get
;
set
;
}
public
decimal
HeadFee
{
get
;
set
;
}
public
string
ErrorMsg
{
get
;
set
;
}
...
...
AutoTurnOver.Models/Report/dc_report_cash_flow_forecast_task.cs
View file @
d08eb7ff
using
System
;
using
AutoTurnOver.Models.Base
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -39,12 +40,14 @@ namespace AutoTurnOver.Models.Report
/// 头程物流
/// </summary>
public
string
transfer_logistics_code
{
get
;
set
;
}
public
string
transfer_logistics_name
{
get
;
set
;
}
/// <summary>
/// 尾程物流
/// </summary>
public
string
tail_logistics_code
{
get
;
set
;
}
public
string
tail_logistics_name
{
get
;
set
;
}
/// <summary>
///
尾程物流
///
退款率
/// </summary>
public
decimal
refund_ratio
{
get
;
set
;
}
/// <summary>
...
...
@@ -74,8 +77,80 @@ namespace AutoTurnOver.Models.Report
public
decimal
@long
{
get
;
set
;
}
public
decimal
weight_kg
{
get
;
set
;
}
public
decimal
width
{
get
;
set
;
}
public
DateTime
update_time
{
get
;
set
;
}
}
public
class
dc_report_cash_flow_forecast_task_info_dto
{
public
List
<
report_cash_flow_view_dto
>
views
{
get
;
set
;
}
public
List
<
turnover_dto
>
turnovers
{
get
;
set
;
}
public
class
turnover_dto
{
public
string
item_title
{
get
;
set
;
}
public
List
<
int
>
types
{
get
;
set
;
}
public
List
<
date_dto
>
dates
{
get
;
set
;
}
public
class
date_dto
{
public
string
date_title
{
get
;
set
;
}
public
DateTime
btime
{
get
;
set
;
}
public
DateTime
etime
{
get
;
set
;
}
public
decimal
val
{
get
;
set
;
}
}
}
}
public
class
report_cash_flow_view_forecast_task_search_dto
{
public
int
task_id
{
get
;
set
;
}
}
public
class
dc_report_cash_flow_forecast_task_dto
:
dc_report_cash_flow_forecast_task
{
public
string
warehouse_name
{
get
;
set
;
}
public
string
status_str
{
get
{
return
((
dc_report_cash_flow_forecast_task_status
)
status
).
ToString
();
}
}
}
public
class
dc_report_cash_flow_forecast_task_date_dto
{
public
string
btime
{
get
;
set
;
}
public
string
etime
{
get
;
set
;
}
}
public
class
dc_report_cash_flow_forecast_task_input_dto
:
dc_report_cash_flow_forecast_task_dto
{
public
string
btime
{
get
;
set
;
}
public
string
etime
{
get
;
set
;
}
public
List
<
sale_dto
>
sales
{
get
;
set
;
}
public
class
sale_dto
{
public
DateTime
date
{
get
;
set
;
}
public
decimal
val
{
get
;
set
;
}
}
}
public
enum
dc_report_cash_flow_forecast_task_status
{
已提交
=
0
,
计算中
=
1
,
计算完成
=
2
,
计算异常
=
3
}
public
class
dc_report_cash_flow_forecast_task_search_dto
{
public
string
bailun_sku
{
get
;
set
;
}
}
public
class
dc_report_cash_flow_forecast_task_sale
...
...
@@ -145,11 +220,25 @@ namespace AutoTurnOver.Models.Report
public
string
occur_time_year_month_no
{
get
;
set
;
}
}
public
class
dc_report_cash_flow_forecast_turnover
{
public
int
id
{
get
;
set
;
}
public
DateTime
date
{
get
;
set
;
}
/// <summary>
/// 预测数值
/// </summary>
public
decimal
val
{
get
;
set
;
}
public
int
type
{
get
;
set
;
}
}
/// <summary>
/// 虚拟周转模型,用来虚拟下单
/// </summary>
public
class
invented_turnover_model
{
public
int
id
{
get
;
set
;
}
public
int
task_id
{
get
;
set
;
}
public
DateTime
date
{
get
;
set
;
}
public
string
date_str
{
get
{
return
date
.
ToString
(
"yyyy-MM-dd"
);
}
}
...
...
AutoTurnOver.Purchase.AverageTarget/AverageTargetBackgrounService.cs
View file @
d08eb7ff
...
...
@@ -16,6 +16,27 @@ namespace AutoTurnOver.Purchase.AverageTarget
protected
override
Task
ExecuteAsync
(
CancellationToken
stoppingToken
)
{
_timer
=
new
Timer
(
DoWork
,
null
,
TimeSpan
.
Zero
,
TimeSpan
.
FromMinutes
(
1
));
Task
.
Factory
.
StartNew
(()
=>
{
while
(
true
)
{
try
{
Console
.
WriteLine
(
$"开始 计算预测现金流,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
report_cash_flow_forecast_dao
.
Calculation
();
Console
.
WriteLine
(
$"结束 计算预测现金流,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
}
Thread
.
Sleep
(
10
*
1000
);
}
});
return
Task
.
CompletedTask
;
}
...
...
AutoTurnOver.Purchase.AverageTarget/Program.cs
View file @
d08eb7ff
...
...
@@ -23,7 +23,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
Console
.
WriteLine
(
"采购平均值计算任务启动..."
);
// 创建采购计划
//Console.WriteLine($"开始同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
daily
.
SynchroPPSSkuStatus
();
//Console.WriteLine($"结束同步sku刊登状态,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
...
...
AutoTurnOver.Purchase.AverageTarget/appsettings.dev.json
View file @
d08eb7ff
...
...
@@ -3,5 +3,6 @@
"Default"
:
"server=gz-cdb-kp7s5i79.sql.tencentcdb.com;port=61691;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"PPSSkuStatus"
:
"http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus"
,
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
,
"Lms_GetLogistics"
:
"http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
AutoTurnOver.Purchase.AverageTarget/appsettings.json
View file @
d08eb7ff
...
...
@@ -3,5 +3,6 @@
"Default"
:
"server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"PPSSkuStatus"
:
"http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus"
,
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
,
"Lms_GetLogistics"
:
"http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
AutoTurnOver.Purchase.AverageTarget/appsettings.prod.json
View file @
d08eb7ff
...
...
@@ -3,5 +3,6 @@
"Default"
:
"server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;"
},
"PPSSkuStatus"
:
"http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus"
,
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
"ApiLogisticsGetFilterLogisticsAssignLine"
:
"http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine"
,
"Lms_GetLogistics"
:
"http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
}
\ No newline at end of file
AutoTurnOver.Services/ForecastTaskServices.cs
0 → 100644
View file @
d08eb7ff
using
AutoTurnOver.Models
;
using
AutoTurnOver.Models.Report
;
using
System
;
using
System.Collections.Generic
;
using
System.Dynamic
;
using
System.Text
;
namespace
AutoTurnOver.Services
{
public
class
ForecastTaskServices
{
#
region
配置页面
public
List
<
dc_report_cash_flow_forecast_task_dto
>
Page
(
dc_report_cash_flow_forecast_task_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
)
{
return
DB
.
report_cash_flow_forecast_dao
.
Page
(
m
,
offset
,
limit
,
ref
total
);
}
public
void
Save
(
dc_report_cash_flow_forecast_task_input_dto
m
)
{
DB
.
report_cash_flow_forecast_dao
.
Save
(
m
);
}
public
dc_report_cash_flow_forecast_task
GetById
(
int
id
)
{
return
DB
.
report_cash_flow_forecast_dao
.
GetById
(
id
);
}
#
endregion
public
List
<
dynamic
>
GetInfo
(
report_cash_flow_view_forecast_task_search_dto
search
)
{
var
order_list
=
DB
.
report_cash_flow_forecast_dao
.
GetInfo
(
search
).
views
;
List
<
dynamic
>
datas
=
new
List
<
dynamic
>();
foreach
(
var
item
in
order_list
)
{
dynamic
o
=
new
ExpandoObject
();
o
.
date_type
=
string
.
Join
(
","
,
item
.
date_type
);
o
.
date_type_str
=
item
.
date_type_str
;
o
.
remarks
=
item
.
remarks
;
foreach
(
var
dat_item
in
item
.
dates
)
{
var
dic
=
(
IDictionary
<
string
,
object
>)
o
;
dic
[
"occur_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
occur_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
if
(
item
.
date_type
.
Contains
((
int
)
dc_report_cash_flow_log_data_type_enum
.
销售数量
)
//|| item.date_type==(int)dc_report_cash_flow_log_data_type_enum.利润
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.退款
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.平台费用
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放销售成本
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放头程费用
)
{
}
else
{
dic
[
"pay_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
pay_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
}
}
datas
.
Add
(
o
);
}
return
datas
;
}
public
dc_report_cash_flow_forecast_task_date_dto
GetDate
(
int
id
)
{
return
DB
.
report_cash_flow_forecast_dao
.
GetDate
(
id
);
}
}
}
AutoTurnOver/Controllers/CommonController.cs
View file @
d08eb7ff
...
...
@@ -31,10 +31,10 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpGet
]
public
JsonResult
ListWareHouse
(
string
type
,
int
?
areaId
)
public
JsonResult
ListWareHouse
(
string
type
,
int
?
areaId
)
{
var
list
=
new
CommonServices
().
ListWareHouse
(
type
,
areaId
);
return
new
JsonResult
(
list
);
}
...
...
@@ -84,7 +84,7 @@ namespace AutoTurnOver.Controllers
var
datas
=
ApiServices
.
GetCategoryList
();
return
new
JsonResult
(
datas
);
}
public
JsonResult
GetProductTypeList
()
{
var
datas
=
daily
.
GetProductTypeList
();
...
...
@@ -126,7 +126,7 @@ namespace AutoTurnOver.Controllers
{
throw
;
}
}
public
JsonResult
ShipLogisticsList
(
string
name
)
...
...
@@ -137,7 +137,8 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
.
Select
(
p
=>
new
{
id
=
p
.
Line_Code
,
text
=
p
.
Line_Code
+
" - "
+
p
.
Line_Name
text
=
p
.
Line_Code
+
" - "
+
p
.
Line_Name
,
type
=
p
.
Start_Point
}));
}
catch
(
Exception
ex
)
...
...
@@ -175,7 +176,7 @@ namespace AutoTurnOver.Controllers
var
datas
=
ApiServices
.
PlatformtypeWebsiteList
(
platform_type
);
return
new
JsonResult
(
datas
);
}
public
JsonResult
BrandList
()
{
var
datas
=
new
CommonServices
().
BrandList
();
...
...
@@ -200,7 +201,8 @@ namespace AutoTurnOver.Controllers
{
try
{
var
datas
=
ApiServices
.
GetCategoryAll
().
Select
(
s
=>
new
{
var
datas
=
ApiServices
.
GetCategoryAll
().
Select
(
s
=>
new
{
id
=
s
.
C_ID
,
pId
=
s
.
C_PARENTID
,
name
=
s
.
C_CNAME
,
...
...
@@ -220,14 +222,15 @@ namespace AutoTurnOver.Controllers
success
=
false
});
}
}
public
JsonResult
GetNewCategoryAll
()
{
try
{
var
datas
=
ApiServices
.
GetNewCategoryAll
().
Select
(
s
=>
new
{
var
datas
=
ApiServices
.
GetNewCategoryAll
().
Select
(
s
=>
new
{
id
=
s
.
id
,
pId
=
s
.
parentId
,
name
=
s
.
name
,
...
...
AutoTurnOver/Controllers/ForecastTaskController.cs
0 → 100644
View file @
d08eb7ff
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
AutoTurnOver.Models.Report
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
namespace
AutoTurnOver.Controllers
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiController
]
public
class
ForecastTaskController
:
ControllerBase
{
#
region
配置页面
[
HttpGet
]
public
JsonResult
Page
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
bailun_sku
)
{
var
m
=
new
dc_report_cash_flow_forecast_task_search_dto
{
bailun_sku
=
bailun_sku
};
var
total
=
0
;
var
service
=
new
Services
.
ForecastTaskServices
();
var
list
=
service
.
Page
(
m
,
offset
,
limit
,
ref
total
);
return
new
JsonResult
(
new
{
rows
=
list
,
total
=
total
,
});
}
[
HttpPost
]
public
JsonResult
Save
([
FromBody
]
dc_report_cash_flow_forecast_task_input_dto
m
)
{
try
{
new
Services
.
ForecastTaskServices
().
Save
(
m
);
return
new
JsonResult
(
new
{
success
=
true
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
,
stack_trace
=
ex
.
StackTrace
});
}
}
[
HttpGet
]
public
JsonResult
GetById
(
int
id
)
{
var
m
=
new
Services
.
ForecastTaskServices
().
GetById
(
id
);
return
new
JsonResult
(
m
);
}
#
endregion
[
HttpGet
]
public
JsonResult
GetInfo
(
int
id
)
{
var
list
=
new
Services
.
ForecastTaskServices
().
GetInfo
(
new
report_cash_flow_view_forecast_task_search_dto
{
task_id
=
id
});
return
new
JsonResult
(
new
{
rows
=
list
,
total
=
0
,
});
}
[
HttpGet
]
public
JsonResult
GetDate
(
int
id
)
{
var
m
=
new
Services
.
ForecastTaskServices
().
GetDate
(
id
);
return
new
JsonResult
(
m
);
}
}
}
\ No newline at end of file
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