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
608d31e4
Commit
608d31e4
authored
Jan 10, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
周转表锁定前3列,新增商品编码,新增汇总行
parent
e52b7484
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
21 deletions
+88
-21
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+56
-17
dc_auto_turnover.cs
AutoTurnOver.Models/dc_auto_turnover.cs
+5
-0
SkuAutoTurnServices.cs
AutoTurnOver.Services/SkuAutoTurnServices.cs
+2
-2
SkuAutoTurnController.cs
AutoTurnOver/Controllers/SkuAutoTurnController.cs
+25
-2
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
608d31e4
...
...
@@ -25,16 +25,43 @@ namespace AutoTurnOver.DB
/// <param name="order">排序类型</param>
/// <param name="sort">排序字段</param>
/// <returns></returns>
public
static
List
<
Models
.
dc_auto_turnover_Extend
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
public
static
List
<
Models
.
dc_auto_turnover_Extend
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
,
bool
isSum
=
false
)
{
try
{
var
sql
=
@"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2',t4.product_inner_code from dc_auto_turnover as dat
var
sql
=
""
;
if
(
isSum
)
{
sql
=
@"select
sum(dat.quantity_inventory) as 'quantity_inventory',
sum(dat.quantity_inventory) as 'quantity_out_stock',
sum(dat.quantity_purchase) as 'quantity_purchase',
sum(dat.quantity_transfer) as 'quantity_transfer',
sum(t2.oneday_sales) as 'oneday_sales',
sum(t2.forecast_oneday_sales) as 'forecast_oneday_sales2',
sum(dat.quantity_final_advise) as 'quantity_final_advise',
sum(dat.quantity_promotion) as 'quantity_promotion'
from dc_auto_turnover as dat
left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code
left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku
where 1=1 "
;
}
else
{
sql
=
@"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2',
t4.product_inner_code,t4.product_code from dc_auto_turnover as dat
left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code
left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku
where 1=1 "
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
product_code
))
{
sql
+=
" and t4.product_code like"
+
$"'%
{
m
.
product_code
}
%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
sku_name
))
{
sql
+=
" and dat.sku_title like"
+
$"'%
{
m
.
sku_name
}
%'"
;
...
...
@@ -74,31 +101,43 @@ where 1=1 ";
sql
+=
" and dat.status=1"
;
}
total
=
_connection
.
ExecuteScalar
<
int
>(
"select count(0) from ("
+
sql
+
") tb1"
);
//设置默认排序字段
if
(
string
.
IsNullOrWhiteSpace
(
sort
))
sort
=
"quantity_init_advise"
;
if
(!
string
.
IsNullOrEmpty
(
sort
))
if
(
isSum
)
{
total
=
0
;
}
else
{
sql
+=
" order by "
+
sort
;
total
=
_connection
.
ExecuteScalar
<
int
>(
"select count(0) from ("
+
sql
+
") tb1"
)
;
if
(!
string
.
IsNullOrEmpty
(
order
))
{
sql
+=
" "
+
order
;
}
else
//设置默认排序字段
if
(
string
.
IsNullOrWhiteSpace
(
sort
))
sort
=
"quantity_init_advise"
;
if
(!
string
.
IsNullOrEmpty
(
sort
))
{
sql
+=
" asc"
;
sql
+=
" order by "
+
sort
;
if
(!
string
.
IsNullOrEmpty
(
order
))
{
sql
+=
" "
+
order
;
}
else
{
sql
+=
" asc"
;
}
}
sql
+=
" limit "
+
offset
+
","
+
limit
;
}
var
obj
=
_connection
.
Query
<
Models
.
dc_auto_turnover_Extend
>(
sql
+
" limit "
+
offset
+
","
+
limit
);
var
obj
=
_connection
.
Query
<
Models
.
dc_auto_turnover_Extend
>(
sql
);
return
obj
.
AsList
();
}
catch
(
Exception
)
{
{
return
new
List
<
Models
.
dc_auto_turnover_Extend
>();
}
...
...
AutoTurnOver.Models/dc_auto_turnover.cs
View file @
608d31e4
...
...
@@ -240,6 +240,11 @@ namespace AutoTurnOver.Models
/// 商品中文名
/// </summary>
public
string
sku_name
{
get
;
set
;
}
/// <summary>
/// 商品编码
/// </summary>
public
string
product_code
{
get
;
set
;
}
}
public
class
dc_auto_turnover_Extend
:
dc_auto_turnover
...
...
AutoTurnOver.Services/SkuAutoTurnServices.cs
View file @
608d31e4
...
...
@@ -19,9 +19,9 @@ namespace AutoTurnOver.Services
/// <param name = "order" > 排序类型 </ param >
/// <param name="sort">排序字段</param>
/// <returns></returns>
public
List
<
dc_auto_turnover_Extend
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
public
List
<
dc_auto_turnover_Extend
>
List
(
Condition_AutoTurnOver
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
,
bool
isSum
=
false
)
{
return
DB
.
dc_auto_turnover
.
List
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
return
DB
.
dc_auto_turnover
.
List
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
,
isSum
);
}
#
region
特殊销售设置
...
...
AutoTurnOver/Controllers/SkuAutoTurnController.cs
View file @
608d31e4
...
...
@@ -27,7 +27,7 @@ namespace AutoTurnOver.Controllers
/// <param name="pagesize">每页记录数</param>
/// <returns></returns>
[
HttpGet
]
public
JsonResult
List
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
int
?
IsRedundant
,
int
?
IsStockOut
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
hasDefectConfig
,
string
product_inner_code
,
string
sku_name
)
public
JsonResult
List
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
int
?
IsRedundant
,
int
?
IsStockOut
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
hasDefectConfig
,
string
product_inner_code
,
string
sku_name
,
string
product_code
)
{
var
m
=
new
Condition_AutoTurnOver
{
...
...
@@ -39,7 +39,8 @@ namespace AutoTurnOver.Controllers
warehousearea
=
warehousearea
,
hasDefectConfig
=
hasDefectConfig
,
product_inner_code
=
product_inner_code
,
sku_name
=
sku_name
sku_name
=
sku_name
,
product_code
=
product_code
};
var
total
=
0
;
...
...
@@ -78,6 +79,28 @@ namespace AutoTurnOver.Controllers
});
}
public
JsonResult
ListSumFooter
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
int
?
IsRedundant
,
int
?
IsStockOut
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
hasDefectConfig
,
string
product_inner_code
,
string
sku_name
,
string
product_code
)
{
var
m
=
new
Condition_AutoTurnOver
{
bailun_sku
=
sku
,
out_of_stock
=
IsStockOut
,
redundancy
=
IsRedundant
,
warehouse_code
=
warehousecode
,
warehousetype
=
warehousetype
,
warehousearea
=
warehousearea
,
hasDefectConfig
=
hasDefectConfig
,
product_inner_code
=
product_inner_code
,
sku_name
=
sku_name
,
product_code
=
product_code
};
var
total
=
0
;
var
service
=
new
Services
.
SkuAutoTurnServices
();
var
list
=
service
.
List
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
,
true
);
return
new
JsonResult
(
list
[
0
]);
}
/// <summary>
/// 导出
/// </summary>
...
...
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