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
2761d73f
Commit
2761d73f
authored
Jan 12, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增fba实时库存查询
parent
b5192314
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
244 additions
and
2 deletions
+244
-2
daily.cs
AutoTurnOver.DB/daily.cs
+0
-0
dc_base_stock.cs
AutoTurnOver.Models/dc_base_stock.cs
+38
-0
DailyServices.cs
AutoTurnOver.Services/DailyServices.cs
+103
-0
TaskDownloadServices.cs
AutoTurnOver.Services/TaskDownloadServices.cs
+17
-0
RedisHelper.cs
AutoTurnOver.Utility/RedisHelper.cs
+2
-2
ApiController.cs
AutoTurnOver/Controllers/ApiController.cs
+11
-0
DailyController.cs
AutoTurnOver/Controllers/DailyController.cs
+73
-0
No files found.
AutoTurnOver.DB/daily.cs
View file @
2761d73f
This diff is collapsed.
Click to expand it.
AutoTurnOver.Models/dc_base_stock.cs
View file @
2761d73f
...
@@ -384,6 +384,44 @@ namespace AutoTurnOver.Models
...
@@ -384,6 +384,44 @@ namespace AutoTurnOver.Models
}
}
}
}
public
class
dc_base_stock_fba_dto
{
public
string
bailun_account
{
get
;
set
;
}
public
string
web_site
{
get
;
set
;
}
public
string
asin
{
get
;
set
;
}
public
string
bailun_sku
{
get
;
set
;
}
public
string
product_type
{
get
;
set
;
}
public
string
group_name
{
get
;
set
;
}
public
string
sale_name
{
get
;
set
;
}
public
string
sku_title_cn
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
public
string
warehouse_name
{
get
;
set
;
}
public
string
area_name
{
get
;
set
;
}
public
decimal
amount_sales_usd_1
{
get
;
set
;
}
public
decimal
bailun_sku_quantity_ordered_1
{
get
;
set
;
}
public
decimal
amount_sales_usd_7
{
get
;
set
;
}
public
decimal
bailun_sku_quantity_ordered_7
{
get
;
set
;
}
public
decimal
amount_sales_usd_30
{
get
;
set
;
}
public
decimal
bailun_sku_quantity_ordered_30
{
get
;
set
;
}
public
int
monitor_status
{
get
;
set
;
}
public
string
buyer_name
{
get
;
set
;
}
public
decimal
unit_price
{
get
;
set
;
}
public
decimal
weight
{
get
;
set
;
}
public
decimal
quantity_purchase
{
get
;
set
;
}
public
decimal
quantity_transfer
{
get
;
set
;
}
public
decimal
quantity_transfer_order
{
get
;
set
;
}
public
decimal
quantity_transfer_temp_schedule
{
get
;
set
;
}
public
decimal
quantity_transfer_temporary_storage
{
get
;
set
;
}
public
decimal
sum_mid
{
get
;
set
;
}
public
decimal
usable_stock_01
{
get
;
set
;
}
public
decimal
usable_stock_02
{
get
;
set
;
}
public
decimal
usable_stock
{
get
;
set
;
}
public
decimal
sum_mid_amount
{
get
;
set
;
}
public
decimal
usable_stock_amount
{
get
;
set
;
}
public
decimal
sum_amount
{
get
;
set
;
}
}
public
class
dc_base_stock_search_dto
public
class
dc_base_stock_search_dto
{
{
[
Description
(
"监控状态"
)]
[
Description
(
"监控状态"
)]
...
...
AutoTurnOver.Services/DailyServices.cs
View file @
2761d73f
...
@@ -49,6 +49,16 @@ namespace AutoTurnOver.Services
...
@@ -49,6 +49,16 @@ namespace AutoTurnOver.Services
return
DB
.
daily
.
RealtimeList
(
search_data
,
categoryModels
,
ref
total
);
return
DB
.
daily
.
RealtimeList
(
search_data
,
categoryModels
,
ref
total
);
}
}
public
List
<
dc_base_stock_fba_dto
>
RealtimeFbaList
(
dc_base_stock_search_dto
search_data
,
ref
int
total
)
{
List
<
bailun_category_new_dto
>
categoryModels
=
null
;
if
(!
string
.
IsNullOrWhiteSpace
(
search_data
.
categoryIds
))
{
categoryModels
=
ApiServices
.
GetNewClientNodesByIds
(
search_data
.
categoryIds
.
Split
(
','
).
Select
(
s
=>
int
.
Parse
(
s
)).
ToList
());
}
return
DB
.
daily
.
RealtimeFbaList
(
search_data
,
categoryModels
,
ref
total
);
}
public
List
<
dc_auto_shortage_push_route_dto
>
ShortagePushList
(
string
platform
,
string
bailun_sku
,
int
offset
,
int
limit
,
ref
int
total
,
DateTime
?
start_date
,
DateTime
?
end_date
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
)
public
List
<
dc_auto_shortage_push_route_dto
>
ShortagePushList
(
string
platform
,
string
bailun_sku
,
int
offset
,
int
limit
,
ref
int
total
,
DateTime
?
start_date
,
DateTime
?
end_date
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
)
{
{
return
DB
.
daily
.
ShortagePushList
(
platform
,
bailun_sku
,
offset
,
limit
,
ref
total
,
start_date
,
end_date
,
warehousecode
,
warehousetype
,
warehousearea
);
return
DB
.
daily
.
ShortagePushList
(
platform
,
bailun_sku
,
offset
,
limit
,
ref
total
,
start_date
,
end_date
,
warehousecode
,
warehousetype
,
warehousearea
);
...
@@ -284,6 +294,99 @@ namespace AutoTurnOver.Services
...
@@ -284,6 +294,99 @@ namespace AutoTurnOver.Services
}
}
public
string
FbaExport
(
dc_base_stock_search_dto
search_data
)
{
try
{
export_count
++;
var
services
=
new
DailyServices
();
var
fileName
=
AppContext
.
BaseDirectory
+
$@"Fba实时库存-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
int
page
=
1
;
int
rows
=
50000
;
if
(
export_count
==
1
)
{
rows
=
250000
;
}
while
(
true
)
{
int
total
=
0
;
search_data
.
offset
=
(
page
-
1
)*
rows
;
search_data
.
limit
=
rows
;
var
list
=
services
.
RealtimeFbaList
(
search_data
,
ref
total
);
if
(
list
==
null
||
list
.
Count
<=
0
)
break
;
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"账号"
,
"站点"
,
"asin"
,
"仓库sku"
,
"产品类型"
,
"分组名称"
,
"销售名称"
,
"产品名称"
,
"昨日review分数"
,
"昨日reivew个数"
,
"仓库编码"
,
"仓库名称"
,
"国家"
,
"昨日销量"
,
"昨日销售额USD"
,
"近7天销量"
,
"近7天销售额USD"
,
"近30天销量"
,
"近30天销售额USD"
,
"监控状态"
,
"采购员"
,
"采购价"
,
"重量"
,
"实时采购在途"
,
"实时调拨在途(总)"
,
"实时调拨在途(调拨单)"
,
"实时调拨在途(采购临时)"
,
"实时调拨在途(暂存)"
,
"总在途数"
,
"广州01仓可用库存"
,
"广州02仓可用库存"
,
"FBA 可售库存"
,
"在途金额"
,
"可配库存金额"
,
"在途+可配总库存"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"账号"
]
=
itemData
.
bailun_account
;
row
[
"站点"
]
=
itemData
.
web_site
;
row
[
"asin"
]
=
itemData
.
asin
;
row
[
"仓库sku"
]
=
itemData
.
bailun_sku
;
row
[
"产品类型"
]
=
itemData
.
product_type
;
row
[
"分组名称"
]
=
itemData
.
group_name
;
row
[
"销售名称"
]
=
itemData
.
sale_name
;
row
[
"产品名称"
]
=
itemData
.
sku_title_cn
;
row
[
"仓库编码"
]
=
itemData
.
warehouse_code
;
row
[
"仓库名称"
]
=
itemData
.
warehouse_name
;
row
[
"国家"
]
=
itemData
.
area_name
;
row
[
"昨日销量"
]
=
itemData
.
bailun_sku_quantity_ordered_1
;
row
[
"昨日销售额USD"
]
=
itemData
.
amount_sales_usd_1
;
row
[
"近7天销量"
]
=
itemData
.
bailun_sku_quantity_ordered_7
;
row
[
"近7天销售额USD"
]
=
itemData
.
amount_sales_usd_7
;
row
[
"近30天销量"
]
=
itemData
.
bailun_sku_quantity_ordered_30
;
row
[
"近30天销售额USD"
]
=
itemData
.
amount_sales_usd_30
;
row
[
"监控状态"
]
=
itemData
.
monitor_status
==
0
?
"监控中"
:
"停止监控"
;
row
[
"采购员"
]
=
itemData
.
buyer_name
;
row
[
"采购价"
]
=
itemData
.
unit_price
;
row
[
"重量"
]
=
itemData
.
weight
;
row
[
"实时采购在途"
]
=
itemData
.
quantity_purchase
;
row
[
"实时调拨在途(总)"
]
=
itemData
.
quantity_transfer
;
row
[
"实时调拨在途(调拨单)"
]
=
itemData
.
quantity_transfer_order
;
row
[
"实时调拨在途(采购临时)"
]
=
itemData
.
quantity_transfer_temp_schedule
;
row
[
"实时调拨在途(暂存)"
]
=
itemData
.
quantity_transfer_temporary_storage
;
row
[
"总在途数"
]
=
itemData
.
sum_mid
;
row
[
"广州01仓可用库存"
]
=
itemData
.
usable_stock_01
;
row
[
"广州02仓可用库存"
]
=
itemData
.
usable_stock_02
;
row
[
"FBA 可售库存"
]
=
itemData
.
usable_stock
;
row
[
"在途金额"
]
=
itemData
.
sum_mid
;
row
[
"可配库存金额"
]
=
itemData
.
sum_mid_amount
;
row
[
"在途+可配总库存"
]
=
itemData
.
sum_amount
;
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
,
page
==
1
);
page
++;
}
return
fileName
;
}
catch
(
Exception
)
{
export_count
--;
throw
;
}
}
public
async
void
GenerateData
()
public
async
void
GenerateData
()
{
{
try
try
...
...
AutoTurnOver.Services/TaskDownloadServices.cs
View file @
2761d73f
...
@@ -47,6 +47,9 @@ namespace AutoTurnOver.Services
...
@@ -47,6 +47,9 @@ namespace AutoTurnOver.Services
case
"商品销售情况统计"
:
case
"商品销售情况统计"
:
item
.
result_file_url
=
await
DownloadGoods
(
item
.
parameter
,
item
);
item
.
result_file_url
=
await
DownloadGoods
(
item
.
parameter
,
item
);
break
;
break
;
case
"Fba实时库存"
:
item
.
result_file_url
=
await
DownloadFbaStock
(
item
.
parameter
,
item
);
break
;
default
:
throw
new
Exception
(
"无法识别的任务"
);
default
:
throw
new
Exception
(
"无法识别的任务"
);
}
}
item
.
end_date
=
DateTime
.
Now
;
item
.
end_date
=
DateTime
.
Now
;
...
@@ -110,6 +113,20 @@ namespace AutoTurnOver.Services
...
@@ -110,6 +113,20 @@ namespace AutoTurnOver.Services
return
fileData
;
return
fileData
;
}
}
/// <summary>
/// <summary>
/// 下载库存
/// </summary>
public
async
Task
<
string
>
DownloadFbaStock
(
string
par_json
,
dc_task_download
download_data
)
{
dc_base_stock_search_dto
search_data
=
par_json
.
ToObject
<
dc_base_stock_search_dto
>();
Console
.
WriteLine
(
"DownloadStock - 开始生成文件"
);
var
memory
=
new
DailyServices
().
FbaExport
(
search_data
);
Console
.
WriteLine
(
"DownloadStock - 开始生成上传文件"
);
var
fileData
=
await
AutoTurnOver
.
Utility
.
QiNiuCloudHelper
.
UploadSectioningAsync
(
memory
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
/// <summary>
/// 下载周转表
/// 下载周转表
/// </summary>
/// </summary>
public
async
Task
<
string
>
DownloadAuto
(
string
par_json
,
dc_task_download
download_data
)
public
async
Task
<
string
>
DownloadAuto
(
string
par_json
,
dc_task_download
download_data
)
...
...
AutoTurnOver.Utility/RedisHelper.cs
View file @
2761d73f
...
@@ -35,7 +35,7 @@ namespace AutoTurnOver.Utility
...
@@ -35,7 +35,7 @@ namespace AutoTurnOver.Utility
}
}
else
else
{
{
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToString
(),
new
TimeSpan
(
0
,
minutes
,
0
,
0
));
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToString
(),
new
TimeSpan
(
0
,
0
,
minutes
,
0
));
}
}
}
}
...
@@ -49,7 +49,7 @@ namespace AutoTurnOver.Utility
...
@@ -49,7 +49,7 @@ namespace AutoTurnOver.Utility
if
(
minutes
<=
0
)
if
(
minutes
<=
0
)
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToJson
(),
(
DateTime
.
Parse
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd 23:59:59"
))
-
DateTime
.
Now
));
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToJson
(),
(
DateTime
.
Parse
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd 23:59:59"
))
-
DateTime
.
Now
));
else
else
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToJson
(),
new
TimeSpan
(
0
,
minutes
,
0
,
0
));
RedisClient
.
redisClient
.
SetStringKey
(
name
,
cache
.
ToJson
(),
new
TimeSpan
(
0
,
0
,
minutes
,
0
));
}
}
else
else
return
default
(
T
);
return
default
(
T
);
...
...
AutoTurnOver/Controllers/ApiController.cs
View file @
2761d73f
...
@@ -125,6 +125,17 @@ namespace AutoTurnOver.Controllers
...
@@ -125,6 +125,17 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
}
}
[
HttpGet
(
"RealtimeFbaListSumFooter"
)]
public
JsonResult
RealtimeFbaListSumFooter
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
{
var
services
=
new
DailyServices
();
var
total
=
0
;
search_data
.
isSum
=
true
;
var
list
=
services
.
RealtimeFbaList
(
search_data
,
ref
total
)
;
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_fba_dto
()
:
list
[
0
]);
}
public
class
GetSkus_dto
public
class
GetSkus_dto
{
{
...
...
AutoTurnOver/Controllers/DailyController.cs
View file @
2761d73f
...
@@ -87,6 +87,40 @@ namespace AutoTurnOver.Controllers
...
@@ -87,6 +87,40 @@ namespace AutoTurnOver.Controllers
});
});
}
}
}
/// <summary>
/// 实时库存
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
[
UseAction
]
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【实时数据】->【FBA实时库存】->【搜索】页面"
,
0
)]
public
JsonResult
RealtimeFbaList
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
{
try
{
var
services
=
new
DailyServices
();
var
total
=
0
;
var
list
=
services
.
RealtimeFbaList
(
search_data
,
ref
total
);
return
new
JsonResult
(
new
{
rows
=
list
,
total
=
total
,
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
message
=
ex
.
Message
,
stack_trace
=
ex
.
StackTrace
});
}
}
}
public
JsonResult
RealtimeListSumFooter
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
public
JsonResult
RealtimeListSumFooter
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
...
@@ -99,6 +133,16 @@ namespace AutoTurnOver.Controllers
...
@@ -99,6 +133,16 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
}
}
public
JsonResult
RealtimeFbaListSumFooter
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
{
var
services
=
new
DailyServices
();
var
total
=
0
;
search_data
.
isSum
=
true
;
var
list
=
services
.
RealtimeFbaList
(
search_data
,
ref
total
);
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_fba_dto
()
:
list
[
0
]);
}
/// <summary>
/// <summary>
...
@@ -241,6 +285,35 @@ namespace AutoTurnOver.Controllers
...
@@ -241,6 +285,35 @@ namespace AutoTurnOver.Controllers
}
}
/// <summary>
/// <summary>
/// 导出Fba实时库存
/// </summary>
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public
JsonResult
ExportFbaRealtime
([
FromQuery
]
dc_base_stock_search_dto
search_data
)
{
try
{
var
user
=
AutoUtility
.
GetUser
();
search_data
.
limit
=
int
.
MaxValue
;
dc_task_download_dao
.
PushData
<
dc_base_stock_search_dto
>(
new
dc_task_download
{
parameter
=
search_data
.
ToJson
(),
task_name
=
"Fba实时库存"
},
user
);
return
new
JsonResult
(
new
{
success
=
true
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
});
}
//int total = 0;
//var memory = new DailyServices().Export(user, monitor_status, searchType, key_words, warehousecode, supplier_name, offset, limit, ref total, warehousetype, warehousearea, has_tort: has_tort, buyer_name: buyer_name, start_date: start_date, end_date: end_date, f_start_date: f_start_date, f_end_date: f_end_date);
//return File(memory, "text/csv", $"{user.UserAccount}实时库存.csv");
}
/// <summary>
/// 缺货订单
/// 缺货订单
/// </summary>
/// </summary>
/// <param name="sku"></param>
/// <param name="sku"></param>
...
...
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