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
26461055
Commit
26461055
authored
Apr 17, 2026
by
DESKTOP-VKRD9QF\Administration
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新建超工单30天提示
parent
6fefd6ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+99
-0
No files found.
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
26461055
...
@@ -45,6 +45,11 @@ import static org.springframework.beans.BeanUtils.copyProperties;
...
@@ -45,6 +45,11 @@ import static org.springframework.beans.BeanUtils.copyProperties;
@RequiredArgsConstructor
@RequiredArgsConstructor
public
class
LanuchServiceImpl
implements
LanuchService
{
public
class
LanuchServiceImpl
implements
LanuchService
{
private
static
final
BigDecimal
MAX_PROCESS_DURATION_DAYS
=
BigDecimal
.
valueOf
(
30
);
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
final
ProdEquipSpecialCalService
prodEquipSpecialCalService
;
private
final
ProdEquipSpecialCalService
prodEquipSpecialCalService
;
private
final
ApsOrderService
apsOrderService
;
private
final
ApsOrderService
apsOrderService
;
private
final
ProdLaunchOrderService
prodLaunchOrderService
;
private
final
ProdLaunchOrderService
prodLaunchOrderService
;
...
@@ -914,6 +919,7 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -914,6 +919,7 @@ public class LanuchServiceImpl implements LanuchService {
RoutingDetail
detail
,
RoutingDetail
detail
,
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
,
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
,
RoutingHeader
routingHeader
)
{
RoutingHeader
routingHeader
)
{
validateProcessDurationLimit
(
prodOrderMain
,
detail
,
routingDetailEquip
);
ProdProcessExec
prodProcessExec
=
new
ProdProcessExec
();
ProdProcessExec
prodProcessExec
=
new
ProdProcessExec
();
prodProcessExec
.
setExecId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
prodProcessExec
.
setExecId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
...
@@ -984,6 +990,99 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -984,6 +990,99 @@ public class LanuchServiceImpl implements LanuchService {
return
prodProcessExec
;
return
prodProcessExec
;
}
}
private
void
validateProcessDurationLimit
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
List
<
RoutingDetailEquip
>
routingDetailEquip
)
{
if
(
prodOrderMain
==
null
||
detail
==
null
||
detail
.
getConstTime
()
==
1
||
prodOrderMain
.
getQuantity
()
<=
0
)
{
return
;
}
List
<
RoutingDetailEquip
>
detailEquipments
=
Optional
.
ofNullable
(
routingDetailEquip
)
.
orElse
(
Collections
.
emptyList
())
.
stream
()
.
filter
(
Objects:
:
nonNull
)
.
filter
(
item
->
Objects
.
equals
(
item
.
getRoutingDetailId
(),
detail
.
getId
()))
.
filter
(
item
->
item
.
getIsdeleted
()
==
null
||
item
.
getIsdeleted
()
==
0
)
.
collect
(
Collectors
.
toList
());
boolean
validatedByMachineOption
=
false
;
for
(
RoutingDetailEquip
detailEquip
:
detailEquipments
)
{
if
(!
hasPositiveDurationConfig
(
detailEquip
.
getDuration
(),
detailEquip
.
getOutputQuantity
()))
{
continue
;
}
validatedByMachineOption
=
true
;
String
machineName
=
detailEquip
.
getName
();
if
(
machineName
==
null
||
machineName
.
trim
().
isEmpty
())
{
machineName
=
detailEquip
.
getTypeName
();
}
validateDurationLimit
(
prodOrderMain
,
detail
.
getName
(),
machineName
,
detailEquip
.
getDuration
(),
detailEquip
.
getOutputQuantity
()
);
}
if
(!
validatedByMachineOption
)
{
validateDurationLimit
(
prodOrderMain
,
detail
.
getName
(),
null
,
detail
.
getRuntime
(),
detail
.
getSingleOut
()
);
}
}
private
boolean
hasPositiveDurationConfig
(
BigDecimal
runtime
,
BigDecimal
singleOut
)
{
return
runtime
!=
null
&&
singleOut
!=
null
&&
runtime
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
singleOut
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
;
}
private
void
validateDurationLimit
(
ProdLaunchOrder
prodOrderMain
,
String
processName
,
String
machineName
,
BigDecimal
runtime
,
BigDecimal
singleOut
)
{
if
(!
hasPositiveDurationConfig
(
runtime
,
singleOut
))
{
return
;
}
BigDecimal
totalSeconds
=
runtime
.
multiply
(
BigDecimal
.
valueOf
(
prodOrderMain
.
getQuantity
()))
.
divide
(
singleOut
,
6
,
RoundingMode
.
HALF_UP
);
if
(
totalSeconds
.
compareTo
(
MAX_PROCESS_DURATION_SECONDS
)
<=
0
)
{
return
;
}
BigDecimal
totalDays
=
totalSeconds
.
divide
(
SECONDS_PER_DAY
,
2
,
RoundingMode
.
HALF_UP
)
.
stripTrailingZeros
();
StringBuilder
message
=
new
StringBuilder
(
"新建场景失败:"
);
message
.
append
(
"订单["
)
.
append
(
prodOrderMain
.
getOrderCode
())
.
append
(
"]工序["
)
.
append
(
processName
==
null
||
processName
.
trim
().
isEmpty
()
?
"未命名工序"
:
processName
)
.
append
(
"]"
);
if
(
machineName
!=
null
&&
!
machineName
.
trim
().
isEmpty
())
{
message
.
append
(
"设备["
).
append
(
machineName
).
append
(
"]"
);
}
message
.
append
(
"按单件工时和数量计算的总工时为"
)
.
append
(
totalDays
.
toPlainString
())
.
append
(
"天,超过30天限制,请检查单件工时、产出数量或订单数量"
);
throw
new
SceneGenerationException
(
message
.
toString
());
}
/**
/**
◦ 批量生成工序关联关系
◦ 批量生成工序关联关系
...
...
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