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
f003b349
Commit
f003b349
authored
Jan 09, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jdt' of
http://39.100.78.207:1213/tongli/hyh.apsj
into jdt
parents
ebfcf137
da07192c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
21 deletions
+48
-21
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+1
-1
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+1
-1
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+4
-4
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+39
-13
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+3
-2
No files found.
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
f003b349
...
...
@@ -292,7 +292,7 @@ public class GeneticAlgorithm {
GeneticDecoder
decoder
=
new
GeneticDecoder
(
_GlobalParam
,
param
.
getBaseTime
(),
machines
,
orders
,
materials
,
machineScheduler
,
orderMaterials
);
if
(
population
!=
null
&&
population
.
size
()>
0
)
{
population
.
forEach
(
chromosome
->
{
population
.
parallelStream
().
forEach
(
chromosome
->
{
chromosome
.
setResult
(
new
ArrayList
<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
f003b349
...
...
@@ -70,7 +70,7 @@ public class GeneticDecoder {
FileHelper
.
writeLogFile
(
"解码-----------开始-------"
+
chromosome
.
getID
()+
":"
+
cacheKey
);
_allOperations
=
chromosome
.
getAllOperations
();
if
(
orderMaterials
!=
null
&&
orderMaterials
.
size
()>
0
)
{
if
(
orderMaterials
!=
null
&&
orderMaterials
.
size
()>
0
&&
_globalParam
.
isIsCheckSf
()
)
{
CreateNewOpSequence
(
chromosome
);
}
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
f003b349
...
...
@@ -189,9 +189,6 @@ public class MachineCalculator {
LocalDateTime
shiftStart
=
shift
.
getStart
();
LocalDateTime
shiftEnd
=
shift
.
getEnd
();
// 计算有效时间
LocalDateTime
effectiveStart
=
st
.
isAfter
(
shiftStart
)
?
st
:
shiftStart
;
long
availableSeconds
=
ChronoUnit
.
SECONDS
.
between
(
effectiveStart
,
shiftEnd
);
...
...
@@ -237,7 +234,10 @@ i++;
boolean
requireContinuous
)
{
List
<
TimeSegment
>
availableSegments
=
new
ArrayList
<>();
LocalDateTime
current
=
start
;
if
(
requiredMinutes
>
3600
*
3999
)
{
int
i
=
0
;
}
// 预先排序设备可用片段,避免后续遍历混乱
List
<
TimeSegment
>
allUseTimeSegment
=
machine
.
getAvailability
().
stream
()
.
filter
(
slot
->
!
slot
.
isUsed
()
&&
slot
.
getType
()
!=
SegmentType
.
MAINTENANCE
)
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
f003b349
...
...
@@ -12,6 +12,7 @@ import org.springframework.context.annotation.ScopeMetadata;
import
javax.xml.transform.Result
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
...
...
@@ -695,11 +696,12 @@ Integer newMachineId1=newMachineId.intValue();
ScheduleResults
.
remove
(
OperationIndex1
.
getAsInt
());
}
int
i
=
0
;
for
(
GlobalOperationInfo
globalOp
:
globalOpList
)
{
globalOp
.
setGlobalOpId
(
i
);
i
++;
}
AtomicInteger
globalOpId
=
new
AtomicInteger
(
0
);
globalOpList
.
forEach
(
t
->
{
t
.
setGlobalOpId
(
globalOpId
.
getAndIncrement
());
});
// chromosome.getOperatRel().remove(GroupId-1);
orders
.
remove
(
sourceorder
);
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
...
...
@@ -741,6 +743,7 @@ Integer newMachineId1=newMachineId.intValue();
GroupResult
groupResult
=
OperatRels
.
get
(
targetOp
.
GroupId
-
1
);
List
<
NodeInfo
>
nodeInfoList
=
groupResult
.
getNodeInfoList
();
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
nodeInfoList
=
groupResult
.
getNodeInfoList
();
for
(
Entry
entry
:
entrys
)
{
...
...
@@ -780,16 +783,27 @@ Integer newMachineId1=newMachineId.intValue();
if
(
info
!=
null
)
{
info
.
setSequence
(
node
.
getGroupSerial
());
info
.
setOp
(
entry
);
}
}
else
{
if
(
StringUtils
.
isBlank
(
entry
.
getMainId
()
))
{
if
(
entry
.
getMainId
()!=
null
&&!
entry
.
getMainId
().
equals
(
""
))
{
//拆分的工序数量补齐到其他的
Entry
main
=
entrys
.
stream
().
filter
(
t
->
t
.
MainId
==
entry
.
getMain
Id
())
filter
(
t
->
t
.
MainId
.
equals
(
entry
.
getMainId
())
&&
t
.
getId
()!=
entry
.
get
Id
())
.
findFirst
()
.
orElse
(
null
);
if
(
main
!=
null
)
{
main
.
setQuantity
(
main
.
getQuantity
()
+
entry
.
getQuantity
());
GlobalOperationInfo
operationInfo
=
globalOpList
.
stream
()
.
filter
(
i
->
i
.
getOp
().
getId
()
==
main
.
getId
())
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Global operation not found: "
+
entry
.
getId
()));
operationInfo
.
setOp
(
main
);
}
}
...
...
@@ -804,7 +818,6 @@ Integer newMachineId1=newMachineId.intValue();
chromosome
.
getOperationSequencing
().
remove
(
OperationIndex
.
getAsInt
());
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
int
globalOpIndex
=
IntStream
.
range
(
0
,
globalOpList
.
size
())
.
filter
(
i
->
globalOpList
.
get
(
i
).
getOp
().
getId
()
==
opId
)
...
...
@@ -815,6 +828,15 @@ Integer newMachineId1=newMachineId.intValue();
chromosome
.
getMachineSelection
().
remove
(
globalOpIndex
);
globalOpList
.
remove
(
globalOpIndex
);
AtomicInteger
globalOpId
=
new
AtomicInteger
(
0
);
globalOpList
.
forEach
(
t
->
{
t
.
setGlobalOpId
(
globalOpId
.
getAndIncrement
());
});
List
<
Entry
>
operations
=
chromosome
.
getAllOperations
();
IntStream
.
range
(
0
,
operations
.
size
())
...
...
@@ -877,11 +899,15 @@ Integer newMachineId1=newMachineId.intValue();
ScheduleResults
.
remove
(
OperationIndex1
.
getAsInt
());
}
int
i
=
0
;
for
(
GlobalOperationInfo
globalOp
:
globalOpList
)
{
globalOp
.
setGlobalOpId
(
i
);
i
++;
}
AtomicInteger
globalOpId
=
new
AtomicInteger
(
0
);
globalOpList
.
forEach
(
t
->
{
t
.
setGlobalOpId
(
globalOpId
.
getAndIncrement
());
});
// chromosome.getOperatRel().remove(GroupId-1);
orders
.
remove
(
sourceorder
);
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
f003b349
...
...
@@ -38,17 +38,18 @@ public class PlanResultServiceTest {
// nsgaiiUtils.Test();
//planResultService.execute2("C5FB5EF2A7334A0A92F826F4937E1008");
//
planResultService.execute2("F79370487E4C455B8C4CF9BA41541CA9");
//
planResultService.execute2("F79370487E4C455B8C4CF9BA41541CA9");
// LocalDateTime t= LocalDateTime.of(2025, 11, 15, 6, 51, 11);
// List<Integer> opids=new ArrayList<>();
// opids.add(1);
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",opids,t,3403L);
//
planResultService.Redecode("B6AE363FF5044DDF8DECE32D5FE0F7EA");
//
planResultService.Redecode("B6AE363FF5044DDF8DECE32D5FE0F7EA");
// MaintenanceWindow maintenanceWindow=new MaintenanceWindow();
// maintenanceWindow.setStartTime(LocalDateTime.of(2025, 10, 21, 0, 0, 0));
// maintenanceWindow.setEndTime(LocalDateTime.of(2025, 10, 31, 0, 0, 0));
// planResultService.AddMaintenanceWindow("B6AE363FF5044DDF8DECE32D5FE0F7EA",1245l,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