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
5b683e6f
Commit
5b683e6f
authored
Jan 14, 2025
by
温志超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新生产排产BUG
parent
3710404a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
5 deletions
+48
-5
ProTaskController.java
.../com/ximai/mes/pro/controller/task/ProTaskController.java
+1
-0
ProTaskWorkunit.java
...n/java/com/ximai/mes/pro/domain/task/ProTaskWorkunit.java
+2
-1
ProTaskWorkunitMapper.java
.../com/ximai/mes/pro/mapper/task/ProTaskWorkunitMapper.java
+1
-1
ProTaskServiceImpl.java
...m/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
+42
-3
ProTaskWorkunitMapper.xml
.../main/resources/mapper/pro/task/ProTaskWorkunitMapper.xml
+2
-0
No files found.
mes/src/main/java/com/ximai/mes/pro/controller/task/ProTaskController.java
View file @
5b683e6f
...
@@ -257,6 +257,7 @@ public class ProTaskController extends BaseController {
...
@@ -257,6 +257,7 @@ public class ProTaskController extends BaseController {
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getScheduleStartDate
()),
MessageUtils
.
message
(
"pro.schedule.error.not.null.startTime"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getScheduleStartDate
()),
MessageUtils
.
message
(
"pro.schedule.error.not.null.startTime"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getDuration
())
||
proTaskVo
.
getDuration
()
<=
0L
,
MessageUtils
.
message
(
"pro.schedule.limit.min.duration"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getDuration
())
||
proTaskVo
.
getDuration
()
<=
0L
,
MessageUtils
.
message
(
"pro.schedule.limit.min.duration"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getWorkunitId
()),
MessageUtils
.
message
(
"md.workUnit.error.not.null"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getWorkunitId
()),
MessageUtils
.
message
(
"md.workUnit.error.not.null"
));
ExceptionUtil
.
checkTrueThrowException
(
StringUtils
.
isNull
(
proTaskVo
.
getTaskWorkunit
())
||
StringUtils
.
isNull
(
proTaskVo
.
getTaskWorkunit
().
getWorkunitId
()),
MessageUtils
.
message
(
"md.workUnit.error.not.null"
));
ExceptionUtil
.
checkTrueThrowException
(
proTaskVo
.
getQuantity
().
compareTo
(
BigDecimal
.
ZERO
)
!=
1
,
MessageUtils
.
message
(
"pro.schedule.limit.min.quantity"
));
ExceptionUtil
.
checkTrueThrowException
(
proTaskVo
.
getQuantity
().
compareTo
(
BigDecimal
.
ZERO
)
!=
1
,
MessageUtils
.
message
(
"pro.schedule.limit.min.quantity"
));
...
...
mes/src/main/java/com/ximai/mes/pro/domain/task/ProTaskWorkunit.java
View file @
5b683e6f
...
@@ -29,7 +29,8 @@ public class ProTaskWorkunit extends BaseEntity {
...
@@ -29,7 +29,8 @@ public class ProTaskWorkunit extends BaseEntity {
@TableId
@TableId
@ApiModelProperty
(
"生产任务ID"
)
@ApiModelProperty
(
"生产任务ID"
)
private
Long
taskWorkunitId
;
private
Long
taskWorkunitId
;
@ApiModelProperty
(
"被拆分的生产任务ID"
)
private
Long
sourceTaskWorkunitId
;
/**
/**
* 任务ID
* 任务ID
*/
*/
...
...
mes/src/main/java/com/ximai/mes/pro/mapper/task/ProTaskWorkunitMapper.java
View file @
5b683e6f
...
@@ -153,7 +153,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
...
@@ -153,7 +153,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
"\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date\n"
+
"\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date\n"
+
"\t, t.attr1, t.attr2, t.attr3, t.attr4\n"
+
"\t, t.attr1, t.attr2, t.attr3, t.attr4\n"
+
"\t, t.create_time, t.update_by, t.update_time, ptw.STATUS, ptw.quantity_qualify, ptw.remark\n"
+
"\t, t.create_time, t.update_by, t.update_time, ptw.STATUS, ptw.quantity_qualify, ptw.remark\n"
+
"\t, ptw.quantity_unqualify, ptw.outsource_unit_price,ptw.outsourced, ptw.vendor_id,ptw.vendor_name, mw.workunit_id, mw.workunit_code, mw.workunit_name, wo.workorder_code\n"
+
"\t, ptw.quantity_unqualify, ptw.outsource_unit_price,ptw.outsourced, ptw.vendor_id,ptw.vendor_name, mw.workunit_id, mw.workunit_code, mw.workunit_name,
ptw.std_working_time,ptw.std_working_time_uom,
wo.workorder_code\n"
+
"\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PREPARE' then 2 when 'PAUSE' then 3 when 'ERROR_STOP' then 4 end) statusIndex\n"
+
"\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PREPARE' then 2 when 'PAUSE' then 3 when 'ERROR_STOP' then 4 end) statusIndex\n"
+
"from pro_task_workunit ptw\n"
+
"from pro_task_workunit ptw\n"
+
"\tleft join pro_task t on ptw.task_id = t.task_id\n"
+
"\tleft join pro_task t on ptw.task_id = t.task_id\n"
+
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
View file @
5b683e6f
...
@@ -11,6 +11,8 @@ import com.ximai.common.utils.data.DataUtil;
...
@@ -11,6 +11,8 @@ import com.ximai.common.utils.data.DataUtil;
import
com.ximai.common.utils.data.DateUtils
;
import
com.ximai.common.utils.data.DateUtils
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.mes.cal.domain.CalPlanWorkunit
;
import
com.ximai.mes.cal.service.ICalPlanWorkunitService
;
import
com.ximai.mes.constant.*
;
import
com.ximai.mes.constant.*
;
import
com.ximai.mes.md.domain.MdItem
;
import
com.ximai.mes.md.domain.MdItem
;
import
com.ximai.mes.md.domain.MdWorkstation
;
import
com.ximai.mes.md.domain.MdWorkstation
;
...
@@ -162,6 +164,8 @@ public class ProTaskServiceImpl implements IProTaskService {
...
@@ -162,6 +164,8 @@ public class ProTaskServiceImpl implements IProTaskService {
@Autowired
@Autowired
private
IProMaterialRequestService
proMaterialRequestService
;
private
IProMaterialRequestService
proMaterialRequestService
;
@Autowired
ICalPlanWorkunitService
calPlanWorkunitService
;
@Resource
@Resource
private
IMdWorkunitService
iMdWorkunitService
;
private
IMdWorkunitService
iMdWorkunitService
;
...
@@ -1185,20 +1189,55 @@ public class ProTaskServiceImpl implements IProTaskService {
...
@@ -1185,20 +1189,55 @@ public class ProTaskServiceImpl implements IProTaskService {
// 封装任务-工作单元
// 封装任务-工作单元
insertTaskWorkunit
.
setQuantity
(
splitQuantityConst
);
insertTaskWorkunit
.
setQuantity
(
splitQuantityConst
);
insertTaskWorkunit
.
setSourceTaskWorkunitId
(
proTaskVo
.
getTaskWorkunitId
());
insertTaskWorkunit
.
setQuantityProduced
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setQuantityProduced
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setQuantityQualify
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setQuantityQualify
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setQuantityUnqualify
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setQuantityUnqualify
(
BigDecimal
.
ZERO
);
insertTaskWorkunit
.
setStatus
(
TaskStatusEnum
.
PREPARE
.
getStatus
());
insertTaskWorkunit
.
setStatus
(
TaskStatusEnum
.
PREPARE
.
getStatus
());
insertTaskWorkunit
.
setTaskType
(
type
);
insertTaskWorkunit
.
setTaskType
(
type
);
Date
startTime
=
proTaskVo
.
getScheduleStartDate
()
==
null
?
new
Date
()
:
proTaskVo
.
getScheduleStart
Date
();
Date
startTime
=
new
Date
();
insertTaskWorkunit
.
setScheduleStartDate
(
startTime
);
insertTaskWorkunit
.
setScheduleStartDate
(
startTime
);
insertTaskWorkunit
.
setScheduleEndDate
(
new
Date
(
startTime
.
getTime
()
+
proTaskVo
.
getDuration
()
*
1000
*
60
*
60
));
QueryWrapper
<
CalPlanWorkunit
>
calPlanWorkunitQuery
=
new
QueryWrapper
<
CalPlanWorkunit
>();
calPlanWorkunitQuery
.
eq
(
"rest_flag"
,
0
);
calPlanWorkunitQuery
.
eq
(
"workunit_id"
,
insertTaskWorkunit
.
getWorkunitId
());
calPlanWorkunitQuery
.
gt
(
"start_date"
,
startTime
);
calPlanWorkunitQuery
.
orderByAsc
(
"start_date"
);
//查询可用工作日历
List
<
CalPlanWorkunit
>
list
=
calPlanWorkunitService
.
selectListWithSchedule
(
calPlanWorkunitQuery
);
if
(
insertTaskWorkunit
.
getStdWorkingTime
()
!=
null
&&
insertTaskWorkunit
.
getStdWorkingTime
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
insertTaskWorkunit
.
getStdWorkingTimeUom
()
!=
null
&&
list
.
size
()
<
1
){
Long
endData
=
0L
;
if
(
insertTaskWorkunit
.
getStdWorkingTimeUom
().
equals
(
"HOUR"
)){
endData
=
insertTaskWorkunit
.
getStdWorkingTime
().
multiply
(
new
BigDecimal
(
1000
*
60
*
60
)).
multiply
(
splitQuantityConst
).
longValue
();
}
else
if
(
insertTaskWorkunit
.
getStdWorkingTimeUom
().
equals
(
"MIN"
)){
endData
=
insertTaskWorkunit
.
getStdWorkingTime
().
multiply
(
new
BigDecimal
(
1000
*
60
)).
multiply
(
splitQuantityConst
).
longValue
();
}
else
if
(
insertTaskWorkunit
.
getStdWorkingTimeUom
().
equals
(
"SECOND"
)){
endData
=
insertTaskWorkunit
.
getStdWorkingTime
().
multiply
(
new
BigDecimal
(
1000
)).
multiply
(
splitQuantityConst
).
longValue
();
}
insertTaskWorkunit
.
setScheduleStartDate
(
list
.
get
(
0
).
getStartDate
());
if
(
endData
!=
0
){
for
(
CalPlanWorkunit
calPlanWorkunit
:
list
){
if
((
calPlanWorkunit
.
getEndDate
().
getTime
()
-
calPlanWorkunit
.
getStartDate
().
getTime
())
>
endData
){
insertTaskWorkunit
.
setScheduleEndDate
(
new
Date
(
calPlanWorkunit
.
getStartDate
().
getTime
()
+
endData
));
}
else
{
endData
=
endData
-
(
calPlanWorkunit
.
getEndDate
().
getTime
()
-
calPlanWorkunit
.
getStartDate
().
getTime
());
}
}
if
(
endData
>
0
){
//不够用
insertTaskWorkunit
.
setScheduleEndDate
(
new
Date
(
list
.
get
(
list
.
size
()
-
1
).
getEndDate
().
getTime
()
+
endData
));
}
}
else
{
insertTaskWorkunit
.
setScheduleEndDate
(
insertTaskWorkunit
.
getScheduleStartDate
());
}
}
else
{
insertTaskWorkunit
.
setScheduleEndDate
(
startTime
);
}
insertTaskWorkunit
.
setDuration
(
insertTaskWorkunit
.
getScheduleEndDate
().
getTime
()
-
insertTaskWorkunit
.
getScheduleStartDate
().
getTime
());
if
(
Objects
.
equals
(
type
,
TaskConst
.
ASSIST_TASK
))
{
if
(
Objects
.
equals
(
type
,
TaskConst
.
ASSIST_TASK
))
{
insertTaskWorkunit
.
setApiFlag
(
true
);
insertTaskWorkunit
.
setApiFlag
(
true
);
}
}
proTaskWorkunitService
.
insertProTaskWorkunit
(
insertTaskWorkunit
);
proTaskWorkunitService
.
insertProTaskWorkunit
(
insertTaskWorkunit
);
return
insertTaskWorkunit
;
return
insertTaskWorkunit
;
}
}
...
...
mes/src/main/resources/mapper/pro/task/ProTaskWorkunitMapper.xml
View file @
5b683e6f
...
@@ -128,6 +128,7 @@
...
@@ -128,6 +128,7 @@
<if
test=
"stdWorkingTime != null"
>
std_working_time,
</if>
<if
test=
"stdWorkingTime != null"
>
std_working_time,
</if>
<if
test=
"stdWorkingTimeUom != null"
>
std_working_time_uom,
</if>
<if
test=
"stdWorkingTimeUom != null"
>
std_working_time_uom,
</if>
<if
test=
"unitPrice != null"
>
unit_price,
</if>
<if
test=
"unitPrice != null"
>
unit_price,
</if>
<if
test=
"sourceTaskWorkunitId != null"
>
source_task_workunit_id,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"taskId != null"
>
#{taskId},
</if>
<if
test=
"taskId != null"
>
#{taskId},
</if>
...
@@ -152,6 +153,7 @@
...
@@ -152,6 +153,7 @@
<if
test=
"stdWorkingTime != null"
>
#{stdWorkingTime},
</if>
<if
test=
"stdWorkingTime != null"
>
#{stdWorkingTime},
</if>
<if
test=
"stdWorkingTimeUom != null"
>
#{stdWorkingTimeUom},
</if>
<if
test=
"stdWorkingTimeUom != null"
>
#{stdWorkingTimeUom},
</if>
<if
test=
"unitPrice != null"
>
#{unitPrice},
</if>
<if
test=
"unitPrice != null"
>
#{unitPrice},
</if>
<if
test=
"sourceTaskWorkunitId != null"
>
#{sourceTaskWorkunitId},
</if>
</trim>
</trim>
</insert>
</insert>
...
...
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