Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c42cce5c
authored
Jul 12, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_dispatch_op0712' into 'develop'
修改 See merge request !220
2 parents
06396a98
bccb35e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
c42cce5
...
@@ -87,22 +87,45 @@ public class OrderAssignCheck {
...
@@ -87,22 +87,45 @@ public class OrderAssignCheck {
log
.
info
(
"插入位置为第{}单"
,
index
);
log
.
info
(
"插入位置为第{}单"
,
index
);
// 计算距离 & 时间
// 计算距离 & 时间
if
(
index
==
0
)
{
if
(
index
==
0
&&
orderSegments
.
isEmpty
()
)
{
// 第一订单为出发地
// 第一订单为出发地
, 没有其他订单
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
OrderSegment
post
=
orderSegments
.
get
(
1
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
()));
OrderSegment
pre
=
new
OrderSegment
(
480
,
post
.
getStart
(),
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
()));
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
// 最早可插入位置为技术员出发时间+行程时间
int
startPos
=
pre
.
getEnd
()
+
p
.
getDuration
();
int
startInsert
=
(
startPos
>=
start
)
?
startPos
:
start
;
// 客户期望最早时间是start, 可最早插入时间是startPos
int
endInsert
=
startInsert
+
takeTime
;
LocalDateTime
startDateTime
=
this
.
point2LocalDateTime
(
startInsert
,
order
.
getDt
());
LocalDateTime
endDateTime
=
this
.
point2LocalDateTime
(
endInsert
,
order
.
getDt
());
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
);
}
else
if
(
index
==
0
&&
!
orderSegments
.
isEmpty
())
{
// 第一订单为出发地, 且有其他订单
EngineerBusiness
b
=
engineerBusinessMPDao
.
getByEngineerCode
(
engineerCode
);
OrderSegment
post
=
orderSegments
.
get
(
0
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
Double
.
parseDouble
(
b
.
getX
()),
Double
.
parseDouble
(
b
.
getY
()));
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
}
}
else
if
(
index
==
orderSegments
.
size
())
{
else
if
(
index
==
orderSegments
.
size
())
{
// 最后一个订单出发
// 最后一个订单出发
OrderSegment
pre
=
orderSegments
.
get
(
index
);
OrderSegment
pre
=
orderSegments
.
get
(
index
);
// 为当前订单
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
OrderSegment
post
=
new
OrderSegment
(
start
,
end
,
Double
.
parseDouble
(
order
.
getX
()),
Double
.
parseDouble
(
order
.
getY
()));
// 最早可插入位置为技术员上一单出发时间+行程时间
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
int
startPos
=
pre
.
getEnd
()
+
p
.
getDuration
();
int
startInsert
=
(
startPos
>=
start
)
?
startPos
:
start
;
// 客户期望最早时间是start, 可最早插入时间是startPos
int
endInsert
=
startInsert
+
takeTime
;
LocalDateTime
startDateTime
=
this
.
point2LocalDateTime
(
startInsert
,
order
.
getDt
());
LocalDateTime
endDateTime
=
this
.
point2LocalDateTime
(
endInsert
,
order
.
getDt
());
return
new
Result
(
true
,
"success"
,
0
,
0
,
startDateTime
,
endDateTime
);
}
else
{
}
else
{
OrderSegment
pre
=
orderSegments
.
get
(
index
);
OrderSegment
pre
=
orderSegments
.
get
(
index
-
1
);
OrderSegment
post
=
orderSegments
.
get
(
index
+
1
);
OrderSegment
post
=
orderSegments
.
get
(
index
);
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
return
this
.
getResult
(
curX
,
curY
,
pre
,
post
,
takeTime
,
order
.
getDt
());
}
}
}
}
...
@@ -194,6 +217,7 @@ public class OrderAssignCheck {
...
@@ -194,6 +217,7 @@ public class OrderAssignCheck {
long
duration
=
distance
/
(
19
*
1000
/
60
);
// 时间为分钟,假设电动车速度为19km/h
long
duration
=
distance
/
(
19
*
1000
/
60
);
// 时间为分钟,假设电动车速度为19km/h
return
new
Pair
((
int
)
distance
,
(
int
)
duration
);
return
new
Pair
((
int
)
distance
,
(
int
)
duration
);
}
}
}
}
@Data
@Data
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment