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
59f24808
Commit
59f24808
authored
Mar 20, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
最大利润导出,新增sku单位重量
parent
31642d7f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
25 deletions
+30
-25
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+1
-1
dc_report_profit_analysis.cs
AutoTurnOver.Models/dc_report_profit_analysis.cs
+1
-0
SkuAutoTurnServices.cs
AutoTurnOver.Services/SkuAutoTurnServices.cs
+28
-24
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
59f24808
...
...
@@ -2175,7 +2175,7 @@ left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku
}
else
{
sql
=
@" select ta.*,t4.product_code from dc_report_profit_analysis as ta
sql
=
@" select ta.*,t4.product_code
,t4.weight
from dc_report_profit_analysis as ta
left join dc_auto_turnover as dat on dat.warehouse_code = ta.warehouse_code and dat.bailun_sku = ta.bailun_sku
left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku
"
;
...
...
AutoTurnOver.Models/dc_report_profit_analysis.cs
View file @
59f24808
...
...
@@ -295,5 +295,6 @@ namespace AutoTurnOver.Models
public
class
dc_report_profit_analysis_dto
:
dc_report_profit_analysis
{
public
string
product_code
{
get
;
set
;
}
public
decimal
?
weight
{
get
;
set
;
}
}
}
AutoTurnOver.Services/SkuAutoTurnServices.cs
View file @
59f24808
...
...
@@ -27,21 +27,22 @@ namespace AutoTurnOver.Services
/// <param name = "order" > 排序类型 </ param >
/// <param name="sort">排序字段</param>
/// <returns></returns>
public
List
<
dc_auto_turnover_list_dto
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
,
bool
isSum
=
false
)
public
List
<
dc_auto_turnover_list_dto
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
,
bool
isSum
=
false
)
{
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
categoryIds
))
{
m
.
categoryModels
=
ApiServices
.
GetNewClientNodesByIds
(
m
.
categoryIds
.
Split
(
','
).
Select
(
s
=>
int
.
Parse
(
s
)).
ToList
());
m
.
categoryModels
=
ApiServices
.
GetNewClientNodesByIds
(
m
.
categoryIds
.
Split
(
','
).
Select
(
s
=>
int
.
Parse
(
s
)).
ToList
());
}
return
DB
.
dc_auto_turnover
.
List
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
,
isSum
);
return
DB
.
dc_auto_turnover
.
List
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
,
isSum
);
}
public
List
<
dc_base_order_data_source_dto
>
GetOrderDataSource
(
dc_base_order_data_source_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
)
public
List
<
dc_base_order_data_source_dto
>
GetOrderDataSource
(
dc_base_order_data_source_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
)
{
return
DB
.
dc_auto_turnover
.
GetOrderDataSource
(
m
,
offset
,
limit
,
ref
total
);
return
DB
.
dc_auto_turnover
.
GetOrderDataSource
(
m
,
offset
,
limit
,
ref
total
);
}
public
IEnumerable
<
string
>
GetLabelList
()
{
public
IEnumerable
<
string
>
GetLabelList
()
{
return
DB
.
dc_auto_turnover
.
GetLabelList
();
}
...
...
@@ -54,9 +55,9 @@ namespace AutoTurnOver.Services
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
public
List
<
dc_auto_config_promotion
>
List
(
Condition_ConfigPromotion
m
,
int
offset
,
int
limit
,
ref
int
total
)
public
List
<
dc_auto_config_promotion
>
List
(
Condition_ConfigPromotion
m
,
int
offset
,
int
limit
,
ref
int
total
)
{
return
DB
.
dc_auto_turnover
.
ListConfigPromotion
(
m
,
offset
,
limit
,
ref
total
);
return
DB
.
dc_auto_turnover
.
ListConfigPromotion
(
m
,
offset
,
limit
,
ref
total
);
}
/// <summary>
...
...
@@ -64,7 +65,7 @@ namespace AutoTurnOver.Services
/// </summary>
/// <param name="days"></param>
/// <returns></returns>
public
IEnumerable
<
dc_auto_config_promotion
>
List
(
string
sku
,
string
warehousecode
,
int
days
)
public
IEnumerable
<
dc_auto_config_promotion
>
List
(
string
sku
,
string
warehousecode
,
int
days
)
{
var
now
=
DateTime
.
Now
;
return
DB
.
dc_auto_turnover
.
ListConfigPromotion
(
sku
,
warehousecode
,
now
,
now
.
AddDays
(
days
));
...
...
@@ -257,7 +258,7 @@ namespace AutoTurnOver.Services
/// <param name="sku">sku编码</param>
/// <param name="warehousecode">仓库编码</param>
/// <returns></returns>
public
dc_auto_inventory
GetAutoInventoryBySkuWH
(
string
sku
,
string
warehousecode
)
public
dc_auto_inventory
GetAutoInventoryBySkuWH
(
string
sku
,
string
warehousecode
)
{
return
DB
.
dc_auto_turnover
.
GetAutoInventoryBySkuWH
(
sku
,
warehousecode
);
}
...
...
@@ -287,7 +288,7 @@ namespace AutoTurnOver.Services
return
DB
.
dc_auto_turnover
.
SkuNewSupplierDeliveryList
();
}
public
string
Export
(
Condition_AutoTurnOver
m
,
string
order
,
string
sort
)
public
string
Export
(
Condition_AutoTurnOver
m
,
string
order
,
string
sort
)
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"周转表-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
...
...
@@ -405,13 +406,13 @@ namespace AutoTurnOver.Services
row
[
"amazon最近14天日均销量"
]
=
itemData
.
history_fourteenday_sales_amazon
;
row
[
"amazon最近30天日均销量"
]
=
itemData
.
history_thirtyday_sales_amazon
;
row
[
"已发货库存"
]
=
itemData
.
shipped_stock
;
row
[
"开发时间"
]
=
(
itemData
.
develop_time
==
null
?
""
:
itemData
.
develop_time
.
Value
.
ToString
(
"yyyy-MM-dd"
));
row
[
"开发时间"
]
=
(
itemData
.
develop_time
==
null
?
""
:
itemData
.
develop_time
.
Value
.
ToString
(
"yyyy-MM-dd"
));
row
[
"是否侵权"
]
=
itemData
.
has_tort
;
row
[
"停止监控时间"
]
=
itemData
.
stop_monitor_create
==
null
?
""
:
itemData
.
stop_monitor_create
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
row
[
"停止监控时间"
]
=
itemData
.
stop_monitor_create
==
null
?
""
:
itemData
.
stop_monitor_create
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
//row["动态备货规则组"] = itemData.group_name;
row
[
"标签"
]
=
itemData
.
sku_label
;
row
[
"停售"
]
=
itemData
.
sku_status_str
;
row
[
"最近7天+预测销量"
]
=
itemData
.
sales_details
==
null
?
""
:
itemData
.
sales_details
.
Replace
(
"["
,
""
).
Replace
(
"]"
,
""
);
row
[
"最近7天+预测销量"
]
=
itemData
.
sales_details
==
null
?
""
:
itemData
.
sales_details
.
Replace
(
"["
,
""
).
Replace
(
"]"
,
""
);
row
[
"品牌"
]
=
itemData
.
brand
;
row
[
"简易分类"
]
=
itemData
.
category_simple_name
;
row
[
"首次入库时间"
]
=
(
itemData
.
first_inbound_date
==
null
?
""
:
itemData
.
first_inbound_date
.
Value
.
ToString
(
"yyyy-MM-dd"
));
...
...
@@ -524,7 +525,7 @@ namespace AutoTurnOver.Services
var
conn
=
MyMySqlConnection
.
_connection
;
// 如果遇到出周转建议的时候,则停止
var
last_data
=
conn
.
QuerySingleOrDefault
<
DateTime
>(
" select MAX(create_time) from dc_auto_purchase_advise "
);
if
((
DateTime
.
Now
-
last_data
).
TotalMinutes
<=
20
)
if
((
DateTime
.
Now
-
last_data
).
TotalMinutes
<=
20
)
{
return
;
}
...
...
@@ -582,7 +583,7 @@ namespace AutoTurnOver.Services
}
if
(
bailun_sku_warehouse_codes
!=
null
&&
bailun_sku_warehouse_codes
.
Count
>=
1
)
if
(
bailun_sku_warehouse_codes
!=
null
&&
bailun_sku_warehouse_codes
.
Count
>=
1
)
{
// 等待周转跑完
AutoTurnOver
.
DB
.
dc_auto_turnover
.
WaitTurnoverQueueTask
();
...
...
@@ -594,7 +595,7 @@ namespace AutoTurnOver.Services
bailun_sku_warehouse_codes
=
bailun_sku_warehouse_codes
},
commandTimeout
:
0
);
// 出周转建议
PurchaseAdviseServices
.
Generate
(
$"采购单更新,刷新周转
{
DateTime
.
Now
.
ToString
(
"HH:mm"
)}
"
,
btime
,
is_bak
:
false
);
PurchaseAdviseServices
.
Generate
(
$"采购单更新,刷新周转
{
DateTime
.
Now
.
ToString
(
"HH:mm"
)}
"
,
btime
,
is_bak
:
false
);
}
...
...
@@ -632,7 +633,7 @@ namespace AutoTurnOver.Services
}
else
{
new_task_synchro_log
.
start_time
=
new
DateTime
(
2021
,
1
,
1
);
new_task_synchro_log
.
start_time
=
new
DateTime
(
2021
,
1
,
1
);
}
new_task_synchro_log
.
id
=
conn
.
Insert
(
new_task_synchro_log
)
??
0
;
...
...
@@ -678,7 +679,7 @@ namespace AutoTurnOver.Services
},
commandTimeout
:
0
);
// 出周转建议
PurchaseAdviseServices
.
Generate
(
$"调拨单刷新
{
DateTime
.
Now
.
ToString
(
"HH:mm"
)}
"
,
btime
,
is_bak
:
false
);
PurchaseAdviseServices
.
Generate
(
$"调拨单刷新
{
DateTime
.
Now
.
ToString
(
"HH:mm"
)}
"
,
btime
,
is_bak
:
false
);
}
...
...
@@ -693,7 +694,8 @@ namespace AutoTurnOver.Services
public
string
warehouse_code
{
get
;
set
;
}
}
public
transfer_profit_result_dto
TransferProfitList
(
string
bailun_sku
,
string
warehouse_code
)
{
public
transfer_profit_result_dto
TransferProfitList
(
string
bailun_sku
,
string
warehouse_code
)
{
return
DB
.
dc_auto_turnover
.
TransferProfitList
(
bailun_sku
,
warehouse_code
);
}
...
...
@@ -707,7 +709,7 @@ namespace AutoTurnOver.Services
}
public
void
BatchPushPurchaseAdvise
(
string
ids
,
UserData
user
)
{
DB
.
dc_auto_turnover
.
BatchPushPurchaseAdvise
(
ids
,
user
);
DB
.
dc_auto_turnover
.
BatchPushPurchaseAdvise
(
ids
,
user
);
}
...
...
@@ -725,17 +727,17 @@ namespace AutoTurnOver.Services
int
total
=
0
;
var
offset
=
(
page
-
1
)
*
rows
;
var
limit
=
rows
;
var
list
=
ProfitAnalysis
(
m
,
offset
,
limit
,
ref
total
,
""
,
""
);
var
list
=
ProfitAnalysis
(
m
,
offset
,
limit
,
ref
total
,
""
,
""
);
if
(
list
==
null
||
list
.
Count
<=
0
)
break
;
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"sku"
,
"国家"
,
"仓库类型"
,
"仓库"
,
"默认调拨方式"
,
"180天日均"
,
"90天日均"
,
"30天日均"
,
"7天日均"
,
"采购单价
"
,
"实际建议周转数"
,
string
[]
cols
=
new
string
[]
{
"sku"
,
"商品编码"
,
"国家"
,
"仓库类型"
,
"仓库"
,
"默认调拨方式"
,
"180天日均"
,
"90天日均"
,
"30天日均"
,
"7天日均"
,
"采购单价"
,
"单位重量
"
,
"实际建议周转数"
,
"实际建议周转金额"
,
"实际周转数"
,
"实际周转运费"
,
"实际运费单价"
,
"海运周转数(推荐海运)"
,
"海运周转金额"
,
"海运周转运费"
,
"空运周转数(推荐空运)"
,
"空运周转金额"
,
"空运周转运费"
,
"实际-海运运费差值"
,
"实际-海运周转采购金额差值"
,
"实际-空运运费差值"
,
"实际-空运周转采购金额差值"
,
"海运-空运运费差值"
,
"海运-空运周转采购金额差值"
,
"安全库存数量"
,
"空运周转天数"
,
"海运周转天数"
,
"30天预测销量海运运费-实际周转运费金额"
,
"30天预测销量空运运费-实际周转运费金额"
,
"30天预测销量空运运费-海运周转运费金额"
,
"差值(实际-海运)/实际周转采购金额占比"
,
"差值(海运-空运)/实际周转采购金额占比"
,
"差值(空运-实际)/实际周转采购金额占比"
,
"海运与实际运费差额/库存差额"
,
"空运与实际运费差额/库存差额"
,
"30天销量海运与实际运费差额/库存金额"
,
"30天销量空运与实际运费差额/库存金额"
,
"补海运周转数"
,
"补海运周转金额"
,
"海运与实际运费差额/库存差额"
,
"空运与实际运费差额/库存差额"
,
"30天销量海运与实际运费差额/库存金额"
,
"30天销量空运与实际运费差额/库存金额"
,
"补海运周转数"
,
"补海运周转金额"
};
foreach
(
var
item
in
cols
)
{
...
...
@@ -747,6 +749,7 @@ namespace AutoTurnOver.Services
DataRow
row
=
table
.
NewRow
();
row
[
"sku"
]
=
itemData
.
bailun_sku
;
row
[
"商品编码"
]
=
itemData
.
product_code
;
row
[
"国家"
]
=
itemData
.
country
;
row
[
"仓库类型"
]
=
itemData
.
warehouse_type
;
row
[
"默认调拨方式"
]
=
itemData
.
transport_type
;
...
...
@@ -756,6 +759,7 @@ namespace AutoTurnOver.Services
row
[
"30天日均"
]
=
itemData
.
sales_avg_30
;
row
[
"7天日均"
]
=
itemData
.
sales_avg_7
;
row
[
"采购单价"
]
=
itemData
.
unit_price
;
row
[
"采购单价"
]
=
itemData
.
weight
;
row
[
"实际建议周转数"
]
=
itemData
.
quantity_final_advise
;
row
[
"实际建议周转金额"
]
=
itemData
.
quantity_final_advise_amount
;
row
[
"实际周转数"
]
=
itemData
.
turnover
;
...
...
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