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
c4392fab
Commit
c4392fab
authored
Apr 03, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常提醒页面新增 建议下单次数字段
parent
32b696fe
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
132 additions
and
19 deletions
+132
-19
Program.cs
AutoGeneratePurchaseAdvise/Program.cs
+1
-1
dc_auto_forecast_fluctuation.cs
AutoTurnOver.DB/dc_auto_forecast_fluctuation.cs
+10
-2
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+6
-6
purchase_advise.cs
AutoTurnOver.DB/purchase_advise.cs
+12
-1
dc_auto_forecast_fluctuation.cs
AutoTurnOver.Models/dc_auto_forecast_fluctuation.cs
+7
-0
dc_auto_purchase_advise.cs
AutoTurnOver.Models/dc_auto_purchase_advise.cs
+4
-0
ExceptionReminderServices.cs
AutoTurnOver.Services/ExceptionReminderServices.cs
+1
-1
ExceptionReminderController.cs
AutoTurnOver/Controllers/ExceptionReminderController.cs
+63
-0
PurchaseAdviseController.cs
AutoTurnOver/Controllers/PurchaseAdviseController.cs
+28
-8
No files found.
AutoGeneratePurchaseAdvise/Program.cs
View file @
c4392fab
...
...
@@ -12,7 +12,7 @@ namespace AutoGeneratePurchaseAdvise
{
Console
.
WriteLine
(
"采购建议计算任务启动..."
);
// 创建采购计划
PurchaseAdviseServices
.
Generate
();
//
PurchaseAdviseServices.Generate();
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
{
services
.
AddHostedService
<
GeneratePurchaseAdviseBackgroundService
>();
...
...
AutoTurnOver.DB/dc_auto_forecast_fluctuation.cs
View file @
c4392fab
...
...
@@ -14,7 +14,7 @@ namespace AutoTurnOver.DB
/// <param name="sku"></param>
/// <param name="warehouse_code"></param>
/// <returns></returns>
public
static
IEnumerable
<
AutoTurnOver
.
Models
.
dc_auto_forecast_fluctuation
>
List
(
dc_auto_forecast_fluctuation_search_dto
data
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
public
static
IEnumerable
<
AutoTurnOver
.
Models
.
dc_auto_forecast_fluctuation
_dto
>
List
(
dc_auto_forecast_fluctuation_search_dto
data
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
var
sql
=
@"
select t1.* from dc_auto_forecast_fluctuation as t1
...
...
@@ -99,7 +99,15 @@ where 1 = 1
}
}
var
obj
=
_connection
.
Query
<
Models
.
dc_auto_forecast_fluctuation
>(
sql
+
" limit "
+
offset
+
","
+
limit
,
parameters
);
var
obj
=
_connection
.
Query
<
Models
.
dc_auto_forecast_fluctuation_dto
>(
sql
+
" limit "
+
offset
+
","
+
limit
,
parameters
);
if
(
obj
!=
null
)
{
foreach
(
var
item
in
obj
)
{
item
.
purchase_advise_count
=
_connection
.
QuerySingleOrDefault
<
int
>(
" select count(1) from dc_auto_purchase_advise_detailed where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku "
,
new
{
item
.
warehouse_code
,
item
.
bailun_sku
});
}
}
return
obj
.
AsList
();
}
...
...
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
c4392fab
...
...
@@ -101,8 +101,8 @@ where 1=1 ";
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
product_code
))
{
sql
+=
" and t4.product_code
like"
+
$"'%
{
m
.
product_code
}
%
'"
;
sqlCount
+=
" and t4.product_code
like"
+
$"'%
{
m
.
product_code
}
%
'"
;
sql
+=
" and t4.product_code
="
+
$"'
{
m
.
product_code
}
'"
;
sqlCount
+=
" and t4.product_code
="
+
$"'
{
m
.
product_code
}
'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
sku_name
))
{
...
...
@@ -111,8 +111,8 @@ where 1=1 ";
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
product_inner_code
))
{
sql
+=
" and t4.product_inner_code
like "
+
$"'%
{
m
.
product_inner_code
}
%
'"
;
sqlCount
+=
" and t4.product_inner_code
like "
+
$"'%
{
m
.
product_inner_code
}
%
'"
;
sql
+=
" and t4.product_inner_code
= "
+
$"'
{
m
.
product_inner_code
}
'"
;
sqlCount
+=
" and t4.product_inner_code
= "
+
$"'
{
m
.
product_inner_code
}
'"
;
}
if
(
m
.
hasDefectConfig
==
true
)
{
...
...
@@ -136,8 +136,8 @@ where 1=1 ";
}
if
(!
string
.
IsNullOrEmpty
(
m
.
bailun_sku
))
{
sql
+=
" and dat.bailun_sku
like '%"
+
m
.
bailun_sku
+
"%
'"
;
sqlCount
+=
" and dat.bailun_sku
like '%"
+
m
.
bailun_sku
+
"%
'"
;
sql
+=
" and dat.bailun_sku
= '"
+
m
.
bailun_sku
+
"
'"
;
sqlCount
+=
" and dat.bailun_sku
= '"
+
m
.
bailun_sku
+
"
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
m
.
warehouse_code
))
...
...
AutoTurnOver.DB/purchase_advise.cs
View file @
c4392fab
...
...
@@ -237,7 +237,8 @@ where 1=1 ";
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
product_inner_code
))
{
sql
+=
" and t3.product_inner_code="
+
m
.
product_inner_code
;
sql
+=
" and t3.product_inner_code=@product_inner_code "
;
parameters
.
Add
(
"product_inner_code"
,
m
.
product_inner_code
);
}
if
(
m
.
type
!=
null
)
{
...
...
@@ -292,6 +293,16 @@ where 1=1 ";
sql
+=
" and t3.buyer_name =@buyer_name "
;
parameters
.
Add
(
"buyer_name"
,
m
.
purchase_user
);
}
if
(
m
.
quantity_final_advise_price_min
>
0
)
{
sql
+=
" and (t3.unit_price * t1.quantity_final_advise)>=@quantity_final_advise_price_min "
;
parameters
.
Add
(
"quantity_final_advise_price_min"
,
m
.
quantity_final_advise_price_min
);
}
if
(
m
.
quantity_final_advise_price_max
>
0
)
{
sql
+=
" and (t3.unit_price * t1.quantity_final_advise)<=@quantity_final_advise_price_max "
;
parameters
.
Add
(
"quantity_final_advise_price_max"
,
m
.
quantity_final_advise_price_max
);
}
if
(
m
.
is_multiple_warehouse
)
{
...
...
AutoTurnOver.Models/dc_auto_forecast_fluctuation.cs
View file @
c4392fab
...
...
@@ -79,6 +79,13 @@ namespace AutoTurnOver.Models
public
decimal
avg_sales_three
{
get
;
set
;
}
}
public
class
dc_auto_forecast_fluctuation_dto
:
dc_auto_forecast_fluctuation
{
/// <summary>
/// 出过采购建议的数量
/// </summary>
public
int
purchase_advise_count
{
get
;
set
;
}
}
public
class
dc_auto_forecast_fluctuation_search_dto
{
public
string
sku
{
get
;
set
;
}
...
...
AutoTurnOver.Models/dc_auto_purchase_advise.cs
View file @
c4392fab
...
...
@@ -254,6 +254,10 @@ namespace AutoTurnOver.Models
/// 是否是同区多仓的sku
/// </summary>
public
bool
is_multiple_warehouse
{
get
;
set
;
}
public
decimal
?
quantity_final_advise_price_min
{
get
;
set
;
}
public
decimal
?
quantity_final_advise_price_max
{
get
;
set
;
}
}
}
AutoTurnOver.Services/ExceptionReminderServices.cs
View file @
c4392fab
...
...
@@ -10,7 +10,7 @@ namespace AutoTurnOver.Services
/// </summary>
public
class
ExceptionReminderServices
{
public
IEnumerable
<
dc_auto_forecast_fluctuation
>
List
(
dc_auto_forecast_fluctuation_search_dto
data
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
public
IEnumerable
<
dc_auto_forecast_fluctuation
_dto
>
List
(
dc_auto_forecast_fluctuation_search_dto
data
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
return
DB
.
dc_auto_forecast_fluctuation
.
List
(
data
,
offset
,
limit
,
ref
total
,
order
,
sort
);
}
...
...
AutoTurnOver/Controllers/ExceptionReminderController.cs
View file @
c4392fab
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
AutoTurnOver.Common
;
...
...
@@ -40,6 +42,67 @@ namespace AutoTurnOver.Controllers
});
}
public
FileResult
Export
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
has_overdue
=
null
,
bool
?
has_confirm
=
null
,
bool
?
has_solve
=
null
,
int
?
err_type
=
null
)
{
var
m
=
new
dc_auto_forecast_fluctuation_search_dto
{
sku
=
sku
,
warehouse_code
=
warehousecode
,
has_overdue
=
has_overdue
,
has_confirm
=
has_confirm
,
has_solve
=
has_solve
,
warehousetype
=
warehousetype
,
warehousearea
=
warehousearea
,
err_type
=
err_type
};
var
total
=
0
;
var
service
=
new
Services
.
ExceptionReminderServices
();
var
list
=
service
.
List
(
m
,
0
,
int
.
MaxValue
,
ref
total
,
order
,
sort
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"建议下单次数"
,
"Sku"
,
"仓库编码"
,
"仓库名称"
,
"最近3日日均"
,
"异常类型"
,
"开始时间"
,
"结束时间"
,
"是否确认"
,
"确认人"
,
"预计解决时间"
,
"处理方案"
,
"是否解决"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"建议下单次数"
]
=
itemData
.
purchase_advise_count
;
row
[
"Sku"
]
=
itemData
.
bailun_sku
;
row
[
"仓库编码"
]
=
itemData
.
warehouse_code
;
row
[
"仓库名称"
]
=
itemData
.
warehouse_name
;
row
[
"最近3日日均"
]
=
itemData
.
avg_sales_three
;
row
[
"异常类型"
]
=
itemData
.
bailun_sku
;
row
[
"开始时间"
]
=
itemData
.
typeStr
;
row
[
"结束时间"
]
=
itemData
.
end_time
;
row
[
"是否确认"
]
=
itemData
.
has_confirm
==
1
?
"是"
:
"否"
;
row
[
"确认人"
]
=
itemData
.
bl_operator
;
row
[
"预计解决时间"
]
=
itemData
.
forecast_solve_time
;
row
[
"处理方案"
]
=
itemData
.
remark
;
row
[
"是否解决"
]
=
itemData
.
has_solve
==
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"
);
}
/// <summary>
/// 异常提醒详情
/// </summary>
...
...
AutoTurnOver/Controllers/PurchaseAdviseController.cs
View file @
c4392fab
...
...
@@ -61,7 +61,8 @@ namespace AutoTurnOver.Controllers
[
HttpGet
]
public
string
DetailList
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
string
order
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
)
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
{
...
...
@@ -77,7 +78,9 @@ namespace AutoTurnOver.Controllers
supplier_name
=
supplier_name
,
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
is_multiple_warehouse
=
is_multiple_warehouse
.
Value
is_multiple_warehouse
=
is_multiple_warehouse
.
Value
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
};
var
total
=
0
;
...
...
@@ -103,7 +106,8 @@ namespace AutoTurnOver.Controllers
[
HttpGet
]
public
JsonResult
DetailListSumFooter
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
...
...
@@ -121,7 +125,9 @@ namespace AutoTurnOver.Controllers
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
isSum
=
true
,
is_multiple_warehouse
=
is_multiple_warehouse
is_multiple_warehouse
=
is_multiple_warehouse
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
};
var
total
=
0
;
...
...
@@ -136,7 +142,11 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public
FileResult
Export
(
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
ispush
=
null
,
bool
is_multiple_warehouse
=
false
)
public
FileResult
Export
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
{
...
...
@@ -148,7 +158,14 @@ namespace AutoTurnOver.Controllers
warehousearea
=
warehousearea
,
warehousetype
=
warehousetype
,
ispush
=
ispush
,
is_multiple_warehouse
=
is_multiple_warehouse
type
=
type
,
supplier_name
=
supplier_name
,
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
isSum
=
false
,
is_multiple_warehouse
=
is_multiple_warehouse
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
};
var
total
=
0
;
...
...
@@ -266,7 +283,8 @@ namespace AutoTurnOver.Controllers
/// <returns></returns>
public
JsonResult
PushBuySys
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
string
order
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
)
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
)
{
try
{
...
...
@@ -284,7 +302,9 @@ namespace AutoTurnOver.Controllers
supplier_name
=
supplier_name
,
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
is_multiple_warehouse
=
is_multiple_warehouse
.
Value
is_multiple_warehouse
=
is_multiple_warehouse
.
Value
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
};
var
total
=
0
;
...
...
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