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
afa564a9
Commit
afa564a9
authored
Apr 20, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备缺失报错提示
parent
6ad77e5d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
28 deletions
+108
-28
RoutingDataService.java
...in/java/com/aps/service/Algorithm/RoutingDataService.java
+21
-4
ChromosomeDataService.java
...in/java/com/aps/service/common/ChromosomeDataService.java
+10
-8
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+77
-16
No files found.
src/main/java/com/aps/service/Algorithm/RoutingDataService.java
View file @
afa564a9
...
...
@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
@Service
public
class
RoutingDataService
{
private
static
final
int
ORACLE_IN_BATCH_SIZE
=
1000
;
@Autowired
private
ProdProcessExecService
_prodProcessExecService
;
...
...
@@ -78,10 +79,7 @@ public class RoutingDataService {
// 查询RoutingDiscreteParam中routingDetailId在上述列表中的所有记录
List
<
RoutingDiscreteParam
>
routingDiscreteParams
=
new
ArrayList
<>();
if
(!
routingDetailIds
.
isEmpty
())
{
routingDiscreteParams
=
_routingDiscreteParamService
.
lambdaQuery
()
.
in
(
RoutingDiscreteParam:
:
getRoutingDetailId
,
routingDetailIds
)
.
eq
(
RoutingDiscreteParam:
:
getIsDeleted
,
0
)
.
list
();
routingDiscreteParams
=
getRoutingDiscreteParamsByRoutingDetailIds
(
routingDetailIds
);
}
...
...
@@ -93,6 +91,25 @@ public class RoutingDataService {
}
private
List
<
RoutingDiscreteParam
>
getRoutingDiscreteParamsByRoutingDetailIds
(
List
<
Long
>
routingDetailIds
)
{
if
(
routingDetailIds
==
null
||
routingDetailIds
.
isEmpty
())
{
return
new
ArrayList
<>();
}
List
<
RoutingDiscreteParam
>
routingDiscreteParams
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
routingDetailIds
.
size
();
i
+=
ORACLE_IN_BATCH_SIZE
)
{
int
endIndex
=
Math
.
min
(
i
+
ORACLE_IN_BATCH_SIZE
,
routingDetailIds
.
size
());
List
<
Long
>
batchIds
=
routingDetailIds
.
subList
(
i
,
endIndex
);
List
<
RoutingDiscreteParam
>
batchParams
=
_routingDiscreteParamService
.
lambdaQuery
()
.
in
(
RoutingDiscreteParam:
:
getRoutingDetailId
,
batchIds
)
.
eq
(
RoutingDiscreteParam:
:
getIsDeleted
,
0
)
.
list
();
routingDiscreteParams
.
addAll
(
batchParams
);
}
return
routingDiscreteParams
;
}
public
Map
<
Integer
,
Object
>
CreateEntry
(
String
SceneId
,
List
<
ProdEquipment
>
ProdEquipments
,
List
<
Order
>
ProdLaunchOrders
,
List
<
RoutingDiscreteParam
>
routingDiscreteParams
,
List
<
ProdOrderProcess
>
ProdOrderProcesss
,
List
<
ProdProcessExec
>
ProdProcessExecs
,
List
<
GroupResult
>
existingResults
,
int
FinishOpertionID
)
{
Map
<
Integer
,
Object
>
list
=
new
HashMap
<>();
...
...
src/main/java/com/aps/service/common/ChromosomeDataService.java
View file @
afa564a9
...
...
@@ -31,7 +31,6 @@ import org.springframework.util.CollectionUtils;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.math.BigDecimal
;
import
java.time.ZoneOffset
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
...
...
@@ -51,6 +50,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@Slf4j
public
class
ChromosomeDataService
{
private
static
final
DateTimeFormatter
FRONTEND_UTC_MILLIS_FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
);
@Autowired
private
SceneService
sceneService
;
...
...
@@ -853,9 +855,7 @@ public class ChromosomeDataService {
// 检查值是否是时间类型
if
(
value
instanceof
LocalDateTime
)
{
LocalDateTime
dateTime
=
(
LocalDateTime
)
value
;
// 转换为OffsetDateTime以包含时区信息
OffsetDateTime
offsetDateTime
=
dateTime
.
atOffset
(
ZoneOffset
.
UTC
);
formattedMap
.
put
(
key
,
offsetDateTime
);
formattedMap
.
put
(
key
,
formatFrontendUtcDateTime
(
dateTime
));
}
else
{
formattedMap
.
put
(
key
,
value
);
}
...
...
@@ -889,9 +889,7 @@ public class ChromosomeDataService {
// 检查是否是时间类型字段
if
(
value
instanceof
LocalDateTime
)
{
LocalDateTime
dateTime
=
(
LocalDateTime
)
value
;
// 转换为OffsetDateTime以包含时区信息
OffsetDateTime
offsetDateTime
=
dateTime
.
atOffset
(
ZoneOffset
.
UTC
);
formattedData
.
put
(
field
.
getName
(),
offsetDateTime
);
formattedData
.
put
(
field
.
getName
(),
formatFrontendUtcDateTime
(
dateTime
));
}
else
{
// 对于String类型字段,如果值为null,设置为空字符串
if
(
value
==
null
&&
field
.
getType
()
==
String
.
class
)
{
...
...
@@ -908,6 +906,10 @@ public class ChromosomeDataService {
return
formattedData
;
}
private
String
formatFrontendUtcDateTime
(
LocalDateTime
dateTime
)
{
return
dateTime
==
null
?
null
:
dateTime
.
format
(
FRONTEND_UTC_MILLIS_FORMATTER
);
}
/**
* 处理materialInfo实体的特殊查询逻辑
*/
...
...
@@ -2927,4 +2929,4 @@ public class ChromosomeDataService {
return
map
;
}
}
\ No newline at end of file
}
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
afa564a9
...
...
@@ -49,6 +49,7 @@ public class LanuchServiceImpl implements LanuchService {
private
static
final
BigDecimal
SECONDS_PER_DAY
=
BigDecimal
.
valueOf
(
24L
*
3600L
);
private
static
final
BigDecimal
MAX_PROCESS_DURATION_SECONDS
=
SECONDS_PER_DAY
.
multiply
(
MAX_PROCESS_DURATION_DAYS
);
private
static
final
int
ORACLE_IN_BATCH_SIZE
=
1000
;
private
final
ProdEquipSpecialCalService
prodEquipSpecialCalService
;
private
final
ApsOrderService
apsOrderService
;
...
...
@@ -71,6 +72,25 @@ public class LanuchServiceImpl implements LanuchService {
private
final
EquipinfoService
equipinfoService
;
private
final
MaterialInfoService
materialInfoService
;
private
final
RoutingHeaderService
routingHeaderService
;
private
List
<
ProdProcessExec
>
getProcessExecBySceneAndRoutingDetailIds
(
String
sceneId
,
List
<
Long
>
routingDetailIds
)
{
if
(
CollectionUtils
.
isEmpty
(
routingDetailIds
))
{
return
new
ArrayList
<>();
}
List
<
ProdProcessExec
>
processExecList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
routingDetailIds
.
size
();
i
+=
ORACLE_IN_BATCH_SIZE
)
{
int
endIndex
=
Math
.
min
(
i
+
ORACLE_IN_BATCH_SIZE
,
routingDetailIds
.
size
());
List
<
Long
>
batchIds
=
routingDetailIds
.
subList
(
i
,
endIndex
);
List
<
ProdProcessExec
>
batchProcessExecs
=
prodProcessExecService
.
lambdaQuery
()
.
eq
(
ProdProcessExec:
:
getSceneId
,
sceneId
)
.
in
(
ProdProcessExec:
:
getRoutingDetailId
,
batchIds
)
.
list
();
processExecList
.
addAll
(
batchProcessExecs
);
}
return
processExecList
;
}
/**
* 生成场景数据
*
...
...
@@ -929,21 +949,21 @@ public class LanuchServiceImpl implements LanuchService {
prodProcessExec
.
setTaskSeq
(
detail
.
getTaskSeq
());
prodProcessExec
.
setRoutingDetailName
(
detail
.
getName
());
RoutingDetailEquip
routingDetailEquip1
=
routingDetailEquip
.
stream
().
filter
(
detailEquip
->
detailEquip
.
getRoutingDetailId
().
equals
(
detail
.
getId
()))
List
<
RoutingDetailEquip
>
matchedRoutingDetailEquips
=
Optional
.
ofNullable
(
routingDetailEquip
)
.
orElse
(
Collections
.
emptyList
())
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
filter
(
detailEquip
->
Objects
.
equals
(
detailEquip
.
getRoutingDetailId
(),
detail
.
getId
()))
.
filter
(
detailEquip
->
detailEquip
.
getIsdeleted
()
==
null
||
detailEquip
.
getIsdeleted
()
==
0
)
.
collect
(
Collectors
.
toList
());
RoutingDetailEquip
routingDetailEquip1
=
matchedRoutingDetailEquips
.
stream
()
.
filter
(
detailEquip
->
detailEquip
.
getType1
()
!=
null
)
.
filter
(
detailEquip
->
detailEquip
.
getIsdeleted
()
==
0
)
.
findFirst
()
.
orElse
(
null
);
if
(
routingDetailEquip1
!=
null
)
{
prodProcessExec
.
setMachineId
(
routingDetailEquip1
.
getType1
());
}
else
{
prodProcessExec
.
setMachineId
(
detail
.
getEquipTypeId
());
.
orElse
(
matchedRoutingDetailEquips
.
stream
().
findFirst
().
orElse
(
null
));
}
Long
machineId
=
resolveProcessExecMachineId
(
prodOrderMain
,
detail
,
routingHeader
,
routingDetailEquip1
);
prodProcessExec
.
setMachineId
(
machineId
);
prodProcessExec
.
setRuntime
(
detail
.
getRuntime
());
...
...
@@ -990,6 +1010,50 @@ public class LanuchServiceImpl implements LanuchService {
return
prodProcessExec
;
}
private
Long
resolveProcessExecMachineId
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
RoutingHeader
routingHeader
,
RoutingDetailEquip
routingDetailEquip
)
{
Long
machineId
=
null
;
if
(
routingDetailEquip
!=
null
&&
routingDetailEquip
.
getType1
()
!=
null
)
{
machineId
=
routingDetailEquip
.
getType1
();
}
else
if
(
detail
!=
null
)
{
machineId
=
detail
.
getEquipTypeId
();
}
if
(
machineId
!=
null
)
{
return
machineId
;
}
String
orderCode
=
prodOrderMain
==
null
?
null
:
prodOrderMain
.
getOrderCode
();
String
processName
=
detail
==
null
?
null
:
detail
.
getName
();
Long
taskSeq
=
detail
==
null
?
null
:
detail
.
getTaskSeq
();
String
routingCode
=
routingHeader
==
null
?
null
:
routingHeader
.
getCode
();
StringBuilder
message
=
new
StringBuilder
(
"新建场景失败:订单["
)
.
append
(
orderCode
==
null
||
orderCode
.
trim
().
isEmpty
()
?
"未命名订单"
:
orderCode
)
.
append
(
"]工序["
)
.
append
(
processName
==
null
||
processName
.
trim
().
isEmpty
()
?
"未命名工序"
:
processName
)
.
append
(
"]"
);
if
(
taskSeq
!=
null
)
{
message
.
append
(
"序号["
).
append
(
taskSeq
).
append
(
"]"
);
}
if
(
routingCode
!=
null
&&
!
routingCode
.
trim
().
isEmpty
())
{
message
.
append
(
"工艺路线["
).
append
(
routingCode
).
append
(
"]"
);
}
if
(
routingDetailEquip
!=
null
)
{
message
.
append
(
"存在工序设备配置,但资源组为空"
);
}
else
{
message
.
append
(
"未配置资源组/设备类型"
);
}
message
.
append
(
",无法生成执行工序,请维护工艺路线或工序设备中的资源组配置后重试"
);
throw
new
SceneGenerationException
(
message
.
toString
());
}
private
void
validateProcessDurationLimit
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
List
<
RoutingDetailEquip
>
routingDetailEquip
)
{
...
...
@@ -1117,10 +1181,7 @@ public class LanuchServiceImpl implements LanuchService {
// 当routingDetailIds为空时,返回空列表
processExecList
=
new
ArrayList
<>();
}
else
{
processExecList
=
prodProcessExecService
.
lambdaQuery
()
.
eq
(
ProdProcessExec:
:
getSceneId
,
sceneId
)
.
in
(
ProdProcessExec:
:
getRoutingDetailId
,
new
ArrayList
<>(
routingDetailIds
))
.
list
();
processExecList
=
getProcessExecBySceneAndRoutingDetailIds
(
sceneId
,
new
ArrayList
<>(
routingDetailIds
));
}
// 构建routingDetailId到execId的映射
...
...
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