Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.APSJ
Project
Project
Details
Activity
Releases
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
佟礼
HYH.APSJ
Commits
5330e8fc
Commit
5330e8fc
authored
Jan 26, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公共分页和list查询修改,设备字段修改
parent
c0f28f4f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
433 additions
and
173 deletions
+433
-173
ScheduleResultController1.java
...in/java/com/aps/controller/ScheduleResultController1.java
+0
-166
RoutingDataService.java
...in/java/com/aps/service/Algorithm/RoutingDataService.java
+26
-3
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+407
-4
No files found.
src/main/java/com/aps/controller/ScheduleResultController1.java
deleted
100644 → 0
View file @
c0f28f4f
package
com
.
aps
.
controller
;
import
com.aps.common.util.R
;
import
com.aps.entity.Gantt.PlanResourceTaskGanttVO1
;
import
com.aps.entity.Gantt.SimpleEquipinfo1
;
import
com.aps.entity.Mpsplannedorder
;
import
com.aps.entity.RoutingDetail
;
import
com.aps.entity.RoutingDetailEquip
;
import
com.aps.entity.RoutingHeader
;
import
com.aps.entity.ScheduledTask
;
import
com.aps.entity.Equipinfo
;
import
com.aps.service.ScheduleService
;
import
com.aps.service.MpsplannedorderService
;
import
com.aps.service.RoutingHeaderService
;
import
com.aps.service.RoutingDetailService
;
import
com.aps.service.RoutingDetailEquipService
;
import
com.aps.service.EquipinfoService
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.responses.ApiResponse
;
import
io.swagger.v3.oas.annotations.responses.ApiResponses
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"/ganttest"
)
@Tag
(
name
=
"甘特图"
,
description
=
"甘特图相关API"
)
public
class
ScheduleResultController1
{
@Autowired
private
ScheduleService
schedulerService
;
@Autowired
private
MpsplannedorderService
orderService
;
@Autowired
private
RoutingHeaderService
processService
;
@Autowired
private
RoutingDetailService
operationService
;
@Autowired
private
RoutingDetailEquipService
operationEquipService
;
@Autowired
private
EquipinfoService
equipmentService
;
@GetMapping
(
"/resourcetest"
)
@Operation
(
summary
=
"资源甘特图"
,
description
=
"获取资源甘特图数据"
)
@ApiResponses
({
@ApiResponse
(
responseCode
=
"200"
,
description
=
"成功返回甘特图数据"
),
@ApiResponse
(
responseCode
=
"500"
,
description
=
"内部服务器错误"
)
})
public
R
<
PlanResourceTaskGanttVO1
>
runScheduling
()
{
try
{
// 获取routingid为'SY1102507-0056202车间-21号线'和'SY1102507-0060202车间-21号线'的待调度工单
List
<
Mpsplannedorder
>
orders
=
orderService
.
lambdaQuery
()
.
in
(
Mpsplannedorder:
:
getRoutingid
,
"SY1102507-0056202车间-21号线"
,
"SY1102507-0060202车间-21号线"
)
.
list
();
if
(
orders
.
isEmpty
())
{
// 当没有订单时,返回空的甘特图VO
PlanResourceTaskGanttVO1
ganttVO
=
new
PlanResourceTaskGanttVO1
()
.
setResources
(
new
ArrayList
<>())
.
setEarliestTaskStartTime
(
LocalDateTime
.
of
(
2025
,
6
,
1
,
0
,
0
,
0
))
.
setLastTaskAssignmentTime
(
LocalDateTime
.
of
(
2025
,
12
,
1
,
0
,
0
,
0
));
return
R
.
ok
(
ganttVO
);
}
// 提取所需的工艺ID列表
Set
<
String
>
routingIds
=
orders
.
stream
()
.
map
(
Mpsplannedorder:
:
getRoutingid
)
.
collect
(
Collectors
.
toSet
());
// 根据工单获取相关工艺
List
<
RoutingHeader
>
processes
=
processService
.
lambdaQuery
()
.
in
(
RoutingHeader:
:
getCode
,
routingIds
)
.
list
();
if
(
processes
.
isEmpty
())
{
return
R
.
failed
(
"未找到相关工艺信息"
);
}
// 提取工艺ID用于后续查询
Set
<
Integer
>
processIds
=
processes
.
stream
()
.
map
(
RoutingHeader:
:
getId
)
.
collect
(
Collectors
.
toSet
());
// 根据工艺获取相关工序
List
<
RoutingDetail
>
operations
=
operationService
.
lambdaQuery
()
.
in
(
RoutingDetail:
:
getRoutingHeaderId
,
processIds
)
.
orderByAsc
(
RoutingDetail:
:
getTaskSeq
)
.
list
();
if
(
operations
.
isEmpty
())
{
return
R
.
failed
(
"未找到相关工序信息"
);
}
// 提取工序ID用于后续查询
Set
<
Long
>
operationIds
=
operations
.
stream
()
.
map
(
RoutingDetail:
:
getId
)
.
collect
(
Collectors
.
toSet
());
// 获取相关工序设备关系
List
<
RoutingDetailEquip
>
operationEquipments
=
operationEquipService
.
lambdaQuery
()
.
in
(
RoutingDetailEquip:
:
getRoutingDetailId
,
operationIds
)
.
list
();
if
(
operationEquipments
.
isEmpty
())
{
return
R
.
failed
(
"未找到工序设备关系信息"
);
}
// 提取设备ID用于后续查询
Set
<
Long
>
equipmentIds
=
operationEquipments
.
stream
()
.
map
(
RoutingDetailEquip:
:
getEquipId
)
.
collect
(
Collectors
.
toSet
());
// 获取相关设备
List
<
Equipinfo
>
equipments
=
equipmentService
.
lambdaQuery
()
.
in
(
Equipinfo:
:
getId
,
equipmentIds
)
.
list
();
// 添加空值检查
if
(
orders
==
null
||
processes
==
null
||
operations
==
null
||
operationEquipments
==
null
||
equipments
==
null
)
{
return
R
.
failed
(
"获取调度数据失败,存在空数据"
);
}
List
<
ScheduledTask
>
result
=
schedulerService
.
scheduleOrders
(
orders
,
processes
,
operations
,
operationEquipments
,
equipments
);
// 转换设备信息为简要信息,并关联相关任务
List
<
SimpleEquipinfo1
>
simpleEquipinfos
=
equipments
.
stream
()
.
map
(
equip
->
{
// 查找与该设备关联的任务
List
<
ScheduledTask
>
equipTasks
=
result
.
stream
()
.
filter
(
task
->
task
.
getEquipId
()
!=
null
&&
task
.
getEquipId
().
equals
(
equip
.
getId
()))
.
collect
(
Collectors
.
toList
());
return
new
SimpleEquipinfo1
()
.
setId
(
equip
.
getId
())
.
setEquipId
(
equip
.
getEquipId
())
.
setEquipName
(
equip
.
getEquipName
())
.
setTasks
(
equipTasks
);
})
.
collect
(
Collectors
.
toList
());
// 设置甘特图VO的最早时间为2025年6月1日,最晚时间为2025年12月1日
PlanResourceTaskGanttVO1
ganttVO
=
new
PlanResourceTaskGanttVO1
()
.
setResources
(
simpleEquipinfos
)
.
setEarliestTaskStartTime
(
LocalDateTime
.
of
(
2025
,
6
,
1
,
0
,
0
,
0
))
.
setLastTaskAssignmentTime
(
LocalDateTime
.
of
(
2025
,
12
,
1
,
0
,
0
,
0
));
return
R
.
ok
(
ganttVO
);
}
catch
(
Exception
e
)
{
return
R
.
failed
(
"调度执行失败: "
+
e
.
getMessage
());
}
}
}
\ No newline at end of file
src/main/java/com/aps/service/Algorithm/RoutingDataService.java
View file @
5330e8fc
...
@@ -304,7 +304,6 @@ public class RoutingDataService {
...
@@ -304,7 +304,6 @@ public class RoutingDataService {
machine
.
setCode
(
""
);
machine
.
setCode
(
""
);
machine
.
setName
(
""
);
machine
.
setName
(
""
);
machines
.
add
(
machine
);
machines
.
add
(
machine
);
}
}
...
@@ -360,7 +359,7 @@ public class RoutingDataService {
...
@@ -360,7 +359,7 @@ public class RoutingDataService {
Equipinfo
equipinfo
=
equipinfoList
.
stream
()
Equipinfo
equipinfo
=
equipinfoList
.
stream
()
.
filter
(
t
->
t
.
getId
().
equals
(
PlanResource
.
getReferenceId
()))
.
filter
(
t
->
t
.
getId
().
equals
(
PlanResource
.
getReferenceId
()))
.
findFirst
().
orElse
(
null
);
.
findFirst
().
orElse
(
null
);
machine
.
setDepartment
(
PlanResource
.
getDepartTitle
());
if
(
equipinfo
!=
null
)
if
(
equipinfo
!=
null
)
{
{
machine
.
setCode
(
equipinfo
.
getEquipId
());
machine
.
setCode
(
equipinfo
.
getEquipId
());
...
@@ -408,6 +407,30 @@ public class RoutingDataService {
...
@@ -408,6 +407,30 @@ public class RoutingDataService {
}
}
}
else
{
}
else
{
for
(
Machine
machine
:
machines
)
{
for
(
Machine
machine
:
machines
)
{
PlanResource
PlanResource
=
PlanResources
.
stream
()
.
filter
(
t
->
t
.
getId
()
==
machine
.
getId
())
.
findFirst
().
orElse
(
null
);
if
(
PlanResource
!=
null
)
{
Equipinfo
equipinfo
=
equipinfoList
.
stream
()
.
filter
(
t
->
t
.
getId
().
equals
(
PlanResource
.
getReferenceId
()))
.
findFirst
().
orElse
(
null
);
machine
.
setDepartment
(
PlanResource
.
getDepartTitle
());
if
(
equipinfo
!=
null
)
{
machine
.
setCode
(
equipinfo
.
getEquipId
());
machine
.
setName
(
equipinfo
.
getEquipName
());
}
else
{
machine
.
setCode
(
PlanResource
.
getReferenceCode
());
machine
.
setName
(
PlanResource
.
getTitle
());
}
}
List
<
Shift
>
shifts1
=
new
ArrayList
<>();
List
<
Shift
>
shifts1
=
new
ArrayList
<>();
Shift
shift
=
new
Shift
();
Shift
shift
=
new
Shift
();
shift
.
setMachineId
(
machine
.
getId
());
shift
.
setMachineId
(
machine
.
getId
());
...
@@ -488,7 +511,7 @@ public class RoutingDataService {
...
@@ -488,7 +511,7 @@ public class RoutingDataService {
Equipinfo
equipinfo
=
equipinfoList
.
stream
()
Equipinfo
equipinfo
=
equipinfoList
.
stream
()
.
filter
(
t
->
t
.
getId
().
equals
(
resource
.
getReferenceId
()))
.
filter
(
t
->
t
.
getId
().
equals
(
resource
.
getReferenceId
()))
.
findFirst
().
orElse
(
null
);
.
findFirst
().
orElse
(
null
);
machine
.
setDepartment
(
resource
.
getDepartTitle
());
if
(
equipinfo
!=
null
)
if
(
equipinfo
!=
null
)
{
{
machine
.
setCode
(
equipinfo
.
getEquipId
());
machine
.
setCode
(
equipinfo
.
getEquipId
());
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
5330e8fc
This diff is collapsed.
Click to expand it.
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