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
31d2cb46
Commit
31d2cb46
authored
May 12, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bom
parent
b1b2a85e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
873 additions
and
783 deletions
+873
-783
GlobalParam.java
src/main/java/com/aps/entity/basic/GlobalParam.java
+1
-1
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+149
-408
GeneticDecoderBom.java
...ain/java/com/aps/service/Algorithm/GeneticDecoderBom.java
+323
-107
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+54
-40
MaterialRequirementService.java
...com/aps/service/Algorithm/MaterialRequirementService.java
+342
-223
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+1
-1
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+1
-1
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+2
-2
No files found.
src/main/java/com/aps/entity/basic/GlobalParam.java
View file @
31d2cb46
...
...
@@ -42,7 +42,7 @@ public class GlobalParam {
/// <summary>
/// 是否全局倒排
/// </summary>
private
boolean
isJit
=
tru
e
;
private
boolean
isJit
=
fals
e
;
private
boolean
_smoothSetup
=
false
;
// 设置时间平滑 工序的前处理是否提前
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
31d2cb46
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/Algorithm/GeneticDecoderBom.java
View file @
31d2cb46
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
31d2cb46
...
...
@@ -76,7 +76,7 @@ public class MachineCalculator {
public
Map
<
Integer
,
Object
>
CreateScheduleResult
(
Machine
machine
,
Entry
operation
,
int
processingTime
,
int
proposedStartTime
,
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments
,
double
oneTime
,
double
quantity
,
boolean
isInterrupt
,
int
changeOvertTime
,
boolean
changeOverInWeek
,
int
setupStartTime
,
boolean
isJit
)
{
,
boolean
isInterrupt
,
int
changeOvertTime
,
boolean
changeOverInWeek
,
int
setupStartTime
,
boolean
is
lockMachineTime
,
boolean
is
Jit
)
{
LocalDateTime
startTime
=
baseTime
.
plus
(
proposedStartTime
,
ChronoUnit
.
SECONDS
);
...
...
@@ -167,7 +167,7 @@ public class MachineCalculator {
times
=
CaldScheduleResult
(
machine
,
operation
,
processingTime
,
startTime
,
timeSegments
,
oneTime
,
quantity
,
isJit
timeSegments
,
oneTime
,
quantity
,
is
lockMachineTime
,
is
Jit
);
}
else
{
...
...
@@ -238,7 +238,7 @@ public class MachineCalculator {
.
collect
(
Collectors
.
toCollection
(
CopyOnWriteArrayList:
:
new
));
times
=
CaldScheduleResult
(
machine
,
operation
,
processingTime
,
startTime
,
timeSegments1
,
oneTime
,
quantity
,
isJit
);
timeSegments1
,
oneTime
,
quantity
,
is
lockMachineTime
,
is
Jit
);
}
else
{
double
e
=
(
double
)
processingTime
/
slot
.
getEfficiency
();
...
...
@@ -285,6 +285,18 @@ public class MachineCalculator {
CopyOnWriteArrayList
<
ScheduleResultDetail
>
times
=
new
CopyOnWriteArrayList
<>();
if
(
operation
.
getQuantity
()==
0
)
{
ScheduleResultDetail
time
=
new
ScheduleResultDetail
();
time
.
setKey
(
""
);
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
currentTime
));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
currentTime
));
time
.
setOneTime
(
oneTime
);
time
.
setQuantity
(
quantity
);
times
.
add
(
time
);
return
times
;
}
TimeSegment
slot
=
GetCurrentOrNextShift
(
machine
,
currentTime
,
prevtime
,
checkprevtime
,
isJit
);
if
(
slot
==
null
)
return
times
;
LocalDateTime
startCandidate
=
null
;
...
...
@@ -333,10 +345,12 @@ public class MachineCalculator {
times
.
add
(
time
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
if
(
islockMachineTime
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
}
return
times
;
}
...
...
@@ -426,10 +440,12 @@ public class MachineCalculator {
CopyOnWriteArrayList
<
ScheduleResultDetail
>
times
=
new
CopyOnWriteArrayList
<>();
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments
=
findAvailableSegments
(
machine
,
currentTime
,
machineTasks
,
remainingTime
,
isInterrupt
,
isJit
);
if
(
timeSegments
==
null
||
timeSegments
.
isEmpty
())
{
return
null
;
}
times
=
CaldScheduleResult
(
machine
,
operation
,
processingTime
,
currentTime
,
timeSegments
,
oneTime
,
quantity
,
isJit
timeSegments
,
oneTime
,
quantity
,
is
lockMachineTime
,
is
Jit
);
// int estimateIndex= (int) Math.ceil(remainingTime / (double) ONE_DAY_MINUTES);
...
...
@@ -472,7 +488,7 @@ public class MachineCalculator {
private
CopyOnWriteArrayList
<
ScheduleResultDetail
>
CaldScheduleResult
(
Machine
machine
,
Entry
operation
,
int
processingTime
,
LocalDateTime
currentTime
,
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments
,
double
oneTime
,
double
quantity
,
boolean
isJit
)
{
,
boolean
islockMachineTime
,
boolean
isJit
)
{
int
remainingTime
=
processingTime
;
CopyOnWriteArrayList
<
ScheduleResultDetail
>
times
=
new
CopyOnWriteArrayList
<>();
...
...
@@ -480,16 +496,12 @@ public class MachineCalculator {
int
estimateIndex
=
(
int
)
Math
.
ceil
(
remainingTime
/
(
double
)
ONE_DAY_MINUTES
);
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments1
=
null
;
if
(
estimateIndex
>
10
)
{
timeSegments1
=
getEnoughSegmentsByEstimateIndex
(
timeSegments
,
currentTime
,
remainingTime
,
isJit
);
if
(
timeSegments1
.
size
()==
2
)
{
timeSegments1
=
getEnoughSegmentsByEstimateIndex
(
timeSegments
,
currentTime
,
remainingTime
,
isJit
);
int
i
=
0
;
}
}
if
(
timeSegments1
==
null
)
{
...
...
@@ -503,10 +515,11 @@ public class MachineCalculator {
ScheduleResultDetail
time
=
(
ScheduleResultDetail
)
outMap
.
get
(
2
);
times
.
add
(
time
);
// 还原未使用的时间段
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
if
(
islockMachineTime
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
}
}
i
++;
}
...
...
@@ -516,13 +529,13 @@ public class MachineCalculator {
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
}
else
{
times
=
CaldScheduleResultDetail
(
timeSegments1
,
machine
,
operation
,
currentTime
,
remainingTime
,
oneTime
,
isJit
);
times
=
CaldScheduleResultDetail
(
timeSegments1
,
machine
,
operation
,
currentTime
,
remainingTime
,
oneTime
,
is
lockMachineTime
,
is
Jit
);
}
return
times
;
}
private
CopyOnWriteArrayList
<
ScheduleResultDetail
>
CaldScheduleResultDetail
(
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments
,
Machine
machine
,
Entry
operation
,
LocalDateTime
st
,
int
remainingTime
,
double
oneTime
,
boolean
isJit
)
private
CopyOnWriteArrayList
<
ScheduleResultDetail
>
CaldScheduleResultDetail
(
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments
,
Machine
machine
,
Entry
operation
,
LocalDateTime
st
,
int
remainingTime
,
double
oneTime
,
boolean
is
lockMachineTime
,
boolean
is
Jit
)
{
int
processable1
=(
int
)
calculateTotalAvailableSecond
(
timeSegments
,
st
,
isJit
);
...
...
@@ -538,19 +551,16 @@ public class MachineCalculator {
remainingTime
=(
int
)
outMap
.
get
(
1
);
ScheduleResultDetail
time1
=(
ScheduleResultDetail
)
outMap
.
get
(
2
);
times
.
add
(
time1
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time1
,
shiftfrist
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
if
(
islockMachineTime
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time1
,
shiftfrist
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
}
}
// 计算有效时间
//中间的数据
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments2
=
new
CopyOnWriteArrayList
<>(
timeSegments
.
subList
(
1
,
timeSegments
.
size
()-
1
));
if
(
timeSegments2
==
null
||
timeSegments2
.
size
()==
0
)
{
int
i
=
0
;
}
LocalDateTime
effectiveStart
=
timeSegments2
.
get
(
0
).
getStart
();
LocalDateTime
effectiveend
=
timeSegments2
.
get
(
timeSegments2
.
size
()-
1
).
getEnd
();
...
...
@@ -570,8 +580,10 @@ if(timeSegments2==null||timeSegments2.size()==0)
time
.
setOneTime
(
oneTime
);
time
.
setUsedSegment
(
timeSegments2
);
timeSegments2
.
forEach
(
t
->
t
.
setUsed
(
true
));
remainingTime
-=
processable
;
if
(
islockMachineTime
)
{
timeSegments2
.
forEach
(
t
->
t
.
setUsed
(
true
));
remainingTime
-=
processable
;
}
times
.
add
(
time
);
...
...
@@ -584,14 +596,16 @@ if(timeSegments2==null||timeSegments2.size()==0)
ScheduleResultDetail
timelast
=(
ScheduleResultDetail
)
outMaplast
.
get
(
2
);
times
.
add
(
timelast
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments2
=
RemoveMachineAvailable
(
machine
,
timelast
,
shiftlast
);
if
(
usedSegments2
!=
null
&&
usedSegments2
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments2
);
}
if
(
islockMachineTime
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments2
=
RemoveMachineAvailable
(
machine
,
timelast
,
shiftlast
);
if
(
usedSegments2
!=
null
&&
usedSegments2
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments2
);
}
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
}
return
times
;
...
...
@@ -1060,7 +1074,7 @@ if(timeSegments2==null||timeSegments2.size()==0)
if
(!
requireContinuous
||
requiredMinutes
<=
0
)
{
return
baseValidSegments
;
}
//不可中断,中间不能休息
if
(
isJit
)
{
...
...
src/main/java/com/aps/service/Algorithm/MaterialRequirementService.java
View file @
31d2cb46
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
31d2cb46
...
...
@@ -45,7 +45,7 @@ import static org.springframework.beans.BeanUtils.copyProperties;
@RequiredArgsConstructor
public
class
LanuchServiceImpl
implements
LanuchService
{
private
static
final
BigDecimal
MAX_PROCESS_DURATION_DAYS
=
BigDecimal
.
valueOf
(
3
0
);
private
static
final
BigDecimal
MAX_PROCESS_DURATION_DAYS
=
BigDecimal
.
valueOf
(
9
0
);
private
static
final
BigDecimal
SECONDS_PER_DAY
=
BigDecimal
.
valueOf
(
24L
*
3600L
);
private
static
final
BigDecimal
MAX_PROCESS_DURATION_SECONDS
=
SECONDS_PER_DAY
.
multiply
(
MAX_PROCESS_DURATION_DAYS
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
31d2cb46
...
...
@@ -1911,7 +1911,7 @@ public class PlanResultService {
.
collect
(
Collectors
.
joining
(
","
));
}
sb
.
append
(
String
.
format
(
"[%d-%d]:[%s-%s] Order %d,OrderID %s, Machine %d, Operation %d,
Batch
%.1f, processingTime %.1f, 前处理 %d, 后处理 %d, 离散参数 %d, bomtime %s,TargetOperationId %s"
,
"[%d-%d]:[%s-%s] Order %d,OrderID %s, Machine %d, Operation %d,
Quantity
%.1f, processingTime %.1f, 前处理 %d, 后处理 %d, 离散参数 %d, bomtime %s,TargetOperationId %s"
,
job
.
getStartTime
(),
job
.
getEndTime
(),
ConvertTime
(
job
.
getStartTime
()),
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
31d2cb46
...
...
@@ -40,9 +40,9 @@ public class PlanResultServiceTest {
// sortService.test1();
// nsgaiiUtils.Test();
// planResultService.execute2("AD62106303684459949A7323D114BF60
");//2000
planResultService
.
execute2
(
"6D7C59CF2576457EBCB5F6CCDF5AF342
"
);
//2000
planResultService
.
execute2
(
"15210B13B88A453F8B84AAC7F16C7541"
);
//2000
//
planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
// planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
...
...
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