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
246b9472
Commit
246b9472
authored
Dec 24, 2025
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
时间配置表设置
parent
6aaa43d8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
38 deletions
+59
-38
ApsTimeConfigController.java
...main/java/com/aps/controller/ApsTimeConfigController.java
+29
-13
LanuchController.java
src/main/java/com/aps/controller/LanuchController.java
+11
-3
LanuchService.java
src/main/java/com/aps/service/LanuchService.java
+2
-2
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+15
-18
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+2
-2
No files found.
src/main/java/com/aps/controller/ApsTimeConfigController.java
View file @
246b9472
package
com
.
aps
.
controller
;
import
com.aps.common.util.ParamValidator
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -8,6 +9,9 @@ import com.aps.common.util.R;
import
com.aps.entity.ApsTimeConfig
;
import
com.aps.service.ApsTimeConfigService
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -35,26 +39,38 @@ public class ApsTimeConfigController {
@Operation
(
summary
=
"获取APS时间配置"
,
description
=
"获取APS时间配置信息"
)
public
R
<
ApsTimeConfig
>
getConfig
()
{
ApsTimeConfig
config
=
apsTimeConfigService
.
getConfig
();
if
(
config
!=
null
)
{
return
R
.
ok
(
config
);
}
else
{
// 如果没有配置,返回默认配置
config
=
new
ApsTimeConfig
();
return
R
.
ok
(
config
);
}
}
/**
* 更新APS时间配置
*/
@P
u
tMapping
(
"/updateConfig"
)
@Operation
(
summary
=
"更新APS时间配置"
,
description
=
"
通过Map参数
更新APS时间配置"
)
@P
os
tMapping
(
"/updateConfig"
)
@Operation
(
summary
=
"更新APS时间配置"
,
description
=
"更新APS时间配置"
)
public
R
<
String
>
updateConfig
(
@RequestBody
Map
<
String
,
Object
>
configMap
)
{
boolean
result
=
apsTimeConfigService
.
updateConfigFromMap
(
configMap
);
if
(
result
)
{
// 使用ParamValidator处理和验证数据
Map
<
String
,
Object
>
processedConfigMap
=
new
HashMap
<>();
LocalDateTime
baseTime
=
ParamValidator
.
parseDateTime
(
configMap
.
get
(
"baseTime"
).
toString
(),
"基准时间"
);
processedConfigMap
.
put
(
"baseTime"
,
baseTime
);
Double
freezeDate
=
ParamValidator
.
getDouble
(
configMap
,
"freezeDate"
,
"冻结日期"
);
processedConfigMap
.
put
(
"freezeDate"
,
BigDecimal
.
valueOf
(
freezeDate
));
Double
startCount
=
ParamValidator
.
getDouble
(
configMap
,
"startCount"
,
"前置时间"
);
processedConfigMap
.
put
(
"startCount"
,
BigDecimal
.
valueOf
(
startCount
));
Double
endCount
=
ParamValidator
.
getDouble
(
configMap
,
"endCount"
,
"后置时间"
);
processedConfigMap
.
put
(
"endCount"
,
BigDecimal
.
valueOf
(
endCount
));
boolean
result
=
apsTimeConfigService
.
updateConfigFromMap
(
processedConfigMap
);
return
R
.
ok
(
"配置更新成功"
);
}
else
{
return
R
.
failed
(
"配置更新失败"
);
}
}
}
src/main/java/com/aps/controller/LanuchController.java
View file @
246b9472
...
...
@@ -33,7 +33,7 @@ public class LanuchController {
*/
@PostMapping
(
"/execute"
)
@Operation
(
summary
=
"启动工单"
)
public
R
<
Strin
g
>
lanuch
(
@RequestBody
Map
<
String
,
String
>
params
)
{
public
R
<
ProdSceneConfi
g
>
lanuch
(
@RequestBody
Map
<
String
,
String
>
params
)
{
String
sceneName
=
params
.
get
(
"sceneName"
);
String
userId
=
params
.
get
(
"userId"
);
...
...
@@ -47,7 +47,15 @@ public class LanuchController {
@Operation
(
summary
=
"运算"
)
public
R
<
Chromosome
>
schedule
(
@RequestBody
Map
<
String
,
String
>
params
)
{
String
sceneId
=
params
.
get
(
"sceneId"
);
// 如果需要处理时间字段,可以从params中获取并转换
// 例如:开始时间、结束时间等
String
startTimeStr
=
params
.
get
(
"startTime"
);
String
endTimeStr
=
params
.
get
(
"endTime"
);
// 在这里可以添加时间格式转换逻辑
// 根据不同格式解析时间字符串
Chromosome
scheduleChromosomes
=
planResultService
.
schedule
(
sceneId
);
return
R
.
ok
(
scheduleChromosomes
);
}
...
...
@@ -57,7 +65,7 @@ public class LanuchController {
*/
@PostMapping
(
"/copyScene"
)
@Operation
(
summary
=
"复制场景"
)
public
R
<
Strin
g
>
copyScene
(
@RequestBody
Map
<
String
,
String
>
params
)
{
public
R
<
ProdSceneConfi
g
>
copyScene
(
@RequestBody
Map
<
String
,
String
>
params
)
{
String
oldSceneId
=
params
.
get
(
"oldSceneId"
);
String
newSceneName
=
params
.
get
(
"newSceneName"
);
String
userId
=
params
.
get
(
"userId"
);
...
...
src/main/java/com/aps/service/LanuchService.java
View file @
246b9472
...
...
@@ -17,7 +17,7 @@ public interface LanuchService {
* @author: jdt
* @return 结果
*/
R
<
Strin
g
>
lanuch
(
String
sceneId
,
String
username
);
R
<
ProdSceneConfi
g
>
lanuch
(
String
sceneId
,
String
username
);
/**
* 生成设备日历数据
...
...
@@ -25,7 +25,7 @@ public interface LanuchService {
* @author: jdt
* @return 结果
*/
R
<
Strin
g
>
copyScene
(
String
oldSceneId
,
String
username
,
String
newSceneId
);
R
<
ProdSceneConfi
g
>
copyScene
(
String
oldSceneId
,
String
username
,
String
newSceneId
);
/**
...
...
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
246b9472
...
...
@@ -86,7 +86,7 @@ public class LanuchServiceImpl implements LanuchService {
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
<
Strin
g
>
lanuch
(
String
sceneName
,
String
username
)
{
public
R
<
ProdSceneConfi
g
>
lanuch
(
String
sceneName
,
String
username
)
{
// 参数校验
if
(
sceneName
==
null
||
sceneName
.
trim
().
isEmpty
())
{
throw
new
IllegalArgumentException
(
"场景名称不能为空"
);
...
...
@@ -97,12 +97,13 @@ public class LanuchServiceImpl implements LanuchService {
}
String
sceneId
=
null
;
try
{
// 1. 创建场景
sceneId
=
createScene
(
sceneName
,
username
);
if
(
scene
Id
==
null
)
{
ProdSceneConfig
sceneConfig
=
createScene
(
sceneName
,
username
);
if
(
scene
Config
==
null
)
{
throw
new
RuntimeException
(
"场景名称已存在"
);
}
sceneId
=
sceneConfig
.
getSceneId
();
prodEquipSpecialCalService
.
copyFromEquipCapacityDef
(
sceneId
);
...
...
@@ -125,13 +126,8 @@ public class LanuchServiceImpl implements LanuchService {
generateProcessRelationsBatch
(
prodLaunchOrders
,
sceneId
);
log
.
info
(
"场景数据生成完成,场景ID:{}"
,
sceneId
);
return
R
.
ok
(
"场景数据生成成功"
);
}
catch
(
Exception
e
)
{
// 发生任何异常都应回滚事务
// 如果sceneId已经创建但在事务完成前发生异常,则事务回滚会自动清理数据
log
.
error
(
"场景生成过程中发生异常,事务将回滚"
,
e
);
throw
new
RuntimeException
(
"场景生成失败"
);
// 重新抛出异常以触发事务回滚
}
return
R
.
ok
(
sceneConfig
);
}
...
...
@@ -143,7 +139,7 @@ public class LanuchServiceImpl implements LanuchService {
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
<
Strin
g
>
copyScene
(
String
oldSceneId
,
String
username
,
String
newSceneName
)
{
public
R
<
ProdSceneConfi
g
>
copyScene
(
String
oldSceneId
,
String
username
,
String
newSceneName
)
{
// Validate input parameters
if
(
oldSceneId
==
null
||
oldSceneId
.
trim
().
isEmpty
())
{
throw
new
IllegalArgumentException
(
"原场景ID不能为空"
);
...
...
@@ -166,10 +162,11 @@ public class LanuchServiceImpl implements LanuchService {
throw
new
RuntimeException
(
"源场景不存在"
);
}
// 创建场景
String
newSceneId
=
createScene
(
newSceneName
,
username
);
if
(
newScene
Id
==
null
)
{
ProdSceneConfig
newSceneConfig
=
createScene
(
newSceneName
,
username
);
if
(
newScene
Config
==
null
)
{
throw
new
RuntimeException
(
"场景名称已存在"
);
}
String
newSceneId
=
newSceneConfig
.
getSceneId
();
// 复制数据
copyProdLaunchOrders
(
oldScene
.
getSceneId
(),
newSceneId
);
...
...
@@ -181,7 +178,7 @@ public class LanuchServiceImpl implements LanuchService {
// 复制染色体文件(排产结果)
copyChromosomeFile
(
oldScene
.
getSceneId
(),
newSceneId
);
return
R
.
ok
(
"场景数据复制成功"
);
return
R
.
ok
(
newSceneConfig
);
}
/**
...
...
@@ -321,10 +318,10 @@ public class LanuchServiceImpl implements LanuchService {
*
◦ @param sceneName 场景名称
◦ @return 场景
ID
,如果场景已存在则返回null
◦ @return 场景
配置对象
,如果场景已存在则返回null
*/
private
Strin
g
createScene
(
String
sceneName
,
String
userId
)
{
private
ProdSceneConfi
g
createScene
(
String
sceneName
,
String
userId
)
{
// 检查场景名称是否已存在
boolean
exists
=
prodSceneConfigService
.
lambdaQuery
()
.
eq
(
ProdSceneConfig:
:
getSceneName
,
sceneName
)
...
...
@@ -346,7 +343,7 @@ public class LanuchServiceImpl implements LanuchService {
prodSceneConfigService
.
save
(
sceneConfig
);
log
.
info
(
"创建新场景成功,场景ID:{},名称:{}"
,
sceneId
,
sceneName
);
return
scene
Id
;
return
scene
Config
;
}
/**
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
246b9472
...
...
@@ -1134,7 +1134,7 @@ private GlobalParam InitGlobalParam()
machine
.
setMaintenanceWindows
(
new
ArrayList
<>());
}
List
<
ProdEquipSpecialCal
>
machineProdEquipSpecialCals
=
ProdEquipSpecialCals
.
stream
()
.
filter
(
t
->
t
.
get
EquipId
()
==
machine
.
getId
()&&
t
.
getReferenceType
()==
1
)
.
filter
(
t
->
t
.
get
PlanResourceId
()
==
machine
.
getId
()&&
t
.
getReferenceType
()==
1
)
.
collect
(
Collectors
.
toList
());
List
<
Shift
>
shifts1
=
new
ArrayList
<>();
for
(
ProdEquipSpecialCal
machineProdEquipSpecialCal
:
machineProdEquipSpecialCals
)
{
...
...
@@ -1335,7 +1335,7 @@ private GlobalParam InitGlobalParam()
com
.
aps
.
entity
.
Gantt
.
ResourceGanttVO
resourceGanttVO
=
new
com
.
aps
.
entity
.
Gantt
.
ResourceGanttVO
();
resourceGanttVO
.
setId
(
machine
.
getId
());
resourceGanttVO
.
setName
(
machine
.
get
Id
()+
"号设备"
);
resourceGanttVO
.
setName
(
machine
.
get
Name
()
);
resourceGanttVO
.
setShift
(
convertToShiftVO
(
machine
));
resourceGanttVO
.
setCode
(
machine
.
getCode
());
// 转换任务列表
...
...
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