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
0babbc59
Commit
0babbc59
authored
Sep 04, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工单分页接口
parent
d653ce10
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
15 deletions
+176
-15
ChromosomeDataController.java
...a/com/aps/controller/common/ChromosomeDataController.java
+1
-1
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+52
-14
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+123
-0
No files found.
src/main/java/com/aps/controller/common/ChromosomeDataController.java
View file @
0babbc59
...
...
@@ -216,7 +216,7 @@ public class ChromosomeDataController {
private
boolean
isFileEntity
(
String
entityName
)
{
// 这里列出所有文件实体的名称
String
[]
fileEntities
=
{
"order"
,
"entry"
,
"machine"
,
"globaloperationinfo"
,
"groupresult"
,
"prodprocessexec"
,
"machineoption"
,
"task"
};
"task"
,
"plan"
,
"resource"
};
for
(
String
fileEntity
:
fileEntities
)
{
if
(
fileEntity
.
equalsIgnoreCase
(
entityName
))
{
return
true
;
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
0babbc59
...
...
@@ -6,6 +6,8 @@ import com.aps.entity.Algorithm.Chromosome;
import
com.aps.entity.Algorithm.GAScheduleResult
;
import
com.aps.entity.Algorithm.OrderMaterialRequirement
;
import
com.aps.entity.Gantt.ResourceGanttVO
;
import
com.aps.entity.Gantt.ResourceSummaryVO
;
import
com.aps.entity.Gantt.ScheduledOrderVO
;
import
com.aps.entity.Gantt.TaskVO
;
import
com.aps.entity.ProdProcessExec
;
import
com.aps.entity.Algorithm.GlobalOperationInfo
;
...
...
@@ -225,6 +227,8 @@ public class ChromosomeDataService {
fileEntityClassMap
.
put
(
"prodprocessexec"
,
ProdProcessExec
.
class
);
fileEntityClassMap
.
put
(
"globaloperationinfo"
,
GlobalOperationInfo
.
class
);
fileEntityClassMap
.
put
(
"groupresult"
,
GroupResult
.
class
);
fileEntityClassMap
.
put
(
"plan"
,
ScheduledOrderVO
.
class
);
fileEntityClassMap
.
put
(
"resource"
,
ResourceSummaryVO
.
class
);
// 获取实体类
Class
<?>
fileEntityClass
=
fileEntityClassMap
.
get
(
entityName
.
toLowerCase
());
...
...
@@ -521,6 +525,9 @@ public class ChromosomeDataService {
* 查询文件数据列表(支持条件过滤)
*/
public
List
<
Object
>
queryChromosomeDataList
(
String
sceneId
,
String
entityName
,
Paged
paged
)
{
if
(
paged
.
getConditions
()
!=
null
)
{
paged
.
getConditions
().
removeIf
(
condition
->
"sceneId"
.
equalsIgnoreCase
(
condition
.
getFieldName
()));
}
// 对于materialInfo且有sceneId时,在conditions中添加排产物料ID过滤
if
(
"materialinfo"
.
equalsIgnoreCase
(
entityName
)
&&
sceneId
!=
null
&&
!
sceneId
.
isEmpty
())
{
boolean
hasProductIds
=
false
;
...
...
@@ -767,6 +774,14 @@ public class ChromosomeDataService {
}
else
{
return
new
ArrayList
<>();
}
}
else
if
(
"plan"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
if
(
paged
.
getConditions
()
!=
null
)
{
paged
.
getConditions
().
removeIf
(
condition
->
"sceneId"
.
equalsIgnoreCase
(
condition
.
getFieldName
()));
}
Object
scheduledData
=
queryFileData
(
sceneId
,
config
);
List
<
Object
>
plans
=
applyConditionsToList
(
scheduledData
,
paged
,
entityName
);
plans
=
sortData
(
plans
,
paged
);
return
applyGroupAndFieldsToList
(
plans
,
paged
);
}
else
if
(
"order"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
// 特殊处理:当实体是Order时,使用orderId字段进行查询
Object
data
=
queryFileData
(
sceneId
,
config
);
...
...
@@ -1190,8 +1205,20 @@ public class ChromosomeDataService {
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
"task"
);
}
else
if
(
"plan"
.
equalsIgnoreCase
(
key
))
{
config
=
new
EntityConfig
();
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
"plan"
);
}
else
if
(
"resource"
.
equalsIgnoreCase
(
key
))
{
config
=
new
EntityConfig
();
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
"resource"
);
}
else
{
//
自动创建数据库配置(默认行为)
//
鑷姩鍒涘缓鏁版嵁搴撻厤缃紙榛樿琛屼负锛?
config
=
createDefaultDbConfig
(
entityName
);
System
.
out
.
println
(
config
.
getTableName
()
);
...
...
@@ -1292,6 +1319,16 @@ public class ChromosomeDataService {
fileDataCache
.
put
(
cacheKey
,
result
);
return
result
;
}
if
(
"plan"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
Object
result
=
planResultService
.
convertToScheduledOrderVOList
(
chromosome
);
fileDataCache
.
put
(
cacheKey
,
result
);
return
result
;
}
if
(
"resource"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
Object
result
=
planResultService
.
convertToResourceSummaryVOList
(
chromosome
);
fileDataCache
.
put
(
cacheKey
,
result
);
return
result
;
}
String
fieldName
=
config
.
getFieldName
();
...
...
@@ -1321,19 +1358,7 @@ 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
());
return
planResultService
.
convertToTaskVOList
(
chromosome
);
}
/**
...
...
@@ -1354,6 +1379,9 @@ public class ChromosomeDataService {
* 查询文件数据(分页+条件)
*/
private
Map
<
String
,
Object
>
queryFileDataWithConditions
(
String
sceneId
,
EntityConfig
config
,
Paged
paged
)
{
if
(
paged
.
getConditions
()
!=
null
)
{
paged
.
getConditions
().
removeIf
(
condition
->
"sceneId"
.
equalsIgnoreCase
(
condition
.
getFieldName
()));
}
Object
data
;
// 特殊处理:当实体是MachineOption时,需要先获取Entry列表,再提取符合条件的Entry的MachineOption
...
...
@@ -1401,6 +1429,16 @@ public class ChromosomeDataService {
}
else
{
data
=
new
ArrayList
<
MachineOption
>();
}
}
else
if
(
"plan"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
if
(
paged
.
getConditions
()
!=
null
)
{
paged
.
getConditions
().
removeIf
(
condition
->
"sceneId"
.
equalsIgnoreCase
(
condition
.
getFieldName
()));
}
Object
scheduledData
=
queryFileData
(
sceneId
,
config
);
data
=
scheduledData
instanceof
List
?
new
ArrayList
<>((
List
<?>)
scheduledData
)
:
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
paged
.
getConditions
()))
{
data
=
filterDataByConditions
((
List
<?>)
data
,
paged
.
getConditions
(),
paged
.
getAnd
());
}
data
=
sortData
((
List
<?>)
data
,
paged
);
}
else
if
(
"order"
.
equalsIgnoreCase
(
config
.
getEntityName
()))
{
// 特殊处理:当实体是Order时,使用orderId字段进行查询
Object
orderData
=
queryFileData
(
sceneId
,
config
);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
0babbc59
...
...
@@ -3642,6 +3642,129 @@ if(job.getGeneDetails()!=null)
public
List
<
TaskVO
>
convertToTaskVOList
(
Chromosome
scheduleChromosome
)
{
List
<
TaskVO
>
taskVOList
=
new
ArrayList
<>();
if
(
scheduleChromosome
==
null
||
scheduleChromosome
.
getResult
()
==
null
||
scheduleChromosome
.
getBaseTime
()
==
null
)
{
return
taskVOList
;
}
List
<
Entry
>
allOperations
=
scheduleChromosome
.
getAllOperations
();
for
(
GAScheduleResult
result
:
scheduleChromosome
.
getResult
())
{
if
(
result
==
null
||
result
.
getOrderId
()
==
null
||
result
.
getMachineId
()
<=
0
)
{
continue
;
}
Entry
entry
=
allOperations
==
null
?
null
:
allOperations
.
stream
()
.
filter
(
operation
->
operation
.
getId
()
==
result
.
getOperationId
())
.
findFirst
()
.
orElse
(
null
);
TaskVO
taskVO
=
new
TaskVO
();
taskVO
.
setId
(
String
.
valueOf
(
result
.
getOperationId
()));
taskVO
.
setPlanId
(
result
.
getOrderId
());
taskVO
.
setPlanCode
(
result
.
getOrderCode
());
taskVO
.
setProductType
(
0
);
taskVO
.
setProductName
(
result
.
getProductName
());
taskVO
.
setProductId
(
result
.
getProductId
());
taskVO
.
setProductCode
(
result
.
getProductCode
());
taskVO
.
setQuantity
(
result
.
getQuantity
());
taskVO
.
setStart
(
scheduleChromosome
.
getBaseTime
().
plusSeconds
(
result
.
getStartTime
()));
taskVO
.
setEnd
(
scheduleChromosome
.
getBaseTime
().
plusSeconds
(
result
.
getEndTime
()));
taskVO
.
setAbsoluteStart
(
taskVO
.
getStart
());
taskVO
.
setAbsoluteEnd
(
taskVO
.
getEnd
());
taskVO
.
setSetup
(
result
.
getPreTime
());
taskVO
.
setTeardown
(
result
.
getTeardownTime
());
taskVO
.
setEquipChange
(
result
.
getChangeOverTime
());
taskVO
.
setEquipCooling
(
0
);
taskVO
.
setDuration
((
int
)
java
.
time
.
Duration
.
between
(
taskVO
.
getStart
(),
taskVO
.
getEnd
()).
toMinutes
());
taskVO
.
setEquipId
(
result
.
getMachineId
());
taskVO
.
setShopId
(
result
.
getMachineId
());
taskVO
.
setShopName
(
result
.
getMachineId
()
+
"\u8F66\u95F4"
);
taskVO
.
setStatus
(
0
);
taskVO
.
setLocked
(
result
.
isIsLocked
());
taskVO
.
setProcessingTime
(
result
.
getProcessingTime
());
taskVO
.
setAbsolutePreparationTime
(
result
.
getTeardownTime
());
if
(
entry
!=
null
)
{
taskVO
.
setSeq
(
Math
.
toIntExact
(
entry
.
getTaskSeq
()));
taskVO
.
setSeqName
(
entry
.
getRoutingDetailName
());
taskVO
.
setDetailId
(
entry
.
getRoutingDetailId
());
taskVO
.
setHeaderId
(
entry
.
getRoutingId
());
taskVO
.
setHeaderName
(
entry
.
getRoutingName
());
}
if
(
result
.
getDesignatedStartTime
()
>
0
)
{
taskVO
.
setDesignatedStartTime
(
scheduleChromosome
.
getBaseTime
().
plusSeconds
(
result
.
getDesignatedStartTime
()));
}
taskVOList
.
add
(
taskVO
);
}
return
taskVOList
;
}
public
List
<
com
.
aps
.
entity
.
Gantt
.
ScheduledOrderVO
>
convertToScheduledOrderVOList
(
Chromosome
scheduleChromosome
)
{
List
<
com
.
aps
.
entity
.
Gantt
.
ScheduledOrderVO
>
scheduledOrders
=
new
ArrayList
<>();
if
(
scheduleChromosome
==
null
||
scheduleChromosome
.
getResult
()
==
null
||
scheduleChromosome
.
getBaseTime
()
==
null
)
{
return
scheduledOrders
;
}
List
<
Entry
>
allOperations
=
scheduleChromosome
.
getAllOperations
();
scheduleChromosome
.
getResult
().
stream
()
.
filter
(
result
->
result
!=
null
&&
result
.
getOrderId
()
!=
null
&&
!
result
.
getOrderId
().
isEmpty
())
.
collect
(
Collectors
.
groupingBy
(
GAScheduleResult:
:
getOrderId
))
.
forEach
((
orderId
,
results
)
->
{
GAScheduleResult
firstResult
=
results
.
get
(
0
);
com
.
aps
.
entity
.
Gantt
.
ScheduledOrderVO
scheduledOrder
=
new
com
.
aps
.
entity
.
Gantt
.
ScheduledOrderVO
();
scheduledOrder
.
setId
(
orderId
);
scheduledOrder
.
setProductName
(
firstResult
.
getProductName
());
scheduledOrder
.
setProductType
(
0
);
scheduledOrder
.
setProductId
(
firstResult
.
getProductId
());
scheduledOrder
.
setQuantity
(
firstResult
.
getQuantity
());
scheduledOrder
.
setCode
(
firstResult
.
getProductCode
());
scheduledOrder
.
setStartDate
(
scheduleChromosome
.
getBaseTime
().
plusSeconds
(
results
.
stream
().
mapToInt
(
GAScheduleResult:
:
getStartTime
).
min
().
orElse
(
0
)));
scheduledOrder
.
setEndDate
(
scheduleChromosome
.
getBaseTime
().
plusSeconds
(
results
.
stream
().
mapToInt
(
GAScheduleResult:
:
getEndTime
).
max
().
orElse
(
0
)));
scheduledOrder
.
setStatus
(
"已发布"
);
scheduledOrder
.
setOrderCode
(
firstResult
.
getOrderCode
());
Entry
entry
=
allOperations
==
null
?
null
:
allOperations
.
stream
()
.
filter
(
operation
->
operation
.
getId
()
==
firstResult
.
getOperationId
())
.
findFirst
().
orElse
(
null
);
if
(
entry
!=
null
)
{
scheduledOrder
.
setHeaderId
(
entry
.
getRoutingId
());
scheduledOrder
.
setHeaderName
(
entry
.
getRoutingName
());
}
scheduledOrders
.
add
(
scheduledOrder
);
});
return
scheduledOrders
;
}
public
List
<
com
.
aps
.
entity
.
Gantt
.
ResourceSummaryVO
>
convertToResourceSummaryVOList
(
Chromosome
scheduleChromosome
)
{
List
<
com
.
aps
.
entity
.
Gantt
.
ResourceSummaryVO
>
resources
=
new
ArrayList
<>();
if
(
scheduleChromosome
==
null
)
{
return
resources
;
}
List
<
Machine
>
machines
=
InitCalendarToAllMachines3
(
scheduleChromosome
);
if
(
machines
==
null
)
{
return
resources
;
}
for
(
Machine
machine
:
machines
)
{
com
.
aps
.
entity
.
Gantt
.
ResourceSummaryVO
resource
=
new
com
.
aps
.
entity
.
Gantt
.
ResourceSummaryVO
();
resource
.
setId
(
machine
.
getId
());
resource
.
setName
(
machine
.
getName
());
resource
.
setCode
(
machine
.
getCode
());
resource
.
setShift
(
convertToShiftVO
(
machine
));
resources
.
add
(
resource
);
}
return
resources
;
}
private
ShiftVO
convertToShiftVO
(
Machine
machine
)
{
ShiftVO
shiftVO
=
new
ShiftVO
();
shiftVO
.
setId
(
machine
.
getId
());
...
...
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