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
bc3adbc4
Commit
bc3adbc4
authored
Jan 15, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改工单订单设备
parent
3c9b2b71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+73
-0
No files found.
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
bc3adbc4
...
...
@@ -974,4 +974,77 @@ Integer newMachineId1=newMachineId.intValue();
// }
}
public
void
editMachineOption
(
Chromosome
chromosome
,
Entry
operation
,
Long
newMachineId
,
GlobalParam
globalParam
)
{
List
<
Entry
>
allOperations
=
chromosome
.
getAllOperations
();
Map
<
Integer
,
Integer
>
opTimeMap
=
chromosome
.
getResult
().
stream
()
.
collect
(
Collectors
.
toMap
(
GAScheduleResult:
:
getOperationId
,
r
->
r
.
getStartTime
()
));
Integer
newMachineId1
=
newMachineId
.
intValue
();
int
opId
=
operation
.
getId
();
// 获取目标结果和工序
GAScheduleResult
targetResult
=
chromosome
.
getResult
().
stream
()
.
filter
(
r
->
r
.
getOperationId
()
==
opId
)
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
Entry
targetOp
=
allOperations
.
stream
()
.
filter
(
o
->
o
.
getId
()
==
opId
)
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
if
(
newMachineId1
!=
0
)
{
int
machineOptionIndex
=
targetOp
.
getMachineOptions
().
stream
()
.
map
(
MachineOption:
:
getMachineId
)
.
collect
(
Collectors
.
toList
())
.
indexOf
(
newMachineId
)
+
1
;
if
(
machineOptionIndex
==
0
)
{
throw
new
NoSuchElementException
(
"Machine not found: "
+
newMachineId
);
}
// 更新设备选择序列
int
globalOpIndex
=
chromosome
.
getGlobalOpList
().
stream
()
.
filter
(
g
->
g
.
getOp
().
getId
()
==
opId
)
.
findFirst
()
.
map
(
GlobalOperationInfo:
:
getGlobalOpId
)
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Global operation not found: "
+
opId
));
chromosome
.
getMachineSelection
().
set
(
globalOpIndex
,
machineOptionIndex
);
targetResult
.
setForcedMachineId
(
newMachineId
);
}
List
<
Integer
>
operationSequencing
=
allOperations
.
stream
()
.
sorted
((
op1
,
op2
)
->
{
int
time1
=
opTimeMap
.
getOrDefault
(
op1
.
getId
(),
Integer
.
MAX_VALUE
);
int
time2
=
opTimeMap
.
getOrDefault
(
op2
.
getId
(),
Integer
.
MAX_VALUE
);
if
(
time1
!=
time2
)
{
return
Integer
.
compare
(
time1
,
time2
);
}
else
{
return
Integer
.
compare
(
op1
.
getSequence
(),
op2
.
getSequence
());
}
})
.
map
(
Entry:
:
getGroupId
)
.
collect
(
Collectors
.
toList
());
chromosome
.
setOperationSequencing
(
operationSequencing
);
// 重新解码
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
}
}
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