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
2bac45e2
Commit
2bac45e2
authored
Jan 16, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增退款汇总报表
parent
b07eca62
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
195 additions
and
5 deletions
+195
-5
dc_aims_transfer_warehouse_dao.cs
AutoTurnOver.DB/dc_aims_transfer_warehouse_dao.cs
+2
-2
purchase_advise.cs
AutoTurnOver.DB/purchase_advise.cs
+61
-1
dc_aims_return_goods.cs
AutoTurnOver.Models/dc_aims_return_goods.cs
+23
-0
PurchaseAdviseServices.cs
AutoTurnOver.Services/PurchaseAdviseServices.cs
+56
-0
TaskDownloadServices.cs
AutoTurnOver.Services/TaskDownloadServices.cs
+17
-0
PurchaseAdviseController.cs
AutoTurnOver/Controllers/PurchaseAdviseController.cs
+36
-2
No files found.
AutoTurnOver.DB/dc_aims_transfer_warehouse_dao.cs
View file @
2bac45e2
...
...
@@ -40,8 +40,8 @@ where 1=1 ";
}
if
(
search_data
.
start_date
!=
null
)
{
sql
+=
" and t1.`date`>=@btime "
;
countSql
+=
" and t1.`date`>=@btime "
;
sql
+=
" and t1.`
create_
date`>=@btime "
;
countSql
+=
" and t1.`
create_
date`>=@btime "
;
parameters
.
Add
(
"btime"
,
search_data
.
start_date
);
}
if
(
search_data
.
end_date
!=
null
)
...
...
AutoTurnOver.DB/purchase_advise.cs
View file @
2bac45e2
...
...
@@ -1894,6 +1894,66 @@ where t1.warehouse_code=@warehousecode and t1.bailun_sku=@sku and t2.create_time
_connection
.
Delete
<
dc_auto_purchase_advise_detailed
>(
id
);
}
/// <summary>
/// 退货汇总
/// </summary>
/// <param name="search_data"></param>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <param name="total"></param>
/// <returns></returns>
public
static
List
<
dc_aims_return_goods_dto
>
ReturnGoodsList
(
dc_aims_return_goods_search_dto
search_data
,
int
offset
,
int
limit
,
ref
int
total
)
{
var
sql
=
@"select t1.*
from dc_aims_return_goods as t1
left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code
where 1=1 "
;
var
countSql
=
" select count(1) from dc_aims_return_goods as t1 left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code where 1=1 "
;
DynamicParameters
parameters
=
new
DynamicParameters
();
if
(!
string
.
IsNullOrWhiteSpace
(
search_data
.
warehousecode
))
{
sql
+=
" and t1.warehouse_code=@warehouse_code "
;
countSql
+=
" and t1.warehouse_code=@warehouse_code "
;
parameters
.
Add
(
"warehouse_code"
,
search_data
.
warehousecode
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
search_data
.
warehousetype
))
{
sql
+=
" and t3.hq_type = @hq_type "
;
countSql
+=
" and t3.hq_type = @hq_type "
;
parameters
.
Add
(
"hq_type"
,
search_data
.
warehousetype
);
}
if
(
search_data
.
warehousearea
>
0
)
{
sql
+=
" and t3.area_id = @area_id "
;
countSql
+=
" and t3.area_id = @area_id "
;
parameters
.
Add
(
"area_id"
,
search_data
.
warehousearea
);
}
if
(
search_data
.
start_date
!=
null
)
{
sql
+=
" and t1.`date`>=@btime "
;
countSql
+=
" and t1.`date`>=@btime "
;
parameters
.
Add
(
"btime"
,
search_data
.
start_date
);
}
if
(
search_data
.
end_date
!=
null
)
{
sql
+=
" and t1.`date`<=@etime "
;
countSql
+=
" and t1.`date`<=@etime "
;
parameters
.
Add
(
"etime"
,
search_data
.
end_date
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
search_data
.
bailun_sku
))
{
sql
+=
" and t1.bailun_sku in @bailun_sku "
;
countSql
+=
" and t1.bailun_sku in @bailun_sku "
;
parameters
.
Add
(
"bailun_sku"
,
search_data
.
bailun_sku
.
Split
(
','
));
}
sql
+=
" order by t1.id desc "
;
total
=
_connection
.
QueryFirst
<
int
>(
countSql
,
parameters
,
commandTimeout
:
0
);
sql
+=
" limit "
+
offset
+
","
+
limit
;
var
obj
=
_connection
.
Query
<
dc_aims_return_goods_dto
>(
sql
,
parameters
,
buffered
:
false
,
commandTimeout
:
0
);
return
obj
.
AsList
();
}
}
}
AutoTurnOver.Models/dc_aims_return_goods.cs
View file @
2bac45e2
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Text
;
namespace
AutoTurnOver.Models
...
...
@@ -29,4 +30,26 @@ namespace AutoTurnOver.Models
public
string
return_addrs
{
get
;
set
;
}
public
decimal
confirm_return_count
{
get
;
set
;
}
}
public
class
dc_aims_return_goods_dto
:
dc_aims_return_goods
{
}
public
class
dc_aims_return_goods_search_dto
{
[
Description
(
"sku"
)]
public
string
bailun_sku
{
get
;
set
;
}
[
Description
(
"开始时间"
)]
public
DateTime
?
start_date
{
get
;
set
;
}
[
Description
(
"结束时间"
)]
public
DateTime
?
end_date
{
get
;
set
;
}
[
Description
(
"仓库编码"
)]
public
string
warehousecode
{
get
;
set
;
}
[
Description
(
"仓库类型"
)]
public
string
warehousetype
{
get
;
set
;
}
[
Description
(
"仓库国家"
)]
public
int
?
warehousearea
{
get
;
set
;
}
}
}
AutoTurnOver.Services/PurchaseAdviseServices.cs
View file @
2bac45e2
...
...
@@ -587,5 +587,61 @@ namespace AutoTurnOver.Services
var
count
=
MyMySqlConnection
.
_connection_read_only
.
QuerySingleOrDefault
<
int
>(
"select count(1) from dc_auto_turnover where gmt_modified>=@time "
,
new
{
time
=
time
});
ApiServices
.
QiYeJiQiRenMsPush
(
new
QiYeJiQiRenMsDto
{
msgtype
=
"text"
,
text
=
new
QiYeJiQiRenMsDto
.
text_dto
{
content
=
$" 骆宾, 当前已更新的周转数
{
count
}
"
}
});
}
public
List
<
dc_aims_return_goods_dto
>
ReturnGoodsList
(
dc_aims_return_goods_search_dto
search_data
,
int
offset
,
int
limit
,
ref
int
total
)
{
return
DB
.
purchase_advise
.
ReturnGoodsList
(
search_data
,
offset
,
limit
,
ref
total
);
}
public
string
ExportReturnGoods
(
dc_aims_return_goods_search_dto
searchData
)
{
try
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"退货汇总-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
int
total
=
0
;
var
list
=
ReturnGoodsList
(
searchData
,
0
,
int
.
MaxValue
,
ref
total
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"规则"
,
"仓库"
,
"sku"
,
"库存"
,
"采购员"
,
"供应商"
,
"采购价"
,
"采购单号"
,
"采购数量"
,
"淘宝单号"
,
"最后签收时间"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"规则"
]
=
itemData
.
rule_title
;
row
[
"仓库"
]
=
itemData
.
warehouse_name
;
row
[
"sku"
]
=
itemData
.
bailun_sku
;
row
[
"库存"
]
=
itemData
.
stock
;
row
[
"采购员"
]
=
itemData
.
buy_name
;
row
[
"供应商"
]
=
itemData
.
suppliers_name
;
row
[
"采购价"
]
=
itemData
.
unit_price
;
row
[
"采购单号"
]
=
itemData
.
purchase_id
;
row
[
"采购数量"
]
=
itemData
.
purchase_count
;
row
[
"淘宝单号"
]
=
itemData
.
order_1688_no
;
row
[
"最后签收时间"
]
=
itemData
.
sign_date
;
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
);
return
fileName
;
//var memory = new MemoryStream();
//using (var stream = new FileStream(fileName, FileMode.Open))
//{
// stream.CopyTo(memory);
//}
//memory.Position = 0;
//return memory;
}
catch
(
Exception
)
{
throw
;
}
}
}
}
AutoTurnOver.Services/TaskDownloadServices.cs
View file @
2bac45e2
...
...
@@ -56,6 +56,9 @@ namespace AutoTurnOver.Services
case
"采购建议"
:
item
.
result_file_url
=
await
DownloadPurchaseAdvise
(
item
.
parameter
,
item
);
break
;
case
"退货汇总"
:
item
.
result_file_url
=
await
DownloadReturnGoods
(
item
.
parameter
,
item
);
break
;
default
:
throw
new
Exception
(
"无法识别的任务"
);
}
item
.
end_date
=
DateTime
.
Now
;
...
...
@@ -147,6 +150,20 @@ namespace AutoTurnOver.Services
return
fileData
;
}
/// <summary>
/// 下载采购建议
/// </summary>
public
async
Task
<
string
>
DownloadReturnGoods
(
string
par_json
,
dc_task_download
download_data
)
{
dc_aims_return_goods_search_dto
search_data
=
par_json
.
ToObject
<
dc_aims_return_goods_search_dto
>();
Console
.
WriteLine
(
"DownloadStock - 开始生成文件"
);
var
memory
=
new
PurchaseAdviseServices
().
ExportReturnGoods
(
search_data
);
Console
.
WriteLine
(
"DownloadStock - 开始生成上传文件"
);
var
fileData
=
await
AutoTurnOver
.
Utility
.
QiNiuCloudHelper
.
UploadSectioningAsync
(
memory
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
/// <summary>
/// 下载库存
/// </summary>
public
async
Task
<
string
>
DownloadFbaStock
(
string
par_json
,
dc_task_download
download_data
)
...
...
AutoTurnOver/Controllers/PurchaseAdviseController.cs
View file @
2bac45e2
...
...
@@ -63,8 +63,6 @@ namespace AutoTurnOver.Controllers
[
HttpGet
]
public
string
DetailList
([
FromQuery
]
dc_auto_purchase_advise_detailed_search_dto
m
,
[
FromQuery
]
int
limit
,
[
FromQuery
]
int
offset
,
[
FromQuery
]
string
sort
,
[
FromQuery
]
string
order
)
{
var
total
=
0
;
var
list
=
PurchaseAdviseServices
.
DetailList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
...
...
@@ -282,5 +280,40 @@ namespace AutoTurnOver.Controllers
}
}
[
HttpGet
]
[
BrowseLog
(
"Bailun_aims"
,
"触发【百伦自动下单系统】->【自动下单管理】->【退货汇总】->【查询】操作"
,
0
)]
public
string
ReturnGoodsList
([
FromQuery
]
dc_aims_return_goods_search_dto
m
,
[
FromQuery
]
int
limit
,
[
FromQuery
]
int
offset
)
{
var
total
=
0
;
var
list
=
new
PurchaseAdviseServices
().
ReturnGoodsList
(
m
,
offset
,
limit
,
ref
total
);
return
new
{
rows
=
list
,
total
=
total
,
}.
ToJson
(
false
);
}
public
JsonResult
ExportReturnGoods
([
FromQuery
]
dc_auto_purchase_advise_detailed_search_dto
m
,
[
FromQuery
]
int
limit
,
[
FromQuery
]
int
offset
,
[
FromQuery
]
string
sort
,
[
FromQuery
]
string
order
)
{
try
{
var
user
=
AutoUtility
.
GetUser
();
dc_task_download_dao
.
PushData
<
dc_auto_purchase_advise_detailed_search_dto
>(
new
dc_task_download
{
parameter
=
m
.
ToJson
(),
task_name
=
"退货汇总"
},
user
);
return
new
JsonResult
(
new
{
success
=
true
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
});
}
}
}
}
\ 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