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 a259e141
authored
Jul 10, 2023
by
张晓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
已派工的pre状态工单可再次纳入分派
1 parent
6f6f6e9e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/BatchServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/BatchServiceImpl.java
View file @
a259e14
...
...
@@ -94,17 +94,35 @@ public class BatchServiceImpl implements BatchService {
" order by a.engineer_code asc"
;
int
engCount
=
jdbcTemplate
.
update
(
sqlEngineer
,
batchNo
,
groupId
);
// 未派过的工单
String
sqlOrder
=
"INSERT INTO dispatch_order (group_id, batch_no, order_id , x, y, expect_time_begin, expect_time_end, tags, priority , skills , take_time )\n"
+
" select a.org_group_id, ? , a.order_id, a.x, a.y , \n"
+
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , concat(a.brand, a.type, a.skill) skills , b.take_time \n"
+
" from order_request a left join product_category b on (a.brand=b.brand and a.type=b.type and a.skill=b.skill )\n"
+
" where a.org_group_id=? and status='OPEN' and appointment_status='NOT_ASSIGNED' and appointment_method like 'AUTO%' \n"
+
" and expect_time_begin between ? and ? \n"
+
" where a.org_group_id=? and a.status='OPEN' "
+
" and a.dt = ? "
+
" and appointment_status ='NOT_ASSIGNED' and appointment_method like 'AUTO%' \n"
+
" order by a.expect_time_begin asc "
;
int
orderCount
=
jdbcTemplate
.
update
(
sqlOrder
,
batchNo
,
groupId
,
batchDay
+
" 00:00:00"
,
batchDay
+
" 23:59:59"
);
jdbcTemplate
.
update
(
"update dispatch_batch set engineer_num=? , order_num=?, start_time=?, status='RUNNING' where group_id=? and batch_no=?"
,
engCount
,
orderCount
,
LocalDateTime
.
now
(),
groupId
,
batchNo
);
int
orderCount
=
jdbcTemplate
.
update
(
sqlOrder
,
batchNo
,
groupId
,
batchDay
);
// 已派过PRE状态还可以再次派
String
sqlOrderPre
=
"INSERT INTO dispatch_order (group_id, batch_no, order_id , x, y, expect_time_begin, expect_time_end, tags, priority , skills , take_time )\n"
+
" select a.org_group_id, ?, a.order_id, a.x, a.y , \n"
+
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , concat(a.brand, a.type, a.skill) skills , b.take_time \n"
+
" from order_request a "
+
" left join product_category b on (a.brand=b.brand and a.type=b.type and a.skill=b.skill )\n"
+
" left join order_appointment o on (a.order_id =o.order_id)\n"
+
" where a.org_group_id=? and a.status='OPEN' \n"
+
" and a.dt = ? "
+
" and a.appointment_status = 'ASSIGNED' and appointment_method like 'AUTO%' \n"
+
" and o.pre_status ='PRE' \n"
+
" order by a.expect_time_begin asc "
;
int
orderCountPre
=
jdbcTemplate
.
update
(
sqlOrderPre
,
batchNo
,
groupId
,
batchDay
);
jdbcTemplate
.
update
(
"update dispatch_batch set engineer_num=? , order_num=?, start_time=?, end_time=null, status='RUNNING' where group_id=? and batch_no=?"
,
engCount
,
orderCount
+
orderCountPre
,
LocalDateTime
.
now
(),
groupId
,
batchNo
);
log
.
info
(
"准备批次数据完成, groupId:{}, day:{}, batchNo:{}"
,
groupId
,
batchDay
,
batchNo
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
a259e14
...
...
@@ -6,6 +6,7 @@ import com.dituhui.pea.dispatch.constraint.DispatchConstraintProvider;
import
com.dituhui.pea.dispatch.dao.DispatchEngineerRepository
;
import
com.dituhui.pea.dispatch.dao.DispatchOrderRepository
;
import
com.dituhui.pea.dispatch.dao.OrgGroupRepository
;
import
com.dituhui.pea.dispatch.entity.DispatchOrder
;
import
com.dituhui.pea.dispatch.entity.OrgGroup
;
import
com.dituhui.pea.dispatch.pojo.*
;
import
com.dituhui.pea.dispatch.service.ExtractService
;
...
...
@@ -87,7 +88,11 @@ public class SolveServiceImpl implements SolveService {
// customerlist
ArrayList
<
Customer
>
customerList
=
new
ArrayList
<>();
dispatchOrderRepo
.
findByGroupIdAndBatchNo
(
groupId
,
batchNo
).
forEach
(
order
->
{
List
<
DispatchOrder
>
dispatchOrderList
=
dispatchOrderRepo
.
findByGroupIdAndBatchNo
(
groupId
,
batchNo
);
log
.
info
(
"组织问题对象, dispatchorder-list, groupId:{}, batchNo:{}, dispatchorder-size:{}"
,
groupId
,
batchNo
,
dispatchOrderList
.
size
());
dispatchOrderList
.
forEach
(
order
->
{
Location
location
=
new
Location
(
order
.
getId
(),
order
.
getOrderId
(),
"工单"
,
Double
.
parseDouble
(
order
.
getX
()),
Double
.
parseDouble
(
order
.
getY
()));
LocalDateTime
ldt1
=
dateToLocalDateTime
(
order
.
getExpectTimeBegin
());
...
...
@@ -101,6 +106,7 @@ public class SolveServiceImpl implements SolveService {
end
=
ldt2
.
getMinute
();
}
// 40分钟兜低(技能未能正确匹配原因)
if
(
null
==
order
.
getTakeTime
())
{
order
.
setTakeTime
(
40
);
...
...
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