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
f006f6ed
Commit
f006f6ed
authored
May 18, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bom
parent
ecfe8236
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
24 deletions
+63
-24
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+3
-0
GeneticDecoderBom.java
...ain/java/com/aps/service/Algorithm/GeneticDecoderBom.java
+2
-2
HybridAlgorithm.java
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
+1
-1
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+51
-16
MaterialRequirementService.java
...com/aps/service/Algorithm/MaterialRequirementService.java
+2
-1
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+1
-1
application.yml
src/main/resources/application.yml
+2
-2
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+1
-1
No files found.
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
f006f6ed
...
@@ -1172,6 +1172,7 @@ public class GeneticDecoder {
...
@@ -1172,6 +1172,7 @@ public class GeneticDecoder {
private
int
processOperation
(
Entry
currentOp
,
Long
machineId
,
double
processTime
,
OpMachine
machineOption
,
Chromosome
chromosome
,
Map
<
Long
,
Machine
>
machineIdMap
,
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
,
Map
<
Integer
,
Entry
>
entryIndexById
,
Map
<
Integer
,
GAScheduleResult
>
scheduleIndexById
,
int
orderDueDate
,
boolean
islockMachineTime
,
boolean
isJit
)
private
int
processOperation
(
Entry
currentOp
,
Long
machineId
,
double
processTime
,
OpMachine
machineOption
,
Chromosome
chromosome
,
Map
<
Long
,
Machine
>
machineIdMap
,
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
,
Map
<
Integer
,
Entry
>
entryIndexById
,
Map
<
Integer
,
GAScheduleResult
>
scheduleIndexById
,
int
orderDueDate
,
boolean
islockMachineTime
,
boolean
isJit
)
{
{
GAScheduleResult
result
=
processOperationResult
(
currentOp
,
machineId
,
processTime
,
machineOption
,
chromosome
,
machineIdMap
,
machineTasksCache
,
entryIndexById
,
scheduleIndexById
,
orderDueDate
,
islockMachineTime
,
isJit
);
GAScheduleResult
result
=
processOperationResult
(
currentOp
,
machineId
,
processTime
,
machineOption
,
chromosome
,
machineIdMap
,
machineTasksCache
,
entryIndexById
,
scheduleIndexById
,
orderDueDate
,
islockMachineTime
,
isJit
);
if
(
result
==
null
)
if
(
result
==
null
)
return
0
;
return
0
;
...
@@ -1861,6 +1862,8 @@ if(geneDetails!=null&&geneDetails.size()>0)
...
@@ -1861,6 +1862,8 @@ if(geneDetails!=null&&geneDetails.size()>0)
}
}
}
}
}
}
}
if
(
bomtype
==
0
||
bomtype
==
1
)
{
Optional
<
LocalDateTime
>
sfDateOpt
=
opboms
.
stream
()
Optional
<
LocalDateTime
>
sfDateOpt
=
opboms
.
stream
()
.
filter
(
t
->
!
"MP"
.
equals
(
t
.
getMaterialTypeName
())
&&
(
t
.
getProductOrderID
()
==
null
||
t
.
getProductOrderID
().
isEmpty
()))
.
filter
(
t
->
!
"MP"
.
equals
(
t
.
getMaterialTypeName
())
&&
(
t
.
getProductOrderID
()
==
null
||
t
.
getProductOrderID
().
isEmpty
()))
.
map
(
OrderMaterialRequirement:
:
getUseTime
)
.
map
(
OrderMaterialRequirement:
:
getUseTime
)
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoderBom.java
View file @
f006f6ed
...
@@ -318,7 +318,7 @@ if(isJit)
...
@@ -318,7 +318,7 @@ if(isJit)
continue
;
continue
;
}
}
for
(
OrderMaterialRequirement
req
:
op
.
getMaterialRequirements
())
{
for
(
OrderMaterialRequirement
req
:
op
.
getMaterialRequirements
())
{
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
()))
{
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
())
&&
req
.
getProductOrderID
()!=
null
&&
req
.
getProductOrderID
().
size
()>
0
)
{
OrderMaterialRequirement
reqq
=
totalNeededByMaterial
.
get
(
req
.
getMaterialId
());
OrderMaterialRequirement
reqq
=
totalNeededByMaterial
.
get
(
req
.
getMaterialId
());
if
(
reqq
!=
null
)
{
if
(
reqq
!=
null
)
{
double
allneeded
=
req
.
getSpentQty
()
/
req
.
getMainQty
()
*
op
.
getQuantity
();
double
allneeded
=
req
.
getSpentQty
()
/
req
.
getMainQty
()
*
op
.
getQuantity
();
...
@@ -354,7 +354,7 @@ if(isJit)
...
@@ -354,7 +354,7 @@ if(isJit)
for
(
OrderMaterialRequirement
req
:
op
.
getMaterialRequirements
())
{
for
(
OrderMaterialRequirement
req
:
op
.
getMaterialRequirements
())
{
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
()))
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
())
&&
req
.
getProductOrderID
()!=
null
&&
req
.
getProductOrderID
().
size
()>
0
)
continue
;
continue
;
OrderMaterialRequirement
reqq
=
totalNeededByMaterial
.
get
(
req
.
getMaterialId
());
OrderMaterialRequirement
reqq
=
totalNeededByMaterial
.
get
(
req
.
getMaterialId
());
...
...
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
View file @
f006f6ed
...
@@ -453,7 +453,7 @@ public class HybridAlgorithm {
...
@@ -453,7 +453,7 @@ public class HybridAlgorithm {
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
// GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
// GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean
ismore
=
fals
e
;
boolean
ismore
=
tru
e
;
if
(
ismore
)
{
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
sharedDecoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
sharedDecoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
f006f6ed
...
@@ -111,17 +111,21 @@ public class MachineCalculator {
...
@@ -111,17 +111,21 @@ public class MachineCalculator {
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
setupStartTime1
));
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
setupStartTime1
));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
shift1
.
getEnd
()));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
shift1
.
getEnd
()));
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift1
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift1
,
false
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
usedSegments
.
addAll
(
usedSegments1
);
}
}
for
(
int
i
=
1
;
i
<
setuptime
.
size
()
;
i
++)
{
if
(
islockMachineTime
)
{
TimeSegment
se
=
setuptime
.
get
(
i
);
for
(
int
i
=
1
;
i
<
setuptime
.
size
();
i
++)
{
se
.
setUsed
(
true
);
TimeSegment
se
=
setuptime
.
get
(
i
);
se
.
setUsed
(
true
);
}
}
}
}
else
{
}
else
{
for
(
TimeSegment
se:
setuptime
)
{
if
(
islockMachineTime
)
{
se
.
setUsed
(
true
);
for
(
TimeSegment
se
:
setuptime
)
{
se
.
setUsed
(
true
);
}
}
}
}
}
...
@@ -159,9 +163,11 @@ public class MachineCalculator {
...
@@ -159,9 +163,11 @@ public class MachineCalculator {
// i++;
// i++;
// }
// }
}
}
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
if
(
islockMachineTime
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
}
}
times
=
CaldScheduleResult
(
times
=
CaldScheduleResult
(
...
@@ -196,10 +202,13 @@ public class MachineCalculator {
...
@@ -196,10 +202,13 @@ public class MachineCalculator {
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
effectiveStart
));
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
effectiveStart
));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
startTime
));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
startTime
));
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
shift
,
false
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
usedSegments
.
addAll
(
usedSegments1
);
}
}
if
(
processable
>=
availableSeconds
)
if
(
processable
>=
availableSeconds
)
{
{
i
++;
i
++;
...
@@ -251,10 +260,12 @@ public class MachineCalculator {
...
@@ -251,10 +260,12 @@ public class MachineCalculator {
time
.
setQuantity
(
quantity
);
time
.
setQuantity
(
quantity
);
times
.
add
(
time
);
times
.
add
(
time
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
if
(
islockMachineTime
)
{
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
usedSegments
.
addAll
(
usedSegments1
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
}
usedSegments
.
addAll
(
usedSegments1
);
}
}
}
}
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
addAll
(
usedSegments
);
...
@@ -1752,9 +1763,12 @@ public class MachineCalculator {
...
@@ -1752,9 +1763,12 @@ public class MachineCalculator {
return
times
;
return
times
;
}
}
private
CopyOnWriteArrayList
<
TimeSegment
>
RemoveMachineAvailable
(
Machine
machine
,
ScheduleResultDetail
geneDetails
,
TimeSegment
targetSegment
)
{
return
RemoveMachineAvailable
(
machine
,
geneDetails
,
targetSegment
,
true
);
}
// 把目标 availability 按本次排程切成“剩余可用段”和“本次已占用段”,并把占用段 key 回写到 geneDetails。
// 把目标 availability 按本次排程切成“剩余可用段”和“本次已占用段”,并把占用段 key 回写到 geneDetails。
private
CopyOnWriteArrayList
<
TimeSegment
>
RemoveMachineAvailable
(
Machine
machine
,
ScheduleResultDetail
geneDetails
,
TimeSegment
targetSegment
)
{
private
CopyOnWriteArrayList
<
TimeSegment
>
RemoveMachineAvailable
(
Machine
machine
,
ScheduleResultDetail
geneDetails
,
TimeSegment
targetSegment
,
boolean
islockMachineTime
)
{
LocalDateTime
geneStartTime
=
baseTime
.
plusSeconds
(
geneDetails
.
getStartTime
());
LocalDateTime
geneStartTime
=
baseTime
.
plusSeconds
(
geneDetails
.
getStartTime
());
...
@@ -1779,7 +1793,13 @@ public class MachineCalculator {
...
@@ -1779,7 +1793,13 @@ public class MachineCalculator {
usedSegment2
.
setHoliday
(
false
);
usedSegment2
.
setHoliday
(
false
);
usedSegment2
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment2
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment2
.
setType
(
SegmentType
.
REGULAR
);
usedSegment2
.
setType
(
SegmentType
.
REGULAR
);
usedSegment2
.
setUsed
(
true
);
if
(
islockMachineTime
)
{
usedSegment2
.
setUsed
(
true
);
}
else
{
usedSegment2
.
setUsed
(
false
);
}
usedSegments
.
add
(
usedSegment2
);
usedSegments
.
add
(
usedSegment2
);
geneDetails
.
setKey
(
usedSegment2
.
getKey
());
geneDetails
.
setKey
(
usedSegment2
.
getKey
());
...
@@ -1793,7 +1813,12 @@ public class MachineCalculator {
...
@@ -1793,7 +1813,12 @@ public class MachineCalculator {
usedSegment
.
setHoliday
(
false
);
usedSegment
.
setHoliday
(
false
);
usedSegment
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment
.
setType
(
SegmentType
.
REGULAR
);
usedSegment
.
setType
(
SegmentType
.
REGULAR
);
if
(
islockMachineTime
)
{
usedSegment
.
setUsed
(
true
);
usedSegment
.
setUsed
(
true
);
}
else
{
usedSegment
.
setUsed
(
false
);
}
usedSegments
.
add
(
usedSegment
);
usedSegments
.
add
(
usedSegment
);
geneDetails
.
setKey
(
usedSegment
.
getKey
());
geneDetails
.
setKey
(
usedSegment
.
getKey
());
targetSegment
.
setStart
(
geneEndTime
);
targetSegment
.
setStart
(
geneEndTime
);
...
@@ -1810,9 +1835,19 @@ public class MachineCalculator {
...
@@ -1810,9 +1835,19 @@ public class MachineCalculator {
usedSegments
.
add
(
usedSegment
);
usedSegments
.
add
(
usedSegment
);
geneDetails
.
setKey
(
targetSegment
.
getKey
());
geneDetails
.
setKey
(
targetSegment
.
getKey
());
targetSegment
.
setStart
(
geneStartTime
);
targetSegment
.
setStart
(
geneStartTime
);
if
(
islockMachineTime
)
{
targetSegment
.
setUsed
(
true
);
targetSegment
.
setUsed
(
true
);
}
else
{
}
else
{
targetSegment
.
setUsed
(
false
);
}
}
else
{
if
(
islockMachineTime
)
{
targetSegment
.
setUsed
(
true
);
targetSegment
.
setUsed
(
true
);
}
else
{
targetSegment
.
setUsed
(
false
);
}
}
}
return
usedSegments
;
return
usedSegments
;
...
...
src/main/java/com/aps/service/Algorithm/MaterialRequirementService.java
View file @
f006f6ed
...
@@ -202,7 +202,7 @@ public class MaterialRequirementService {
...
@@ -202,7 +202,7 @@ public class MaterialRequirementService {
{
{
Map
<
Integer
,
Object
>
reslte1
=
preloadSfRoutingBomCache
(
materialIds
,
routingHeaders
,
routingsupportings
,
replaces
);
Map
<
Integer
,
Object
>
reslte1
=
preloadSfRoutingBomCache
(
materialIds
,
routingHeaders
,
routingsupportings
,
replaces
);
List
<
Long
>
routingIds1
=(
List
<
Long
>)
reslte1
.
get
(
1
);
List
<
Long
>
routingIds1
=(
List
<
Long
>)
reslte1
.
get
(
1
);
if
(
routingIds1
!=
null
)
if
(
routingIds1
!=
null
&&
routingIds1
.
size
()>
0
)
{
{
List
<
Long
>
equipids
=
preloadSfRoutingCache
(
sceneId
,
routingIds1
);
List
<
Long
>
equipids
=
preloadSfRoutingCache
(
sceneId
,
routingIds1
);
reslte
.
put
(
1
,
equipids
);
reslte
.
put
(
1
,
equipids
);
...
@@ -347,6 +347,7 @@ public class MaterialRequirementService {
...
@@ -347,6 +347,7 @@ public class MaterialRequirementService {
List
<
RoutingDetailEquip
>
routingDetailEquips
=
null
;
List
<
RoutingDetailEquip
>
routingDetailEquips
=
null
;
List
<
RoutingDetailConnect
>
connections
=
null
;
List
<
RoutingDetailConnect
>
connections
=
null
;
List
<
RoutingDiscreteParam
>
routingDiscreteParams
=
null
;
List
<
RoutingDiscreteParam
>
routingDiscreteParams
=
null
;
if
(
routingIds
!=
null
||
routingIds
.
size
()
>
0
)
{
if
(
routingIds
!=
null
||
routingIds
.
size
()
>
0
)
{
RoutingDetails
=
lanuchService
.
getRoutingDetails
(
routingIds
);
RoutingDetails
=
lanuchService
.
getRoutingDetails
(
routingIds
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
f006f6ed
...
@@ -269,7 +269,7 @@ public class PlanResultService {
...
@@ -269,7 +269,7 @@ public class PlanResultService {
throw
new
BusinessException
(
"排产计算结果保存失败,请稍后重试或联系管理员"
);
throw
new
BusinessException
(
"排产计算结果保存失败,请稍后重试或联系管理员"
);
}
}
//
WriteScheduleSummary(chromosome);
WriteScheduleSummary
(
chromosome
);
return
chromosome
;
return
chromosome
;
...
...
src/main/resources/application.yml
View file @
f006f6ed
...
@@ -55,10 +55,10 @@ spring:
...
@@ -55,10 +55,10 @@ spring:
# Oracle数据源
# Oracle数据源
oracle
:
oracle
:
driver-class-name
:
oracle.jdbc.OracleDriver
driver-class-name
:
oracle.jdbc.OracleDriver
url
:
jdbc:oracle:thin:@//39.100.77.7:1522/ORCLPDB1
# ORCL为你的Oracle实例名
#
url: jdbc:oracle:thin:@//39.100.77.7:1522/ORCLPDB1 # ORCL为你的Oracle实例名
# username: mes # 替换为你的Oracle用户名
# username: mes # 替换为你的Oracle用户名
# password: root_mes123456 # 替换为你的Oracle密码
# password: root_mes123456 # 替换为你的Oracle密码
#
url: jdbc:oracle:thin:@//39.100.78.207:7002/ORCLPDB1 # ORCL为你的Oracle实例名
url
:
jdbc:oracle:thin:@//39.100.78.207:7002/ORCLPDB1
# ORCL为你的Oracle实例名
username
:
mes
# 替换为你的Oracle用户名
username
:
mes
# 替换为你的Oracle用户名
password
:
root_mes123456
# 替换为你的Oracle密码
password
:
root_mes123456
# 替换为你的Oracle密码
# sqlserver:
# sqlserver:
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
f006f6ed
...
@@ -41,7 +41,7 @@ public class PlanResultServiceTest {
...
@@ -41,7 +41,7 @@ public class PlanResultServiceTest {
// sortService.test1();
// sortService.test1();
// nsgaiiUtils.Test();
// nsgaiiUtils.Test();
planResultService
.
execute2
(
"
4990F98F300549F384A754AAE7486BD9
"
);
//2000
planResultService
.
execute2
(
"
A83368B01AEA45168A5202C16425E530
"
);
//2000
// planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
// planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
...
...
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