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
28f87b1f
Commit
28f87b1f
authored
Dec 11, 2025
by
Tong Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
遗传算法-策略
parent
cd421110
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2486 additions
and
2084 deletions
+2486
-2084
chromosome_result_B571EF6682DB463AB2977B1055A74112.json
...t/chromosome_result_B571EF6682DB463AB2977B1055A74112.json
+2399
-2036
ProdLaunchOrder.java
src/main/java/com/aps/entity/ProdLaunchOrder.java
+1
-0
GeneticAlgorithm.java
...main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
+5
-5
GeneticDecoder.java
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
+12
-5
NSGAIIUtils.java
src/main/java/com/aps/service/Algorithm/NSGAIIUtils.java
+20
-15
LanuchServiceImpl.java
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
+3
-3
PlanResultService.java
src/main/java/com/aps/service/plan/PlanResultService.java
+46
-20
No files found.
result/chromosome_result_B571EF6682DB463AB2977B1055A74112.json
View file @
28f87b1f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/java/com/aps/entity/ProdLaunchOrder.java
View file @
28f87b1f
...
@@ -27,6 +27,7 @@ public class ProdLaunchOrder {
...
@@ -27,6 +27,7 @@ public class ProdLaunchOrder {
private
String
groupCode
;
private
String
groupCode
;
private
String
colorCode
;
private
String
colorCode
;
private
double
quantity
;
private
double
quantity
;
private
String
orderCode
;
private
String
orderStatus
;
//S未启动E执行中C已完成
private
String
orderStatus
;
//S未启动E执行中C已完成
private
String
materialId
;
private
String
materialId
;
private
String
routingCode
;
private
String
routingCode
;
...
...
src/main/java/com/aps/service/Algorithm/GeneticAlgorithm.java
View file @
28f87b1f
...
@@ -194,7 +194,7 @@ public class GeneticAlgorithm {
...
@@ -194,7 +194,7 @@ public class GeneticAlgorithm {
// chromosome.setFitness(fitnessCalc.calculateFitness(chromosome));
// chromosome.setFitness(fitnessCalc.calculateFitness(chromosome));
// });
// });
if
(
population
!=
null
&&
population
.
size
()>
0
)
{
if
(
population
!=
null
&&
population
.
size
()>
0
)
{
population
.
parallelStream
().
forEach
(
chromosome
->
{
population
.
forEach
(
chromosome
->
{
chromosome
.
setResult
(
new
ArrayList
<>());
chromosome
.
setResult
(
new
ArrayList
<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
...
@@ -202,10 +202,10 @@ public class GeneticAlgorithm {
...
@@ -202,10 +202,10 @@ public class GeneticAlgorithm {
chromosome
.
setAllOperations
(
allOperations
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setAllOperations
(
allOperations
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setGlobalOpList
(
globalOpList
);
// 简单拷贝,实际可能需要深拷贝
chromosome
.
setGlobalOpList
(
globalOpList
);
// 简单拷贝,实际可能需要深拷贝
Chromosome
chromosomen
=
decoder
.
decodeChromosomeWithCache
(
chromosome
);
decoder
.
decodeChromosomeWithCache
(
chromosome
);
// if (chromosomen
.getFitness() == 0) {
if
(
chromosome
.
getFitness
()
==
0
)
{
// chromosomen.setFitness(_fitnessCalculator.calculateFitness(chromosomen
));
chromosome
.
setFitness
(
_fitnessCalculator
.
calculateFitness
(
chromosome
));
//
}
}
});
});
...
...
src/main/java/com/aps/service/Algorithm/GeneticDecoder.java
View file @
28f87b1f
...
@@ -62,10 +62,16 @@ public class GeneticDecoder {
...
@@ -62,10 +62,16 @@ public class GeneticDecoder {
// 缓存命中:复用缓存结果
// 缓存命中:复用缓存结果
Chromosome
cachedResult
=
decodingCache
.
get
(
cacheKey
);
Chromosome
cachedResult
=
decodingCache
.
get
(
cacheKey
);
// 赋值给染色体
// 赋值给染色体
String
ID
=
chromosome
.
getID
();
chromosome
.
setObjectives
(
cachedResult
.
getObjectives
());
Chromosome
chromosomen
=
ProductionDeepCopyUtil
.
deepCopy
(
cachedResult
);
chromosome
.
setMakespan
(
cachedResult
.
getMakespan
());
chromosomen
.
setID
(
ID
);
chromosome
.
setTotalFlowTime
(
cachedResult
.
getTotalFlowTime
());
return
chromosomen
;
chromosome
.
setTotalChangeoverTime
(
cachedResult
.
getTotalChangeoverTime
());
chromosome
.
setMachineLoadStd
(
cachedResult
.
getMachineLoadStd
());
chromosome
.
setDelayTime
(
cachedResult
.
getDelayTime
());
chromosome
.
setResult
(
ProductionDeepCopyUtil
.
deepCopy
(
cachedResult
.
getResult
()));
// Chromosome chromosomen= ProductionDeepCopyUtil.deepCopy(cachedResult);
return
chromosome
;
}
}
}
finally
{
}
finally
{
cacheLock
.
unlock
();
// 确保锁释放
cacheLock
.
unlock
();
// 确保锁释放
...
@@ -414,7 +420,7 @@ public class GeneticDecoder {
...
@@ -414,7 +420,7 @@ public class GeneticDecoder {
List
<
OperationDependency
>
SSOperations
=
currentOp
.
getPrevEntryIds
().
stream
()
List
<
OperationDependency
>
SSOperations
=
currentOp
.
getPrevEntryIds
().
stream
()
.
filter
(
t
->
t
.
getDependencyType
()
==
DependencyType
.
StartToStart
)
.
filter
(
t
->
t
.
getDependencyType
()
==
DependencyType
.
StartToStart
)
.
collect
(
Collectors
.
toList
());
//重叠
.
collect
(
Collectors
.
toList
());
//重叠
if
(
FsOperations
!=
null
&&
Fs
Operations
.
size
()
>
0
)
{
if
(
SSOperations
!=
null
&&
SS
Operations
.
size
()
>
0
)
{
List
<
GAScheduleResult
>
newScheduleResult
=
new
ArrayList
<>();
List
<
GAScheduleResult
>
newScheduleResult
=
new
ArrayList
<>();
List
<
ScheduleResultDetail
>
newScheduleResultDetails
=
new
ArrayList
<>();
List
<
ScheduleResultDetail
>
newScheduleResultDetails
=
new
ArrayList
<>();
...
@@ -762,6 +768,7 @@ public class GeneticDecoder {
...
@@ -762,6 +768,7 @@ public class GeneticDecoder {
Objectives
[
2
]
=
totalSetupTime
;
Objectives
[
2
]
=
totalSetupTime
;
Objectives
[
3
]
=
machineLoadBalance
;
Objectives
[
3
]
=
machineLoadBalance
;
Objectives
[
4
]
=
tardiness
;
Objectives
[
4
]
=
tardiness
;
chromosome
.
setObjectives
(
Objectives
);
}
}
private
double
calculateTotalFlowTime
(
Chromosome
chromosome
)
{
private
double
calculateTotalFlowTime
(
Chromosome
chromosome
)
{
...
...
src/main/java/com/aps/service/Algorithm/NSGAIIUtils.java
View file @
28f87b1f
...
@@ -111,56 +111,61 @@ public class NSGAIIUtils {
...
@@ -111,56 +111,61 @@ public class NSGAIIUtils {
* 串行快速非支配排序(兼容小规模种群)
* 串行快速非支配排序(兼容小规模种群)
*/
*/
public
List
<
List
<
Chromosome
>>
fastNonDominatedSort
(
List
<
Chromosome
>
population
)
{
public
List
<
List
<
Chromosome
>>
fastNonDominatedSort
(
List
<
Chromosome
>
population
)
{
preprocessObjectives
(
population
);
// 1. 初始化数据结构:S(被支配集合)、n(支配数)
List
<
List
<
Chromosome
>>
fronts
=
new
ArrayList
<>();
Map
<
Chromosome
,
List
<
Chromosome
>>
S
=
new
HashMap
<>();
Map
<
Chromosome
,
List
<
Chromosome
>>
S
=
new
HashMap
<>();
Map
<
Chromosome
,
Integer
>
n
=
new
HashMap
<>();
Map
<
Chromosome
,
Integer
>
n
=
new
HashMap
<>();
List
<
Chromosome
>
front1
=
new
ArrayList
<>();
List
<
List
<
Chromosome
>>
fronts
=
new
ArrayList
<>();
// 为每个个体预先初始化 S 和 n
for
(
Chromosome
p
:
population
)
{
for
(
Chromosome
p
:
population
)
{
S
.
put
(
p
,
new
ArrayList
<>());
S
.
put
(
p
,
new
ArrayList
<>());
// 初始化空集合,避免null
n
.
put
(
p
,
0
);
n
.
put
(
p
,
0
);
// 支配数初始化为0
}
// 2. 计算每个个体的支配关系
for
(
Chromosome
p
:
population
)
{
for
(
Chromosome
q
:
population
)
{
for
(
Chromosome
q
:
population
)
{
if
(
p
==
q
)
continue
;
if
(
p
==
q
)
continue
;
if
(
dominates
(
p
,
q
))
{
if
(
dominates
(
p
,
q
))
{
// p支配q,将q加入p的被支配集合S
S
.
get
(
p
).
add
(
q
);
S
.
get
(
p
).
add
(
q
);
}
else
if
(
dominates
(
q
,
p
))
{
}
else
if
(
dominates
(
q
,
p
))
{
// q支配p,增加p的支配数n
n
.
put
(
p
,
n
.
get
(
p
)
+
1
);
n
.
put
(
p
,
n
.
get
(
p
)
+
1
);
}
}
}
}
// 3. 初始化第一前沿(支配数为0的个体)
if
(
n
.
get
(
p
)
==
0
)
{
if
(
n
.
get
(
p
)
==
0
)
{
p
.
setRank
(
1
);
if
(
fronts
.
isEmpty
())
{
front1
.
add
(
p
);
fronts
.
add
(
new
ArrayList
<>());
}
fronts
.
get
(
0
).
add
(
p
);
}
}
}
}
fronts
.
add
(
front1
);
// 4. 生成后续前沿
int
i
=
0
;
int
i
=
0
;
while
(!
fronts
.
get
(
i
).
isEmpty
())
{
while
(
fronts
.
get
(
i
).
size
()
>
0
)
{
List
<
Chromosome
>
nextFront
=
new
ArrayList
<>();
List
<
Chromosome
>
nextFront
=
new
ArrayList
<>();
for
(
Chromosome
p
:
fronts
.
get
(
i
))
{
for
(
Chromosome
p
:
fronts
.
get
(
i
))
{
// 遍历p的被支配集合S.get(p)(此时已初始化,不会为null)
for
(
Chromosome
q
:
S
.
get
(
p
))
{
for
(
Chromosome
q
:
S
.
get
(
p
))
{
n
.
put
(
q
,
n
.
get
(
q
)
-
1
);
n
.
put
(
q
,
n
.
get
(
q
)
-
1
);
if
(
n
.
get
(
q
)
==
0
)
{
if
(
n
.
get
(
q
)
==
0
)
{
q
.
setRank
(
i
+
2
);
nextFront
.
add
(
q
);
nextFront
.
add
(
q
);
}
}
}
}
}
}
i
++;
i
++;
if
(!
nextFront
.
isEmpty
())
{
fronts
.
add
(
nextFront
);
fronts
.
add
(
nextFront
);
}
}
}
return
fronts
;
return
fronts
;
}
}
/**
/**
* 预处理目标值(归一化+加权)
* 预处理目标值(归一化+加权)
*/
*/
...
...
src/main/java/com/aps/service/impl/LanuchServiceImpl.java
View file @
28f87b1f
...
@@ -346,13 +346,13 @@ public class LanuchServiceImpl implements LanuchService {
...
@@ -346,13 +346,13 @@ public class LanuchServiceImpl implements LanuchService {
launchOrder
.
setSerie
(
order
.
getSeries
());
launchOrder
.
setSerie
(
order
.
getSeries
());
launchOrder
.
setCreateUser
(
String
.
valueOf
(
order
.
getCreatoruserid
()));
launchOrder
.
setCreateUser
(
String
.
valueOf
(
order
.
getCreatoruserid
()));
launchOrder
.
setMaterialCode
(
order
.
getMmcode
());
launchOrder
.
setMaterialCode
(
order
.
getMmcode
());
// launchOrder.setStartDate(order.get
);
launchOrder
.
setStartDate
(
order
.
getBegintime
()
);
launchOrder
.
setEndDate
(
order
.
getDeliverytime
());
launchOrder
.
setEndDate
(
order
.
getDeliverytime
());
//
launchOrder.setOrderPriority(order.getPrioritry());
//
launchOrder.setOrderPriority(order.getPrioritry());
launchOrder
.
setOrderPriority
(
1
);
launchOrder
.
setOrderPriority
(
1
);
launchOrder
.
setQuantity
(
order
.
getQuantity
());
launchOrder
.
setQuantity
(
order
.
getQuantity
());
launchOrder
.
setMaterialId
(
order
.
getMmid
());
launchOrder
.
setMaterialId
(
order
.
getMmid
());
launchOrder
.
setOrderCode
(
order
.
getCode
());
String
mmid
=
order
.
getMmid
();
String
mmid
=
order
.
getMmid
();
// // 通过mmid查找对应的工艺
// // 通过mmid查找对应的工艺
// if (mmid != null && !mmid.isEmpty()) {
// if (mmid != null && !mmid.isEmpty()) {
...
...
src/main/java/com/aps/service/plan/PlanResultService.java
View file @
28f87b1f
...
@@ -13,9 +13,12 @@ import com.aps.entity.basic.ScheduleChromosome;
...
@@ -13,9 +13,12 @@ import com.aps.entity.basic.ScheduleChromosome;
import
com.aps.entity.Schedule.GenVO
;
import
com.aps.entity.Schedule.GenVO
;
import
com.aps.entity.Schedule.MachineVO
;
import
com.aps.entity.Schedule.MachineVO
;
import
com.aps.entity.basic.*
;
import
com.aps.entity.basic.*
;
import
com.aps.mapper.ConfigMapper
;
import
com.aps.service.*
;
import
com.aps.service.*
;
import
com.aps.service.Algorithm.*
;
import
com.aps.service.Algorithm.*
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -74,6 +77,11 @@ public class PlanResultService {
...
@@ -74,6 +77,11 @@ public class PlanResultService {
@Autowired
@Autowired
private
ConfigService
_configService
;
private
ConfigService
_configService
;
@Autowired
private
ConfigMapper
configMapper
;
@Autowired
@Autowired
private
StrategyRuleService
_strategyRuleService
;
private
StrategyRuleService
_strategyRuleService
;
...
@@ -766,24 +774,36 @@ private GlobalParam InitGlobalParam()
...
@@ -766,24 +774,36 @@ private GlobalParam InitGlobalParam()
{
{
GlobalParam
globalParam
=
new
GlobalParam
();
GlobalParam
globalParam
=
new
GlobalParam
();
Config
config
=
_configService
.
lambdaQuery
()
.
eq
(
Config:
:
getComponent
,
"setting"
)
.
one
();
LambdaQueryWrapper
<
Config
>
queryWrapper
=
new
LambdaQueryWrapper
<
Config
>()
.
eq
(
Config:
:
getComponent
,
"setting"
)
.
orderByDesc
(
Config:
:
getId
);
// 按更新时间降序
Page
<
Config
>
page
=
new
Page
<>(
1
,
1
);
configMapper
.
selectPage
(
page
,
queryWrapper
);
// 3. 提取最后一条记录
Config
config
=
page
.
getRecords
().
isEmpty
()
?
null
:
page
.
getRecords
().
get
(
0
);
List
<
ConfigSetting
>
configs
=
_configService
.
getComponentSettingsByPageAndNote
(
config
.
getId
(),
"setting"
);
List
<
ConfigSetting
>
configs
=
_configService
.
getComponentSettingsByPageAndNote
(
config
.
getId
(),
"setting"
);
for
(
ConfigSetting
c
:
configs
)
{
for
(
ConfigSetting
c
:
configs
)
{
if
(
c
.
getTitle
()
==
"日历"
)
if
(
c
.
getTitle
()
.
equals
(
"日历"
)
)
{
{
globalParam
.
setIsUseCalendar
(
c
.
isValue
());
globalParam
.
setIsUseCalendar
(
c
.
isValue
());
}
}
else
if
(
c
.
getTitle
()
==
"设置时间"
)
else
if
(
c
.
getTitle
()
.
equals
(
"设置时间"
)
)
{
{
globalParam
.
setIsUseCalendar
(
c
.
isValue
());
globalParam
.
setIsUseCalendar
(
c
.
isValue
());
}
else
if
(
c
.
getTitle
()
==
"原材料"
)
}
else
if
(
c
.
getTitle
()
.
equals
(
"原材料"
)
)
{
{
globalParam
.
setIsCheckBom
(
c
.
isValue
());
globalParam
.
setIsCheckBom
(
c
.
isValue
());
}
}
else
if
(
c
.
getTitle
()
==
"设置时间平滑"
)
else
if
(
c
.
getTitle
()
.
equals
(
"设置时间平滑"
)
)
{
{
globalParam
.
set_smoothSetup
(
c
.
isValue
());
globalParam
.
set_smoothSetup
(
c
.
isValue
());
}
}
...
@@ -798,8 +818,8 @@ private GlobalParam InitGlobalParam()
...
@@ -798,8 +818,8 @@ private GlobalParam InitGlobalParam()
for
(
ProdLaunchOrder
lo
:
ProdLaunchOrders
)
{
for
(
ProdLaunchOrder
lo
:
ProdLaunchOrders
)
{
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setMaterialCode
(
lo
.
getMaterialCode
());
order
.
setMaterialCode
(
lo
.
getMaterialCode
());
order
.
setSerie
(
lo
.
getSerie
());
order
.
setSerie
(
lo
.
getSerie
()
==
null
?
""
:
lo
.
getSerie
()
);
order
.
setOrderCode
(
lo
.
get
Group
Code
());
order
.
setOrderCode
(
lo
.
get
Order
Code
());
order
.
setOrderId
(
lo
.
getOrderId
());
order
.
setOrderId
(
lo
.
getOrderId
());
order
.
setRoutingId
(
lo
.
getRoutingId
());
order
.
setRoutingId
(
lo
.
getRoutingId
());
order
.
setMaterialId
(
lo
.
getMaterialId
());
order
.
setMaterialId
(
lo
.
getMaterialId
());
...
@@ -841,7 +861,7 @@ private GlobalParam InitGlobalParam()
...
@@ -841,7 +861,7 @@ private GlobalParam InitGlobalParam()
for
(
StrategyScheduling
strategy
:
selecteds
)
{
for
(
StrategyScheduling
strategy
:
selecteds
)
{
int
Amplitude
=
strategy
.
getAmplitude
();
int
Amplitude
=
strategy
.
getAmplitude
();
if
(
strategy
.
getName
()
==
"customer_due_date"
)
{
if
(
strategy
.
getName
()
.
equals
(
"customer_due_date"
)
)
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
if
(
Amplitude
>
0
)
{
if
(
Amplitude
>
0
)
{
...
@@ -854,10 +874,10 @@ private GlobalParam InitGlobalParam()
...
@@ -854,10 +874,10 @@ private GlobalParam InitGlobalParam()
condition
.
setReverse
(
false
);
// 递增
condition
.
setReverse
(
false
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"groupDueDate"
);
files
.
add
(
"groupDueDate"
);
i
++;
}
else
if
(
strategy
.
getName
().
equals
(
"startd_date"
)
)
{
}
else
if
(
strategy
.
getName
()
==
"startd_date"
)
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
if
(
Amplitude
>
0
)
{
if
(
Amplitude
>
0
)
{
...
@@ -870,54 +890,60 @@ private GlobalParam InitGlobalParam()
...
@@ -870,54 +890,60 @@ private GlobalParam InitGlobalParam()
condition
.
setReverse
(
false
);
// 递增
condition
.
setReverse
(
false
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"groupStartDate"
);
files
.
add
(
"groupStartDate"
);
i
++;
}
else
if
(
strategy
.
getName
().
equals
(
"gathering_series"
))
{
}
else
if
(
strategy
.
getName
()
==
"gathering_series"
)
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"serie"
);
condition
.
setFieldName
(
"serie"
);
condition
.
setReverse
(
false
);
// 递增
condition
.
setReverse
(
false
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"serie"
);
files
.
add
(
"serie"
);
}
else
if
(
strategy
.
getName
()
==
"maximum_operation_priority"
&&
!
files
.
contains
(
"priority"
))
{
i
++;
}
else
if
(
strategy
.
getName
()
.
equals
(
"Minimum_wo_priority"
)
&&
!
files
.
contains
(
"priority"
))
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"priority"
);
condition
.
setFieldName
(
"priority"
);
condition
.
setReverse
(
false
);
// 递增
condition
.
setReverse
(
false
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"priority"
);
files
.
add
(
"priority"
);
}
else
if
(
strategy
.
getName
()
==
"maximum_wo_priority"
&&
!
files
.
contains
(
"priority"
))
{
i
++;
}
else
if
(
strategy
.
getName
()
.
equals
(
"maximum_wo_priority"
)
&&
!
files
.
contains
(
"priority"
))
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"priority"
);
condition
.
setFieldName
(
"priority"
);
condition
.
setReverse
(
true
);
// 高优先级在前
condition
.
setReverse
(
true
);
// 高优先级在前
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"priority"
);
files
.
add
(
"priority"
);
}
else
if
(
strategy
.
getName
()
==
"material_rise"
)
{
i
++;
}
else
if
(
strategy
.
getName
()
.
equals
(
"material_rise"
))
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"materialCode"
);
condition
.
setFieldName
(
"materialCode"
);
condition
.
setReverse
(
true
);
// 递增
condition
.
setReverse
(
true
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"materialCode"
);
files
.
add
(
"materialCode"
);
}
else
if
(
strategy
.
getName
()
==
"plan_rise"
&&
!
files
.
contains
(
"orderCode"
))
{
i
++;
}
else
if
(
strategy
.
getName
()
.
equals
(
"plan_rise"
)
&&
!
files
.
contains
(
"orderCode"
))
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"orderCode"
);
condition
.
setFieldName
(
"orderCode"
);
condition
.
setReverse
(
true
);
// 递增
condition
.
setReverse
(
true
);
// 递增
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"orderCode"
);
files
.
add
(
"orderCode"
);
}
else
if
(
strategy
.
getName
()
==
"plan_drop"
&&
!
files
.
contains
(
"orderCode"
))
{
i
++;
}
else
if
(
strategy
.
getName
()
.
equals
(
"plan_drop"
)
&&
!
files
.
contains
(
"orderCode"
))
{
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition
=
new
OrderSortRule
.
SortCondition
();
condition
.
setSequence
(
i
);
condition
.
setSequence
(
i
);
condition
.
setFieldName
(
"orderCode"
);
condition
.
setFieldName
(
"orderCode"
);
condition
.
setReverse
(
false
);
// 递减
condition
.
setReverse
(
false
);
// 递减
conditions
.
add
(
condition
);
conditions
.
add
(
condition
);
files
.
add
(
"orderCode"
);
files
.
add
(
"orderCode"
);
}
i
++;
i
++;
}
}
}
}
else
{
}
else
{
OrderSortRule
.
SortCondition
condition3
=
new
OrderSortRule
.
SortCondition
();
OrderSortRule
.
SortCondition
condition3
=
new
OrderSortRule
.
SortCondition
();
condition3
.
setSequence
(
1
);
condition3
.
setSequence
(
1
);
...
...
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