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
8fa4eff6
Commit
8fa4eff6
authored
Feb 07, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bom
parent
159ecfb7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
36 deletions
+36
-36
Entry.java
src/main/java/com/aps/entity/basic/Entry.java
+6
-6
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+4
-4
Initialization.java
src/main/java/com/aps/service/Algorithm/Initialization.java
+3
-3
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+18
-18
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+5
-5
No files found.
src/main/java/com/aps/entity/basic/Entry.java
View file @
8fa4eff6
...
...
@@ -27,20 +27,20 @@ public class Entry {
/**
* 基因编号
*/
p
ublic
int
id
;
p
rivate
int
id
;
/**
* 所属组ID 需要按照前后顺序生产的工单给一组
*/
p
ublic
int
G
roupId
;
p
rivate
int
g
roupId
;
/**
* 原订单ID
*/
p
ublic
String
O
rderId
;
p
rivate
String
o
rderId
;
p
ublic
String
O
rderCode
;
p
rivate
String
o
rderCode
;
p
ublic
String
S
ceneId
;
p
rivate
String
s
ceneId
;
private
Integer
routingId
;
private
String
routingCode
;
private
String
routingName
;
...
...
@@ -113,7 +113,7 @@ public class Entry {
/**
* 所需物料
*/
p
ublic
List
<
OrderMaterialRequirement
>
M
aterialRequirements
;
// 所需物料
p
rivate
List
<
OrderMaterialRequirement
>
m
aterialRequirements
;
// 所需物料
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
8fa4eff6
...
...
@@ -224,7 +224,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int
scheduledCount1
=
scheduledCount
;
List
<
Entry
>
allOperations
=
chromosome
.
getAllOperations
();
Entry
entry
=
allOperations
.
stream
()
.
filter
(
t
->
t
.
GroupId
==
num
&&
t
.
getSequence
()==
scheduledCount1
)
.
filter
(
t
->
t
.
getGroupId
()
==
num
&&
t
.
getSequence
()==
scheduledCount1
)
.
findFirst
().
orElse
(
null
);
if
(
entry
!=
null
&&
entry
.
getDependentOnOrderIds
().
size
()>
0
)
{
...
...
@@ -255,7 +255,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
}
int
scheduledCount1
=
scheduledCount
;
Entry
entry
=
allOperations
.
stream
()
.
filter
(
t
->
t
.
GroupId
==
orderid
&&
t
.
getSequence
()==
scheduledCount1
)
.
filter
(
t
->
t
.
getGroupId
()
==
orderid
&&
t
.
getSequence
()==
scheduledCount1
)
.
findFirst
().
orElse
(
null
);
if
(
entry
!=
null
&&
entry
.
getDependentOnOrderIds
().
size
()>
0
)
{
...
...
@@ -704,7 +704,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
if
(
FsOperations
!=
null
&&
FsOperations
.
size
()
>
0
)
{
for
(
OperationDependency
opid
:
FsOperations
)
{
List
<
GAScheduleResult
>
prevOperations
=
chromosome
.
getResult
().
stream
()
.
filter
(
t
->
t
.
getGroupId
()
==
currentOp
.
GroupId
&&
t
.
getOperationId
()
==
opid
.
getPrevOperationId
())
.
filter
(
t
->
t
.
getGroupId
()
==
currentOp
.
getGroupId
()
&&
t
.
getOperationId
()
==
opid
.
getPrevOperationId
())
.
collect
(
Collectors
.
toList
());
//多台
for
(
GAScheduleResult
prevOp
:
prevOperations
)
{
//加上后处理时间
...
...
@@ -722,7 +722,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
for
(
OperationDependency
opid
:
SSOperations
)
{
List
<
GAScheduleResult
>
prevOperations
=
chromosome
.
getResult
().
stream
()
.
filter
(
t
->
t
.
getGroupId
()
==
currentOp
.
GroupId
&&
t
.
getOperationId
()
==
opid
.
getPrevOperationId
())
.
filter
(
t
->
t
.
getGroupId
()
==
currentOp
.
getGroupId
()
&&
t
.
getOperationId
()
==
opid
.
getPrevOperationId
())
.
collect
(
Collectors
.
toList
());
//多台
for
(
GAScheduleResult
prevOp
:
prevOperations
)
{
newScheduleResult
.
add
(
prevOp
);
...
...
src/main/java/com/aps/service/Algorithm/Initialization.java
View file @
8fa4eff6
...
...
@@ -154,7 +154,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
if
(
optionalMachines
==
null
||
optionalMachines
.
size
()==
0
)
{
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
OrderCode
+
":"
+
op
.
getSequence
());
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
getOrderCode
()
+
":"
+
op
.
getSequence
());
}
...
...
@@ -237,7 +237,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
if
(
optionalMachines
==
null
||
optionalMachines
.
size
()==
0
)
{
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
OrderCode
+
":"
+
op
.
getSequence
());
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
getOrderCode
()
+
":"
+
op
.
getSequence
());
}
...
...
@@ -308,7 +308,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
List
<
MachineOption
>
optionalMachines
=
op
.
getMachineOptions
();
if
(
optionalMachines
==
null
||
optionalMachines
.
size
()==
0
)
{
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
OrderCode
+
":"
+
op
.
getSequence
());
throw
new
RuntimeException
(
"工序没有设置设备"
+
op
.
getOrderCode
()
+
":"
+
op
.
getSequence
());
}
int
randomSeq
=
rnd
.
nextInt
(
optionalMachines
.
size
())
+
1
;
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
8fa4eff6
...
...
@@ -73,7 +73,7 @@ int newStartTime=0;
.
filter
(
o
->
o
.
getId
()
==
targetopId
)
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
targetopId
));
int
GroupId
=
targetOp1
.
GroupId
;
int
GroupId
=
targetOp1
.
getGroupId
()
;
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
GroupId
))
// 过滤出值为1的索引
.
skip
(
targetOp1
.
Sequence
-
1
)
// 跳过第一个匹配项
...
...
@@ -120,12 +120,12 @@ int newStartTime=0;
if
(
targetopId
!=
0
)
{
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
getGroupId
()
))
// 过滤出值为1的索引
.
skip
(
targetOp
.
Sequence
-
1
)
// 跳过第一个匹配项
.
findFirst
();
// 取第二个匹配项
int
targetOpIndex
=
OperationIndex
.
getAsInt
();
opsIndexs
.
add
(
targetOpIndex
);
ordersIds
.
add
(
targetOp
.
GroupId
);
ordersIds
.
add
(
targetOp
.
getGroupId
()
);
List
<
Entry
>
targetOp2s
=
allOperations
.
stream
()
.
filter
(
o
->
o
.
getGroupId
()
==
targetOp
.
getGroupId
()
&&
o
.
getSequence
()
>
targetOp
.
getSequence
()).
collect
(
Collectors
.
toList
());
...
...
@@ -134,14 +134,14 @@ int newStartTime=0;
{
for
(
Entry
targetOp4:
targetOp2s
)
{
OptionalInt
OperationIndex1
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
getGroupId
()
))
// 过滤出值为1的索引
.
skip
(
targetOp4
.
Sequence
-
1
)
// 跳过第一个匹配项
.
findFirst
();
// 取第二个匹配项
int
targetOpIndex2
=
OperationIndex1
.
getAsInt
();
if
(
targetOpIndex2
<
targetopIndex1
)
//后面的工序位置比目标位置靠前
{
//后面的工序也要往后挪
opsIndexs
.
add
(
targetOpIndex2
);
ordersIds
.
add
(
targetOp
.
GroupId
);
ordersIds
.
add
(
targetOp
.
getGroupId
()
);
}
}
}
...
...
@@ -187,7 +187,7 @@ int newStartTime=0;
}
}
int
GroupId
=
targetOp1
.
GroupId
;
int
GroupId
=
targetOp1
.
getGroupId
()
;
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
GroupId
))
// 过滤出值为1的索引
.
skip
(
targetOp1
.
Sequence
-
1
)
// 跳过第一个匹配项
...
...
@@ -609,7 +609,7 @@ if(targetOp.getSequence()>1) {
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
// 找到原来的组和父子级
GroupResult
groupResult
=
OperatRels
.
get
(
targetOp
.
GroupId
-
1
);
GroupResult
groupResult
=
OperatRels
.
get
(
targetOp
.
getGroupId
()
-
1
);
List
<
NodeInfo
>
nodeInfoList
=
groupResult
.
getNodeInfoList
();
NodeInfo
Oprel
=
nodeInfoList
.
stream
()
...
...
@@ -618,7 +618,7 @@ if(targetOp.getSequence()>1) {
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
int
targetGroupIndex
=
targetOp
.
GroupId
-
1
;
int
targetGroupIndex
=
targetOp
.
getGroupId
()
-
1
;
List
<
Integer
>
newParentIds
=
Oprel
.
getNewParentIds
();
List
<
Integer
>
newChildIds
=
Oprel
.
getNewChildIds
();
//记录新的工序ID和数量
...
...
@@ -655,7 +655,7 @@ if(targetOp.getSequence()>1) {
int
machineSeq
=
index
.
orElse
(
0
)+
1
;
List
<
Integer
>
OperationSequencing
=
chromosome
.
getOperationSequencing
();
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
getGroupId
()
))
// 过滤出值为1的索引
.
skip
(
targetOp
.
Sequence
-
1
)
// 跳过第一个匹配项
.
findFirst
();
// 取第二个匹配项
int
targetOpIndex
=
OperationIndex
.
getAsInt
()+
1
;
...
...
@@ -912,7 +912,7 @@ if(targetOp.getSequence()>1) {
List
<
Integer
>
OperationSequencing
=
chromosome
.
getOperationSequencing
();
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
getGroupId
()
))
// 过滤出值为1的索引
.
skip
(
entry
.
Sequence
-
1
)
// 跳过第一个匹配项
.
findFirst
();
int
targetOpIndex
=
OperationIndex
.
getAsInt
()+
1
;
...
...
@@ -961,7 +961,7 @@ if(targetOp.getSequence()>1) {
.
collect
(
Collectors
.
toList
());
int
GroupId
=
0
;
for
(
Entry
entry
:
sourceOps
)
{
GroupId
=
entry
.
GroupId
;
GroupId
=
entry
.
getGroupId
()
;
OptionalInt
index
=
IntStream
.
range
(
0
,
allOperations
.
size
())
.
filter
(
h
->
entry
.
getId
()==
allOperations
.
get
(
h
).
getId
())
.
findFirst
();
...
...
@@ -975,7 +975,7 @@ if(targetOp.getSequence()>1) {
chromosome
.
getMachineSelection
().
remove
((
int
)
index1
.
orElse
(
0
));
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
getGroupId
()
))
// 过滤出值为1的索引
.
findFirst
();
int
targetOpIndex
=
OperationIndex
.
getAsInt
();
OperationSequencing
.
remove
((
int
)
targetOpIndex
);
...
...
@@ -1033,10 +1033,10 @@ if(targetOp.getSequence()>1) {
List
<
Entry
>
entrys
=
allOperations
.
stream
()
.
filter
(
o
->
o
.
GroupId
==
targetOp
.
GroupId
)
.
filter
(
o
->
o
.
getGroupId
()
==
targetOp
.
getGroupId
()
)
.
collect
(
Collectors
.
toList
());
//当前组的
GroupResult
groupResult
=
OperatRels
.
get
(
targetOp
.
GroupId
-
1
);
GroupResult
groupResult
=
OperatRels
.
get
(
targetOp
.
getGroupId
()
-
1
);
List
<
NodeInfo
>
nodeInfoList
=
groupResult
.
getNodeInfoList
();
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
...
...
@@ -1108,8 +1108,8 @@ if(targetOp.getSequence()>1) {
List
<
Integer
>
OperationSequencing
=
chromosome
.
getOperationSequencing
();
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
GroupId
))
// 过滤出值为1的索引
.
skip
(
targetOp
.
Sequence
-
1
)
// 跳过第一个匹配项
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
targetOp
.
getGroupId
()
))
// 过滤出值为1的索引
.
skip
(
targetOp
.
getSequence
()
-
1
)
// 跳过第一个匹配项
.
findFirst
();
chromosome
.
getOperationSequencing
().
remove
((
int
)
OperationIndex
.
getAsInt
());
...
...
@@ -1168,7 +1168,7 @@ if(targetOp.getSequence()>1) {
.
collect
(
Collectors
.
toList
());
int
GroupId
=
0
;
for
(
Entry
entry
:
sourceOps
)
{
GroupId
=
entry
.
GroupId
;
GroupId
=
entry
.
getGroupId
()
;
OptionalInt
index
=
IntStream
.
range
(
0
,
allOperations
.
size
())
.
filter
(
h
->
entry
.
getId
()==
allOperations
.
get
(
h
).
getId
())
.
findFirst
();
...
...
@@ -1182,7 +1182,7 @@ if(targetOp.getSequence()>1) {
chromosome
.
getMachineSelection
().
remove
((
int
)
index1
.
orElse
(
0
));
OptionalInt
OperationIndex
=
IntStream
.
range
(
0
,
OperationSequencing
.
size
())
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
GroupId
))
// 过滤出值为1的索引
.
filter
(
i
->
OperationSequencing
.
get
(
i
).
equals
(
entry
.
getGroupId
()
))
// 过滤出值为1的索引
.
findFirst
();
int
targetOpIndex
=
OperationIndex
.
getAsInt
();
OperationSequencing
.
remove
((
int
)
targetOpIndex
);
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
8fa4eff6
...
...
@@ -39,7 +39,7 @@ public class PlanResultServiceTest {
// TestSortService sortService=new TestSortService();
// sortService.test1();
// nsgaiiUtils.Test();
planResultService
.
execute2
(
"921BC266191E4812A105E406BF91E812"
);
//
planResultService.execute2("921BC266191E4812A105E406BF91E812");
// planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D");
// planResultService.execute2("726D4C1A712B4B1393175BD44B775B66");
...
...
@@ -51,10 +51,10 @@ public class PlanResultServiceTest {
// planResultService.Redecode("27065EA0ECD14A81B7FAAFEF52273F93");
// planResultService.Redecode("921BC266191E4812A105E406BF91E812");
// planResultService.Drag("27065EA0ECD14A81B7FAAFEF52273F93",opids,6,false,0l);
//
MaintenanceWindow maintenanceWindow=new MaintenanceWindow();
// maintenanceWindow.setStartTime(LocalDateTime.of(2026, 2, 4
, 0, 0, 0));
// maintenanceWindow.setEndTime(LocalDateTime.of(2025, 2, 5
, 0, 0, 0));
// planResultService.AddMaintenanceWindow("00E0C5D3E4AD4F36B56C39395906618D",2492
l,maintenanceWindow);
MaintenanceWindow
maintenanceWindow
=
new
MaintenanceWindow
();
maintenanceWindow
.
setStartTime
(
LocalDateTime
.
of
(
2026
,
9
,
13
,
0
,
0
,
0
));
maintenanceWindow
.
setEndTime
(
LocalDateTime
.
of
(
2025
,
9
,
19
,
0
,
0
,
0
));
planResultService
.
AddMaintenanceWindow
(
"5475E00B844847ACB6DC20227967BA2F"
,
2488
l
,
maintenanceWindow
);
// // planResultService.DelOperation("B6AE363FF5044DDF8DECE32D5FE0F7EA",7);
// planResultService.SpiltOrder("A41D662EE0764D008173C5A0E42B15F6","5f9d5383-b89a-4a4f-8805-2f617c711968",new Double[]{500d, 500d});
...
...
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