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
6d4e146b
Commit
6d4e146b
authored
May 14, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bom
parent
06001699
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
377 additions
and
5077 deletions
+377
-5077
aps.log
logs/aps.log
+48
-4079
aps_error.log
logs/aps_error.log
+129
-870
ProductionDeepCopyUtil.java
...main/java/com/aps/common/util/ProductionDeepCopyUtil.java
+12
-0
Chromosome.java
src/main/java/com/aps/entity/Algorithm/Chromosome.java
+2
-0
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+130
-93
GeneticDecoderBom.java
...ain/java/com/aps/service/Algorithm/GeneticDecoderBom.java
+40
-21
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+13
-0
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+0
-11
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.
logs/aps.log
View file @
6d4e146b
This diff is collapsed.
Click to expand it.
logs/aps_error.log
View file @
6d4e146b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/java/com/aps/common/util/ProductionDeepCopyUtil.java
View file @
6d4e146b
package
com
.
aps
.
common
.
util
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
...
...
@@ -126,5 +127,16 @@ public class ProductionDeepCopyUtil {
}
}
public
static
<
K
,
V
>
Map
<
K
,
V
>
deepCopyMap
(
Map
<
K
,
V
>
source
)
{
if
(
source
==
null
)
{
return
new
HashMap
<>();
}
try
{
String
json
=
objectMapper
.
writeValueAsString
(
source
);
return
objectMapper
.
readValue
(
json
,
new
TypeReference
<
Map
<
K
,
V
>>()
{});
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Map深拷贝失败"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/aps/entity/Algorithm/Chromosome.java
View file @
6d4e146b
...
...
@@ -127,6 +127,8 @@ public class Chromosome {
private
ObjectiveWeights
objectiveWeights
;
// private Map<String,Material> materials = new HashMap<>();
private
List
<
Material
>
materials
=
new
ArrayList
<>();
private
List
<
String
>
materialIds
=
new
ArrayList
<>();
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
6d4e146b
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/Algorithm/GeneticDecoderBom.java
View file @
6d4e146b
package
com
.
aps
.
service
.
Algorithm
;
import
com.aps.common.util.FileHelper
;
import
com.aps.common.util.ProductionDeepCopyUtil
;
import
com.aps.entity.Algorithm.*
;
import
com.aps.entity.basic.*
;
...
...
@@ -30,12 +31,12 @@ public class GeneticDecoderBom {
materialRequirementService
=
_materialRequirementService
;
}
public
int
computeSemiFinishedAnchor
(
int
semiGroupId
,
public
int
computeSemiFinishedAnchor
(
GeneticDecoder
decoder
,
int
semiGroupId
,
Map
<
Integer
,
List
<
Entry
>>
entrysBygroupId
,
Map
<
String
,
OpMachine
>
opMachineKeyMap
,
Chromosome
chromosome
,
Map
<
Integer
,
GAScheduleResult
>
scheduleIndexById
,
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
)
{
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
,
Map
<
Long
,
Machine
>
machineIdMap
,
Map
<
Integer
,
Entry
>
entryIndexById
)
{
List
<
Entry
>
semiOps
=
entrysBygroupId
.
get
(
semiGroupId
);
if
(
semiOps
==
null
||
semiOps
.
isEmpty
())
return
0
;
...
...
@@ -58,23 +59,34 @@ public class GeneticDecoderBom {
Entry
firstTargetOp
=
targetOps
.
get
(
0
);
if
(
Entry
.
SchedulingMode
.
FORWARD
.
name
().
equals
(
firstTargetOp
.
getSchedulingMode
()))
{
int
rootStart
=
forwardEstimateToOperation
(
targetOpId
,
targetGroupId
,
0
,
int
rootStart
=
forwardEstimateToOperation
(
decoder
,
targetOpId
,
targetGroupId
,
0
,
entrysBygroupId
,
opMachineKeyMap
,
chromosome
,
scheduleIndexById
,
machineTasksCache
,
false
);
scheduleIndexById
,
machineTasksCache
,
machineIdMap
,
entryIndexById
,
false
);
List
<
Integer
>
chainGroupIds
=
new
ArrayList
<>(
intermediateGroupIds
);
chainGroupIds
.
add
(
targetGroupId
);
rootStart
=
correctByRawMaterialStockForChain
(
chainGroupIds
,
targetGroupId
,
targetOpId
,
rootStart
,
entrysBygroupId
,
chromosome
);
int
anchor
=
rootStart
;
// FileHelper.writeLogFile(" 成品开始 "+targetGroupId+" : "+rootStart);
if
(
anchor
==
0
)
{
return
-
1
;
}
for
(
int
i
=
intermediateGroupIds
.
size
()
-
1
;
i
>=
0
;
i
--)
{
int
start1
=
forwardEstimateToOperation
(
0
,
intermediateGroupIds
.
get
(
i
),
anchor
,
int
sfGroupId
=
intermediateGroupIds
.
get
(
i
);
int
start1
=
forwardEstimateToOperation
(
decoder
,
0
,
sfGroupId
,
anchor
,
entrysBygroupId
,
opMachineKeyMap
,
chromosome
,
scheduleIndexById
,
machineTasksCache
,
true
);
if
(
start1
<
0
)
{
scheduleIndexById
,
machineTasksCache
,
machineIdMap
,
entryIndexById
,
true
);
// FileHelper.writeLogFile(" 半成品开始 "+sfGroupId+" : "+start1+" - "+anchor);
if
(
start1
<=
0
)
{
isFORWARD
=
true
;
break
;
}
...
...
@@ -126,12 +138,14 @@ public class GeneticDecoderBom {
}
return
-
1
;
}
private
int
forwardEstimateToOperation
(
int
targetOpId
,
int
groupId
,
int
startSecond
,
private
int
forwardEstimateToOperation
(
GeneticDecoder
decoder
,
int
targetOpId
,
int
groupId
,
int
startSecond
,
Map
<
Integer
,
List
<
Entry
>>
entrysBygroupId
,
Map
<
String
,
OpMachine
>
opMachineKeyMap
,
Chromosome
chromosome
,
Map
<
Integer
,
GAScheduleResult
>
scheduleIndexById
,
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
,
boolean
isJit
)
{
Map
<
Long
,
CopyOnWriteArrayList
<
GAScheduleResult
>>
machineTasksCache
,
Map
<
Long
,
Machine
>
machineIdMap
,
Map
<
Integer
,
Entry
>
entryIndexById
,
boolean
isJit
)
{
List
<
Entry
>
ops
=
entrysBygroupId
.
get
(
groupId
);
if
(
ops
==
null
)
return
0
;
...
...
@@ -209,30 +223,35 @@ if(isJit)
if
(
machine
!=
null
&&!
machine
.
getCapacityTypeName
().
equals
(
"Infinite"
))
{
CopyOnWriteArrayList
<
GAScheduleResult
>
machineTasks
=
getMachineTasks
(
mId
,
chromosome
,
machineTasksCache
);
CopyOnWriteArrayList
<
ScheduleResultDetail
>
geneDetails
=
estimateCalendarAwareDuration
(
machine
,
op
,
machineTasks
,
start
,
rawDur
,
mo
.
getProcessingTime
(),
isJit
);
if
(
geneDetails
!=
null
)
{
start
=
geneDetails
.
stream
()
.
mapToInt
(
ScheduleResultDetail:
:
getStartTime
)
.
min
()
.
orElse
(
0
);
end
=
geneDetails
.
stream
()
.
mapToInt
(
ScheduleResultDetail:
:
getEndTime
)
.
max
()
.
orElse
(
0
);
GAScheduleResult
result
=
decoder
.
processOperationResult
(
op
,
mId
,
mo
.
getProcessingTime
(),
mo
,
chromosome
,
machineIdMap
,
machineTasksCache
,
entryIndexById
,
scheduleIndexById
,
start
,
false
,
isJit
);
// CopyOnWriteArrayList<ScheduleResultDetail> geneDetails = estimateCalendarAwareDuration(machine,op,machineTasks, start, rawDur,mo.getProcessingTime(),isJit);
if
(
result
!=
null
)
{
start
=
result
.
getStartTime
();
end
=
result
.
getEndTime
();
}
else
{
return
-
1
;
}
}
else
{
if
(
isJit
)
{
start
=
start
-
rawDur
;
end
=
start
;
start
=
start
-
rawDur
;
}
else
{
start
=
end
;
end
=
start
+
rawDur
;
}
// FileHelper.writeLogFile(" 半成品 " + op.getGroupId() + " - " + op.getSequence() + ",开始时间: " + start + ",结束时间: " + end + ",处理时间: " + rawDur );
}
if
(
op
.
getId
()
==
targetOpId
)
return
start
;
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
6d4e146b
...
...
@@ -507,7 +507,20 @@ public class MachineCalculator {
if
(
timeSegments1
==
null
)
{
int
i
=
0
;
CopyOnWriteArrayList
<
TimeSegment
>
usedSegments
=
new
CopyOnWriteArrayList
<>();
double
AvTotal
=
calculateTotalMinutesByIndex
(
timeSegments
,
currentTime
,
timeSegments
.
size
(),
isJit
);
if
(
AvTotal
<
remainingTime
)
{
return
null
;
}
while
(
remainingTime
>
0
)
{
TimeSegment
shift
=
timeSegments
.
get
(
i
);
Map
<
Integer
,
Object
>
outMap
=
CreateScheduleResultDetail
(
shift
,
currentTime
,
remainingTime
,
oneTime
,
isJit
);
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
6d4e146b
...
...
@@ -1906,17 +1906,6 @@ if(targetOp.getSequence()>1) {
GeneticDecoder
decoder
=
prepareDecodePass
(
chromosome
,
baseTime
,
globalParam
,
baseMaterialsSnapshot
,
true
);
decoder
.
decode
(
chromosome
,
false
);
PostEditJitService
postEditJitService
=
new
PostEditJitService
();
try
{
if
(
postEditJitService
.
applyPostEditJitBias
(
chromosome
,
globalParam
))
{
chromosome
.
setResultOld
(
ProductionDeepCopyUtil
.
deepCopyList
(
chromosome
.
getResult
(),
GAScheduleResult
.
class
));
decoder
=
prepareDecodePass
(
chromosome
,
baseTime
,
globalParam
,
baseMaterialsSnapshot
,
false
);
decoder
.
decode
(
chromosome
,
false
,
false
);
}
}
finally
{
postEditJitService
.
clearTemporaryJitBias
(
chromosome
);
}
KpiCalculator
kpiCalculator
=
new
KpiCalculator
(
chromosome
);
kpiCalculator
.
calculatekpi
();
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
6d4e146b
...
...
@@ -260,7 +260,7 @@ public class PlanResultService {
_sceneService
.
saveChromosomeToFile
(
chromosome
,
SceneId
);
WriteScheduleSummary
(
chromosome
);
//
WriteScheduleSummary(chromosome);
return
chromosome
;
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
6d4e146b
...
...
@@ -40,7 +40,7 @@ public class PlanResultServiceTest {
// sortService.test1();
// nsgaiiUtils.Test();
planResultService
.
execute2
(
"6D7C59CF2576457EBCB5F6CCDF5AF342"
);
//2000
//
planResultService.execute2("6D7C59CF2576457EBCB5F6CCDF5AF342");//2000
// planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
...
...
@@ -48,7 +48,7 @@ public class PlanResultServiceTest {
// planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
// planResultService.execute2("EAF3C94B8F3345278F226C94FB0FED86");//bom
// planResultService.execute2("6D63146BE5C84A78B5AB044327BA55BD");//2000
//
planResultService.execute2("6D63146BE5C84A78B5AB044327BA55BD");//5000
planResultService
.
execute2
(
"6D63146BE5C84A78B5AB044327BA55BD"
);
//5000
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
// planResultService.execute2("EFDD34E4B5BC434BAEAE6A84DFCD4E7B");//20
// planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D");
...
...
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