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
bc529e67
Commit
bc529e67
authored
May 27, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a8b02830
85fa9adb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
1 deletion
+70
-1
ChromosomeDataController.java
...a/com/aps/controller/common/ChromosomeDataController.java
+10
-1
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+5
-0
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+55
-0
No files found.
src/main/java/com/aps/controller/common/ChromosomeDataController.java
View file @
bc529e67
...
...
@@ -65,7 +65,7 @@ public class ChromosomeDataController {
// 文件实体必须要有sceneId
if
(
isFileEntity
(
entityName
)
&&
(
sceneId
==
null
||
sceneId
.
isEmpty
()))
{
return
R
.
ok
(
null
);
return
ok
(
emptyPageResult
(
paged
)
);
}
Map
<
String
,
Object
>
result
=
chromosomeDataService
.
queryChromosomeDataWithConditions
(
...
...
@@ -225,6 +225,15 @@ public class ChromosomeDataController {
return
false
;
}
private
Map
<
String
,
Object
>
emptyPageResult
(
Paged
paged
)
{
Map
<
String
,
Object
>
result
=
new
java
.
util
.
HashMap
<>();
result
.
put
(
"records"
,
Collections
.
emptyList
());
result
.
put
(
"totalCount"
,
0
);
result
.
put
(
"pageIndex"
,
paged
!=
null
&&
paged
.
getPageIndex
()
!=
null
?
Math
.
max
(
1
,
paged
.
getPageIndex
())
:
1
);
result
.
put
(
"size"
,
paged
!=
null
&&
paged
.
getPageSize
()
!=
null
?
paged
.
getPageSize
()
:
10
);
return
result
;
}
/**
* 批量查询接口(report)
* 支持在一个请求中查询多个实体
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
bc529e67
...
...
@@ -1649,6 +1649,11 @@ public class ChromosomeDataService {
result
.
put
(
"totalCount"
,
total
);
result
.
put
(
"pageIndex"
,
page
);
result
.
put
(
"size"
,
size
);
}
else
if
(
data
==
null
)
{
result
.
put
(
"records"
,
Collections
.
emptyList
());
result
.
put
(
"totalCount"
,
0
);
result
.
put
(
"pageIndex"
,
page
);
result
.
put
(
"size"
,
size
);
}
else
{
result
.
put
(
"records"
,
data
);
result
.
put
(
"totalCount"
,
1
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
bc529e67
...
...
@@ -47,6 +47,7 @@ import java.time.temporal.ChronoUnit;
import
java.util.*
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
...
...
@@ -1566,6 +1567,7 @@ public class PlanResultService {
// 5. 自动插单(占位后推 + 空挡前移)
GlobalParam
globalParam
=
buildGlobalParamFromSnapshot
(
sceneId
,
chromosome
,
true
);
ensureAutoInsertMachines
(
chromosome
,
newProdEquipments
,
baseTime
,
globalParam
);
ScheduleOperationService
scheduleOperation
=
new
ScheduleOperationService
(
materialRequirementService
,
this
);
scheduleOperation
.
InsertOrderAuto
(
chromosome
,
...
...
@@ -1584,6 +1586,59 @@ public class PlanResultService {
return
chromosome
;
}
private
void
ensureAutoInsertMachines
(
Chromosome
chromosome
,
List
<
ProdEquipment
>
newProdEquipments
,
LocalDateTime
baseTime
,
GlobalParam
globalParam
)
{
if
(
chromosome
==
null
||
newProdEquipments
==
null
||
newProdEquipments
.
isEmpty
())
{
return
;
}
if
(
chromosome
.
getMachines
()
==
null
)
{
chromosome
.
setMachines
(
new
ArrayList
<>());
}
if
(
chromosome
.
getInitMachines
()
==
null
)
{
chromosome
.
setInitMachines
(
new
ArrayList
<>());
}
Set
<
Long
>
existingMachineIds
=
chromosome
.
getMachines
().
stream
()
.
filter
(
Objects:
:
nonNull
)
.
map
(
Machine:
:
getId
)
.
collect
(
Collectors
.
toSet
());
Set
<
Long
>
requiredMachineIds
=
newProdEquipments
.
stream
()
.
map
(
ProdEquipment:
:
getEquipId
)
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toCollection
(
LinkedHashSet:
:
new
));
requiredMachineIds
.
removeAll
(
existingMachineIds
);
if
(
requiredMachineIds
.
isEmpty
())
{
return
;
}
// 自动插单可能引入当前场景原来没有用到的设备,需要按设备日历补进染色体设备池。
MachineSchedulerService
machineScheduler
=
new
MachineSchedulerService
(
baseTime
);
List
<
Machine
>
allMachines
=
globalParam
!=
null
&&
!
globalParam
.
isIsUseCalendar
()
?
_routingDataService
.
InitNoCalendarToAllMachines
(
machineScheduler
,
baseTime
)
:
_routingDataService
.
InitCalendarToAllMachines
(
machineScheduler
,
baseTime
);
Map
<
Long
,
Machine
>
machineById
=
allMachines
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
collect
(
Collectors
.
toMap
(
Machine:
:
getId
,
Function
.
identity
(),
(
existing
,
replacement
)
->
existing
));
List
<
Long
>
missingMachineIds
=
new
ArrayList
<>();
for
(
Long
machineId
:
requiredMachineIds
)
{
Machine
machine
=
machineById
.
get
(
machineId
);
if
(
machine
==
null
)
{
missingMachineIds
.
add
(
machineId
);
continue
;
}
Machine
machineCopy
=
ProductionDeepCopyUtil
.
deepCopy
(
machine
,
Machine
.
class
);
Machine
initMachineCopy
=
ProductionDeepCopyUtil
.
deepCopy
(
machine
,
Machine
.
class
);
chromosome
.
getMachines
().
add
(
machineCopy
);
chromosome
.
getInitMachines
().
add
(
initMachineCopy
);
}
if
(!
missingMachineIds
.
isEmpty
())
{
throw
new
RuntimeException
(
"自动插单失败:新工序设备未找到设备资源/日历配置: "
+
missingMachineIds
);
}
log
.
info
(
"自动插单补充设备到当前排产设备池: sceneId={}, machineIds={}"
,
chromosome
.
getScenarioID
(),
requiredMachineIds
);
}
public
Chromosome
Move
(
String
SceneId
,
List
<
Integer
>
opId
,
LocalDateTime
newStartTime
,
Long
newMachineId
,
int
lockStartTime
)
{
...
...
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