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
bc959d00
Commit
bc959d00
authored
Mar 09, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
85b5af1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
213 additions
and
1 deletion
+213
-1
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+119
-1
SkuAutoTurnServices.cs
AutoTurnOver.Services/SkuAutoTurnServices.cs
+94
-0
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
bc959d00
...
@@ -1881,7 +1881,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
...
@@ -1881,7 +1881,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
bailun_sku
=
bailun_sku
,
bailun_sku
=
bailun_sku
,
warehouse_code
=
warehouse_code
warehouse_code
=
warehouse_code
})
??
new
dc_base_head_transport_config
{
};
})
??
new
dc_base_head_transport_config
{
};
data
.
transport_type
=
dc_base_head_transport_config_data
.
head_transport
;
data
.
transport_type
=
dc_base_head_transport_config_data
.
head_transport
??
""
;
dc_report_profit_analysis
sales_data
=
_connection
.
QueryFirstOrDefault
<
dc_report_profit_analysis
>(
@" select
dc_report_profit_analysis
sales_data
=
_connection
.
QueryFirstOrDefault
<
dc_report_profit_analysis
>(
@" select
sum( case when paid_time>=@btime2 and paid_time<=@etime1 then bailun_sku_quantity_ordered else 0 end ) as 'sales_avg_7',
sum( case when paid_time>=@btime2 and paid_time<=@etime1 then bailun_sku_quantity_ordered else 0 end ) as 'sales_avg_7',
sum( case when paid_time>=@btime3 and paid_time<=@etime1 then bailun_sku_quantity_ordered else 0 end ) as 'sales_avg_30',
sum( case when paid_time>=@btime3 and paid_time<=@etime1 then bailun_sku_quantity_ordered else 0 end ) as 'sales_avg_30',
...
@@ -1991,6 +1991,123 @@ order by t1.gmt_modified asc
...
@@ -1991,6 +1991,123 @@ order by t1.gmt_modified asc
new_task_synchro_log
.
status
=
1
;
new_task_synchro_log
.
status
=
1
;
conn
.
Update
(
new_task_synchro_log
);
conn
.
Update
(
new_task_synchro_log
);
}
}
/// <summary>
/// 查询供应链调拨在途
/// </summary>
/// <param name="sku">sku</param>
/// <param name="warehouse_code">仓库编码</param>
/// <returns></returns>
public
static
List
<
dc_report_profit_analysis
>
ProfitAnalysis
(
dc_base_stock_search_dto
search_data
,
ref
int
total
)
{
DynamicParameters
parameters
=
new
DynamicParameters
();
var
sql
=
""
;
sql
=
@" select * from dc_report_profit_analysis as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
where 1=1
"
;
var
countSql
=
@"
select
count(1)
from dc_report_profit_analysis as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
where 1=1
"
;
if
(!
string
.
IsNullOrWhiteSpace
(
search_data
.
warehousetype
))
{
sql
+=
" and t1.warehouse_type = @hq_type "
;
countSql
+=
" and t1.warehouse_type = @hq_type "
;
parameters
.
Add
(
"hq_type"
,
search_data
.
warehousetype
);
}
if
(
search_data
.
warehousearea
>
0
)
{
sql
+=
" and t2.area_id = @area_id "
;
countSql
+=
" and t2.area_id = @area_id "
;
parameters
.
Add
(
"area_id"
,
search_data
.
warehousearea
);
}
if
(
search_data
.
searchType
>
0
&&
!
string
.
IsNullOrWhiteSpace
(
search_data
.
key_words
))
{
switch
(
search_data
.
searchType
)
{
case
1
:
sql
+=
" and t1.bailun_sku in @bailun_skus "
;
countSql
+=
" and t1.bailun_sku in @bailun_skus "
;
parameters
.
Add
(
"bailun_skus"
,
search_data
.
key_words
.
Split
(
','
));
break
;
case
2
:
sql
+=
" and t1.bailun_sku like @bailun_sku "
;
countSql
+=
" and t1.bailun_sku like @bailun_sku "
;
parameters
.
Add
(
"bailun_sku"
,
$"%
{
search_data
.
key_words
}
%"
);
break
;
}
}
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
(
search_data
.
isSum
)
{
total
=
0
;
}
else
{
if
(
search_data
.
is_warehouse_sum
)
{
countSql
+=
" group by t1.warehouse_code "
;
sql
+=
" group by t1.warehouse_code "
;
total
=
_connection
.
Query
<
int
>(
countSql
,
parameters
,
commandTimeout
:
0
).
Count
();
}
else
{
if
(
search_data
.
limit
>
1000
)
{
total
=
0
;
}
else
{
total
=
_connection
.
Query
<
int
>(
countSql
,
parameters
,
commandTimeout
:
0
).
Count
();
}
}
if
(
string
.
IsNullOrWhiteSpace
(
search_data
.
sort
))
{
search_data
.
sort
=
" t1.`ocean_purchase_amount` "
;
search_data
.
order
=
"desc"
;
}
if
(!
string
.
IsNullOrEmpty
(
search_data
.
sort
)
&&
!
string
.
IsNullOrEmpty
(
search_data
.
order
))
{
sql
+=
" order by "
+
search_data
.
sort
;
if
(!
string
.
IsNullOrEmpty
(
search_data
.
order
))
{
sql
+=
" "
+
search_data
.
order
;
}
else
{
sql
+=
" asc"
;
}
}
sql
+=
" limit "
+
search_data
.
offset
+
","
+
search_data
.
limit
;
}
var
obj
=
_connection
.
Query
<
dc_report_profit_analysis
>(
sql
,
parameters
,
buffered
:
false
,
commandTimeout
:
0
).
AsList
();
return
obj
;
}
}
}
}
}
\ No newline at end of file
AutoTurnOver.Services/SkuAutoTurnServices.cs
View file @
bc959d00
...
@@ -685,5 +685,99 @@ namespace AutoTurnOver.Services
...
@@ -685,5 +685,99 @@ namespace AutoTurnOver.Services
return
DB
.
dc_auto_turnover
.
TransferProfitList
(
bailun_sku
,
warehouse_code
);
return
DB
.
dc_auto_turnover
.
TransferProfitList
(
bailun_sku
,
warehouse_code
);
}
}
public
List
<
dc_report_profit_analysis
>
ProfitAnalysis
(
dc_base_stock_search_dto
search_data
,
ref
int
total
)
{
return
DB
.
dc_auto_turnover
.
ProfitAnalysis
(
search_data
,
ref
total
);
}
public
string
ProfitAnalysisExport
(
dc_base_stock_search_dto
search_data
)
{
try
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"周转利润分析-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
int
page
=
1
;
int
rows
=
100000
;
while
(
true
)
{
int
total
=
0
;
search_data
.
offset
=
(
page
-
1
)
*
rows
;
search_data
.
limit
=
rows
;
var
list
=
ProfitAnalysis
(
search_data
,
ref
total
);
if
(
list
==
null
||
list
.
Count
<=
0
)
break
;
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"sku"
,
"国家"
,
"仓库类型"
,
"仓库"
,
"默认调拨方式"
,
"180天日均"
,
"90天日均"
,
"30天日均"
,
"7天日均"
,
"采购单价"
,
"实际建议周转数"
,
"实际建议周转金额"
,
"实际周转数"
,
"实际周转运费"
,
"实际运费单价"
,
"海运周转数(推荐海运)"
,
"海运周转金额"
,
"海运周转运费"
,
"空运周转数(推荐空运)"
,
"空运周转金额"
,
"空运周转运费"
,
"实际-海运周转采购金额差值"
,
"实际-空运运费差值"
,
"实际-空运周转采购金额差值"
,
"海运-空运运费差值"
,
"海运-空运周转采购金额差值"
,
"安全库存数量"
,
"空运周转天数"
,
"海运周转天数"
,
"30天预测销量海运运费-实际周转运费金额"
,
"30天预测销量空运运费-实际周转运费金额"
,
"30天预测销量空运运费-海运周转运费金额"
,
"差值(实际-海运)/实际周转采购金额占比"
,
"差值(海运-空运)/实际周转采购金额占比"
,
"差值(空运-实际)/实际周转采购金额占比"
,
"海运与实际运费差额/库存差额"
,
"空运与实际运费差额/库存差额"
,
"30天销量海运与实际运费差额/库存差额"
,
"30天销量空运与实际运费差额/库存差额"
,
"补海运周转数"
,
"补海运周转金额"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"sku"
]
=
itemData
.
bailun_sku
;
row
[
"国家"
]
=
itemData
.
country
;
row
[
"仓库类型"
]
=
itemData
.
warehouse_type
;
row
[
"默认调拨方式"
]
=
itemData
.
transport_type
;
row
[
"180天日均"
]
=
itemData
.
transport_type
;
row
[
"90天日均"
]
=
itemData
.
transport_type
;
row
[
"30天日均"
]
=
itemData
.
transport_type
;
row
[
"7天日均"
]
=
itemData
.
transport_type
;
row
[
"采购单价"
]
=
itemData
.
transport_type
;
row
[
"实际建议周转数"
]
=
itemData
.
transport_type
;
row
[
"实际建议周转金额"
]
=
itemData
.
transport_type
;
row
[
"实际周转数"
]
=
itemData
.
transport_type
;
row
[
"实际周转运费"
]
=
itemData
.
transport_type
;
row
[
"实际运费单价"
]
=
itemData
.
transport_type
;
row
[
"海运周转数(推荐海运)"
]
=
itemData
.
transport_type
;
row
[
"海运周转金额"
]
=
itemData
.
transport_type
;
row
[
"海运周转运费"
]
=
itemData
.
transport_type
;
row
[
"空运周转数(推荐空运)"
]
=
itemData
.
transport_type
;
row
[
"空运周转金额"
]
=
itemData
.
transport_type
;
row
[
"空运周转运费"
]
=
itemData
.
transport_type
;
row
[
"实际-海运周转采购金额差值"
]
=
itemData
.
transport_type
;
row
[
"实际-空运运费差值"
]
=
itemData
.
transport_type
;
row
[
"实际-空运周转采购金额差值"
]
=
itemData
.
transport_type
;
row
[
"海运-空运运费差值"
]
=
itemData
.
transport_type
;
row
[
"海运-空运周转采购金额差值"
]
=
itemData
.
transport_type
;
row
[
"安全库存数量"
]
=
itemData
.
transport_type
;
row
[
"空运周转天数"
]
=
itemData
.
transport_type
;
row
[
"海运周转天数"
]
=
itemData
.
transport_type
;
row
[
"30天预测销量海运运费-实际周转运费金额"
]
=
itemData
.
transport_type
;
row
[
"30天预测销量空运运费-实际周转运费金额"
]
=
itemData
.
transport_type
;
row
[
"30天预测销量空运运费-海运周转运费金额"
]
=
itemData
.
transport_type
;
row
[
"差值(实际-海运)/实际周转采购金额占比"
]
=
itemData
.
transport_type
;
row
[
"差值(海运-空运)/实际周转采购金额占比"
]
=
itemData
.
transport_type
;
row
[
"差值(空运-实际)/实际周转采购金额占比"
]
=
itemData
.
transport_type
;
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
,
page
==
1
);
page
++;
}
return
fileName
;
}
catch
(
Exception
)
{
throw
;
}
}
}
}
}
}
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