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
16c13690
Commit
16c13690
authored
Sep 09, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
现金流报表支持导出
parent
8f8b9efa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
1 deletion
+150
-1
CashFlowServices.cs
AutoTurnOver.Services/CashFlowServices.cs
+4
-1
CashFlowController.cs
AutoTurnOver/Controllers/CashFlowController.cs
+146
-0
No files found.
AutoTurnOver.Services/CashFlowServices.cs
View file @
16c13690
...
@@ -24,6 +24,7 @@ namespace AutoTurnOver.Services
...
@@ -24,6 +24,7 @@ namespace AutoTurnOver.Services
{
{
var
dic
=
(
IDictionary
<
string
,
object
>)
o
;
var
dic
=
(
IDictionary
<
string
,
object
>)
o
;
dic
[
"occur_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
occur_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
dic
[
"occur_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
occur_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
dic
[
"v_occur_"
+
(
dat_item
.
date_title
)]
=
Math
.
Round
(
dat_item
.
occur_val
,
2
);
if
(
if
(
item
.
date_type
.
Contains
(
(
int
)
dc_report_cash_flow_log_data_type_enum
.
销售数量
)
item
.
date_type
.
Contains
(
(
int
)
dc_report_cash_flow_log_data_type_enum
.
销售数量
)
//|| item.date_type==(int)dc_report_cash_flow_log_data_type_enum.利润
//|| item.date_type==(int)dc_report_cash_flow_log_data_type_enum.利润
...
@@ -33,11 +34,13 @@ namespace AutoTurnOver.Services
...
@@ -33,11 +34,13 @@ namespace AutoTurnOver.Services
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放头程费用
//|| item.date_type == (int)dc_report_cash_flow_log_data_type_enum.释放头程费用
)
)
{
{
dic
[
"pay_"
+
(
dat_item
.
date_title
)]
=
null
;
dic
[
"v_pay_"
+
(
dat_item
.
date_title
)]
=
null
;
}
}
else
else
{
{
dic
[
"pay_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
pay_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
dic
[
"pay_"
+
(
dat_item
.
date_title
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
pay_val
,
2
),
btime
=
dat_item
.
btime
,
etime
=
dat_item
.
etime
,
data_type
=
item
.
date_type
};
dic
[
"v_pay_"
+
(
dat_item
.
date_title
)]
=
Math
.
Round
(
dat_item
.
pay_val
,
2
);
}
}
}
}
...
...
AutoTurnOver/Controllers/CashFlowController.cs
View file @
16c13690
...
@@ -11,6 +11,7 @@ using AutoTurnOver.Services;
...
@@ -11,6 +11,7 @@ using AutoTurnOver.Services;
using
Dapper
;
using
Dapper
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
AutoTurnOver.Utility
;
namespace
AutoTurnOver.Controllers
namespace
AutoTurnOver.Controllers
{
{
...
@@ -38,6 +39,78 @@ namespace AutoTurnOver.Controllers
...
@@ -38,6 +39,78 @@ namespace AutoTurnOver.Controllers
});
});
}
}
public
FileResult
ExportView
(
DateTime
?
btime
,
DateTime
?
etime
,
string
platform_type
,
string
web_site
,
string
bailun_sku
,
string
warehouse_code
)
{
report_cash_flow_view_search_dto
search_data
=
new
report_cash_flow_view_search_dto
{
etime
=
etime
,
btime
=
btime
,
web_site
=
web_site
,
platform_type
=
platform_type
,
warehouse_code
=
warehouse_code
,
bailun_sku
=
bailun_sku
};
var
e_btime
=
DateTime
.
Now
.
AddDays
(-
8
).
ToDayHome
();
var
e_etime
=
DateTime
.
Now
.
AddDays
(-
1
).
ToDayEnd
();
if
(
search_data
.
btime
!=
null
)
{
e_btime
=
search_data
.
btime
.
Value
.
ToDayHome
();
}
if
(
search_data
.
etime
!=
null
)
{
e_etime
=
search_data
.
etime
.
Value
.
ToDayEnd
();
}
var
list
=
new
CashFlowServices
().
GetView
(
search_data
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"类型"
,
"汇总-发生"
,
"汇总-支付"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
var
col_this_date
=
e_etime
;
while
(
col_this_date
.
ToDayHome
()>
e_btime
.
ToDayHome
())
{
table
.
Columns
.
Add
(
$"
{
col_this_date
.
ToString
(
"MM-dd"
)}
-发生"
);
table
.
Columns
.
Add
(
$"
{
col_this_date
.
ToString
(
"MM-dd"
)}
-支付"
);
col_this_date
=
col_this_date
.
AddDays
(-
1
);
}
foreach
(
var
itemDataD
in
list
)
{
DataRow
row
=
table
.
NewRow
();
var
itemData
=
(
IDictionary
<
string
,
object
>)
itemDataD
;
row
[
"类型"
]
=
itemData
[
"date_type_str"
];
row
[
"汇总-发生"
]
=
itemData
[
"v_occur_汇总"
];
row
[
"汇总-支付"
]
=
itemData
[
"v_pay_汇总"
];
var
row_this_date
=
e_etime
;
while
(
row_this_date
.
ToDayHome
()
>
e_btime
.
ToDayHome
())
{
row
[
$"
{
row_this_date
.
ToString
(
"MM-dd"
)}
-发生"
]
=
itemData
[
"v_occur_"
+
$"
{
row_this_date
.
Month
}
-
{
row_this_date
.
Day
}
"
];
row
[
$"
{
row_this_date
.
ToString
(
"MM-dd"
)}
-支付"
]
=
itemData
[
"v_pay_"
+
$"
{
row_this_date
.
Month
}
-
{
row_this_date
.
Day
}
"
];
row_this_date
=
row_this_date
.
AddDays
(-
1
);
}
table
.
Rows
.
Add
(
row
);
}
var
fileName
=
AppContext
.
BaseDirectory
+
@"Result\RealtimeStock\现金流报表.csv"
;
DataTableHelper
.
SaveCSV
(
table
,
fileName
);
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
stream
.
CopyTo
(
memory
);
}
memory
.
Position
=
0
;
return
File
(
memory
,
"text/csv"
,
"现金流报表.csv"
);
}
public
FileResult
Export
(
DateTime
?
btime
,
DateTime
?
etime
,
string
bailun_sku
,
string
data_type
=
null
,
int
?
type
=
null
,
string
platform_type
=
null
,
string
warehouse_code
=
null
,
string
web_site
=
""
,
int
?
view_type
=
1
)
public
FileResult
Export
(
DateTime
?
btime
,
DateTime
?
etime
,
string
bailun_sku
,
string
data_type
=
null
,
int
?
type
=
null
,
string
platform_type
=
null
,
string
warehouse_code
=
null
,
string
web_site
=
""
,
int
?
view_type
=
1
)
{
{
var
m
=
new
dc_report_cash_flow_log_export_page_search_dto
var
m
=
new
dc_report_cash_flow_log_export_page_search_dto
...
@@ -140,6 +213,79 @@ namespace AutoTurnOver.Controllers
...
@@ -140,6 +213,79 @@ namespace AutoTurnOver.Controllers
}
}
public
FileResult
ExportSkuView
(
int
?
data_type
,
string
sku_label
,
string
bailun_sku
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
buyer_name
,
string
warehousecode
,
string
supplier_name
,
string
warehousetype
,
int
?
warehousearea
,
int
?
monitor_status
=
null
,
string
product_type
=
null
)
{
var
m
=
new
dc_report_cash_flow_sku_group_search_dto
{
bailun_sku
=
bailun_sku
,
page
=
1
,
rows
=
int
.
MaxValue
,
sidx
=
sort
,
sord
=
order
,
buyer_name
=
buyer_name
,
sku_label
=
string
.
IsNullOrWhiteSpace
(
sku_label
)
?
null
:
WebUtility
.
UrlDecode
(
sku_label
),
data_type
=
data_type
,
supplier_name
=
supplier_name
,
product_type
=
product_type
,
warehouse_code
=
warehousecode
,
monitor_status
=
monitor_status
,
warehousearea
=
warehousearea
,
warehousetype
=
warehousetype
};
var
services
=
new
CashFlowServices
();
var
list
=
services
.
SkuView
(
m
).
Items
;
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"sku"
,
"仓库编码"
,
"仓库名称"
,
"名称"
,
"累计值"
,
"本月结余"
,
"本月正数"
,
"本月负数"
,
"上月结余"
,
"上月正数"
,
"上月负数"
,
"采购员"
,
"可用库存"
,
"可用库存金额"
,
"在途数量"
,
"在途金额"
,
"7日日均"
,
"14日日均"
,
"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
.
warehouse_code
;
row
[
"仓库名称"
]
=
itemData
.
warehouse_name
;
row
[
"名称"
]
=
itemData
.
sku_name
;
row
[
"累计值"
]
=
itemData
.
balance
;
row
[
"本月结余"
]
=
itemData
.
current_balance
;
row
[
"本月正数"
]
=
itemData
.
current_income
;
row
[
"本月负数"
]
=
itemData
.
current_expend
;
row
[
"上月结余"
]
=
itemData
.
last_balance
;
row
[
"上月正数"
]
=
itemData
.
last_income
;
row
[
"上月负数"
]
=
itemData
.
last_expend
;
row
[
"采购员"
]
=
itemData
.
buyer_name
;
row
[
"可用库存"
]
=
itemData
.
usable_stock
;
row
[
"可用库存金额"
]
=
itemData
.
stock_amount
;
row
[
"在途数量"
]
=
itemData
.
on_the_way
;
row
[
"在途金额"
]
=
itemData
.
on_the_way_amount
;
row
[
"7日日均"
]
=
itemData
.
history_sevenday_sales
;
row
[
"14日日均"
]
=
itemData
.
history_fourteenday_sales
;
row
[
"30日日均"
]
=
itemData
.
history_thirtyday_sales
;
row
[
"停售状态"
]
=
itemData
.
sku_status
==
1
?
"停售"
:
"在售"
;
table
.
Rows
.
Add
(
row
);
}
var
fileName
=
AppContext
.
BaseDirectory
+
@"Result\RealtimeStock\现金流明细.csv"
;
DataTableHelper
.
SaveCSV
(
table
,
fileName
);
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
stream
.
CopyTo
(
memory
);
}
memory
.
Position
=
0
;
return
File
(
memory
,
"text/csv"
,
"现金流明细.csv"
);
}
[
HttpGet
]
[
HttpGet
]
public
JsonResult
LogPage
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
DateTime
?
btime
,
DateTime
?
etime
,
string
bailun_sku
,
string
data_type
=
null
,
int
?
type
=
null
,
string
platform_type
=
null
,
string
warehouse_code
=
null
,
string
web_site
=
""
,
int
?
view_type
=
1
)
public
JsonResult
LogPage
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
DateTime
?
btime
,
DateTime
?
etime
,
string
bailun_sku
,
string
data_type
=
null
,
int
?
type
=
null
,
string
platform_type
=
null
,
string
warehouse_code
=
null
,
string
web_site
=
""
,
int
?
view_type
=
1
)
{
{
...
...
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