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
4fd980d4
Commit
4fd980d4
authored
Jan 15, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
aaffccff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Program.cs
AutoGeneratePurchaseAdvise/Program.cs
+1
-0
purchase_advise.cs
AutoTurnOver.DB/purchase_advise.cs
+16
-3
No files found.
AutoGeneratePurchaseAdvise/Program.cs
View file @
4fd980d4
...
@@ -36,6 +36,7 @@ namespace AutoGeneratePurchaseAdvise
...
@@ -36,6 +36,7 @@ namespace AutoGeneratePurchaseAdvise
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(4);
//purchase_advise.ReplaceLogistics(DateTime.Now, "935619301", "MMDUKFBA");
//purchase_advise.ReplaceLogistics(DateTime.Now, "935619301", "MMDUKFBA");
//PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")));
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
AutoTurnOver.DB/purchase_advise.cs
View file @
4fd980d4
...
@@ -50,6 +50,8 @@ namespace AutoTurnOver.DB
...
@@ -50,6 +50,8 @@ namespace AutoTurnOver.DB
// 寻找有没有满足条件的物流方案
// 寻找有没有满足条件的物流方案
foreach
(
var
item
in
ouDatas
)
foreach
(
var
item
in
ouDatas
)
{
{
try
{
// 查询物流方案
// 查询物流方案
var
logisticsDatas
=
ApiUtility
.
GetFilterLogisticsAssignLineList
(
new
Models
.
ApiDto
.
api_logistic_query_input_dto
()
var
logisticsDatas
=
ApiUtility
.
GetFilterLogisticsAssignLineList
(
new
Models
.
ApiDto
.
api_logistic_query_input_dto
()
{
{
...
@@ -61,10 +63,10 @@ namespace AutoTurnOver.DB
...
@@ -61,10 +63,10 @@ namespace AutoTurnOver.DB
if
(
logisticsDatas
!=
null
&&
logisticsDatas
.
Count
>=
1
)
if
(
logisticsDatas
!=
null
&&
logisticsDatas
.
Count
>=
1
)
{
{
// 查询最快的物流渠道
// 查询最快的物流渠道
var
avgs
=
ApiUtility
.
GetLmsOrderTransferAvg
(
new
Models
.
ApiDto
.
api_lms_order_transfer_sku_requst_dto
{
warehouse_code
=
item
.
warehouse_code
,
country
=
item
.
country_code
,
logistics_code
=
string
.
Join
(
","
,
logisticsDatas
.
Select
(
s
=>
s
.
Line_Code
))
}).
Where
(
s
=>
s
.
avg_put_days
!=
null
).
ToList
();
var
avgs
=
ApiUtility
.
GetLmsOrderTransferAvg
(
new
Models
.
ApiDto
.
api_lms_order_transfer_sku_requst_dto
{
warehouse_code
=
item
.
warehouse_code
,
country
=
item
.
country_code
,
logistics_code
=
string
.
Join
(
","
,
logisticsDatas
.
Select
(
s
=>
s
.
Line_Code
))
}).
Where
(
s
=>
s
.
avg_put_days
!=
null
).
ToList
();
if
(
avgs
!=
null
)
if
(
avgs
!=
null
)
{
{
var
selectItem
=
avgs
.
Where
(
s
=>
s
.
avg_put_days
!=
null
).
Where
(
s
=>
s
.
avg_put_days
+
s
.
avg_sign_days
<=
item
.
surplus_allocation_days
).
OrderByDescending
(
s
=>
s
.
avg_sign_days
+
s
.
avg_put_days
).
FirstOrDefault
();
var
selectItem
=
avgs
.
Where
(
s
=>
s
.
avg_put_days
!=
null
).
Where
(
s
=>
s
.
avg_put_days
+
s
.
avg_sign_days
<=
item
.
surplus_allocation_days
).
OrderByDescending
(
s
=>
s
.
avg_sign_days
+
s
.
avg_put_days
).
FirstOrDefault
();
// 有时效符合条件的物流可用
// 有时效符合条件的物流可用
if
(
selectItem
!=
null
)
if
(
selectItem
!=
null
)
{
{
...
@@ -83,7 +85,7 @@ namespace AutoTurnOver.DB
...
@@ -83,7 +85,7 @@ namespace AutoTurnOver.DB
remarks
+=
" 未配置 "
;
remarks
+=
" 未配置 "
;
}
}
remarks
+=
$" \n 默认时效 调拨天数:
{
item
.
transfer_delivery
}
, 入库天数:
{
item
.
abroad_inbound_delivery
}
预计入库:
{
DateTime
.
Now
.
AddDays
(
item
.
payment_before_delivery
+
item
.
inspection_delivery
+
item
.
supplier_delivery
+
(
int
)
Math
.
Round
(
item
.
transfer_delivery
)
+
(
int
)
Math
.
Round
(
item
.
abroad_inbound_delivery
,
0
)).
ToString
(
"yyyy-MM-dd"
)}
"
;
remarks
+=
$" \n 默认时效 调拨天数:
{
item
.
transfer_delivery
}
, 入库天数:
{
item
.
abroad_inbound_delivery
}
预计入库:
{
DateTime
.
Now
.
AddDays
(
item
.
payment_before_delivery
+
item
.
inspection_delivery
+
item
.
supplier_delivery
+
(
int
)
Math
.
Round
(
item
.
transfer_delivery
)
+
(
int
)
Math
.
Round
(
item
.
abroad_inbound_delivery
,
0
)).
ToString
(
"yyyy-MM-dd"
)}
"
;
remarks
+=
$" \n 当前推荐物流平均时效 调拨天数:
{
Math
.
Round
(
selectItem
.
avg_sign_days
)}
, 入库天数:
{
Math
.
Round
(
selectItem
.
avg_put_days
.
Value
,
0
)}
\n 预计入库 :
{
DateTime
.
Now
.
AddDays
(
item
.
payment_before_delivery
+
item
.
inspection_delivery
+
item
.
supplier_delivery
+
(
int
)
Math
.
Round
(
selectItem
.
avg_sign_days
)
+
(
int
)
Math
.
Round
(
selectItem
.
avg_put_days
.
Value
,
0
)).
ToString
(
"yyyy-MM-dd"
)}
"
;
remarks
+=
$" \n 当前推荐物流平均时效 调拨天数:
{
Math
.
Round
(
selectItem
.
avg_sign_days
)}
, 入库天数:
{
Math
.
Round
(
selectItem
.
avg_put_days
.
Value
,
0
)}
\n 预计入库 :
{
DateTime
.
Now
.
AddDays
(
item
.
payment_before_delivery
+
item
.
inspection_delivery
+
item
.
supplier_delivery
+
(
int
)
Math
.
Round
(
selectItem
.
avg_sign_days
)
+
(
int
)
Math
.
Round
(
selectItem
.
avg_put_days
.
Value
,
0
)).
ToString
(
"yyyy-MM-dd"
)}
"
;
_connection
.
Insert
(
new
dc_auto_replace_logistics_task
_connection
.
Insert
(
new
dc_auto_replace_logistics_task
{
{
bailun_sku
=
item
.
bailun_sku
,
bailun_sku
=
item
.
bailun_sku
,
...
@@ -108,6 +110,17 @@ namespace AutoTurnOver.DB
...
@@ -108,6 +110,17 @@ namespace AutoTurnOver.DB
}
}
}
}
}
}
catch
(
Exception
ex
)
{
_connection
.
Insert
(
new
dc_task_error_log
{
date
=
DateTime
.
Now
,
message
=
item
.
ToJson
()
+
" --- "
+
ex
.
Message
,
stack_trace
=
ex
.
StackTrace
,
task_name
=
"空运切换异常"
});
}
}
}
}
...
...
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