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
b11e0318
Commit
b11e0318
authored
Dec 31, 2025
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备维修设备日历修改
parent
5f4dee85
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1252 additions
and
389 deletions
+1252
-389
pom.xml
pom.xml
+5
-0
LanuchController.java
src/main/java/com/aps/controller/LanuchController.java
+3
-3
ChromosomeDataController.java
...a/com/aps/controller/common/ChromosomeDataController.java
+85
-176
MaintenanceWindowController.java
...com/aps/controller/gantt/MaintenanceWindowController.java
+17
-17
ResourceGanttController.java
...ava/com/aps/controller/gantt/ResourceGanttController.java
+1
-1
Entry.java
src/main/java/com/aps/entity/basic/Entry.java
+1
-1
MaintenanceWindow.java
src/main/java/com/aps/entity/basic/MaintenanceWindow.java
+33
-15
DataSourceType.java
src/main/java/com/aps/entity/common/DataSourceType.java
+26
-0
EntityConfig.java
src/main/java/com/aps/entity/common/EntityConfig.java
+48
-0
EntityConfigConfiguration.java
...java/com/aps/entity/common/EntityConfigConfiguration.java
+59
-0
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+2
-2
MaterialRequirementService.java
...com/aps/service/Algorithm/MaterialRequirementService.java
+2
-1
RoutingDataService.java
...in/java/com/aps/service/Algorithm/RoutingDataService.java
+4
-0
ScheduleOperationService.java
...a/com/aps/service/Algorithm/ScheduleOperationService.java
+3
-0
LanuchService.java
src/main/java/com/aps/service/LanuchService.java
+1
-1
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+593
-159
DatabaseQueryService.java
...ain/java/com/aps/service/common/DatabaseQueryService.java
+284
-0
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+24
-12
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+61
-1
No files found.
pom.xml
View file @
b11e0318
...
@@ -106,6 +106,11 @@
...
@@ -106,6 +106,11 @@
<version>
2.15.2
</version>
<!-- 建议与jackson-databind版本一致 -->
<version>
2.15.2
</version>
<!-- 建议与jackson-databind版本一致 -->
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.8.16
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/aps/controller/LanuchController.java
View file @
b11e0318
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
@RestController
@RestController
@RequestMapping
(
"/lanuch"
)
@RequestMapping
(
"/lanuch"
)
...
@@ -44,8 +45,8 @@ public class LanuchController {
...
@@ -44,8 +45,8 @@ public class LanuchController {
R
<
ProdSceneConfig
>
result
=
lanuchService
.
lanuch
(
sceneName
,
userId
);
R
<
ProdSceneConfig
>
result
=
lanuchService
.
lanuch
(
sceneName
,
userId
);
// 异步更新物料和设备缓存
// 异步更新物料和设备缓存
,不等待完成
updateMaterialAndEquipmentCacheAsync
(
);
CompletableFuture
.
runAsync
(
this
::
updateMaterialAndEquipmentCacheAsync
);
return
result
;
return
result
;
}
}
...
@@ -56,7 +57,6 @@ public class LanuchController {
...
@@ -56,7 +57,6 @@ public class LanuchController {
log
.
info
(
"开始异步更新物料缓存"
);
log
.
info
(
"开始异步更新物料缓存"
);
planResultService
.
getMaterials
();
planResultService
.
getMaterials
();
log
.
info
(
"物料缓存更新完成"
);
log
.
info
(
"物料缓存更新完成"
);
log
.
info
(
"开始异步更新设备缓存"
);
log
.
info
(
"开始异步更新设备缓存"
);
planResultService
.
InitCalendarToAllMachines
();
planResultService
.
InitCalendarToAllMachines
();
log
.
info
(
"设备缓存更新完成"
);
log
.
info
(
"设备缓存更新完成"
);
...
...
src/main/java/com/aps/controller/common/ChromosomeDataController.java
View file @
b11e0318
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/controller/gantt/MaintenanceWindowController.java
View file @
b11e0318
package
com
.
aps
.
controller
.
gantt
;
package
com
.
aps
.
controller
.
gantt
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.aps.common.util.ParamValidator
;
import
com.aps.common.util.ParamValidator
;
import
com.aps.common.util.R
;
import
com.aps.common.util.R
;
import
com.aps.entity.Algorithm.Chromosome
;
import
com.aps.entity.Algorithm.Chromosome
;
...
@@ -27,27 +28,26 @@ public class MaintenanceWindowController {
...
@@ -27,27 +28,26 @@ public class MaintenanceWindowController {
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@Operation
(
summary
=
"添加维护窗口"
,
description
=
"为指定机器添加维护窗口"
,
@Operation
(
summary
=
"添加维护窗口"
,
description
=
"为指定机器添加维护窗口"
,
requestBody
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
parameters
.
RequestBody
(
requestBody
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
parameters
.
RequestBody
(
description
=
"维护窗口参数"
,
description
=
"维护窗口参数"
,
content
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Content
(
content
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Content
(
mediaType
=
"application/json"
,
mediaType
=
"application/json"
,
examples
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
ExampleObject
(
examples
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
ExampleObject
(
name
=
"添加维护窗口示例"
,
name
=
"添加维护窗口示例"
,
value
=
"{\n \"sceneId\": \"B571EF6682DB463AB2977B1055A74112\",\n \"machineId\": 3402,\n \"maintenanceWindow\": {\n \"id\": \"maintenance-001\",\n \"startTime\": \"2025-11-03T07:36:00.000Z\",\n \"endTime\": \"2025-11-03T09:36:00.000Z\",\n \"reason\": \"定期维护\"\n }\n}"
value
=
"{\n \"sceneId\": \"B571EF6682DB463AB2977B1055A74112\",\n \"machineId\": 3402,\n \"maintenanceWindow\": {\n \"id\": \"maintenance-001\",\n \"startTime\": \"2025-11-03T07:36:00.000Z\",\n \"endTime\": \"2025-11-03T09:36:00.000Z\",\n \"reason\": \"定期维护\"\n }\n}"
)
)
)
)
)
)
)
)
public
R
<
Chromosome
>
addMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
addMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
Long
machineId
=
ParamValidator
.
getLong
(
params
,
"machineId"
,
"机器ID"
);
Long
machineId
=
ParamValidator
.
getLong
(
params
,
"machineId"
,
"机器ID"
);
MaintenanceWindow
maintenanceWindow
=
(
MaintenanceWindow
)
params
.
get
(
"maintenanceWindow"
);
MaintenanceWindow
maintenanceWindow
=
BeanUtil
.
toBean
(
params
.
get
(
"maintenanceWindow"
),
MaintenanceWindow
.
class
);
Chromosome
result
=
planResultService
.
AddMaintenanceWindow
(
sceneId
,
machineId
,
maintenanceWindow
);
Chromosome
result
=
planResultService
.
AddMaintenanceWindow
(
sceneId
,
machineId
,
maintenanceWindow
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"添加成功"
);
}
}
@
Delete
Mapping
(
"/delete"
)
@
Post
Mapping
(
"/delete"
)
@Operation
(
summary
=
"删除维护窗口"
,
description
=
"删除指定机器的维护窗口"
,
@Operation
(
summary
=
"删除维护窗口"
,
description
=
"删除指定机器的维护窗口"
,
requestBody
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
parameters
.
RequestBody
(
requestBody
=
@io
.
swagger
.
v3
.
oas
.
annotations
.
parameters
.
RequestBody
(
description
=
"删除维护窗口请求参数"
,
description
=
"删除维护窗口请求参数"
,
...
@@ -60,13 +60,13 @@ public class MaintenanceWindowController {
...
@@ -60,13 +60,13 @@ public class MaintenanceWindowController {
)
)
)
)
)
)
public
R
<
Chromosome
>
delMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
delMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
Long
machineId
=
ParamValidator
.
getLong
(
params
,
"machineId"
,
"机器ID"
);
Long
machineId
=
ParamValidator
.
getLong
(
params
,
"machineId"
,
"机器ID"
);
String
maintenanceId
=
ParamValidator
.
getString
(
params
,
"maintenanceId"
,
"维护窗口ID"
);
String
maintenanceId
=
ParamValidator
.
getString
(
params
,
"maintenanceId"
,
"维护窗口ID"
);
Chromosome
result
=
planResultService
.
DelMaintenanceWindow
(
sceneId
,
machineId
,
maintenanceId
);
Chromosome
result
=
planResultService
.
DelMaintenanceWindow
(
sceneId
,
machineId
,
maintenanceId
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"删除成功"
);
}
}
@PostMapping
(
"/get"
)
@PostMapping
(
"/get"
)
...
@@ -83,7 +83,7 @@ public class MaintenanceWindowController {
...
@@ -83,7 +83,7 @@ public class MaintenanceWindowController {
)
)
)
)
@ApiResponses
({
@ApiResponses
({
@ApiResponse
(
responseCode
=
"200"
,
description
=
"成功获取维护窗口列表"
)
@ApiResponse
(
responseCode
=
"200"
,
description
=
"成功获取维护窗口列表"
)
})
})
public
R
<
List
<
MaintenanceWindow
>>
getMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
List
<
MaintenanceWindow
>>
getMaintenanceWindow
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
...
src/main/java/com/aps/controller/gantt/ResourceGanttController.java
View file @
b11e0318
...
@@ -806,7 +806,7 @@ public class ResourceGanttController {
...
@@ -806,7 +806,7 @@ public class ResourceGanttController {
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
Machine
>
machineList
=
planResultService
.
InitCalendarToAllMachines
2
(
sceneId
);
List
<
Machine
>
machineList
=
planResultService
.
InitCalendarToAllMachines
3
(
schedule
);
// 转换为 ResourceGanttVO 格式
// 转换为 ResourceGanttVO 格式
List
<
ResourceGanttVO
>
resourceGanttVOList
=
new
ArrayList
<>();
List
<
ResourceGanttVO
>
resourceGanttVOList
=
new
ArrayList
<>();
...
...
src/main/java/com/aps/entity/basic/Entry.java
View file @
b11e0318
...
@@ -22,7 +22,7 @@ public class Entry {
...
@@ -22,7 +22,7 @@ public class Entry {
/**
/**
* 基因编号
* 基因编号
*/
*/
public
int
I
d
;
public
int
i
d
;
/**
/**
* 所属组ID 需要按照前后顺序生产的工单给一组
* 所属组ID 需要按照前后顺序生产的工单给一组
*/
*/
...
...
src/main/java/com/aps/entity/basic/MaintenanceWindow.java
View file @
b11e0318
...
@@ -11,15 +11,18 @@ public class MaintenanceWindow {
...
@@ -11,15 +11,18 @@ public class MaintenanceWindow {
private
LocalDateTime
endTime
;
private
LocalDateTime
endTime
;
private
String
reason
;
private
String
reason
;
private
String
equipCode
;
private
String
equipName
;
public
MaintenanceWindow
()
{}
public
MaintenanceWindow
()
{}
public
MaintenanceWindow
(
LocalDateTime
startTime
,
LocalDateTime
endTime
,
String
reason
)
{
public
MaintenanceWindow
(
LocalDateTime
startTime
,
LocalDateTime
endTime
,
String
reason
)
{
this
.
startTime
=
startTime
;
this
.
startTime
=
startTime
;
this
.
endTime
=
endTime
;
this
.
endTime
=
endTime
;
this
.
reason
=
reason
;
this
.
reason
=
reason
;
}
}
/**
/**
* 从Holiday对象构造MaintenanceWindow
* 从Holiday对象构造MaintenanceWindow
* @param holiday 假期对象
* @param holiday 假期对象
...
@@ -27,7 +30,7 @@ public class MaintenanceWindow {
...
@@ -27,7 +30,7 @@ public class MaintenanceWindow {
public
MaintenanceWindow
(
Holiday
holiday
)
{
public
MaintenanceWindow
(
Holiday
holiday
)
{
this
(
holiday
.
getStart
(),
holiday
.
getEnd
(),
"Holiday Period"
);
this
(
holiday
.
getStart
(),
holiday
.
getEnd
(),
"Holiday Period"
);
}
}
/**
/**
* 从Holiday对象构造MaintenanceWindow(可指定原因)
* 从Holiday对象构造MaintenanceWindow(可指定原因)
* @param holiday 假期对象
* @param holiday 假期对象
...
@@ -36,28 +39,28 @@ public class MaintenanceWindow {
...
@@ -36,28 +39,28 @@ public class MaintenanceWindow {
public
MaintenanceWindow
(
Holiday
holiday
,
String
reason
)
{
public
MaintenanceWindow
(
Holiday
holiday
,
String
reason
)
{
this
(
holiday
.
getStart
(),
holiday
.
getEnd
(),
reason
);
this
(
holiday
.
getStart
(),
holiday
.
getEnd
(),
reason
);
}
}
// Getters and Setters
// Getters and Setters
public
LocalDateTime
getStartTime
()
{
public
LocalDateTime
getStartTime
()
{
return
startTime
;
return
startTime
;
}
}
public
void
setStartTime
(
LocalDateTime
startTime
)
{
public
void
setStartTime
(
LocalDateTime
startTime
)
{
this
.
startTime
=
startTime
;
this
.
startTime
=
startTime
;
}
}
public
LocalDateTime
getEndTime
()
{
public
LocalDateTime
getEndTime
()
{
return
endTime
;
return
endTime
;
}
}
public
void
setEndTime
(
LocalDateTime
endTime
)
{
public
void
setEndTime
(
LocalDateTime
endTime
)
{
this
.
endTime
=
endTime
;
this
.
endTime
=
endTime
;
}
}
public
String
getReason
()
{
public
String
getReason
()
{
return
reason
;
return
reason
;
}
}
public
void
setReason
(
String
reason
)
{
public
void
setReason
(
String
reason
)
{
this
.
reason
=
reason
;
this
.
reason
=
reason
;
}
}
...
@@ -69,18 +72,33 @@ public class MaintenanceWindow {
...
@@ -69,18 +72,33 @@ public class MaintenanceWindow {
public
void
setId
(
String
id
)
{
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
String
getEquipCode
()
{
return
equipCode
;
}
public
void
setEquipCode
(
String
equipCode
)
{
this
.
equipCode
=
equipCode
;
}
public
String
getEquipName
()
{
return
equipName
;
}
public
void
setEquipName
(
String
equipName
)
{
this
.
equipName
=
equipName
;
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
MaintenanceWindow
that
=
(
MaintenanceWindow
)
o
;
MaintenanceWindow
that
=
(
MaintenanceWindow
)
o
;
return
Objects
.
equals
(
startTime
,
that
.
startTime
)
&&
return
Objects
.
equals
(
startTime
,
that
.
startTime
)
&&
Objects
.
equals
(
endTime
,
that
.
endTime
);
Objects
.
equals
(
endTime
,
that
.
endTime
);
}
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
startTime
,
endTime
);
return
Objects
.
hash
(
startTime
,
endTime
);
...
...
src/main/java/com/aps/entity/common/DataSourceType.java
0 → 100644
View file @
b11e0318
// DataSourceType.java
package
com
.
aps
.
entity
.
common
;
public
enum
DataSourceType
{
FILE
(
"file"
),
// 文件数据源(现有)
DATABASE
(
"db"
);
// 数据库数据源(新增)
private
String
type
;
DataSourceType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
public
static
DataSourceType
fromString
(
String
type
)
{
for
(
DataSourceType
dataSource
:
DataSourceType
.
values
())
{
if
(
dataSource
.
getType
().
equalsIgnoreCase
(
type
))
{
return
dataSource
;
}
}
return
FILE
;
// 默认返回FILE
}
}
\ No newline at end of file
src/main/java/com/aps/entity/common/EntityConfig.java
0 → 100644
View file @
b11e0318
// EntityConfig.java
package
com
.
aps
.
entity
.
common
;
public
class
EntityConfig
{
private
String
entityName
;
private
DataSourceType
dataSource
;
private
String
tableName
;
// 数据库表名(如果是数据库源)
private
String
fieldName
;
// Chromosome字段名(如果是文件源)
private
Class
<?>
entityClass
;
// 实体类(数据库实体使用)
// 构造方法
public
EntityConfig
()
{}
public
EntityConfig
(
String
entityName
,
DataSourceType
dataSource
,
String
fieldName
,
String
tableName
,
Class
<?>
entityClass
)
{
this
.
entityName
=
entityName
;
this
.
dataSource
=
dataSource
;
this
.
fieldName
=
fieldName
;
this
.
tableName
=
tableName
;
this
.
entityClass
=
entityClass
;
}
// getter/setter
public
String
getEntityName
()
{
return
entityName
;
}
public
void
setEntityName
(
String
entityName
)
{
this
.
entityName
=
entityName
;
}
public
DataSourceType
getDataSource
()
{
return
dataSource
;
}
public
void
setDataSource
(
DataSourceType
dataSource
)
{
this
.
dataSource
=
dataSource
;
}
public
String
getTableName
()
{
return
tableName
;
}
public
void
setTableName
(
String
tableName
)
{
this
.
tableName
=
tableName
;
}
public
String
getFieldName
()
{
return
fieldName
;
}
public
void
setFieldName
(
String
fieldName
)
{
this
.
fieldName
=
fieldName
;
}
public
Class
<?>
getEntityClass
()
{
return
entityClass
;
}
public
void
setEntityClass
(
Class
<?>
entityClass
)
{
this
.
entityClass
=
entityClass
;
}
@Override
public
String
toString
()
{
return
"EntityConfig{"
+
"entityName='"
+
entityName
+
'\''
+
", dataSource="
+
dataSource
+
", tableName='"
+
tableName
+
'\''
+
", fieldName='"
+
fieldName
+
'\''
+
", entityClass="
+
entityClass
+
'}'
;
}
}
\ No newline at end of file
src/main/java/com/aps/entity/common/EntityConfigConfiguration.java
0 → 100644
View file @
b11e0318
package
com
.
aps
.
entity
.
common
;
import
com.aps.entity.ProdEquipment
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.HashMap
;
import
java.util.Map
;
@Configuration
public
class
EntityConfigConfiguration
{
@Bean
public
Map
<
String
,
EntityConfig
>
entityConfigMap
()
{
Map
<
String
,
EntityConfig
>
configMap
=
new
HashMap
<>();
// ========== 文件实体配置 ==========
addFileEntity
(
configMap
,
"order"
,
"orders"
);
addFileEntity
(
configMap
,
"entry"
,
"allOperations"
);
addFileEntity
(
configMap
,
"machine"
,
"InitMachines"
);
addFileEntity
(
configMap
,
"globaloperationinfo"
,
"globalOpList"
);
addFileEntity
(
configMap
,
"groupresult"
,
"OperatRel"
);
// ========== 数据库实体配置 ==========
// 设备表配置
addDbEntity
(
configMap
,
"prod_equipment"
,
"PROD_EQUIPMENT"
,
ProdEquipment
.
class
);
return
configMap
;
}
/**
* 添加文件实体配置
*/
private
void
addFileEntity
(
Map
<
String
,
EntityConfig
>
configMap
,
String
entityName
,
String
fieldName
)
{
EntityConfig
config
=
new
EntityConfig
();
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
FILE
);
config
.
setFieldName
(
fieldName
);
config
.
setTableName
(
null
);
config
.
setEntityClass
(
null
);
configMap
.
put
(
entityName
.
toLowerCase
(),
config
);
}
/**
* 添加数据库实体配置
*/
private
void
addDbEntity
(
Map
<
String
,
EntityConfig
>
configMap
,
String
entityName
,
String
tableName
,
Class
<?>
entityClass
)
{
EntityConfig
config
=
new
EntityConfig
();
config
.
setEntityName
(
entityName
);
config
.
setDataSource
(
DataSourceType
.
DATABASE
);
config
.
setTableName
(
tableName
);
config
.
setEntityClass
(
entityClass
);
config
.
setFieldName
(
null
);
configMap
.
put
(
entityName
.
toLowerCase
(),
config
);
}
}
\ No newline at end of file
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
b11e0318
...
@@ -300,7 +300,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
...
@@ -300,7 +300,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int
opSequence
=
currentOp
.
getSequence
();
int
opSequence
=
currentOp
.
getSequence
();
GAScheduleResult
existingResult
=
chromosome
.
getResultOld
().
stream
()
GAScheduleResult
existingResult
=
chromosome
.
getResultOld
().
stream
()
.
filter
(
r
->
r
.
getOperationId
()
==
currentOp
.
Id
)
.
filter
(
r
->
r
.
getOperationId
()
==
currentOp
.
getId
()
)
.
findFirst
().
orElse
(
null
);
.
findFirst
().
orElse
(
null
);
if
(
existingResult
!=
null
)
{
if
(
existingResult
!=
null
)
{
if
(
existingResult
.
isIsLocked
())
if
(
existingResult
.
isIsLocked
())
...
@@ -429,7 +429,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
...
@@ -429,7 +429,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
// System.out.println(" 标准模式:安排主处理+" + setupTime + "分钟换型=" + processingTimeTotal + "分钟");
// System.out.println(" 标准模式:安排主处理+" + setupTime + "分钟换型=" + processingTimeTotal + "分钟");
}
}
GAScheduleResult
existingResult
=
chromosome
.
getResultOld
().
stream
().
filter
(
r
->
r
.
getOperationId
()
==
operation
.
Id
).
findFirst
().
orElse
(
null
);
GAScheduleResult
existingResult
=
chromosome
.
getResultOld
().
stream
().
filter
(
r
->
r
.
getOperationId
()
==
operation
.
getId
()
).
findFirst
().
orElse
(
null
);
if
(
existingResult
!=
null
)
if
(
existingResult
!=
null
)
{
{
earliestStartTime
=
Math
.
max
(
earliestStartTime
,
existingResult
.
getDesignatedStartTime
());
earliestStartTime
=
Math
.
max
(
earliestStartTime
,
existingResult
.
getDesignatedStartTime
());
...
...
src/main/java/com/aps/service/Algorithm/MaterialRequirementService.java
View file @
b11e0318
...
@@ -313,8 +313,9 @@ if(routingIds.size()==0)
...
@@ -313,8 +313,9 @@ if(routingIds.size()==0)
order
.
setRoutingId
(
headers1
.
getId
());
order
.
setRoutingId
(
headers1
.
getId
());
ProdLaunchOrder
prodOrderMain
=
convertToLaunchOrder
(
order
,
""
);
ProdLaunchOrder
prodOrderMain
=
convertToLaunchOrder
(
order
,
""
);
List
<
RoutingDetailEquip
>
finalRoutingDetailEquips
=
routingDetailEquips
;
List
<
ProdProcessExec
>
processExecList
=
RoutingDetails
.
stream
()
List
<
ProdProcessExec
>
processExecList
=
RoutingDetails
.
stream
()
.
map
(
detail
->
lanuchService
.
createProcessExec
(
prodOrderMain
,
detail
,
sceneId
))
.
map
(
detail
->
lanuchService
.
createProcessExec
(
prodOrderMain
,
detail
,
sceneId
,
finalRoutingDetailEquips
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
ProdEquipment
>
ProdEquipmentList
=
lanuchService
.
batchInsertEquipMent
(
routingDetailEquips
,
sceneId
,
processExecList
,
false
);
List
<
ProdEquipment
>
ProdEquipmentList
=
lanuchService
.
batchInsertEquipMent
(
routingDetailEquips
,
sceneId
,
processExecList
,
false
);
...
...
src/main/java/com/aps/service/Algorithm/RoutingDataService.java
View file @
b11e0318
...
@@ -543,6 +543,8 @@ public class RoutingDataService {
...
@@ -543,6 +543,8 @@ public class RoutingDataService {
maintenanceWindow
.
setId
(
equipMaintainTask
.
getId
().
toString
());
maintenanceWindow
.
setId
(
equipMaintainTask
.
getId
().
toString
());
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setEquipCode
(
equipMaintainTask
.
getEquipCode
());
maintenanceWindow
.
setEquipName
(
equipMaintainTask
.
getEquipName
());
maintenanceWindow
.
setReason
(
""
);
maintenanceWindow
.
setReason
(
""
);
maintenanceWindows
.
add
(
maintenanceWindow
);
maintenanceWindows
.
add
(
maintenanceWindow
);
}
}
...
@@ -623,6 +625,8 @@ public class RoutingDataService {
...
@@ -623,6 +625,8 @@ public class RoutingDataService {
maintenanceWindow
.
setId
(
equipMaintainTask
.
getId
().
toString
());
maintenanceWindow
.
setId
(
equipMaintainTask
.
getId
().
toString
());
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setEquipCode
(
equipMaintainTask
.
getEquipCode
());
maintenanceWindow
.
setEquipName
(
equipMaintainTask
.
getEquipName
());
maintenanceWindow
.
setReason
(
""
);
maintenanceWindow
.
setReason
(
""
);
maintenanceWindows
.
add
(
maintenanceWindow
);
maintenanceWindows
.
add
(
maintenanceWindow
);
}
}
...
...
src/main/java/com/aps/service/Algorithm/ScheduleOperationService.java
View file @
b11e0318
...
@@ -155,6 +155,9 @@ Integer newMachineId1=newMachineId.intValue();
...
@@ -155,6 +155,9 @@ Integer newMachineId1=newMachineId.intValue();
.
findFirst
().
orElse
(
null
);
.
findFirst
().
orElse
(
null
);
if
(
machine
!=
null
)
if
(
machine
!=
null
)
{
{
maintenanceWindow
.
setEquipCode
(
machine
.
getCode
());
maintenanceWindow
.
setEquipName
(
machine
.
getName
());
maintenanceWindow
.
setId
(
UUID
.
randomUUID
().
toString
());
maintenanceWindow
.
setId
(
UUID
.
randomUUID
().
toString
());
machine
.
getMaintenanceWindows
().
add
(
maintenanceWindow
);
machine
.
getMaintenanceWindows
().
add
(
maintenanceWindow
);
...
...
src/main/java/com/aps/service/LanuchService.java
View file @
b11e0318
...
@@ -40,7 +40,7 @@ public interface LanuchService {
...
@@ -40,7 +40,7 @@ public interface LanuchService {
ProdProcessExec
createProcessExec
(
ProdLaunchOrder
prodOrderMain
,
ProdProcessExec
createProcessExec
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
RoutingDetail
detail
,
String
sceneId
);
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
);
List
<
ProdEquipment
>
batchInsertEquipMent
(
List
<
ProdEquipment
>
batchInsertEquipMent
(
List
<
RoutingDetailEquip
>
routingDetailEquips
,
List
<
RoutingDetailEquip
>
routingDetailEquips
,
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
b11e0318
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/common/DatabaseQueryService.java
0 → 100644
View file @
b11e0318
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
b11e0318
...
@@ -6,6 +6,7 @@ import com.aps.common.util.SnowFlackIdWorker;
...
@@ -6,6 +6,7 @@ import com.aps.common.util.SnowFlackIdWorker;
import
com.aps.entity.*
;
import
com.aps.entity.*
;
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.basic.Entry
;
import
com.aps.entity.basic.Order
;
import
com.aps.entity.basic.Order
;
import
com.aps.mapper.RoutingDetailMapper
;
import
com.aps.mapper.RoutingDetailMapper
;
import
com.aps.mapper.RoutingHeaderMapper
;
import
com.aps.mapper.RoutingHeaderMapper
;
...
@@ -245,15 +246,15 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -245,15 +246,15 @@ public class LanuchServiceImpl implements LanuchService {
throw
new
RuntimeException
(
"插入mes_order失败"
);
throw
new
RuntimeException
(
"插入mes_order失败"
);
}
}
List
<
ProdProcessExec
>
processExecList
=
prodProcessExecService
.
lambdaQuery
()
//
List<ProdProcessExec> processExecList = prodProcessExecService.lambdaQuery()
.
eq
(
ProdProcessExec:
:
getSceneId
,
sceneId
)
//
.eq(ProdProcessExec::getSceneId, sceneId)
.
list
();
//
.list();
List
<
Entry
>
entrys
=
chromosome
.
getAllOperations
();
// 遍历GAScheduleResult结果并转换为dispatch
// 遍历GAScheduleResult结果并转换为dispatch
List
<
Dispatch
>
dispatches
=
new
ArrayList
<>();
List
<
Dispatch
>
dispatches
=
new
ArrayList
<>();
for
(
GAScheduleResult
gaResult
:
chromosome
.
getResult
())
{
for
(
GAScheduleResult
gaResult
:
chromosome
.
getResult
())
{
ProdProcessExec
prodProcessExec
=
processExecList
.
stream
()
Entry
entry1
=
entrys
.
stream
()
.
filter
(
processExec
->
processExec
.
getExecId
().
equals
(
gaResult
.
getExecId
()))
.
filter
(
entry
->
entry
.
getExecId
().
equals
(
gaResult
.
getExecId
()))
.
findFirst
()
.
findFirst
()
.
orElse
(
null
);
.
orElse
(
null
);
...
@@ -267,10 +268,10 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -267,10 +268,10 @@ public class LanuchServiceImpl implements LanuchService {
dispatch
.
setEndTime
(
baseTime
.
plusSeconds
(
gaResult
.
getEndTime
()));
dispatch
.
setEndTime
(
baseTime
.
plusSeconds
(
gaResult
.
getEndTime
()));
dispatch
.
setENof
(
gaResult
.
getOrderId
());
dispatch
.
setENof
(
gaResult
.
getOrderId
());
// 设置状态等其他字段
// 设置状态等其他字段
dispatch
.
setTaskSeq
(
prodProcessExec
.
getTaskSeq
());
dispatch
.
setTaskSeq
(
entry1
.
getTaskSeq
());
dispatch
.
setMesCode
(
gaResult
.
getOrderId
());
dispatch
.
setMesCode
(
gaResult
.
getOrderId
());
dispatch
.
setRoutingDetailId
(
prodProcessExec
.
getRoutingDetailId
());
dispatch
.
setRoutingDetailId
(
entry1
.
getRoutingDetailId
());
dispatch
.
setOpe
(
prodProcessExec
.
getRoutingDetailName
());
dispatch
.
setOpe
(
entry1
.
getRoutingDetailName
());
// 添加到列表中
// 添加到列表中
dispatches
.
add
(
dispatch
);
dispatches
.
add
(
dispatch
);
}
}
...
@@ -619,7 +620,7 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -619,7 +620,7 @@ public class LanuchServiceImpl implements LanuchService {
List
<
RoutingDetail
>
routingDetails
,
List
<
RoutingDetail
>
routingDetails
,
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
)
{
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
)
{
List
<
ProdProcessExec
>
processExecList
=
routingDetails
.
stream
()
List
<
ProdProcessExec
>
processExecList
=
routingDetails
.
stream
()
.
map
(
detail
->
createProcessExec
(
prodOrderMain
,
detail
,
sceneId
))
.
map
(
detail
->
createProcessExec
(
prodOrderMain
,
detail
,
sceneId
,
routingDetailEquip
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
batchInsertEquipMent
(
routingDetailEquip
,
sceneId
,
processExecList
,
true
);
batchInsertEquipMent
(
routingDetailEquip
,
sceneId
,
processExecList
,
true
);
...
@@ -645,7 +646,7 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -645,7 +646,7 @@ public class LanuchServiceImpl implements LanuchService {
*/
*/
public
ProdProcessExec
createProcessExec
(
ProdLaunchOrder
prodOrderMain
,
public
ProdProcessExec
createProcessExec
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
RoutingDetail
detail
,
String
sceneId
)
{
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
)
{
ProdProcessExec
prodProcessExec
=
new
ProdProcessExec
();
ProdProcessExec
prodProcessExec
=
new
ProdProcessExec
();
prodProcessExec
.
setExecId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
prodProcessExec
.
setExecId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
...
@@ -653,7 +654,18 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -653,7 +654,18 @@ public class LanuchServiceImpl implements LanuchService {
prodProcessExec
.
setRoutingDetailId
(
detail
.
getId
());
prodProcessExec
.
setRoutingDetailId
(
detail
.
getId
());
prodProcessExec
.
setTaskSeq
(
detail
.
getTaskSeq
());
prodProcessExec
.
setTaskSeq
(
detail
.
getTaskSeq
());
prodProcessExec
.
setRoutingDetailName
(
detail
.
getName
());
prodProcessExec
.
setRoutingDetailName
(
detail
.
getName
());
prodProcessExec
.
setMachineId
(
detail
.
getEquipTypeId
());
RoutingDetailEquip
routingDetailEquip1
=
routingDetailEquip
.
stream
().
filter
(
detailEquip
->
detailEquip
.
getRoutingDetailId
().
equals
(
detail
.
getId
()))
.
filter
(
detailEquip
->
detailEquip
.
getType1
()
!=
null
)
.
filter
(
detailEquip
->
detailEquip
.
getIsdeleted
()
==
0
)
.
findFirst
()
.
orElse
(
null
);
prodProcessExec
.
setMachineId
(
routingDetailEquip1
.
getType1
());
prodProcessExec
.
setRuntime
(
detail
.
getRuntime
());
prodProcessExec
.
setRuntime
(
detail
.
getRuntime
());
prodProcessExec
.
setSingleOut
(
detail
.
getSingleOut
());
prodProcessExec
.
setSingleOut
(
detail
.
getSingleOut
());
if
(
detail
.
getEquipTypeId
()
!=
null
)
if
(
detail
.
getEquipTypeId
()
!=
null
)
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
b11e0318
...
@@ -1725,6 +1725,8 @@ private GlobalParam InitGlobalParam()
...
@@ -1725,6 +1725,8 @@ private GlobalParam InitGlobalParam()
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setStartTime
(
equipMaintainTask
.
getPlanStartTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setEndTime
(
equipMaintainTask
.
getPlanFinishTime
());
maintenanceWindow
.
setReason
(
""
);
maintenanceWindow
.
setReason
(
""
);
maintenanceWindow
.
setEquipCode
(
equipMaintainTask
.
getEquipCode
());
maintenanceWindow
.
setEquipName
(
equipMaintainTask
.
getEquipName
());
maintenanceWindows
.
add
(
maintenanceWindow
);
maintenanceWindows
.
add
(
maintenanceWindow
);
}
}
...
@@ -1881,4 +1883,62 @@ private GlobalParam InitGlobalParam()
...
@@ -1881,4 +1883,62 @@ private GlobalParam InitGlobalParam()
}
}
}
\ No newline at end of file
public
List
<
Machine
>
InitCalendarToAllMachines3
(
Chromosome
chromosome
)
{
List
<
Machine
>
machines
=
chromosome
.
getInitMachines
();
Set
<
Long
>
machineIds
=
chromosome
.
getResult
().
stream
()
.
map
(
GAScheduleResult:
:
getMachineId
)
.
collect
(
Collectors
.
toSet
());
machines
=
machines
.
stream
()
.
filter
(
machine
->
machineIds
.
contains
(
machine
.
getId
()))
.
collect
(
Collectors
.
toList
());
for
(
Machine
machine:
machines
)
{
{
List
<
Shift
>
result
=
new
ArrayList
<>();
List
<
Shift
>
shifts
=
machine
.
getShifts
();
for
(
Shift
shift
:
shifts
)
{
// 处理跨天班次(开始时间晚于结束时间的情况,如 7:30 到 3:30)
if
(
shift
.
getEndTime
().
isBefore
(
shift
.
getStartTime
()))
{
// 创建第一天的班次 (开始时间到24:00)
Shift
firstShift
=
new
Shift
();
firstShift
.
setStartTime
(
shift
.
getStartTime
());
firstShift
.
setEndTime
(
LocalTime
.
of
(
23
,
59
,
59
));
// 23:59:59代替24:00
firstShift
.
setDays
(
new
HashSet
<>(
shift
.
getDays
()));
firstShift
.
setStatus
(
shift
.
getStatus
());
firstShift
.
setStartDate
(
shift
.
getStartDate
());
firstShift
.
setEndDate
(
shift
.
getEndDate
());
firstShift
.
setSpecial
(
shift
.
isSpecial
());
// 创建第二天的班次 (00:00到结束时间)
Shift
secondShift
=
new
Shift
();
secondShift
.
setStartTime
(
LocalTime
.
MIDNIGHT
);
secondShift
.
setEndTime
(
shift
.
getEndTime
());
secondShift
.
setDays
(
new
HashSet
<>(
shift
.
getDays
()));
secondShift
.
setStatus
(
shift
.
getStatus
());
secondShift
.
setStartDate
(
shift
.
getStartDate
().
plusDays
(
1
));
secondShift
.
setEndDate
(
shift
.
getEndDate
().
plusDays
(
1
));
secondShift
.
setSpecial
(
shift
.
isSpecial
());
result
.
add
(
firstShift
);
result
.
add
(
secondShift
);
}
else
{
// 正常班次直接添加
result
.
add
(
shift
);
}
}
machine
.
setShifts
(
result
);
}
}
return
machines
;
}
}
\ No newline at end of file
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