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
acfd275e
Commit
acfd275e
authored
May 18, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://39.100.78.207:1213/tongli/hyh.apsj
parents
6c2d7167
f006f6ed
Show 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 @
acfd275e
...
...
@@ -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
)
{
GAScheduleResult
result
=
processOperationResult
(
currentOp
,
machineId
,
processTime
,
machineOption
,
chromosome
,
machineIdMap
,
machineTasksCache
,
entryIndexById
,
scheduleIndexById
,
orderDueDate
,
islockMachineTime
,
isJit
);
if
(
result
==
null
)
return
0
;
...
...
@@ -1861,6 +1862,8 @@ if(geneDetails!=null&&geneDetails.size()>0)
}
}
}
}
if
(
bomtype
==
0
||
bomtype
==
1
)
{
Optional
<
LocalDateTime
>
sfDateOpt
=
opboms
.
stream
()
.
filter
(
t
->
!
"MP"
.
equals
(
t
.
getMaterialTypeName
())
&&
(
t
.
getProductOrderID
()
==
null
||
t
.
getProductOrderID
().
isEmpty
()))
.
map
(
OrderMaterialRequirement:
:
getUseTime
)
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoderBom.java
View file @
acfd275e
...
...
@@ -318,7 +318,7 @@ if(isJit)
continue
;
}
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
());
if
(
reqq
!=
null
)
{
double
allneeded
=
req
.
getSpentQty
()
/
req
.
getMainQty
()
*
op
.
getQuantity
();
...
...
@@ -354,7 +354,7 @@ if(isJit)
for
(
OrderMaterialRequirement
req
:
op
.
getMaterialRequirements
())
{
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
()))
if
(!
"MP"
.
equals
(
req
.
getMaterialTypeName
())
&&
req
.
getProductOrderID
()!=
null
&&
req
.
getProductOrderID
().
size
()>
0
)
continue
;
OrderMaterialRequirement
reqq
=
totalNeededByMaterial
.
get
(
req
.
getMaterialId
());
...
...
src/main/java/com/aps/service/Algorithm/HybridAlgorithm.java
View file @
acfd275e
...
...
@@ -453,7 +453,7 @@ public class HybridAlgorithm {
FileHelper
.
writeLogFile
(
"解码---------------"
+
population
.
size
()
);
// GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean
ismore
=
fals
e
;
boolean
ismore
=
tru
e
;
if
(
ismore
)
{
CompletableFuture
.
allOf
(
population
.
stream
()
.
map
(
chromosome
->
CompletableFuture
.
runAsync
(()
->
decode
(
sharedDecoder
,
chromosome
,
param
,
allOperations
,
globalOpList
),
decodeExecutor
))
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
acfd275e
...
...
@@ -111,19 +111,23 @@ public class MachineCalculator {
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
setupStartTime1
));
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
)
{
usedSegments
.
addAll
(
usedSegments1
);
}
for
(
int
i
=
1
;
i
<
setuptime
.
size
()
;
i
++)
{
if
(
islockMachineTime
)
{
for
(
int
i
=
1
;
i
<
setuptime
.
size
();
i
++)
{
TimeSegment
se
=
setuptime
.
get
(
i
);
se
.
setUsed
(
true
);
}
}
}
else
{
for
(
TimeSegment
se:
setuptime
)
{
if
(
islockMachineTime
)
{
for
(
TimeSegment
se
:
setuptime
)
{
se
.
setUsed
(
true
);
}
}
}
// int i = 0;
...
...
@@ -159,10 +163,12 @@ public class MachineCalculator {
// i++;
// }
}
if
(
islockMachineTime
)
{
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
}
}
times
=
CaldScheduleResult
(
machine
,
operation
,
processingTime
,
startTime
,
...
...
@@ -196,10 +202,13 @@ public class MachineCalculator {
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
effectiveStart
));
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
)
{
usedSegments
.
addAll
(
usedSegments1
);
}
if
(
processable
>=
availableSeconds
)
{
i
++;
...
...
@@ -251,11 +260,13 @@ public class MachineCalculator {
time
.
setQuantity
(
quantity
);
times
.
add
(
time
);
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
if
(
islockMachineTime
)
{
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments1
=
RemoveMachineAvailable
(
machine
,
time
,
slot
);
if
(
usedSegments1
!=
null
&&
usedSegments1
.
size
()
>
0
)
{
usedSegments
.
addAll
(
usedSegments1
);
}
}
}
if
(
usedSegments
!=
null
&&
usedSegments
.
size
()
>
0
)
{
machine
.
getAvailability
().
addAll
(
usedSegments
);
machine
.
getAvailability
().
sort
(
Comparator
.
comparing
(
TimeSegment:
:
getStart
));
...
...
@@ -1752,9 +1763,12 @@ public class MachineCalculator {
return
times
;
}
private
CopyOnWriteArrayList
<
TimeSegment
>
RemoveMachineAvailable
(
Machine
machine
,
ScheduleResultDetail
geneDetails
,
TimeSegment
targetSegment
)
{
return
RemoveMachineAvailable
(
machine
,
geneDetails
,
targetSegment
,
true
);
}
// 把目标 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
());
...
...
@@ -1779,7 +1793,13 @@ public class MachineCalculator {
usedSegment2
.
setHoliday
(
false
);
usedSegment2
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment2
.
setType
(
SegmentType
.
REGULAR
);
if
(
islockMachineTime
)
{
usedSegment2
.
setUsed
(
true
);
}
else
{
usedSegment2
.
setUsed
(
false
);
}
usedSegments
.
add
(
usedSegment2
);
geneDetails
.
setKey
(
usedSegment2
.
getKey
());
...
...
@@ -1793,7 +1813,12 @@ public class MachineCalculator {
usedSegment
.
setHoliday
(
false
);
usedSegment
.
setKey
(
UUID
.
randomUUID
().
toString
());
usedSegment
.
setType
(
SegmentType
.
REGULAR
);
if
(
islockMachineTime
)
{
usedSegment
.
setUsed
(
true
);
}
else
{
usedSegment
.
setUsed
(
false
);
}
usedSegments
.
add
(
usedSegment
);
geneDetails
.
setKey
(
usedSegment
.
getKey
());
targetSegment
.
setStart
(
geneEndTime
);
...
...
@@ -1810,9 +1835,19 @@ public class MachineCalculator {
usedSegments
.
add
(
usedSegment
);
geneDetails
.
setKey
(
targetSegment
.
getKey
());
targetSegment
.
setStart
(
geneStartTime
);
if
(
islockMachineTime
)
{
targetSegment
.
setUsed
(
true
);
}
else
{
targetSegment
.
setUsed
(
false
);
}
}
else
{
if
(
islockMachineTime
)
{
targetSegment
.
setUsed
(
true
);
}
else
{
targetSegment
.
setUsed
(
false
);
}
}
return
usedSegments
;
...
...
src/main/java/com/aps/service/Algorithm/MaterialRequirementService.java
View file @
acfd275e
...
...
@@ -202,7 +202,7 @@ public class MaterialRequirementService {
{
Map
<
Integer
,
Object
>
reslte1
=
preloadSfRoutingBomCache
(
materialIds
,
routingHeaders
,
routingsupportings
,
replaces
);
List
<
Long
>
routingIds1
=(
List
<
Long
>)
reslte1
.
get
(
1
);
if
(
routingIds1
!=
null
)
if
(
routingIds1
!=
null
&&
routingIds1
.
size
()>
0
)
{
List
<
Long
>
equipids
=
preloadSfRoutingCache
(
sceneId
,
routingIds1
);
reslte
.
put
(
1
,
equipids
);
...
...
@@ -347,6 +347,7 @@ public class MaterialRequirementService {
List
<
RoutingDetailEquip
>
routingDetailEquips
=
null
;
List
<
RoutingDetailConnect
>
connections
=
null
;
List
<
RoutingDiscreteParam
>
routingDiscreteParams
=
null
;
if
(
routingIds
!=
null
||
routingIds
.
size
()
>
0
)
{
RoutingDetails
=
lanuchService
.
getRoutingDetails
(
routingIds
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
acfd275e
...
...
@@ -279,7 +279,7 @@ public class PlanResultService {
throw
new
BusinessException
(
"排产计算结果保存失败,请稍后重试或联系管理员"
);
}
//
WriteScheduleSummary(chromosome);
WriteScheduleSummary
(
chromosome
);
return
chromosome
;
...
...
src/main/resources/application.yml
View file @
acfd275e
...
...
@@ -55,10 +55,10 @@ spring:
# Oracle数据源
oracle
:
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用户名
# 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用户名
password
:
root_mes123456
# 替换为你的Oracle密码
# sqlserver:
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
acfd275e
...
...
@@ -41,7 +41,7 @@ public class PlanResultServiceTest {
// sortService.test1();
// nsgaiiUtils.Test();
planResultService
.
execute2
(
"
4990F98F300549F384A754AAE7486BD9
"
);
//2000
planResultService
.
execute2
(
"
A83368B01AEA45168A5202C16425E530
"
);
//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