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
751a4804
Commit
751a4804
authored
Mar 19, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购交期,遇到小数向上取整
parent
c4951d3e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
10 deletions
+65
-10
purchase_advise.cs
AutoTurnOver.DB/purchase_advise.cs
+16
-1
dc_auto_purchase_advise.cs
AutoTurnOver.Models/dc_auto_purchase_advise.cs
+2
-0
Program.cs
AutoTurnOver.Purchase.AverageTarget/Program.cs
+1
-1
PurchaseAverageTargetServices.cs
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
+4
-4
PurchaseAdviseController.cs
AutoTurnOver/Controllers/PurchaseAdviseController.cs
+42
-4
No files found.
AutoTurnOver.DB/purchase_advise.cs
View file @
751a4804
...
...
@@ -189,12 +189,27 @@ select
try
{
DynamicParameters
parameters
=
new
DynamicParameters
();
string
sql
=
""
;
if
(
m
.
isSum
)
{
sql
=
@"
select
var
sql
=
@"select t1.*,t2.warehouse_name,t3.sku_title_cn as 'sku_name',t4.create_time
from dc_auto_purchase_advise_detailed as t1
from dc_auto_purchase_advise_detailed as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_auto_purchase_advise as t4 on t1.main_id = t4.id
where 1=1 "
;
}
else
{
sql
=
@"
select t1.*,t2.warehouse_name,t3.sku_title_cn as 'sku_name',t4.create_time from dc_auto_purchase_advise_detailed as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_auto_purchase_advise as t4 on t1.main_id = t4.id
where 1=1 "
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
m
.
product_inner_code
))
{
...
...
AutoTurnOver.Models/dc_auto_purchase_advise.cs
View file @
751a4804
...
...
@@ -215,6 +215,8 @@ namespace AutoTurnOver.Models
public
string
supplier_name
{
get
;
set
;
}
public
string
product_inner_code
{
get
;
set
;
}
public
bool
isSum
{
get
;
set
;
}
}
}
AutoTurnOver.Purchase.AverageTarget/Program.cs
View file @
751a4804
...
...
@@ -20,7 +20,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
{
Console
.
WriteLine
(
"采购平均值计算任务启动..."
);
// 创建采购计划
//PurchaseA
dviseServices.Generate();
//PurchaseA
verageTargetServices.Calculation();
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
{
...
...
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
View file @
751a4804
...
...
@@ -53,7 +53,7 @@ namespace AutoTurnOver.Services
var
purchaseList
=
AveragePurchase
.
GetPurchaseList
(
skuItem
,
_seed_count
).
ToList
();
//有相关采购单 (有不止一个单,才算平均数)
if
(
purchaseList
!=
null
&&
purchaseList
.
Select
(
s
=>
s
.
purchase_id
).
Distinct
().
Count
()
>
1
)
if
(
purchaseList
!=
null
&&
purchaseList
.
Select
(
s
=>
s
.
purchase_id
).
Distinct
().
Count
()
>
1
)
{
data
.
supplier_name
=
purchaseList
[
0
].
supplier_name
;
...
...
@@ -71,11 +71,11 @@ namespace AutoTurnOver.Services
if
(
tempPurchase
.
pay_type
==
1
)
{
delivery_days
+=
(
int
)
(
itemArrivalList
.
Min
(
s
=>
s
.
update_time
)
-
tempPurchase
.
pay_time
).
Value
.
TotalDays
;
delivery_days
+=
(
int
)
Math
.
Ceiling
((
itemArrivalList
.
Min
(
s
=>
s
.
update_time
)
-
tempPurchase
.
pay_time
).
Value
.
TotalHours
/
24
)
;
}
else
{
delivery_days
+=
(
int
)
(
itemArrivalList
.
Min
(
s
=>
s
.
update_time
)
-
tempPurchase
.
confirm_time
).
Value
.
TotalDays
;
delivery_days
+=
(
int
)
Math
.
Ceiling
((
itemArrivalList
.
Min
(
s
=>
s
.
update_time
)
-
tempPurchase
.
confirm_time
).
Value
.
TotalDays
/
24
)
;
}
}
...
...
@@ -156,7 +156,7 @@ namespace AutoTurnOver.Services
conn
.
Update
(
task_log
);
}
public
static
IEnumerable
<
dc_average_purchase
>
GetListByWCode
(
string
sku
,
string
warehouse_code
)
public
static
IEnumerable
<
dc_average_purchase
>
GetListByWCode
(
string
sku
,
string
warehouse_code
)
{
return
AveragePurchase
.
GetListByWCode
(
sku
,
warehouse_code
);
}
...
...
AutoTurnOver/Controllers/PurchaseAdviseController.cs
View file @
751a4804
...
...
@@ -61,7 +61,7 @@ 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
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
)
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
{
...
...
@@ -90,6 +90,44 @@ namespace AutoTurnOver.Controllers
}
/// <summary>
/// 采购建议列表
/// </summary>
/// <param name="limit"></param>
/// <param name="offset"></param>
/// <param name="has_push"></param>
/// <param name="sort"></param>
/// <param name="end_date"></param>
/// <param name="start_date"></param>
/// <returns></returns>
[
HttpGet
]
public
string
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
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
{
main_id
=
main_id
,
sku
=
sku
,
warehouse_code
=
warehousecode
,
end_date
=
end_date
,
start_date
=
start_date
,
warehousearea
=
warehousearea
,
warehousetype
=
warehousetype
,
ispush
=
ispush
,
type
=
type
,
supplier_name
=
supplier_name
,
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
isSum
=
true
};
var
total
=
0
;
var
list
=
PurchaseAdviseServices
.
DetailList
(
m
,
offset
,
limit
,
ref
total
);
return
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_auto_purchase_advise_detailed_dto
()
:
list
[
0
]).
ToJson
(
true
);
}
/// <summary>
/// 导出实时库存
/// </summary>
/// <param name="sku"></param>
...
...
@@ -195,12 +233,12 @@ namespace AutoTurnOver.Controllers
var
total
=
0
;
var
list
=
PurchaseAdviseServices
.
DetailList
(
m
,
0
,
int
.
MaxValue
,
ref
total
);
foreach
(
var
item
in
list
.
GroupBy
(
s
=>
s
.
type
))
foreach
(
var
item
in
list
.
GroupBy
(
s
=>
s
.
type
))
{
PurchaseAdviseServices
.
PushBuySys
(
item
.
ToList
(),
item
.
Key
);
}
return
new
JsonResult
(
new
{
success
=
true
...
...
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