Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes
Project
Project
Details
Activity
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
ximai
mes
Commits
9fbfe285
Commit
9fbfe285
authored
Oct 31, 2025
by
wzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉核心逻辑
parent
1939a180
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
158 deletions
+1
-158
ProTaskServiceImpl.java
...m/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
+1
-158
No files found.
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
View file @
9fbfe285
...
...
@@ -782,149 +782,6 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
return
list
.
stream
().
map
(
s
->
s
.
getWorkorderCode
()).
collect
(
Collectors
.
toList
());
}
@Override
@Transactional
public
List
<
ProPackagePrintResult
>
feedBack
(
ProFeedback
feedback
)
{
List
<
ProPackagePrintResult
>
response
=
new
ArrayList
<>();
BigDecimal
feedbackQualifyConst
=
feedback
.
getQuantityQualify
();
BigDecimal
fuantityUnqualify
=
feedback
.
getQuantityUnqualify
();
//温志超修改 :合格和非合格数量都不允许小于0
ExceptionUtil
.
checkTrueThrowException
(
(
feedbackQualifyConst
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
||
fuantityUnqualify
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
),
MessageUtils
.
message
(
"pro.feedback.error.min.quantity"
));
ExceptionUtil
.
checkTrueThrowException
((
feedbackQualifyConst
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
&&
fuantityUnqualify
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
),
"报工数目合格、不合格数不能都小于等于0"
);
boolean
addOneQuantityWait
=
false
;
//序号报工校验,当addOneQuantityWait为true时说明已经报工过不良,不再增加
if
(
StringUtils
.
isNotEmpty
(
feedback
.
getQrcode
())){
FeedbackValidateSerialNoParams
feedbackValidateSerialNoParams
=
new
FeedbackValidateSerialNoParams
();
feedbackValidateSerialNoParams
.
setQrcode
(
feedback
.
getQrcode
());
feedbackValidateSerialNoParams
.
setTaskWorkunitId
(
feedback
.
getTaskWorkunitId
());
feedbackValidateSerialNoParams
.
setTaskId
(
feedback
.
getTaskId
());
addOneQuantityWait
=
proFeedbackService
.
validateSerialNo
(
feedbackValidateSerialNoParams
,
true
);
}
ProTaskWorkunit
taskWorkunit
=
proTaskWorkunitService
.
selectProTaskWorkunitByTaskWorkunitId
(
feedback
.
getTaskWorkunitId
());
ExceptionUtil
.
checkTrueThrowException
(!
taskWorkunit
.
getStatus
().
equals
(
TaskStatusEnum
.
BEGINNING
.
getStatus
()),
MessageUtils
.
message
(
"pro.feedback.error.before.start"
));
//检索已经报工的数量
double
execQuantityQualifySumConst
=
proFeedbackService
.
selectQuantityQualifySum
(
new
ProFeedback
(
null
,
null
,
null
,
taskWorkunit
.
getTaskWorkunitId
()));
ProTask
task
=
this
.
selectProTaskByTaskId
(
feedback
.
getTaskId
());
if
(
addOneQuantityWait
){
//addOneQuantityWait为true时说明该条吗已经存在过报工记录且为不良品 此时可能 不良品-》不良品 不良品-》良品
//增加一个可加工数,后续计算中会减1,抵消以后相当于QuantityWait可加工数不变
task
.
setQuantityWait
(
task
.
getQuantityWait
().
add
(
new
BigDecimal
(
1
)));
//减少一个不良加工数,后续计算中根据报工是不合格增加1,如果为合格则不再增加
task
.
setQuantityUnqualify
(
task
.
getQuantityUnqualify
().
subtract
(
new
BigDecimal
(
1
)));
//减少一个已加工数,抵消以后增加一个相当于已加工数不变
task
.
setQuantityProduced
(
task
.
getQuantityProduced
().
subtract
(
new
BigDecimal
(
1
)));
taskWorkunit
.
setQuantityUnqualify
(
taskWorkunit
.
getQuantityUnqualify
().
subtract
(
new
BigDecimal
(
1
)));
taskWorkunit
.
setQuantityProduced
(
taskWorkunit
.
getQuantityProduced
().
subtract
(
new
BigDecimal
(
1
)));
}
BigDecimal
taskQuantityWaitConst
=
task
.
getQuantityWait
();
double
feedbackQualityDouConst
=
feedbackQualifyConst
.
doubleValue
();
BigDecimal
quantityWaitVal
=
BigDecimal
.
ZERO
;
BigDecimal
feedbackQualityVal
=
BigDecimal
.
valueOf
(
feedbackQualityDouConst
);
QueryWrapper
<
ProWorkorder
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"t1.workorder_code"
,
task
.
getArrangeCode
());
queryWrapper
.
notIn
(
"t1.status"
,
Arrays
.
asList
(
WorkorderStatusEnum
.
CLOSE
.
getValue
(),
WorkorderStatusEnum
.
CANCEL
.
getValue
(),
WorkorderStatusEnum
.
CANCELED
.
getValue
()));
List
<
ProWorkorder
>
proWorkorders
=
proWorkorderService
.
selectListByQw
(
queryWrapper
);
//检查该工单绑定的生产版本是否允许超报,PS只有首工序允许
if
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
){
if
(
task
.
getOrdinal
()
==
1
){
if
(
proWorkorders
.
size
()
>
0
&&
proWorkorders
.
get
(
0
).
getProductionSolutionId
()
!=
null
){
ProProductionSolution
proProductionSolution
=
proProductionSolutionMapper
.
selectProProductionSolutionByProductionSolutionId
(
proWorkorders
.
get
(
0
).
getProductionSolutionId
());
if
(
proProductionSolution
!=
null
&&
proProductionSolution
.
getSurpassState
()
!=
null
){
if
(!
proProductionSolution
.
getSurpassState
()){
//不允许超报 可报工数目 - (合格数 + 不合格数)不能小于 0
ExceptionUtil
.
checkTrueThrowException
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
,
"工单关联的生产版本不允许超报行为"
);
}
}
}
}
else
{
ExceptionUtil
.
checkTrueThrowException
(
true
,
"非首工序不允许超过可报工数报工"
);
}
}
//本次合格数和不合格数总和大于可报工数目 与 已报工数目已经超过了排产数量
if
((
feedbackQualityDouConst
+
fuantityUnqualify
.
doubleValue
())>=
task
.
getQuantityWait
().
doubleValue
()
&&
task
.
getQuantity
().
doubleValue
()
<=
(
execQuantityQualifySumConst
+
feedbackQualityDouConst
+
fuantityUnqualify
.
doubleValue
()))
{
//记录实际完工时间
taskWorkunit
.
setActualEndDate
(
Calendar
.
getInstance
().
getTime
());
taskWorkunit
.
setStatus
(
FINISHED
.
getStatus
());
}
quantityWaitVal
=
taskQuantityWaitConst
.
subtract
(
feedbackQualityVal
.
add
(
fuantityUnqualify
));
task
.
setQuantityWait
(
quantityWaitVal
);
task
.
setQuantityProduced
(
DataUtil
.
getNormalData
(
task
.
getQuantityProduced
()).
add
(
feedbackQualityVal
).
add
(
fuantityUnqualify
));
task
.
setQuantityQualify
(
DataUtil
.
getNormalData
(
task
.
getQuantityQualify
()).
add
(
feedbackQualityVal
));
taskWorkunit
.
setQuantityProduced
(
DataUtil
.
getNormalData
(
taskWorkunit
.
getQuantityProduced
()).
add
(
feedbackQualityVal
).
add
(
fuantityUnqualify
));
taskWorkunit
.
setQuantityQualify
(
DataUtil
.
getNormalData
(
taskWorkunit
.
getQuantityQualify
()).
add
(
feedbackQualityVal
));
task
.
setQuantityUnqualify
(
DataUtil
.
getNormalData
(
task
.
getQuantityUnqualify
()).
add
(
feedback
.
getQuantityUnqualify
()));
taskWorkunit
.
setQuantityUnqualify
(
DataUtil
.
getNormalData
(
taskWorkunit
.
getQuantityUnqualify
()).
add
(
feedback
.
getQuantityUnqualify
()));
List
<
MdWorkstation
>
mdWorkstations
=
workstationMapper
.
selectListByQw
(
new
QueryWrapper
<
MdWorkstation
>().
eq
(
"workstation_id"
,
feedback
.
getWorkstationId
()));
ExceptionUtil
.
checkTrueThrowException
(
CollectionUtil
.
isEmpty
(
mdWorkstations
),
MessageUtils
.
message
(
"md.workStation.error.not.exist"
));
MdWorkstation
workstation
=
mdWorkstations
.
get
(
0
);
feedback
.
setWorkstationCode
(
workstation
.
getWorkstationCode
());
feedback
.
setWorkstationName
(
workstation
.
getWorkstationName
());
feedback
.
setWorkstationId
(
DataUtil
.
repliceData
(
feedback
.
getWorkstationId
(),
workstation
.
getWorkstationId
()));
feedback
.
setFeedbackType
(
"SELF"
);
feedback
.
setWorkunitId
(
taskWorkunit
.
getWorkunitId
());
//暂停更新记录
if
(
Objects
.
equals
(
taskWorkunit
.
getStatus
(),
FINISHED
.
getStatus
()))
{
proStartWorkService
.
closeObj
(
feedback
);
}
else
{
proStartWorkService
.
updateObj
(
feedback
);
}
//按派工表保存报工记录
LinkedHashMap
<
String
,
ProFeedbackSplitInfo
>
feedbackWorkorder
=
proFeedbackService
.
taskFeedback
(
task
,
feedback
);
//查询关联下道工序
ProTask
nextTask
=
this
.
getNextTaskByTaskId
(
feedback
.
getTaskId
());
AtomicReference
<
ProTaskWorkunit
>
nextTaskWorkunit
=
new
AtomicReference
<>();
if
(
nextTask
!=
null
)
{
// 下道任务待加工数累加合格数量
nextTask
.
setQuantityWait
(
DataUtil
.
getNormalData
(
nextTask
.
getQuantityWait
()).
add
(
feedbackQualifyConst
));
List
<
ProTaskWorkunit
>
proTaskWorkunits
=
proTaskWorkunitMapper
.
selectListByQw
(
new
QueryWrapper
<
ProTaskWorkunit
>().
eq
(
"task_id"
,
nextTask
.
getTaskId
()));
proTaskWorkunits
.
stream
().
filter
(
x
->
Objects
.
equals
(
x
.
getStatus
(),
FINISHED
.
getStatus
())).
forEach
(
x
->
{
nextTaskWorkunit
.
set
(
x
);
x
.
setStatus
(
TaskWorkunitStatusEnum
.
PREPARE
.
getStatus
());
proTaskWorkunitMapper
.
updateProTaskWorkunit
(
x
);
});
nextTask
.
setStatus
(
TaskStatusEnum
.
PREPARE
.
getStatus
());
this
.
updateProTask
(
nextTask
);
}
this
.
updateProTask
(
task
);
if
(
feedbackQualityVal
.
doubleValue
()
>
0
)
{
//查询关联下道工序
//如果为最后一道工序,回写工单数量
if
(
StringUtils
.
isEmpty
(
nextTask
))
{
feedbackWorkorder
.
forEach
((
k
,
v
)
->
{
proWorkorderService
.
reportUpdateProWorkorder
(
v
.
getWorkorder
(),
v
.
getQuantityQualify
(),
v
.
getQuantityUnqualify
());
});
}
}
proTaskWorkunitService
.
updateProTaskWorkunit
(
taskWorkunit
);
feedbackWorkorder
.
forEach
((
k
,
v
)
->
{
FeedbackDto
feedbackDto
=
FeedbackDto
.
builder
().
workorder
(
v
.
getWorkorder
()).
currTask
(
task
).
currTaskWorkunit
(
taskWorkunit
)
.
nextTask
(
nextTask
).
nextTaskWorkunit
(
nextTaskWorkunit
.
get
()).
build
();
applicationContext
.
getBean
(
ProTaskServiceImpl
.
class
).
feedbackToErp
(
feedbackDto
,
v
.
getQuantityQualify
(),
v
.
getQuantityUnqualify
());
});
return
response
;
}
@MethodExtendedProcesses
(
config
={
@MethodExtendedProcess
(
sysSwitchParam
=
"erp.process.finish.create.enable"
,
processClz
=
ProcessTransferCreateProcess
.
class
,
...
...
@@ -1371,21 +1228,7 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
@Transactional
@Override
public
void
schedule
(
List
<
WorkorderScheduleParams
>
workorderScheduleParams
)
{
ThXMScheduleAlgorithmAdapter
scheduleAlgorithmAdapter
=
new
ThXMScheduleAlgorithmAdapter
();
scheduleAlgorithmAdapter
.
setAlgorithmDataSource
(
algorithmDataSource
);
scheduleAlgorithmAdapter
.
setAlgorithmResultProcess
(
algorithmResultProcess
);
EquipmentSelectionStrategyThXMImpl
defaultStrategy
=
new
EquipmentSelectionStrategyThXMImpl
();
defaultStrategy
.
addEvaluateEquipment
(
new
EvaluateEquipmentSerial
());
scheduleAlgorithmAdapter
.
setEquipmentSelectionStrategy
(
defaultStrategy
);
scheduleAlgorithmAdapter
.
setAlgorithmExtendDataSources
(
new
ArrayList
<
AlgorithmExtendDataSource
>()
{
private
static
final
long
serialVersionUID
=
-
4466020352312471396L
;
{
add
(
equipmentNewestTaskAlgorithmData
);
add
(
scheduleSetupRuleAlgorithmData
);
}
});
LocalDateTime
minStartSchedule
=
workorderScheduleParams
.
stream
().
map
(
s
->
s
.
getScheduleDate
()).
sorted
().
findFirst
().
get
();
scheduleAlgorithmAdapter
.
schedule
(
minStartSchedule
,
workorderScheduleParams
);
}
@Override
...
...
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