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
3c0b67c4
Commit
3c0b67c4
authored
Jan 22, 2026
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
效率系数
parent
06ae8e1c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
350 additions
and
33 deletions
+350
-33
OrderMaterialRequirement.java
...va/com/aps/entity/Algorithm/OrderMaterialRequirement.java
+1
-0
Order.java
src/main/java/com/aps/entity/basic/Order.java
+4
-0
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+10
-10
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+6
-2
MachineCalculator.java
...ain/java/com/aps/service/Algorithm/MachineCalculator.java
+35
-8
MaterialRequirementService.java
...com/aps/service/Algorithm/MaterialRequirementService.java
+235
-5
LanuchService.java
src/main/java/com/aps/service/LanuchService.java
+6
-0
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+30
-0
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+19
-4
PlanResultServiceTest.java
src/test/java/com/aps/demo/PlanResultServiceTest.java
+4
-4
No files found.
src/main/java/com/aps/entity/Algorithm/OrderMaterialRequirement.java
View file @
3c0b67c4
...
...
@@ -18,6 +18,7 @@ public class OrderMaterialRequirement {
private
String
orderId
;
private
int
operationId
;
private
String
childOrderId
;
private
Long
routingDetailId
;
private
String
materialId
;
private
String
materialCode
;
private
String
materialName
;
...
...
src/main/java/com/aps/entity/basic/Order.java
View file @
3c0b67c4
package
com
.
aps
.
entity
.
basic
;
import
com.aps.entity.Algorithm.OrderMaterialRequirement
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
...
...
@@ -50,4 +51,7 @@ private List<Integer> FinishOrderId ;
/// </summary>
private
List
<
Integer
>
TargetFinishedOperationId
;
private
double
delayHours
;
//延迟时间
//物料需求
private
List
<
OrderMaterialRequirement
>
materialRequirementList
;
}
\ No newline at end of file
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
3c0b67c4
...
...
@@ -74,16 +74,16 @@ public class GeneticAlgorithm {
throw
new
RuntimeException
(
"没有待排产工单"
);
}
if
(
materials
!=
null
&&
materials
.
size
()>
0
)
{
materialRequirementService
.
init
(
materials
,
orders
,
allOperations
,
_entryRel
,
machineScheduler
,
machines
,
_GlobalParam
);
orderMaterials
=
materialRequirementService
.
buildMultiLevelRequirementNetwork
(
param
.
getBaseTime
());
Set
<
Long
>
existIds
=
new
HashSet
<>();
machines
=
machines
.
stream
()
.
filter
(
t
->
existIds
.
add
(
t
.
getId
()))
//HashSet.add() 方法:添加成功返回 true,重复返回 false;
.
collect
(
Collectors
.
toList
());
}
//
if(materials!=null&&materials.size()>0) {
//
//
materialRequirementService.init(materials, orders, allOperations, _entryRel, machineScheduler, machines,_GlobalParam);
//
//
orderMaterials = materialRequirementService.buildMultiLevelRequirementNetwork(param.getBaseTime());
//
Set<Long> existIds = new HashSet<>();
//
machines=machines.stream()
//
.filter(t->existIds.add(t.getId()))//HashSet.add() 方法:添加成功返回 true,重复返回 false;
//
.collect(Collectors.toList());
//
}
LocalDateTime
starttime
=
LocalDateTime
.
now
();
FileHelper
.
writeLogFile
(
"排产-----------开始-----------"
+
allOperations
.
get
(
0
).
getSceneId
());
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
3c0b67c4
...
...
@@ -375,8 +375,8 @@ if(finishedOrder==null||finishedOrder.size()==0)
{
processingTimeTotal
=(
int
)
Math
.
ceil
(
processingTime
);
}
else
{
BigDecimal
t
=
machineOption
.
getSingleOut
().
divide
(
machineOption
.
getRuntime
()).
multiply
(
BigDecimal
.
valueOf
(
operation
.
getQuantity
()
));
processingTimeTotal
=(
int
)
Math
.
ceil
(
t
.
doubleValue
()
);
double
t
=
machineOption
.
getRuntime
().
doubleValue
()/
machineOption
.
getSingleOut
().
doubleValue
()*(
operation
.
getQuantity
(
));
processingTimeTotal
=(
int
)
Math
.
ceil
(
t
);
}
if
(
machine
==
null
||
operation
.
getMachineOptions
()==
null
)
...
...
@@ -447,6 +447,10 @@ if(finishedOrder==null||finishedOrder.size()==0)
operation
.
setChangeLineTime
(
setupTime
);
geneDetails
=(
CopyOnWriteArrayList
<
ScheduleResultDetail
>)
result
.
get
(
2
);
}
}
else
{
geneDetails
=
machineCalculator
.
getNextAvailableTime
(
machine
,
earliestStartTime
,
-
1
,
processingTimeTotal
,
machineTasks
,
operation
.
IsInterrupt
!=
1
,
true
,
processingTime
,
operation
.
getQuantity
(),
true
);
}
// FileHelper.writeLogFile(" 开始 "+operation.getGroupId()+" : "+operation.getId()+",处理时间: " + processingTime + ", 后处理: " + teardownTime +
...
...
src/main/java/com/aps/service/Algorithm/MachineCalculator.java
View file @
3c0b67c4
...
...
@@ -103,6 +103,7 @@ public class MachineCalculator {
//判断换型开始时间是否在工作时间段内,要占用工作时间,分割工作时间
if
(
setupStartTime1
.
compareTo
(
shiftStart1
)>
0
)
{
//换型时间不考虑效率系数
ScheduleResultDetail
time
=
new
ScheduleResultDetail
();
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
setupStartTime1
));
time
.
setEndTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
shift1
.
getEnd
()));
...
...
@@ -213,9 +214,21 @@ public class MachineCalculator {
?
slot
.
getStart
()
:
startTime
;
LocalDateTime
endCandidate
=
startCandidate
.
plusSeconds
(
processingTime
);
if
(
endCandidate
.
isAfter
(
slot
.
getEnd
()))
{
// LocalDateTime endCandidate = startCandidate.plusSeconds(processingTime);
long
availableSeconds
=
ChronoUnit
.
SECONDS
.
between
(
startCandidate
,
slot
.
getEnd
());
//实际可用时间
long
availableSeconds_e
=
Math
.
round
(
availableSeconds
*
slot
.
getEfficiency
())
;
// if (endCandidate.isAfter(slot.getEnd())) {
if
(
processingTime
>
availableSeconds_e
)
{
CopyOnWriteArrayList
<
TimeSegment
>
timeSegments1
=
timeSegments
.
stream
()
.
filter
(
t
->
t
.
getStart
().
compareTo
(
startCandidate
)>=
0
)
.
collect
(
Collectors
.
toCollection
(
CopyOnWriteArrayList:
:
new
));
...
...
@@ -223,6 +236,10 @@ public class MachineCalculator {
machine
,
processingTime
,
startTime
,
timeSegments1
,
oneTime
,
quantity
);
}
else
{
double
e
=
(
double
)
processingTime
/
slot
.
getEfficiency
();
LocalDateTime
endCandidate
=
startCandidate
.
plusSeconds
((
int
)
Math
.
ceil
(
e
));
ScheduleResultDetail
time
=
new
ScheduleResultDetail
();
time
.
setKey
(
slot
.
getKey
());
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
startCandidate
));
...
...
@@ -268,15 +285,25 @@ public class MachineCalculator {
LocalDateTime
startCandidate
=
slot
.
getStart
().
isAfter
(
prevTimeDateTime
!=
null
?
prevTimeDateTime
:
currentTime
)
?
slot
.
getStart
()
:
(
prevTimeDateTime
!=
null
?
prevTimeDateTime
:
currentTime
);
if
(
slot
.
getStart
().
isBefore
(
startCandidate
))
{
int
i
=
0
;
}
LocalDateTime
endCandidate
=
startCandidate
.
plusSeconds
(
processingTime
);
if
(
endCandidate
.
isAfter
(
slot
.
getEnd
()))
{
// LocalDateTime endCandidate = startCandidate.plusSeconds(processingTime);
long
availableSeconds
=
ChronoUnit
.
SECONDS
.
between
(
startCandidate
,
slot
.
getEnd
());
//实际可用时间
long
availableSeconds_e
=
Math
.
round
(
availableSeconds
*
slot
.
getEfficiency
())
;
// if (endCandidate.isAfter(slot.getEnd())) {
if
(
processingTime
>
availableSeconds_e
)
{
return
CaldEarliestStart
(
machine
,
processingTime
,
currentTime
,
prevtime
,
machineTasks
,
oneTime
,
quantity
,
checkprevtime
,
islockMachineTime
,
isInterrupt
);
}
else
{
double
e
=
(
double
)
processingTime
/
slot
.
getEfficiency
();
LocalDateTime
endCandidate
=
startCandidate
.
plusSeconds
((
int
)
Math
.
ceil
(
e
));
ScheduleResultDetail
time
=
new
ScheduleResultDetail
();
time
.
setKey
(
slot
.
getKey
());
time
.
setStartTime
((
int
)
ChronoUnit
.
SECONDS
.
between
(
baseTime
,
startCandidate
));
...
...
src/main/java/com/aps/service/Algorithm/MaterialRequirementService.java
View file @
3c0b67c4
This diff is collapsed.
Click to expand it.
src/main/java/com/aps/service/LanuchService.java
View file @
3c0b67c4
...
...
@@ -36,8 +36,14 @@ public interface LanuchService {
List
<
RoutingDetail
>
getRoutingDetails
(
Integer
routingHeaderId
);
List
<
RoutingDetail
>
getRoutingDetails
(
List
<
Long
>
routingHeaderIds
);
List
<
RoutingDetailEquip
>
getRoutingDetailEquip
(
Integer
routingHeaderId
,
String
routingCode
);
List
<
RoutingDetailEquip
>
getRoutingDetailEquip
(
List
<
Long
>
routingHeaderId
);
ProdProcessExec
createProcessExec
(
ProdLaunchOrder
prodOrderMain
,
RoutingDetail
detail
,
String
sceneId
,
List
<
RoutingDetailEquip
>
routingDetailEquip
);
...
...
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
3c0b67c4
...
...
@@ -644,6 +644,22 @@ public class LanuchServiceImpl implements LanuchService {
return
routingDetails
;
}
public
List
<
RoutingDetail
>
getRoutingDetails
(
List
<
Long
>
routingHeaderIds
)
{
LambdaQueryWrapper
<
RoutingDetail
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
RoutingDetail:
:
getRoutingHeaderId
,
routingHeaderIds
)
.
eq
(
RoutingDetail:
:
getIsDeleted
,
0
)
// 添加 is_deleted=0 过滤条件
.
orderByAsc
(
RoutingDetail:
:
getTaskSeq
);
List
<
RoutingDetail
>
routingDetails
=
routingDetailMapper
.
selectList
(
wrapper
);
if
(
CollectionUtils
.
isEmpty
(
routingDetails
))
{
log
.
error
(
"工艺下无工序信息: {}"
,
routingHeaderIds
);
throw
new
RuntimeException
(
"工艺下无工序信息: "
+
routingHeaderIds
);
}
return
routingDetails
;
}
/**
◦ 批量插入工序执行记录
...
...
@@ -1080,6 +1096,20 @@ if (connection.getDestoperationid() !=null && connection.getSourceoperationid()
.
eq
(
RoutingDetailEquip:
:
getIsdeleted
,
0
)
.
list
();
// 添加 is_deleted=0 过滤条件
// if (CollectionUtils.isEmpty(detailEquips)) {
// log.error("工艺下无设备信息: {}", routingHeaderId);
// throw new RuntimeException("工艺下无设备信息: " + routingCode);
// }
return
detailEquips
;
}
public
List
<
RoutingDetailEquip
>
getRoutingDetailEquip
(
List
<
Long
>
routingHeaderId
)
{
List
<
RoutingDetailEquip
>
detailEquips
=
routingDetailEquipService
.
lambdaQuery
()
.
in
(
RoutingDetailEquip:
:
getRoutingHeaderId
,
routingHeaderId
)
.
eq
(
RoutingDetailEquip:
:
getIsdeleted
,
0
)
.
list
();
// 添加 is_deleted=0 过滤条件
// if (CollectionUtils.isEmpty(detailEquips)) {
// log.error("工艺下无设备信息: {}", routingHeaderId);
// throw new RuntimeException("工艺下无设备信息: " + routingCode);
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
3c0b67c4
...
...
@@ -284,16 +284,24 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
Map
<
Long
,
Double
>
machineIds
=(
Map
<
Long
,
Double
>)
list
.
get
(
3
);
machines
=
machines
.
stream
().
filter
(
t
->
machineIds
.
containsKey
(
t
.
getId
())).
collect
(
Collectors
.
toList
());
// List<Long> equipIDs= materialRequirementService.preloadRoutingCache(SceneId,orders,Materials,globalParam.isIsCheckSf());
Set
machineIds1
=
machineIds
.
keySet
();
// if(equipIDs!=null&&equipIDs.size()>0)
// {
// machineIds1.addAll(equipIDs);
// }
machines
=
machines
.
stream
().
filter
(
t
->
machineIds1
.
contains
(
t
.
getId
())).
collect
(
Collectors
.
toList
());
for
(
Machine
machine
:
machines
){
Long
machineId
=
machine
.
getId
();
if
(
machineIds
.
get
(
machineId
)>
3600
*
24
*
200
)
{
if
(
machineIds
.
get
(
machineId
)
!=
null
&&
machineIds
.
get
(
machineId
)
>
3600
*
24
*
200
)
{
int
day
=
(
int
)
(
machineIds
.
get
(
machineId
)
/
3600
/
24
)+
100
;
List
<
TimeSegment
>
segments
=
machineScheduler
.
generateTimeSegment
(
machine
,
null
,
day
);
machineScheduler
.
addSegmentsWithDeduplication
(
machine
,
segments
);
}
}
...
...
@@ -1286,7 +1294,6 @@ private GlobalParam InitGlobalParam()
}
}
GlobalCacheUtil
.
put
(
"material"
,
materials
,
10
,
TimeUnit
.
MINUTES
);
FileHelper
.
writeLogFile
(
"初始化物料-----------结束-------"
);
return
materials
;
...
...
@@ -1418,6 +1425,7 @@ private GlobalParam InitGlobalParam()
// });
}
redisUtils
.
set
(
"material"
,
materials
);
GlobalCacheUtil
.
put
(
"material"
,
materials
,
10
,
TimeUnit
.
MINUTES
);
return
materials
;
}
...
...
@@ -1429,6 +1437,13 @@ private GlobalParam InitGlobalParam()
return
entrys
;
}
private
void
InitRouting
(
String
SceneId
,
List
<
Order
>
ProdLaunchOrders
)
{
FileHelper
.
writeLogFile
(
"初始化工艺-----------开始-------"
);
FileHelper
.
writeLogFile
(
"初始化工艺-----------结束-------"
);
}
public
GenVO
convertGeneToGenVO
(
Gene
gene
,
LocalDateTime
baseTime
)
{
...
...
src/test/java/com/aps/demo/PlanResultServiceTest.java
View file @
3c0b67c4
...
...
@@ -37,16 +37,16 @@ public class PlanResultServiceTest {
// NSGAIIUtils nsgaiiUtils=new NSGAIIUtils();
// nsgaiiUtils.Test();
// planResultService.execute2("FFAC5AA2E0B943D292933B28BDAB9068
");
planResultService
.
execute2
(
"FCB16D2535F24078BAD79729894C38D1
"
);
// planResultService.execute2("726D4C1A712B4B1393175BD44B775B66");
// planResultService.execute2("265F24B6DF3C40E4B17D193B0CC8AAF2");
// LocalDateTime t= LocalDateTime.of(2026, 02, 14, 1, 25, 52);
List
<
Integer
>
opids
=
new
ArrayList
<>();
//BCA6FA43FFA444D3952CF8F6E1EA291B
opids
.
add
(
7
);
//
List<Integer> opids=new ArrayList<>();//BCA6FA43FFA444D3952CF8F6E1EA291B
//
opids.add(7);
// planResultService.Move("27065EA0ECD14A81B7FAAFEF52273F93",opids,t,1265l,0);
// planResultService.Redecode("27065EA0ECD14A81B7FAAFEF52273F93");
// planResultService.Redecode("CA71321FE55B4437A3900315692F9220");
planResultService
.
Drag
(
"27065EA0ECD14A81B7FAAFEF52273F93"
,
opids
,
6
,
false
,
0
l
);
//
planResultService.Drag("27065EA0ECD14A81B7FAAFEF52273F93",opids,6,false,0l);
// MaintenanceWindow maintenanceWindow=new MaintenanceWindow();
// maintenanceWindow.setStartTime(LocalDateTime.of(2025, 10, 21, 0, 0, 0));
// maintenanceWindow.setEndTime(LocalDateTime.of(2025, 10, 31, 0, 0, 0));
...
...
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