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
d9c75b53
Commit
d9c75b53
authored
Nov 20, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
b14e6a69
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
28 deletions
+67
-28
dc_base_week_coefficient_dao.cs
AutoTurnOver.DB/dc_base_week_coefficient_dao.cs
+9
-1
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+58
-27
No files found.
AutoTurnOver.DB/dc_base_week_coefficient_dao.cs
View file @
d9c75b53
...
...
@@ -54,7 +54,7 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o
// 计算每周,每天的加权系数
for
(
int
i
=
1
;
i
<=
weeks
;
i
++)
{
var
btime
=
date28
.
AddDays
(
i
-
1
);
var
btime
=
date28
.
AddDays
(
(
i
-
1
)*
7
);
var
etime
=
btime
.
AddDays
(
6
);
// 计算本周总销量
var
sumData
=
week_date_datas
.
Where
(
s
=>
s
.
date
>=
btime
&&
s
.
date
<=
etime
).
ToList
();
...
...
@@ -62,6 +62,10 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o
var
sumDataAvgVal
=
((
decimal
)
sumDataVal
)
/
7
M
;
for
(
int
j
=
0
;
j
<=
6
;
j
++)
{
if
(
j
==
3
&&
i
==
4
)
{
}
if
(
sumDataAvgVal
<=
0
)
{
week_coefficient_datas
.
Add
(
new
week_coefficient_dto
{
week
=
j
,
coefficient
=
0
M
,
formula
=
" ( 0 / 0 )"
});
...
...
@@ -83,6 +87,10 @@ where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code and t1.bailun_o
for
(
int
i
=
0
;
i
<=
6
;
i
++)
{
if
(
i
==
3
)
{
}
var
weekDatas
=
week_coefficient_datas
.
Where
(
s
=>
s
.
week
==
i
);
var
avg
=
weekDatas
.
Select
(
s
=>
s
.
coefficient
).
Average
();
//var has_val = weekDatas.Select(s => s.coefficient).Average();
...
...
AutoTurnOver/Controllers/ReportsController.cs
View file @
d9c75b53
...
...
@@ -12,6 +12,9 @@ using AutoTurnOver.Common;
using
System.IO
;
using
AutoTurnOver.Models
;
using
AutoTurnOver.Models.stock
;
using
AutoTurnOver.DB
;
using
Dapper
;
using
AutoTurnOver.Models.auto
;
namespace
AutoTurnOver.Controllers
{
...
...
@@ -41,16 +44,39 @@ namespace AutoTurnOver.Controllers
break
;
}
}
// 提前查询周系数公式
var
dc_base_week_coefficient_datas
=
MyMySqlConnection
.
_connection_read_only
.
Query
<
dc_base_week_coefficient
>(
" select * from dc_base_week_coefficient where bailun_sku_warehouse_code=@bailun_sku_warehouse_code "
,
new
{
bailun_sku_warehouse_code
=
$"
{
sku
}{
warehousecode
}
"
});
//[0.13, 0.12, 0.11, 0.11, 0.1, 0.09, 0.09, 0.08, 0.08, 0.07, 0.06, 0.06, 0.05, 0.04, 0.04, 0.03, 0.02, 0.02, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
var
date
=
new
List
<
string
>();
var
today
=
DateTime
.
Now
.
AddDays
(-
7
);
var
weeks
=
new
List
<
dynamic
>();
for
(
var
i
=
0
;
i
<
count
;
i
++)
{
date
.
Add
(
today
.
AddDays
(
i
).
ToString
(
"MM/dd"
));
var
dateI
=
today
.
AddDays
(
i
);
date
.
Add
(
dateI
.
ToString
(
"MM/dd"
));
}
for
(
var
i
=
-
7
;
i
<
count
;
i
++)
{
var
dateI
=
today
.
AddDays
(
i
);
var
weekItem
=
dc_base_week_coefficient_datas
.
FirstOrDefault
(
s
=>
s
.
week
==
(
int
)
dateI
.
DayOfWeek
);
if
(
weekItem
!=
null
)
{
weeks
.
Add
(
new
{
date
=
dateI
.
ToString
(
"MM/dd"
),
formula
=
$" (
{
weekItem
.
formula
}
)"
,
val
=
$"
{
weekItem
.
coefficient
}
"
});
}
else
{
weeks
.
Add
(
new
{
date
=
dateI
.
ToString
(
"MM/dd"
),
formula
=
"-"
,
val
=
"-"
});
}
}
var
names
=
new
List
<
string
>()
{
"销量"
,
"计算公式"
,
"计算规则"
,
"预计入库"
,
"可用库存"
,
"预计缺货数量"
,
"特殊销量"
,
"市场因素"
,
"建议下单数量"
,
"人工下单数量"
};
var
names
=
new
List
<
string
>()
{
"销量"
,
"计算公式"
,
"计算规则"
,
"预计入库"
,
"可用库存"
,
"预计缺货数量"
,
"特殊销量"
,
"市场因素"
,
"建议下单数量"
,
"人工下单数量"
};
var
turnoverData
=
new
Services
.
SkuAutoTurnServices
().
GetModel
(
sku
,
warehousecode
);
var
saleVolumeData
=
new
Services
.
SaleVolumeServices
().
GetBySkuWarehouseCode
(
sku
,
warehousecode
);
var
averageTargets
=
PurchaseAverageTargetServices
.
GetListByWCode
(
sku
,
warehousecode
);
...
...
@@ -93,6 +119,7 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
new
{
data
=
result
,
weeks
=
weeks
,
turnoverData
,
saleVolumeData
,
days
=
date
,
...
...
@@ -227,7 +254,7 @@ namespace AutoTurnOver.Controllers
/// <returns></returns>
[
UseAction
]
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【实时数据】->【实时缺货明细】->【搜索】页面"
,
0
)]
public
JsonResult
QuantityOutStockDetailList
(
DateTime
?
pay_time_min
,
DateTime
?
pay_time_max
,
string
platform_type
,
string
shiplogistics_code
,
int
?
bailun_account_id
,
int
?
search_type
,
string
warehousecode
,
string
key_words
,
string
purchase_user
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
)
public
JsonResult
QuantityOutStockDetailList
(
DateTime
?
pay_time_min
,
DateTime
?
pay_time_max
,
string
platform_type
,
string
shiplogistics_code
,
int
?
bailun_account_id
,
int
?
search_type
,
string
warehousecode
,
string
key_words
,
string
purchase_user
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
quantity_out_stock_detail_search_dto
{
...
...
@@ -313,7 +340,7 @@ namespace AutoTurnOver.Controllers
{
DataRow
row
=
table
.
NewRow
();
row
[
"缺货统计时间"
]
=
itemData
.
gmt_out_stock_modified
==
null
?
""
:
itemData
.
gmt_out_stock_modified
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
row
[
"缺货统计时间"
]
=
itemData
.
gmt_out_stock_modified
==
null
?
""
:
itemData
.
gmt_out_stock_modified
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
row
[
"平台订单号"
]
=
itemData
.
origin_order_id
;
row
[
"平台类型"
]
=
itemData
.
platform_type
;
row
[
"百伦订单号"
]
=
itemData
.
bailun_order_id
;
...
...
@@ -603,9 +630,10 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
BrowseLog
(
"Bailun_aims"
,
"触发【百伦自动周转系统】->【实时数据】->【实时缺货明细】->【批量出信】操作"
,
1
)]
public
FileResult
BatchSendMessage
(
string
bailun_order_ids
,
string
content
,
string
subject
,
string
remarks
)
public
FileResult
BatchSendMessage
(
string
bailun_order_ids
,
string
content
,
string
subject
,
string
remarks
)
{
BatchSendMessageInputDto
data
=
new
BatchSendMessageInputDto
{
BatchSendMessageInputDto
data
=
new
BatchSendMessageInputDto
{
bailun_order_ids
=
bailun_order_ids
,
content
=
content
,
remarks
=
remarks
,
...
...
@@ -633,14 +661,15 @@ namespace AutoTurnOver.Controllers
/// <returns></returns>
[
UseAction
]
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【报表】->【商品分类汇总】->【搜索】页面"
,
0
)]
public
JsonResult
GetSkuWebsiteSales
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
public
JsonResult
GetSkuWebsiteSales
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
platform_type
=
platform_type
,
warehousetype
=
warehousetype
,
etime
=
etime
,
btime
=
btime
,
warehousearea
=
warehousearea
,
warehousearea
=
warehousearea
,
warehouse_code
=
warehousecode
};
...
...
@@ -836,14 +865,15 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
);
}
public
JsonResult
GetSkuWarehouseSales
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
public
JsonResult
GetSkuWarehouseSales
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
platform_type
=
platform_type
,
warehousetype
=
warehousetype
,
etime
=
etime
,
btime
=
btime
,
warehousearea
=
warehousearea
,
warehousearea
=
warehousearea
,
warehouse_code
=
warehousecode
};
...
...
@@ -883,7 +913,7 @@ namespace AutoTurnOver.Controllers
var
list
=
new
ReportServices
().
GetSkuWarehouseSales
(
search_data
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"分类"
,
"仓库"
};
string
[]
cols
=
new
string
[]
{
"分类"
,
"仓库"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
...
...
@@ -930,28 +960,29 @@ namespace AutoTurnOver.Controllers
return
File
(
memory
,
"text/csv"
,
"商品汇总_仓库.csv"
);
}
public
FileResult
SkuWebsiteSalesExport
(
string
platform_type
,
string
label
,
string
website
,
string
warehouse_code
,
int
?
year
,
int
?
month
,
int
?
day
)
public
FileResult
SkuWebsiteSalesExport
(
string
platform_type
,
string
label
,
string
website
,
string
warehouse_code
,
int
?
year
,
int
?
month
,
int
?
day
)
{
var
user
=
AutoUtility
.
GetUser
();
var
memory
=
new
ReportServices
().
SkuWebsiteSalesExport
(
new
bailun_sku_website_sales_detailed_search_dto
{
day
=
day
??
0
,
var
memory
=
new
ReportServices
().
SkuWebsiteSalesExport
(
new
bailun_sku_website_sales_detailed_search_dto
{
day
=
day
??
0
,
label
=
label
,
month
=
month
??
0
,
month
=
month
??
0
,
platform_type
=
platform_type
,
website
=
website
,
website
=
website
,
warehouse_code
=
warehouse_code
,
year
=
year
??
0
year
=
year
??
0
},
AutoUtility
.
GetUser
());
return
File
(
memory
,
"text/csv"
,
$"
{
user
.
UserAccount
}
商品分类数据信息.csv"
);
}
public
JsonResult
GetSkuWebsiteSalesSumFooter
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
public
JsonResult
GetSkuWebsiteSalesSumFooter
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
platform_type
=
platform_type
,
warehousetype
=
warehousetype
,
has_sum
=
true
,
has_sum
=
true
,
etime
=
etime
,
btime
=
btime
,
warehousearea
=
warehousearea
,
...
...
@@ -963,14 +994,14 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
}
public
JsonResult
GetSkuWarehouseSalesSumFooter
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
public
JsonResult
GetSkuWarehouseSalesSumFooter
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
platform_type
=
platform_type
,
warehousetype
=
warehousetype
,
has_sum
=
true
,
has_sum
=
true
,
etime
=
etime
,
btime
=
btime
,
warehousearea
=
warehousearea
,
...
...
@@ -1017,7 +1048,7 @@ namespace AutoTurnOver.Controllers
}
[
UseAction
]
public
JsonResult
GetGoods
(
string
product_inner_code
,
string
platform_type
,
int
offset
,
int
limit
,
string
order
,
string
sort
)
public
JsonResult
GetGoods
(
string
product_inner_code
,
string
platform_type
,
int
offset
,
int
limit
,
string
order
,
string
sort
)
{
var
m
=
new
bailun_sku_goods_search_dto
{
...
...
@@ -1074,7 +1105,7 @@ namespace AutoTurnOver.Controllers
/// <param name="sort"></param>
/// <returns></returns>
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【实时数据】->【安全库存汇总】->【搜索】页面"
,
0
)]
public
JsonResult
GetInventoryStock
(
string
warehousetype
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
int
?
warehousearea
,
string
warehouse_code
)
public
JsonResult
GetInventoryStock
(
string
warehousetype
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
int
?
warehousearea
,
string
warehouse_code
)
{
try
{
...
...
@@ -1083,7 +1114,7 @@ namespace AutoTurnOver.Controllers
warehousetype
=
warehousetype
,
warehousearea
=
warehousearea
,
warehouse_code
=
warehouse_code
,
page
=
(
offset
/
limit
)
+
1
,
page
=
(
offset
/
limit
)
+
1
,
rows
=
limit
,
sidx
=
sort
,
sord
=
order
,
...
...
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