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
c977460e
Commit
c977460e
authored
May 26, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2bf4f011
ffd1e0bc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
7 deletions
+55
-7
ChromosomeDataController.java
...a/com/aps/controller/common/ChromosomeDataController.java
+2
-1
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+14
-1
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+32
-0
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+7
-5
No files found.
src/main/java/com/aps/controller/common/ChromosomeDataController.java
View file @
c977460e
...
@@ -215,7 +215,8 @@ public class ChromosomeDataController {
...
@@ -215,7 +215,8 @@ public class ChromosomeDataController {
*/
*/
private
boolean
isFileEntity
(
String
entityName
)
{
private
boolean
isFileEntity
(
String
entityName
)
{
// 这里列出所有文件实体的名称
// 这里列出所有文件实体的名称
String
[]
fileEntities
=
{
"order"
,
"entry"
,
"machine"
,
"globaloperationinfo"
,
"groupresult"
,
"prodprocessexec"
,
"machineoption"
};
String
[]
fileEntities
=
{
"order"
,
"entry"
,
"machine"
,
"globaloperationinfo"
,
"groupresult"
,
"prodprocessexec"
,
"machineoption"
,
"task"
};
for
(
String
fileEntity
:
fileEntities
)
{
for
(
String
fileEntity
:
fileEntities
)
{
if
(
fileEntity
.
equalsIgnoreCase
(
entityName
))
{
if
(
fileEntity
.
equalsIgnoreCase
(
entityName
))
{
return
true
;
return
true
;
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
c977460e
...
@@ -1936,6 +1936,18 @@ if(targetOp.getSequence()>1) {
...
@@ -1936,6 +1936,18 @@ if(targetOp.getSequence()>1) {
}
}
resetDecodeMaterials
(
chromosome
,
baseMaterialsSnapshot
);
resetDecodeMaterials
(
chromosome
,
baseMaterialsSnapshot
);
// 重解码前重新初始化物料需求缓存,同时给MaterialRequirementService设置本次排产基准时间。
List
<
Material
>
decodeMaterials
=
chromosome
.
getMaterials
()
==
null
?
new
ArrayList
<>()
:
new
ArrayList
<>(
chromosome
.
getMaterials
().
values
());
materialRequirementService
.
preloadRoutingCache
(
chromosome
.
getScenarioID
(),
baseTime
,
chromosome
.
getOrders
(),
decodeMaterials
,
chromosome
.
getAllOperations
(),
globalParam
!=
null
&&
globalParam
.
isIsCheckSf
()
);
MachineSchedulerService
machineScheduler
=
new
MachineSchedulerService
(
baseTime
);
MachineSchedulerService
machineScheduler
=
new
MachineSchedulerService
(
baseTime
);
chromosome
.
setMachines
(
ProductionDeepCopyUtil
.
deepCopyList
(
chromosome
.
getInitMachines
(),
Machine
.
class
)
);
chromosome
.
setMachines
(
ProductionDeepCopyUtil
.
deepCopyList
(
chromosome
.
getInitMachines
(),
Machine
.
class
)
);
...
@@ -1943,8 +1955,9 @@ if(targetOp.getSequence()>1) {
...
@@ -1943,8 +1955,9 @@ if(targetOp.getSequence()>1) {
chromosome
.
getResult
().
clear
();
chromosome
.
getResult
().
clear
();
chromosome
.
setResult
(
new
CopyOnWriteArrayList
<>());
chromosome
.
setResult
(
new
CopyOnWriteArrayList
<>());
// BOM计算会使用decoder里的materials,自动插单重排也必须传入当前物料快照。
return
new
GeneticDecoder
(
globalParam
,
baseTime
,
chromosome
.
getMachines
(),
return
new
GeneticDecoder
(
globalParam
,
baseTime
,
chromosome
.
getMachines
(),
chromosome
.
getOrders
(),
null
,
machineScheduler
,
materialRequirementService
,
chromosome
.
getScenarioID
());
chromosome
.
getOrders
(),
chromosome
.
getMaterials
()
,
machineScheduler
,
materialRequirementService
,
chromosome
.
getScenarioID
());
}
}
private
TreeMap
<
String
,
Material
>
resolveDecodeMaterials
(
Chromosome
chromosome
)
{
private
TreeMap
<
String
,
Material
>
resolveDecodeMaterials
(
Chromosome
chromosome
)
{
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
c977460e
...
@@ -5,6 +5,8 @@ import com.aps.common.util.R;
...
@@ -5,6 +5,8 @@ import com.aps.common.util.R;
import
com.aps.entity.Algorithm.Chromosome
;
import
com.aps.entity.Algorithm.Chromosome
;
import
com.aps.entity.Algorithm.GAScheduleResult
;
import
com.aps.entity.Algorithm.GAScheduleResult
;
import
com.aps.entity.Algorithm.OrderMaterialRequirement
;
import
com.aps.entity.Algorithm.OrderMaterialRequirement
;
import
com.aps.entity.Gantt.ResourceGanttVO
;
import
com.aps.entity.Gantt.TaskVO
;
import
com.aps.entity.ProdProcessExec
;
import
com.aps.entity.ProdProcessExec
;
import
com.aps.entity.Algorithm.GlobalOperationInfo
;
import
com.aps.entity.Algorithm.GlobalOperationInfo
;
import
com.aps.entity.Algorithm.IDAndChildID.GroupResult
;
import
com.aps.entity.Algorithm.IDAndChildID.GroupResult
;
...
@@ -307,6 +309,7 @@ public class ChromosomeDataService {
...
@@ -307,6 +309,7 @@ public class ChromosomeDataService {
entityClassMap
.
put
(
"prodprocessexec"
,
ProdProcessExec
.
class
);
entityClassMap
.
put
(
"prodprocessexec"
,
ProdProcessExec
.
class
);
entityClassMap
.
put
(
"globaloperationinfo"
,
GlobalOperationInfo
.
class
);
entityClassMap
.
put
(
"globaloperationinfo"
,
GlobalOperationInfo
.
class
);
entityClassMap
.
put
(
"groupresult"
,
GroupResult
.
class
);
entityClassMap
.
put
(
"groupresult"
,
GroupResult
.
class
);
entityClassMap
.
put
(
"task"
,
TaskVO
.
class
);
return
entityClassMap
.
get
(
entityName
.
toLowerCase
());
return
entityClassMap
.
get
(
entityName
.
toLowerCase
());
}
}
...
@@ -1180,6 +1183,13 @@ public class ChromosomeDataService {
...
@@ -1180,6 +1183,13 @@ public class ChromosomeDataService {
config
.
setEntityName
(
entityName
);
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
"orders"
);
config
.
setFieldName
(
"orders"
);
}
// 特殊处理:当实体是Task时,取资源甘特图中的TaskVO列表。
else
if
(
"task"
.
equalsIgnoreCase
(
key
))
{
config
=
new
EntityConfig
();
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
"task"
);
}
else
{
}
else
{
// 自动创建数据库配置(默认行为)
// 自动创建数据库配置(默认行为)
config
=
createDefaultDbConfig
(
entityName
);
config
=
createDefaultDbConfig
(
entityName
);
...
@@ -1277,6 +1287,12 @@ public class ChromosomeDataService {
...
@@ -1277,6 +1287,12 @@ public class ChromosomeDataService {
}
}
try
{
try
{
if
(
"task"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
Object
result
=
extractResourceGanttTasks
(
chromosome
);
fileDataCache
.
put
(
cacheKey
,
result
);
return
result
;
}
String
fieldName
=
config
.
getFieldName
();
String
fieldName
=
config
.
getFieldName
();
// 特殊处理:当实体是MachineOption时,使用allOperations字段
// 特殊处理:当实体是MachineOption时,使用allOperations字段
...
@@ -1304,6 +1320,22 @@ public class ChromosomeDataService {
...
@@ -1304,6 +1320,22 @@ public class ChromosomeDataService {
}
}
}
}
private
List
<
TaskVO
>
extractResourceGanttTasks
(
Chromosome
chromosome
)
{
if
(
chromosome
==
null
)
{
return
new
ArrayList
<>();
}
List
<
Machine
>
machineList
=
planResultService
.
InitCalendarToAllMachines3
(
chromosome
);
List
<
ResourceGanttVO
>
resourceGanttVOs
=
planResultService
.
convertToResourceGanttVO1
(
chromosome
,
machineList
);
if
(
resourceGanttVOs
==
null
||
resourceGanttVOs
.
isEmpty
())
{
return
new
ArrayList
<>();
}
return
resourceGanttVOs
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
filter
(
vo
->
vo
.
getList
()
!=
null
)
.
flatMap
(
vo
->
vo
.
getList
().
stream
())
.
collect
(
Collectors
.
toList
());
}
/**
/**
* 从缓存中获取反射字段,避免重复反射操作
* 从缓存中获取反射字段,避免重复反射操作
*/
*/
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
c977460e
...
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
...
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
java.awt.Color
;
import
java.awt.Color
;
...
@@ -1463,13 +1464,9 @@ public class PlanResultService {
...
@@ -1463,13 +1464,9 @@ public class PlanResultService {
if
(
groupCode
!=
null
)
{
if
(
groupCode
!=
null
)
{
launchOrder
.
setGroupCode
(
groupCode
);
launchOrder
.
setGroupCode
(
groupCode
);
}
}
try
{
launchOrder
.
setOrderDesc
(
new
ObjectMapper
().
writeValueAsString
(
newOrderData
));
}
catch
(
Exception
e
)
{
launchOrder
.
setOrderDesc
(
String
.
valueOf
(
newOrderData
));
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Chromosome
InsertOrderAuto
(
String
sceneId
,
Map
<
String
,
Object
>
newOrderData
)
{
public
Chromosome
InsertOrderAuto
(
String
sceneId
,
Map
<
String
,
Object
>
newOrderData
)
{
if
(
newOrderData
==
null
)
{
if
(
newOrderData
==
null
)
{
throw
new
RuntimeException
(
"newOrder 不能为空"
);
throw
new
RuntimeException
(
"newOrder 不能为空"
);
...
@@ -1560,6 +1557,11 @@ public class PlanResultService {
...
@@ -1560,6 +1557,11 @@ public class PlanResultService {
if
(
apsTimeConfig
!=
null
&&
apsTimeConfig
.
getBaseTime
()
!=
null
)
{
if
(
apsTimeConfig
!=
null
&&
apsTimeConfig
.
getBaseTime
()
!=
null
)
{
baseTime
=
apsTimeConfig
.
getBaseTime
();
baseTime
=
apsTimeConfig
.
getBaseTime
();
}
}
if
(
baseTime
==
null
)
{
throw
new
RuntimeException
(
"自动插单失败:排产基准时间为空"
);
}
// 自动插单后会重解码,染色体里的基准时间也要同步,避免后续按空基准时间计算。
chromosome
.
setBaseTime
(
baseTime
);
LocalDateTime
anchorTime
=
baseTime
.
plusSeconds
(
Math
.
max
(
freezeSeconds
,
0L
));
LocalDateTime
anchorTime
=
baseTime
.
plusSeconds
(
Math
.
max
(
freezeSeconds
,
0L
));
// 5. 自动插单(占位后推 + 空挡前移)
// 5. 自动插单(占位后推 + 空挡前移)
...
...
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