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
9d9c753b
Commit
9d9c753b
authored
Dec 18, 2025
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回数据修改
parent
a17d29cb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
647 additions
and
280 deletions
+647
-280
chromosome_result_B571EF6682DB463AB2977B1055A74112.json
...t/chromosome_result_B571EF6682DB463AB2977B1055A74112.json
+454
-96
ParamValidator.java
src/main/java/com/aps/common/util/ParamValidator.java
+74
-53
ResourceGanttController.java
...ava/com/aps/controller/gantt/ResourceGanttController.java
+118
-118
RoutingDataService.java
...in/java/com/aps/service/Algorithm/RoutingDataService.java
+1
-13
No files found.
result/chromosome_result_B571EF6682DB463AB2977B1055A74112.json
View file @
9d9c753b
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/common/util/ParamValidator.java
View file @
9d9c753b
...
@@ -93,6 +93,27 @@ public class ParamValidator {
...
@@ -93,6 +93,27 @@ public class ParamValidator {
}
}
}
}
public
static
Double
getDouble
(
Map
<
String
,
Object
>
params
,
String
key
,
String
fieldName
)
{
Object
value
=
params
.
get
(
key
);
requireNonNull
(
value
,
fieldName
);
try
{
if
(
value
instanceof
Number
)
{
return
((
Number
)
value
).
doubleValue
();
}
else
if
(
value
instanceof
String
)
{
String
str
=
((
String
)
value
).
trim
();
if
(
str
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
fieldName
+
"不能为空字符串"
);
}
return
Double
.
parseDouble
(
str
);
}
else
{
throw
new
IllegalArgumentException
(
fieldName
+
"格式不正确,必须是数字或字符串"
);
}
}
catch
(
NumberFormatException
e
)
{
throw
new
IllegalArgumentException
(
fieldName
+
"格式不正确: "
+
value
);
}
}
public
static
Long
getLong
(
Map
<
String
,
Object
>
params
,
String
key
,
String
fieldName
)
{
public
static
Long
getLong
(
Map
<
String
,
Object
>
params
,
String
key
,
String
fieldName
)
{
Object
value
=
params
.
get
(
key
);
Object
value
=
params
.
get
(
key
);
requireNonNull
(
value
,
fieldName
);
requireNonNull
(
value
,
fieldName
);
...
...
src/main/java/com/aps/controller/gantt/ResourceGanttController.java
View file @
9d9c753b
...
@@ -140,7 +140,7 @@ public class ResourceGanttController {
...
@@ -140,7 +140,7 @@ public class ResourceGanttController {
@PostMapping
(
"/operationMove"
)
@PostMapping
(
"/operationMove"
)
@Operation
(
summary
=
"操作移动"
,
description
=
"操作移动"
)
@Operation
(
summary
=
"操作移动"
,
description
=
"操作移动"
)
public
R
<
Chromosome
>
operationMove
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
operationMove
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
// 1. 提取参数
// 1. 提取参数
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -154,7 +154,7 @@ public class ResourceGanttController {
...
@@ -154,7 +154,7 @@ public class ResourceGanttController {
// 3. 执行业务
// 3. 执行业务
Chromosome
result
=
planResultService
.
Move
(
sceneId
,
opid
,
newStartTime
,
newMachineId
);
Chromosome
result
=
planResultService
.
Move
(
sceneId
,
opid
,
newStartTime
,
newMachineId
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"移动成功"
);
}
}
@PostMapping
(
"/operationedit"
)
@PostMapping
(
"/operationedit"
)
...
@@ -175,7 +175,7 @@ public class ResourceGanttController {
...
@@ -175,7 +175,7 @@ public class ResourceGanttController {
@PostMapping
(
"/changebasetime"
)
@PostMapping
(
"/changebasetime"
)
@Operation
(
summary
=
"修改基础时间"
,
description
=
"修改基础时间"
)
@Operation
(
summary
=
"修改基础时间"
,
description
=
"修改基础时间"
)
public
R
<
Chromosome
>
changeBaseTime
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
changeBaseTime
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"changeBaseTime 请求参数: {}"
,
params
);
log
.
info
(
"changeBaseTime 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -183,12 +183,12 @@ public class ResourceGanttController {
...
@@ -183,12 +183,12 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
ChangeBaseTime
(
sceneId
,
baseTime
);
Chromosome
result
=
planResultService
.
ChangeBaseTime
(
sceneId
,
baseTime
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"保存成功"
);
}
}
@PostMapping
(
"/operationspilt"
)
@PostMapping
(
"/operationspilt"
)
@Operation
(
summary
=
"工单拆分"
,
description
=
"工单拆分"
)
@Operation
(
summary
=
"工单拆分"
,
description
=
"工单拆分"
)
public
R
<
Chromosome
>
spiltOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
spiltOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"spiltOperation 请求参数: {}"
,
params
);
log
.
info
(
"spiltOperation 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -200,12 +200,15 @@ public class ResourceGanttController {
...
@@ -200,12 +200,15 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
SpiltOperation
(
sceneId
,
opid
,
splitCountsArray
);
Chromosome
result
=
planResultService
.
SpiltOperation
(
sceneId
,
opid
,
splitCountsArray
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"拆分成功"
);
}
}
@PostMapping
(
"/operationdel"
)
@PostMapping
(
"/operationdel"
)
@Operation
(
summary
=
"删除工单"
,
description
=
"删除工单"
)
@Operation
(
summary
=
"删除工单"
,
description
=
"删除工单"
)
public
R
<
Chromosome
>
delOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
delOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"delOperation 请求参数: {}"
,
params
);
log
.
info
(
"delOperation 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -213,12 +216,12 @@ public class ResourceGanttController {
...
@@ -213,12 +216,12 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
DelOperation
(
sceneId
,
opid
);
Chromosome
result
=
planResultService
.
DelOperation
(
sceneId
,
opid
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"删除成功"
);
}
}
@PostMapping
(
"/operationlocked"
)
@PostMapping
(
"/operationlocked"
)
@Operation
(
summary
=
"工单锁定"
,
description
=
"订工单锁定"
)
@Operation
(
summary
=
"工单锁定"
,
description
=
"订工单锁定"
)
public
R
<
Chromosome
>
lockedOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
lockedOperation
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"lockedOperation 请求参数: {}"
,
params
);
log
.
info
(
"lockedOperation 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -227,12 +230,12 @@ public class ResourceGanttController {
...
@@ -227,12 +230,12 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
LockOperation
(
sceneId
,
opid
,
isLocked
);
Chromosome
result
=
planResultService
.
LockOperation
(
sceneId
,
opid
,
isLocked
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"锁定成功"
);
}
}
@PostMapping
(
"/orderspilt"
)
@PostMapping
(
"/orderspilt"
)
@Operation
(
summary
=
"订单拆分"
,
description
=
"订单拆分"
)
@Operation
(
summary
=
"订单拆分"
,
description
=
"订单拆分"
)
public
R
<
Chromosome
>
spiltOrder
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
spiltOrder
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"spiltOrder 请求参数: {}"
,
params
);
log
.
info
(
"spiltOrder 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -243,12 +246,39 @@ public class ResourceGanttController {
...
@@ -243,12 +246,39 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
SpiltOrder
(
sceneId
,
orderid
,
splitCountsArray
);
Chromosome
result
=
planResultService
.
SpiltOrder
(
sceneId
,
orderid
,
splitCountsArray
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"拆分成功"
);
}
}
@PostMapping
(
"/orderCopy"
)
@Operation
(
summary
=
"订单复制"
,
description
=
"订单复制"
)
public
R
<
String
>
copyOrder
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"copyOrder 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
orderid
=
ParamValidator
.
getString
(
params
,
"orderId"
,
"订单ID"
);
Double
copyCount
=
ParamValidator
.
getDouble
(
params
,
"copyCount"
,
"复制数量"
);
Double
[]
splitCountsArray
=
new
Double
[
2
];
// 创建一个空的Double数组,可以根据实际需求调整大小或初始化值
splitCountsArray
[
0
]
=
0.0
;
splitCountsArray
[
1
]
=
copyCount
;
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
SpiltOrder
(
sceneId
,
orderid
,
splitCountsArray
);
return
R
.
ok
(
"复制成功"
);
}
@PostMapping
(
"/ordermerge"
)
@PostMapping
(
"/ordermerge"
)
@Operation
(
summary
=
"订单合并"
,
description
=
"订单合并"
)
@Operation
(
summary
=
"订单合并"
,
description
=
"订单合并"
)
public
R
<
Chromosome
>
orderMerge
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
public
R
<
String
>
orderMerge
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"orderMerge 请求参数: {}"
,
params
);
log
.
info
(
"orderMerge 请求参数: {}"
,
params
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
String
sceneId
=
ParamValidator
.
getString
(
params
,
"sceneId"
,
"场景ID"
);
...
@@ -257,7 +287,7 @@ public class ResourceGanttController {
...
@@ -257,7 +287,7 @@ public class ResourceGanttController {
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
ParamValidator
.
validateSceneExists
(
sceneService
,
sceneId
);
Chromosome
result
=
planResultService
.
MergeOrder
(
sceneId
,
sourceorderid
,
targetorderid
);
Chromosome
result
=
planResultService
.
MergeOrder
(
sceneId
,
sourceorderid
,
targetorderid
);
return
R
.
ok
(
result
);
return
R
.
ok
(
"合并成功"
);
}
}
/**
/**
...
@@ -472,36 +502,6 @@ public class ResourceGanttController {
...
@@ -472,36 +502,6 @@ public class ResourceGanttController {
//
// @GetMapping("/productGantt")
// @Operation(summary = "获取资源甘特图数据", description = "获取资源甘特图数据")
// public List<ProductGanttVO> getProductGantt(@RequestParam String sceneId) {
// // 从PlanResultService获取ScheduleChromosome列表
// Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
//
// // 转换为 ResourceGanttVO 格式
// List<ProductGanttVO> productGanttVOList= new ArrayList<>();
// List<ProductGanttVO> resourceGanttVOs = convertToProductGanttVO1(schedule);
// productGanttVOList.addAll(resourceGanttVOs);
//
// return productGanttVOList;
// }
//
//
// @GetMapping("/resourceGantt")
// @Operation(summary = "获取资源甘特图数据", description = "获取资源甘特图数据")
// public List<ResourceGanttVO> getResourceGantt(@RequestParam String sceneId) {
// // 从PlanResultService获取ScheduleChromosome列表
// Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
//
// // 转换为 ResourceGanttVO 格式
// List<ResourceGanttVO> resourceGanttVOList = new ArrayList<>();
// List<ResourceGanttVO> resourceGanttVOs = convertToResourceGanttVO1(schedule);
// resourceGanttVOList.addAll(resourceGanttVOs);
//
// return resourceGanttVOList;
// }
...
...
src/main/java/com/aps/service/Algorithm/RoutingDataService.java
View file @
9d9c753b
...
@@ -300,12 +300,7 @@ public class RoutingDataService {
...
@@ -300,12 +300,7 @@ public class RoutingDataService {
if
(
PlanResources1
!=
null
&&
PlanResources1
.
size
()>
0
)
if
(
PlanResources1
!=
null
&&
PlanResources1
.
size
()>
0
)
{
{
for
(
PlanResource
PlanResource
:
PlanResources1
)
{
for
(
PlanResource
PlanResource
:
PlanResources1
)
{
machine
.
setCode
(
PlanResource
.
getCode
());
machine
.
setName
(
PlanResource
.
getTitle
());
if
(
PlanResource
.
getWorkSchedId
()==
null
)
{
continue
;
}
List
<
MesShiftWorkSched
>
ShiftWorkScheds
=
MesShiftWorkScheds
.
stream
()
List
<
MesShiftWorkSched
>
ShiftWorkScheds
=
MesShiftWorkScheds
.
stream
()
.
filter
(
t
->
(
long
)
t
.
getWeekWorkSchedId
()
==
PlanResource
.
getWorkSchedId
())
.
filter
(
t
->
(
long
)
t
.
getWeekWorkSchedId
()
==
PlanResource
.
getWorkSchedId
())
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
...
@@ -320,14 +315,7 @@ public class RoutingDataService {
...
@@ -320,14 +315,7 @@ public class RoutingDataService {
}
}
}
}
if
(
shifts1
.
size
()==
0
)
{
throw
new
RuntimeException
(
String
.
format
(
"设备%s没有设置日历"
,
machine
.
getCode
()+
":"
+
machine
.
getName
()));
}
machine
.
setShifts
(
shifts1
);
machine
.
setShifts
(
shifts1
);
List
<
ProdEquipSpecialCal
>
Holidays
=
ProdEquipSpecialCals
.
stream
()
List
<
ProdEquipSpecialCal
>
Holidays
=
ProdEquipSpecialCals
.
stream
()
...
...
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