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
a97046ef
Commit
a97046ef
authored
Dec 26, 2022
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出程序新增自动导出
parent
9b2a7f7c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
69 deletions
+118
-69
ReportInvestReturnServices.cs
AutoTurnOver.Services/ReportInvestReturnServices.cs
+74
-0
TaskDownloadServices.cs
AutoTurnOver.Services/TaskDownloadServices.cs
+19
-0
ReportInvestReturnController.cs
AutoTurnOver/Controllers/ReportInvestReturnController.cs
+14
-69
ReportFinanceBackgrounService.cs
ResetOutofstock/ReportFinanceBackgrounService.cs
+11
-0
No files found.
AutoTurnOver.Services/ReportInvestReturnServices.cs
View file @
a97046ef
using
AutoTurnOver.Models
;
using
AutoTurnOver.Models
;
using
AutoTurnOver.Utility
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Text
;
using
System.Text
;
namespace
AutoTurnOver.Services
namespace
AutoTurnOver.Services
...
@@ -19,5 +21,77 @@ namespace AutoTurnOver.Services
...
@@ -19,5 +21,77 @@ namespace AutoTurnOver.Services
{
{
return
DB
.
report_invest_return_dao
.
AnaList
(
m
,
offset
,
limit
,
sort
,
order
,
ref
total
);
return
DB
.
report_invest_return_dao
.
AnaList
(
m
,
offset
,
limit
,
sort
,
order
,
ref
total
);
}
}
public
string
AnaExport
(
out
int
total
)
{
total
=
0
;
var
service
=
new
Services
.
ReportInvestReturnService
();
var
list
=
service
.
AnaList
(
new
Condition_ConfigPromotion
{
},
0
,
int
.
MaxValue
,
null
,
null
,
ref
total
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"sku"
,
"所属项目"
,
"标题"
,
"采购单价 ¥"
,
"仓库编码"
,
"仓库名称"
,
"仓库类型"
,
"总库存(在库+在途)"
,
"总金额 (在库+在途)"
,
"日均销量"
,
"过去30天销量"
,
"过去7天销量"
,
"出单天数 (总)"
,
"出单天数 (过去30天)"
,
"首次出单日期"
,
"最后出单日期"
,
"30天利润 CNY"
,
"可售天数"
,
"采购在途数量"
,
"采购在途金额"
,
"头程在途"
,
"头程在途金额"
,
"在库库存"
,
"在库金额 CNY"
,
"预估运费 CNY"
,
"单位头程费"
,
"预测30天销量"
,
"预测30天销售额 CNY"
,
"最近30天的平均销售单价 CNY"
,
"广告费率"
,
"最近30天广告费 USD"
,
"最近30天的销售额 USD"
,
"最近30天的平台费 USD"
,
"平台费率"
,
"最近30天的退款金额 USD"
,
"退款金额占比"
,
"最后更新时间"
,
"库存管理得分"
,
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"sku"
]
=
itemData
.
sku
;
row
[
"所属项目"
]
=
itemData
.
project
;
row
[
"最近30天广告费 USD"
]
=
itemData
.
adfee_day_30
;
row
[
"标题"
]
=
itemData
.
sku_name
;
row
[
"采购单价 ¥"
]
=
itemData
.
price
;
row
[
"仓库编码"
]
=
itemData
.
warehouse_code
;
row
[
"仓库名称"
]
=
itemData
.
warehouse_name
;
row
[
"仓库类型"
]
=
itemData
.
warehouse_type
;
row
[
"总库存(在库+在途)"
]
=
itemData
.
stock
;
row
[
"总金额 (在库+在途)"
]
=
itemData
.
stock_amount
;
row
[
"日均销量"
]
=
itemData
.
sales_day_average
;
row
[
"过去30天销量"
]
=
itemData
.
sales_day_30
;
row
[
"过去7天销量"
]
=
itemData
.
sales_day_7
;
row
[
"出单天数 (总)"
]
=
itemData
.
order_days
;
row
[
"出单天数 (过去30天)"
]
=
itemData
.
consume_days_30
;
row
[
"首次出单日期"
]
=
itemData
.
first_order_date
==
null
?
""
:
itemData
.
first_order_date
.
Value
.
ToString
(
"`yyyy-MM-dd"
);
row
[
"最后出单日期"
]
=
itemData
.
last_order_date
==
null
?
""
:
itemData
.
last_order_date
.
Value
.
ToString
(
"`yyyy-MM-dd"
);
row
[
"30天利润 CNY"
]
=
itemData
.
profit_30_forecast
;
row
[
"可售天数"
]
=
itemData
.
vendibility_days
;
row
[
"采购在途数量"
]
=
itemData
.
quantity_purchase
;
row
[
"采购在途金额"
]
=
itemData
.
quantity_purchase_amount
;
row
[
"头程在途"
]
=
itemData
.
quantity_transfer
;
row
[
"头程在途金额"
]
=
itemData
.
quantity_transfer_amount
;
row
[
"在库库存"
]
=
itemData
.
library_stock
;
row
[
"在库金额 CNY"
]
=
itemData
.
library_stock_amount
;
row
[
"预估运费 CNY"
]
=
itemData
.
estimated_freight
;
row
[
"单位头程费"
]
=
itemData
.
freight_unit_price
;
row
[
"预测30天销量"
]
=
itemData
.
sales_day_30_forecast
;
row
[
"预测30天销售额 CNY"
]
=
itemData
.
gmv_day_30_forecast_cny
;
row
[
"最近30天的平均销售单价 CNY"
]
=
itemData
.
gmv_day30_avg_unit_price_cny
;
row
[
"广告费率"
]
=
itemData
.
adfee_rate
.
ToString
(
"P"
);
row
[
"平台费率"
]
=
itemData
.
platform_fee_rate
.
ToString
(
"P"
);
row
[
"退款金额占比"
]
=
itemData
.
refund_rate
.
ToString
(
"P"
);
row
[
"最近30天的销售额 USD"
]
=
itemData
.
amount_total_day_30
;
row
[
"最近30天的平台费 USD"
]
=
itemData
.
platform_fee_day_30
;
row
[
"最近30天的退款金额 USD"
]
=
itemData
.
refund_amount_day_30
;
row
[
"最后更新时间"
]
=
itemData
.
gmt_update_time
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
row
[
"库存管理得分"
]
=
itemData
.
stock_score
;
table
.
Rows
.
Add
(
row
);
}
var
fileName
=
AppContext
.
BaseDirectory
+
@"Result\RealtimeStock\投资回报分析.csv"
;
CsvFileHelper
.
SaveCSV
(
table
,
fileName
);
return
fileName
;
}
}
}
}
}
AutoTurnOver.Services/TaskDownloadServices.cs
View file @
a97046ef
...
@@ -79,6 +79,9 @@ namespace AutoTurnOver.Services
...
@@ -79,6 +79,9 @@ namespace AutoTurnOver.Services
break
;
break
;
case
"利润最大化分析"
:
case
"利润最大化分析"
:
item
.
result_file_url
=
await
DownloadProfitAnalysis
(
item
.
parameter
,
item
);
item
.
result_file_url
=
await
DownloadProfitAnalysis
(
item
.
parameter
,
item
);
break
;
case
"投资回报分析"
:
item
.
result_file_url
=
await
ReportInvestReturnAnalysis
(
item
.
parameter
,
item
);
break
;
break
;
default
:
throw
new
Exception
(
"无法识别的任务"
);
default
:
throw
new
Exception
(
"无法识别的任务"
);
}
}
...
@@ -164,6 +167,22 @@ namespace AutoTurnOver.Services
...
@@ -164,6 +167,22 @@ namespace AutoTurnOver.Services
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
return
fileData
;
}
}
/// <summary>
/// 利润最大化分析
/// </summary>
public
async
Task
<
string
>
ReportInvestReturnAnalysis
(
string
par_json
,
dc_task_download
download_data
)
{
ana_search_dto
search_data
=
par_json
.
ToObject
<
ana_search_dto
>();
Console
.
WriteLine
(
"DownloadStock - 开始生成文件"
);
var
rows
=
0
;
var
memory
=
new
ReportInvestReturnService
().
AnaExport
(
out
rows
);
download_data
.
rows
=
rows
;
Console
.
WriteLine
(
"DownloadStock - 开始生成上传文件"
);
var
fileData
=
await
AutoTurnOver
.
Utility
.
QiNiuCloudHelper
.
UploadSectioningAsync
(
memory
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
/// <summary>
/// <summary>
/// 下载改在线记录
/// 下载改在线记录
...
...
AutoTurnOver/Controllers/ReportInvestReturnController.cs
View file @
a97046ef
...
@@ -5,6 +5,7 @@ using System.IO;
...
@@ -5,6 +5,7 @@ using System.IO;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
AutoTurnOver.Common
;
using
AutoTurnOver.Common
;
using
AutoTurnOver.DB
;
using
AutoTurnOver.Models
;
using
AutoTurnOver.Models
;
using
AutoTurnOver.Utility
;
using
AutoTurnOver.Utility
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
...
@@ -33,80 +34,23 @@ namespace AutoTurnOver.Controllers
...
@@ -33,80 +34,23 @@ namespace AutoTurnOver.Controllers
});
});
}
}
public
File
Result
AnaExport
()
public
Json
Result
AnaExport
()
{
{
int
total
=
0
;
try
var
service
=
new
Services
.
ReportInvestReturnService
();
var
list
=
service
.
AnaList
(
new
Condition_ConfigPromotion
{
},
0
,
int
.
MaxValue
,
null
,
null
,
ref
total
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"sku"
,
"所属项目"
,
"标题"
,
"采购单价 ¥"
,
"仓库编码"
,
"仓库名称"
,
"仓库类型"
,
"总库存(在库+在途)"
,
"总金额 (在库+在途)"
,
"日均销量"
,
"过去30天销量"
,
"过去7天销量"
,
"出单天数 (总)"
,
"出单天数 (过去30天)"
,
"首次出单日期"
,
"最后出单日期"
,
"30天利润 CNY"
,
"可售天数"
,
"采购在途数量"
,
"采购在途金额"
,
"头程在途"
,
"头程在途金额"
,
"在库库存"
,
"在库金额 CNY"
,
"预估运费 CNY"
,
"单位头程费"
,
"预测30天销量"
,
"预测30天销售额 CNY"
,
"最近30天的平均销售单价 CNY"
,
"广告费率"
,
"最近30天广告费 USD"
,
"最近30天的销售额 USD"
,
"最近30天的平台费 USD"
,
"平台费率"
,
"最近30天的退款金额 USD"
,
"退款金额占比"
,
"最后更新时间"
,
"库存管理得分"
,
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
{
DataRow
row
=
table
.
NewRow
();
var
user
=
AutoUtility
.
GetUser
();
dc_task_download_dao
.
PushData
<
dc_base_stock_search_dto
>(
new
dc_task_download
row
[
"sku"
]
=
itemData
.
sku
;
{
row
[
"所属项目"
]
=
itemData
.
project
;
parameter
=
new
{
}.
ToJson
(),
row
[
"最近30天广告费 USD"
]
=
itemData
.
adfee_day_30
;
task_name
=
"投资回报分析"
row
[
"标题"
]
=
itemData
.
sku_name
;
},
user
);
row
[
"采购单价 ¥"
]
=
itemData
.
price
;
return
new
JsonResult
(
new
{
success
=
true
});
row
[
"仓库编码"
]
=
itemData
.
warehouse_code
;
row
[
"仓库名称"
]
=
itemData
.
warehouse_name
;
row
[
"仓库类型"
]
=
itemData
.
warehouse_type
;
row
[
"总库存(在库+在途)"
]
=
itemData
.
stock
;
row
[
"总金额 (在库+在途)"
]
=
itemData
.
stock_amount
;
row
[
"日均销量"
]
=
itemData
.
sales_day_average
;
row
[
"过去30天销量"
]
=
itemData
.
sales_day_30
;
row
[
"过去7天销量"
]
=
itemData
.
sales_day_7
;
row
[
"出单天数 (总)"
]
=
itemData
.
order_days
;
row
[
"出单天数 (过去30天)"
]
=
itemData
.
consume_days_30
;
row
[
"首次出单日期"
]
=
itemData
.
first_order_date
==
null
?
""
:
itemData
.
first_order_date
.
Value
.
ToString
(
"`yyyy-MM-dd"
);
row
[
"最后出单日期"
]
=
itemData
.
last_order_date
==
null
?
""
:
itemData
.
last_order_date
.
Value
.
ToString
(
"`yyyy-MM-dd"
);
row
[
"30天利润 CNY"
]
=
itemData
.
profit_30_forecast
;
row
[
"可售天数"
]
=
itemData
.
vendibility_days
;
row
[
"采购在途数量"
]
=
itemData
.
quantity_purchase
;
row
[
"采购在途金额"
]
=
itemData
.
quantity_purchase_amount
;
row
[
"头程在途"
]
=
itemData
.
quantity_transfer
;
row
[
"头程在途金额"
]
=
itemData
.
quantity_transfer_amount
;
row
[
"在库库存"
]
=
itemData
.
library_stock
;
row
[
"在库金额 CNY"
]
=
itemData
.
library_stock_amount
;
row
[
"预估运费 CNY"
]
=
itemData
.
estimated_freight
;
row
[
"单位头程费"
]
=
itemData
.
freight_unit_price
;
row
[
"预测30天销量"
]
=
itemData
.
sales_day_30_forecast
;
row
[
"预测30天销售额 CNY"
]
=
itemData
.
gmv_day_30_forecast_cny
;
row
[
"最近30天的平均销售单价 CNY"
]
=
itemData
.
gmv_day30_avg_unit_price_cny
;
row
[
"广告费率"
]
=
itemData
.
adfee_rate
.
ToString
(
"P"
);
row
[
"平台费率"
]
=
itemData
.
platform_fee_rate
.
ToString
(
"P"
);
row
[
"退款金额占比"
]
=
itemData
.
refund_rate
.
ToString
(
"P"
);
row
[
"最近30天的销售额 USD"
]
=
itemData
.
amount_total_day_30
;
row
[
"最近30天的平台费 USD"
]
=
itemData
.
platform_fee_day_30
;
row
[
"最近30天的退款金额 USD"
]
=
itemData
.
refund_amount_day_30
;
row
[
"最后更新时间"
]
=
itemData
.
gmt_update_time
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
row
[
"库存管理得分"
]
=
itemData
.
stock_score
;
table
.
Rows
.
Add
(
row
);
}
}
catch
(
Exception
ex
)
var
fileName
=
AppContext
.
BaseDirectory
+
@"Result\RealtimeStock\投资回报分析.csv"
;
DataTableHelper
.
SaveCSV
(
table
,
fileName
);
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
{
stream
.
CopyTo
(
memory
);
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
}
);
}
}
memory
.
Position
=
0
;
return
File
(
memory
,
"text/csv"
,
"投资回报分析.csv"
);
}
}
}
}
}
}
\ No newline at end of file
ResetOutofstock/ReportFinanceBackgrounService.cs
View file @
a97046ef
using
AutoTurnOver.DB
;
using
AutoTurnOver.DB
;
using
AutoTurnOver.Models
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Hosting
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -70,6 +71,16 @@ namespace ResetOutofstock
...
@@ -70,6 +71,16 @@ namespace ResetOutofstock
//dc_report_finance_dao.CalculationAccounts(DateTime.Now.AddDays(-90));
//dc_report_finance_dao.CalculationAccounts(DateTime.Now.AddDays(-90));
Console
.
WriteLine
(
$"结束 财报应首付账款,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束 财报应首付账款,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
}
if
(
now
.
Hour
==
23
&&
now
.
Minute
==
50
)
{
Console
.
WriteLine
(
$"开始 备份投资回报分析表 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_task_download_dao
.
PushData
<
dc_base_stock_search_dto
>(
new
dc_task_download
{
parameter
=
"{}"
,
task_name
=
"投资回报分析"
},
new
UserData
{
UserName
=
"sys-bak"
});
Console
.
WriteLine
(
$"结束 备份投资回报分析表,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
}
}
...
...
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