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
d1891608
Commit
d1891608
authored
Jan 15, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
138726ae
bc3adbc4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
597 additions
and
29 deletions
+597
-29
SwaggerMapParamConfig.java
src/main/java/com/aps/config/SwaggerMapParamConfig.java
+0
-5
ChromosomeDataController.java
...a/com/aps/controller/common/ChromosomeDataController.java
+228
-0
ResourceGanttController.java
...ava/com/aps/controller/gantt/ResourceGanttController.java
+28
-1
Entry.java
src/main/java/com/aps/entity/basic/Entry.java
+2
-2
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+9
-9
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+73
-0
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+150
-5
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+107
-7
No files found.
src/main/java/com/aps/config/SwaggerMapParamConfig.java
View file @
d1891608
...
...
@@ -380,11 +380,6 @@ public class SwaggerMapParamConfig {
examples
.
put
(
"订单更新示例"
,
createExample
(
"更新订单数据"
,
"{\n"
+
" \"sceneId\": \"SCENE001\",\n"
+
" \"data\": {\n"
+
" \"id\": \"123\",\n"
+
" \"name\": \"updated name\"\n"
+
" }\n"
+
"}"
));
break
;
...
...
src/main/java/com/aps/controller/common/ChromosomeDataController.java
View file @
d1891608
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/controller/gantt/ResourceGanttController.java
View file @
d1891608
...
...
@@ -252,7 +252,7 @@ public class ResourceGanttController {
@PostMapping
(
"/
operationEdit
"
)
@PostMapping
(
"/
editOperation
"
)
@Operation
(
summary
=
"修改工单"
,
description
=
"修改工单"
)
public
R
<
Chromosome
>
operationEdit
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"operationEdit 请求参数: {}"
,
params
);
...
...
@@ -267,6 +267,33 @@ public class ResourceGanttController {
return
R
.
ok
(
result
);
}
@PostMapping
(
"/editMachineOption"
)
@Operation
(
summary
=
"修改机器选项"
,
description
=
"修改工序的机器选项"
,
requestBody
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
parameters
.
RequestBody
(
description
=
"修改机器选项参数"
,
content
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Content
(
mediaType
=
"application/json"
,
examples
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
ExampleObject
(
name
=
"修改机器选项示例"
,
value
=
"{\n \"sceneId\": \"B571EF6682DB463AB2977B1055A74112\",\n \"entry\": {\n \"id\": 1,\n \"groupId\": 1,\n \"sequence\": 1,\n \"orderId\": \"ORDER001\",\n \"orderCode\": \"订单编号\",\n \"productId\": 1,\n \"productName\": \"产品名称\",\n \"productCode\": \"产品编号\",\n \"routingId\": 1,\n \"routingDetailId\": 1,\n \"execId\": \"EXEC001\",\n \"orderId\": \"ORDER001\",\n \"orderCode\": \"订单编号\",\n \"sceneId\": \"B571EF6682DB463AB2977B1055A74112\",\n \"mainId\": \"MAIN001\",\n \"priority\": 1,\n \"quantity\": 100,\n \"sequence\": 1,\n \"machineOptions\": [],\n \"selectMachineID\": 1,\n \"prevEntryIds\": [],\n \"nextEntryIds\": [],\n \"state\": 1,\n \"isInterrupt\": 1,\n \"materialRequirements\": []\n },\n \"newMachineId\": 123\n}"
)
)
)
)
public
R
<
Chromosome
>
editMachineOption
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"editMachineOption 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
// 使用BeanUtil转换LinkedHashMap为Entry对象
Entry
entry
=
BeanUtil
.
toBean
(
params
.
get
(
"entry"
),
Entry
.
class
);
Long
newMachineId
=
ParamValidator
.
getLong
(
params
,
"newMachineId"
,
"新机器ID"
);
Chromosome
result
=
planResultService
.
editMachineOption
(
sceneId
,
entry
,
newMachineId
);
return
R
.
ok
(
result
);
}
@PostMapping
(
"/changebasetime"
)
@Operation
(
summary
=
"修改基础时间"
,
description
=
"修改基础时间"
)
public
R
<
String
>
changeBaseTime
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
...
...
src/main/java/com/aps/entity/basic/Entry.java
View file @
d1891608
...
...
@@ -78,12 +78,12 @@ public class Entry {
/**
* 可选设备列表
*/
p
ublic
List
<
MachineOption
>
MachineOptions
;
p
rivate
List
<
MachineOption
>
MachineOptions
;
/**
* 选择的设备
*/
p
ublic
Long
SelectMachineID
;
p
rivate
Long
SelectMachineID
;
/**
* 前工单ID
...
...
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
d1891608
...
...
@@ -298,15 +298,15 @@ return population;
population
=
population
.
stream
()
.
collect
(
Collectors
.
toMap
(
Chromosome:
:
getGeneStr
,
// key:去重的字段(GeneStr)
u
->
u
,
// value:Chromosome对象
(
u1
,
u2
)
->
u1
// 重复时保留第一个元素
))
.
values
()
// 获取去重后的
.
stream
()
.
collect
(
Collectors
.
toList
());
//
population = population.stream()
//
.collect(Collectors.toMap(
//
Chromosome::getGeneStr, // key:去重的字段(GeneStr)
//
u -> u, // value:Chromosome对象
//
(u1, u2) -> u1 // 重复时保留第一个元素
//
))
//
.values() // 获取去重后的
//
.stream()
//
.collect(Collectors.toList());
return
population
;
}
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
d1891608
...
...
@@ -1035,4 +1035,77 @@ if(targetOp.getSequence()>1) {
// }
}
public
void
editMachineOption
(
Chromosome
chromosome
,
Entry
operation
,
Long
newMachineId
,
GlobalParam
globalParam
)
{
List
<
Entry
>
allOperations
=
chromosome
.
getAllOperations
();
Map
<
Integer
,
Integer
>
opTimeMap
=
chromosome
.
getResult
().
stream
()
.
collect
(
Collectors
.
toMap
(
GAScheduleResult:
:
getOperationId
,
r
->
r
.
getStartTime
()
));
Integer
newMachineId1
=
newMachineId
.
intValue
();
int
opId
=
operation
.
getId
();
// 获取目标结果和工序
GAScheduleResult
targetResult
=
chromosome
.
getResult
().
stream
()
.
filter
(
r
->
r
.
getOperationId
()
==
opId
)
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
Entry
targetOp
=
allOperations
.
stream
()
.
filter
(
o
->
o
.
getId
()
==
opId
)
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Operation not found: "
+
opId
));
if
(
newMachineId1
!=
0
)
{
int
machineOptionIndex
=
targetOp
.
getMachineOptions
().
stream
()
.
map
(
MachineOption:
:
getMachineId
)
.
collect
(
Collectors
.
toList
())
.
indexOf
(
newMachineId
)
+
1
;
if
(
machineOptionIndex
==
0
)
{
throw
new
NoSuchElementException
(
"Machine not found: "
+
newMachineId
);
}
// 更新设备选择序列
int
globalOpIndex
=
chromosome
.
getGlobalOpList
().
stream
()
.
filter
(
g
->
g
.
getOp
().
getId
()
==
opId
)
.
findFirst
()
.
map
(
GlobalOperationInfo:
:
getGlobalOpId
)
.
orElseThrow
(()
->
new
NoSuchElementException
(
"Global operation not found: "
+
opId
));
chromosome
.
getMachineSelection
().
set
(
globalOpIndex
,
machineOptionIndex
);
targetResult
.
setForcedMachineId
(
newMachineId
);
}
List
<
Integer
>
operationSequencing
=
allOperations
.
stream
()
.
sorted
((
op1
,
op2
)
->
{
int
time1
=
opTimeMap
.
getOrDefault
(
op1
.
getId
(),
Integer
.
MAX_VALUE
);
int
time2
=
opTimeMap
.
getOrDefault
(
op2
.
getId
(),
Integer
.
MAX_VALUE
);
if
(
time1
!=
time2
)
{
return
Integer
.
compare
(
time1
,
time2
);
}
else
{
return
Integer
.
compare
(
op1
.
getSequence
(),
op2
.
getSequence
());
}
})
.
map
(
Entry:
:
getGroupId
)
.
collect
(
Collectors
.
toList
());
chromosome
.
setOperationSequencing
(
operationSequencing
);
// 重新解码
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
}
}
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
d1891608
package
com
.
aps
.
service
.
common
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.aps.entity.Algorithm.Chromosome
;
import
com.aps.entity.ProdProcessExec
;
import
com.aps.entity.basic.Entry
;
import
com.aps.entity.basic.MachineOption
;
import
com.aps.entity.basic.Order
;
import
com.aps.entity.common.*
;
import
com.aps.service.plan.PlanResultService
;
import
com.aps.service.plan.SceneService
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.namedparam.MapSqlParameterSource
;
import
org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -24,12 +32,21 @@ public class ChromosomeDataService {
@Autowired
private
DatabaseQueryService
databaseQueryService
;
@Autowired
private
NamedParameterJdbcTemplate
namedParameterJdbcTemplate
;
@Autowired
private
Map
<
String
,
EntityConfig
>
entityConfigMap
;
@Autowired
private
PlanResultService
planResultService
;
/**
* 根据场景ID和实体名称查询Chromosome中的数据
*/
ObjectMapper
objectMapper
=
new
ObjectMapper
()
.
registerModule
(
new
JavaTimeModule
())
.
configure
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
,
false
);
public
Object
queryChromosomeData
(
String
sceneId
,
String
entityName
)
{
EntityConfig
config
=
getEntityConfig
(
entityName
);
...
...
@@ -793,14 +810,27 @@ public class ChromosomeDataService {
return
result
.
toString
();
}
/**
* 更新Chromosome中的数据(
仅支持文件
实体)
* 更新Chromosome中的数据(
支持文件实体和数据库
实体)
*/
public
boolean
updateChromosomeData
(
String
sceneId
,
String
entityName
,
Map
<
String
,
Object
>
data
)
{
EntityConfig
config
=
getEntityConfig
(
entityName
);
if
(
config
.
getDataSource
()
==
DataSourceType
.
DATABASE
)
{
throw
new
RuntimeException
(
"数据库实体暂不支持更新操作"
);
if
(
config
.
getDataSource
()
==
DataSourceType
.
FILE
)
{
if
(
"entry"
.
equalsIgnoreCase
(
entityName
))
{
convertNestedObjects
(
data
);
}
return
updateFileEntity
(
sceneId
,
entityName
,
data
);
}
else
{
// 数据库实体更新
return
updateDatabaseEntity
(
entityName
,
data
);
}
}
/**
* 更新文件实体数据
*/
private
boolean
updateFileEntity
(
String
sceneId
,
String
entityName
,
Map
<
String
,
Object
>
data
)
{
EntityConfig
config
=
getEntityConfig
(
entityName
);
// 从文件中加载Chromosome对象
Chromosome
chromosome
=
sceneService
.
loadChromosomeFromFile
(
sceneId
);
...
...
@@ -853,8 +883,36 @@ public class ChromosomeDataService {
}
}
}
else
{
// 直接更新整个字段
field
.
set
(
chromosome
,
data
);
// 如果不是列表类型或没有id字段,抛出异常提示
throw
new
RuntimeException
(
"更新文件实体时必须提供id字段以标识要更新的具体对象"
);
}
if
(
entityName
.
equals
(
"order"
))
{
chromosome
=
planResultService
.
editOrder
(
chromosome
,
sceneId
,
BeanUtil
.
toBean
(
data
,
Order
.
class
));
System
.
out
.
println
(
"test1123"
);
}
else
if
(
entityName
.
equals
(
"entry"
))
{
System
.
out
.
println
(
"5757"
);
Entry
entry
=
objectMapper
.
convertValue
(
data
,
Entry
.
class
);
// 2. 手动转换machineOptions字段
if
(
data
.
containsKey
(
"machineOptions"
))
{
List
<?>
machineOptionsList
=
(
List
<?>)
data
.
get
(
"machineOptions"
);
List
<
MachineOption
>
convertedOptions
=
new
ArrayList
<>();
for
(
Object
item
:
machineOptionsList
)
{
// 手动转换每个MachineOption对象
MachineOption
option
=
objectMapper
.
convertValue
(
item
,
MachineOption
.
class
);
convertedOptions
.
add
(
option
);
}
// 设置转换后的machineOptions
entry
.
setMachineOptions
(
convertedOptions
);
}
chromosome
=
planResultService
.
editOperation
(
chromosome
,
sceneId
,
entry
);
}
else
if
(
entityName
.
equals
(
"machineOption"
))
{
// chromosome =planResultService.editMachine(chromosome, sceneId, BeanUtil.toBean(data, MachineOption.class));
}
// 保存更新后的Chromosome到文件
...
...
@@ -866,6 +924,57 @@ public class ChromosomeDataService {
}
}
/**
* 更新数据库实体数据
*/
private
boolean
updateDatabaseEntity
(
String
entityName
,
Map
<
String
,
Object
>
data
)
{
EntityConfig
config
=
getEntityConfig
(
entityName
);
String
tableName
=
config
.
getTableName
();
if
(
data
==
null
||
!
data
.
containsKey
(
"id"
))
{
throw
new
RuntimeException
(
"更新数据库实体时必须提供id字段"
);
}
String
id
=
data
.
get
(
"id"
).
toString
();
// 构建更新SQL
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"UPDATE "
).
append
(
tableName
).
append
(
" SET "
);
List
<
String
>
setParts
=
new
ArrayList
<>();
MapSqlParameterSource
params
=
new
MapSqlParameterSource
();
// 遍历要更新的字段,排除id字段
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
data
.
entrySet
())
{
String
fieldName
=
entry
.
getKey
();
Object
fieldValue
=
entry
.
getValue
();
if
(!
"id"
.
equalsIgnoreCase
(
fieldName
))
{
// 将驼峰命名转换为下划线大写格式
String
dbFieldName
=
camelCaseToUnderScoreUpperCase
(
fieldName
).
toUpperCase
();
setParts
.
add
(
dbFieldName
+
" = :"
+
fieldName
);
params
.
addValue
(
fieldName
,
fieldValue
);
}
}
if
(
setParts
.
isEmpty
())
{
throw
new
RuntimeException
(
"没有有效的字段用于更新"
);
}
sql
.
append
(
String
.
join
(
", "
,
setParts
));
// 添加WHERE条件
sql
.
append
(
" WHERE ID = :idParam"
);
params
.
addValue
(
"idParam"
,
id
);
try
{
int
rowsAffected
=
namedParameterJdbcTemplate
.
update
(
sql
.
toString
(),
params
);
return
rowsAffected
>
0
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"数据库更新失败: "
+
e
.
getMessage
(),
e
);
}
}
/**
* 批量操作Chromosome中的数据(仅支持文件实体)
*/
...
...
@@ -1057,6 +1166,16 @@ public class ChromosomeDataService {
field
.
set
(
obj
,
Double
.
parseDouble
(
fieldValue
.
toString
()));
}
else
if
(
fieldType
==
Boolean
.
class
||
fieldType
==
boolean
.
class
)
{
field
.
set
(
obj
,
Boolean
.
parseBoolean
(
fieldValue
.
toString
()));
}
else
if
(
fieldType
==
List
.
class
)
{
// 特殊处理List类型字段,特别是MachineOption列表
List
<?>
valueList
=
(
List
<?>)
fieldValue
;
if
(!
valueList
.
isEmpty
()
&&
valueList
.
get
(
0
)
instanceof
Map
)
{
// 如果列表中的元素是Map(如JSON反序列化结果),需要特殊处理
// 对于MachineOption这类复杂对象,我们暂时直接赋值
field
.
set
(
obj
,
fieldValue
);
}
else
{
field
.
set
(
obj
,
fieldValue
);
}
}
else
{
field
.
set
(
obj
,
fieldValue
);
}
...
...
@@ -1155,4 +1274,30 @@ public class ChromosomeDataService {
return
new
ArrayList
<>();
// 如果不是Entry类型,返回空列表
}
private
void
convertNestedObjects
(
Map
<
String
,
Object
>
data
)
{
// 转换machineOptions(支持大小写)
convertListField
(
data
,
"MachineOptions"
,
MachineOption
.
class
);
// 可以添加其他需要转换的字段
}
private
<
T
>
void
convertListField
(
Map
<
String
,
Object
>
data
,
String
fieldName
,
Class
<
T
>
targetClass
)
{
if
(
data
.
containsKey
(
fieldName
))
{
Object
fieldValue
=
data
.
get
(
fieldName
);
if
(
fieldValue
instanceof
List
)
{
List
<?>
list
=
(
List
<?>)
fieldValue
;
List
<
T
>
convertedList
=
new
ArrayList
<>();
for
(
Object
item
:
list
)
{
if
(
item
instanceof
LinkedHashMap
)
{
T
convertedItem
=
BeanUtil
.
toBean
((
Map
<?,
?>)
item
,
targetClass
);
convertedList
.
add
(
convertedItem
);
}
}
data
.
put
(
fieldName
,
convertedList
);
}
}
}
}
\ No newline at end of file
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
d1891608
...
...
@@ -323,7 +323,43 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
}
public
Chromosome
editMachineOption
(
String
SceneId
,
Entry
operation
,
Long
newMachineId
)
{
Chromosome
chromosome
=
_sceneService
.
loadChromosomeFromFile
(
SceneId
);
if
(
chromosome
==
null
||
chromosome
.
getAllOperations
()
==
null
)
{
return
chromosome
;
}
List
<
Entry
>
operations
=
chromosome
.
getAllOperations
();
int
position
=
IntStream
.
range
(
0
,
operations
.
size
())
.
filter
(
i
->
operations
.
get
(
i
).
getId
()
==
operation
.
getId
())
.
findFirst
()
.
orElse
(-
1
);
if
(
position
!=
-
1
)
{
Entry
oldEntry
=
operations
.
set
(
position
,
operation
);
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
if
(
globalOpList
!=
null
)
{
globalOpList
.
stream
()
.
filter
(
opInfo
->
opInfo
.
getOp
()
!=
null
&&
opInfo
.
getOp
().
getId
()
==
oldEntry
.
getId
())
.
forEach
(
opInfo
->
opInfo
.
setOp
(
operation
));
}
}
GlobalParam
globalParam
=
new
GlobalParam
();
// Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
// WriteScheduleSummary(chromosome);
ScheduleOperationService
ScheduleOperation
=
new
ScheduleOperationService
();
WriteScheduleSummary
(
chromosome
);
ScheduleOperation
.
editMachineOption
(
chromosome
,
operation
,
newMachineId
,
globalParam
);
WriteScheduleSummary
(
chromosome
);
_sceneService
.
saveChromosomeToFile
(
chromosome
,
SceneId
);
return
chromosome
;
}
public
Chromosome
EditOperation
(
String
SceneId
,
Entry
operation
)
{
...
...
@@ -344,12 +380,12 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
if
(
globalOpList
!=
null
)
{
globalOpList
.
stream
()
.
filter
(
opInfo
->
opInfo
.
getOp
()
==
oldEntry
)
.
filter
(
opInfo
->
opInfo
.
getOp
()
!=
null
&&
opInfo
.
getOp
().
getId
()
==
oldEntry
.
getId
()
)
.
forEach
(
opInfo
->
opInfo
.
setOp
(
operation
));
}
}
return
redecodeChromosome
(
chromosome
);
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return
redecodeChromosome
(
chromosome
,
SceneId
);
}
public
Chromosome
EditOrder
(
String
SceneId
,
Order
order
)
{
...
...
@@ -373,10 +409,73 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
orderSortService
.
assignPriority
(
orders
,
rule
);
updateOrderRelatedEntries
(
chromosome
,
order
);
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return
redecodeChromosome
(
chromosome
,
SceneId
);
}
public
Chromosome
editOrder
(
Chromosome
chromosome
,
String
SceneId
,
Order
order
)
{
List
<
Order
>
orders
=
chromosome
.
getOrders
();
orderSortService
.
initializeFieldExtractors
();
OrderSortRule
rule
=
createMultiConditionRule
(
orders
);
orderSortService
.
assignPriority
(
orders
,
rule
);
updateOrderRelatedEntries
(
chromosome
,
order
);
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return
redecodeChromosome
(
chromosome
,
SceneId
);
}
public
Chromosome
editOperation
(
Chromosome
chromosome
,
String
SceneId
,
Entry
operation
)
{
return
redecodeChromosome
(
chromosome
);
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
if
(
globalOpList
!=
null
)
{
globalOpList
.
stream
()
.
filter
(
opInfo
->
opInfo
.
getOp
()
!=
null
&&
opInfo
.
getOp
().
getId
()
==
operation
.
getId
())
.
forEach
(
opInfo
->
opInfo
.
setOp
(
operation
));
}
GlobalParam
globalParam
=
new
GlobalParam
();
ScheduleOperationService
ScheduleOperation
=
new
ScheduleOperationService
();
System
.
out
.
println
(
operation
.
getSelectMachineID
());
ScheduleOperation
.
editMachineOption
(
chromosome
,
operation
,
operation
.
getSelectMachineID
(),
globalParam
);
return
redecodeChromosome
(
chromosome
,
SceneId
);
}
public
Chromosome
editMachine
(
Chromosome
chromosome
,
String
SceneId
,
Entry
operation
)
{
List
<
GlobalOperationInfo
>
globalOpList
=
chromosome
.
getGlobalOpList
();
if
(
globalOpList
!=
null
)
{
globalOpList
.
stream
()
.
filter
(
opInfo
->
opInfo
.
getOp
()
!=
null
&&
opInfo
.
getOp
().
getId
()
==
operation
.
getId
())
.
forEach
(
opInfo
->
opInfo
.
setOp
(
operation
));
}
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return
redecodeChromosome
(
chromosome
,
SceneId
);
}
/**
* 更新订单相关的所有Entry的数量和优先级
*/
...
...
@@ -408,10 +507,11 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
/**
* 重新解码染色体
*/
private
Chromosome
redecodeChromosome
(
Chromosome
chromosome
)
{
private
Chromosome
redecodeChromosome
(
Chromosome
chromosome
,
String
SceneId
)
{
GlobalParam
globalParam
=
new
GlobalParam
();
ScheduleOperationService
scheduleOperation
=
new
ScheduleOperationService
();
scheduleOperation
.
redecode
(
chromosome
,
chromosome
.
getBaseTime
(),
globalParam
);
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return
chromosome
;
}
...
...
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