opt:优化调度
This commit is contained in:
@@ -4,94 +4,72 @@
|
|||||||
|
|
||||||
<select id="getAllCutPlan"
|
<select id="getAllCutPlan"
|
||||||
resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
|
resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
|
||||||
SELECT
|
SELECT resource_name,
|
||||||
p.resource_name,
|
parent_container_name,
|
||||||
CASE
|
manufacture_sort,
|
||||||
WHEN LENGTH(p.parent_container_name) > 0 THEN p.parent_container_name
|
split_group,
|
||||||
ELSE p.restruct_container_name
|
up_or_down,
|
||||||
END AS parent_container_name,
|
qzz_size,
|
||||||
|
qzz_generation,
|
||||||
|
start_time
|
||||||
|
FROM (SELECT p.resource_name,
|
||||||
|
p.parent_container_name,
|
||||||
|
p.manufacture_sort,
|
||||||
p.split_group,
|
p.split_group,
|
||||||
p.up_or_down,
|
p.up_or_down,
|
||||||
p.qzz_size,
|
p.qzz_size,
|
||||||
p.qzz_generation,
|
p.qzz_generation,
|
||||||
COALESCE ( count_table.num, 0 ) num,
|
MIN(p.start_time) AS start_time
|
||||||
COALESCE ( ct1.cn, 0 ) AS cn,
|
FROM `pdm_bi_slittingproductionplan` p
|
||||||
COALESCE ( ct2.cnn, 0 ) AS cnn
|
WHERE p.`status` = '01'
|
||||||
FROM
|
|
||||||
`pdm_bi_slittingproductionplan` p
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
pp.resource_name,
|
|
||||||
COUNT(*) AS num
|
|
||||||
FROM
|
|
||||||
pdm_bi_slittingproductionplan pp
|
|
||||||
WHERE
|
|
||||||
pp.qzzno IN ( SELECT IF ( LENGTH( bc.qzz_no1 )> 0, bc.qzz_no1, bc.qzz_no2 ) FROM bst_ivt_cutpointivt bc )
|
|
||||||
AND pp.`status` <![CDATA[ < ]]> '09'
|
|
||||||
AND pp.is_child_tz_ok = '1' AND DATE( pp.start_time ) = CURDATE()
|
|
||||||
GROUP BY pp.resource_name
|
|
||||||
) AS count_table ON p.resource_name = count_table.resource_name
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
pp.resource_name,
|
|
||||||
COUNT(*) AS cn
|
|
||||||
FROM
|
|
||||||
pdm_bi_slittingproductionplan pp
|
|
||||||
WHERE
|
|
||||||
pp.qzzno IN ( SELECT IF ( LENGTH( tc.up_qzzno )> 0, tc.up_qzzno, tc.down_qzzno ) FROM st_ivt_cutpointivt tc )
|
|
||||||
AND pp.`status` = '05' AND DATE( pp.start_time ) = CURDATE()
|
|
||||||
GROUP BY pp.resource_name
|
|
||||||
) AS ct1 ON p.resource_name = ct1.resource_name
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
pp.resource_name,
|
|
||||||
pp.parent_container_name,
|
|
||||||
pp.split_group,
|
|
||||||
pp.up_or_down,
|
|
||||||
COUNT(*) AS cnn
|
|
||||||
FROM
|
|
||||||
pdm_bi_slittingproductionplan pp
|
|
||||||
WHERE
|
|
||||||
pp.`status` = '01'
|
|
||||||
AND pp.is_child_tz_ok = '1' AND DATE( pp.start_time ) = CURDATE()
|
|
||||||
GROUP BY
|
|
||||||
pp.resource_name,
|
|
||||||
pp.parent_container_name,
|
|
||||||
pp.split_group,
|
|
||||||
pp.up_or_down
|
|
||||||
) AS ct2 ON p.resource_name = ct2.resource_name
|
|
||||||
AND p.parent_container_name = ct2.parent_container_name
|
|
||||||
AND p.split_group = ct2.split_group
|
|
||||||
AND p.up_or_down <![CDATA[ <> ]]> ct2.up_or_down
|
|
||||||
WHERE
|
|
||||||
p.`status` = '01'
|
|
||||||
AND p.is_child_tz_ok = '0'
|
AND p.is_child_tz_ok = '0'
|
||||||
AND p.is_paper_ok = '1'
|
AND p.is_paper_ok = '1'
|
||||||
AND p.is_delete = '0'
|
AND p.is_delete = '0'
|
||||||
AND IFNULL(p.up_or_down,'') <![CDATA[ <> ]]> ''
|
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
|
||||||
AND IFNULL(p.left_or_right,'') <![CDATA[ <> ]]> ''
|
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
|
||||||
AND DATE(p.start_time) >= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
|
AND DATE (p.start_time) >= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
|
||||||
AND '1' = (SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name)
|
AND IFNULL(p.parent_container_name, '') <![CDATA[ <> ]]> ''
|
||||||
|
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
||||||
GROUP BY
|
GROUP BY
|
||||||
p.resource_name,
|
p.resource_name,
|
||||||
p.parent_container_name,
|
p.parent_container_name,
|
||||||
p.restruct_container_name,
|
|
||||||
p.split_group,
|
p.split_group,
|
||||||
p.up_or_down,
|
p.up_or_down,
|
||||||
p.qzz_size,
|
p.qzz_size,
|
||||||
|
p.qzz_generation
|
||||||
|
UNION ALL
|
||||||
|
SELECT p.resource_name,
|
||||||
|
p.restruct_container_name AS parent_container_name,
|
||||||
|
p.split_group,
|
||||||
|
p.up_or_down,
|
||||||
|
p.manufacture_sort,
|
||||||
|
p.qzz_size,
|
||||||
p.qzz_generation,
|
p.qzz_generation,
|
||||||
num,
|
MIN(p.start_time) AS start_time
|
||||||
cn,
|
FROM `pdm_bi_slittingproductionplan` p
|
||||||
cnn
|
WHERE p.`status` = '01'
|
||||||
ORDER BY
|
AND p.is_child_tz_ok = '0'
|
||||||
cnn DESC,
|
AND p.is_paper_ok = '1'
|
||||||
num,
|
AND p.is_delete = '0'
|
||||||
cn,
|
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
|
||||||
|
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
|
||||||
|
AND DATE (p.start_time) >= DATE_SUB(CURDATE()
|
||||||
|
, INTERVAL #{day} DAY)
|
||||||
|
AND IFNULL(p.restruct_container_name
|
||||||
|
, '') <![CDATA[ <> ]]> ''
|
||||||
|
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
||||||
|
GROUP BY
|
||||||
p.resource_name,
|
p.resource_name,
|
||||||
p.parent_container_name,
|
|
||||||
p.restruct_container_name,
|
p.restruct_container_name,
|
||||||
p.split_group,
|
p.split_group,
|
||||||
p.up_or_down
|
p.manufacture_sort,
|
||||||
|
p.up_or_down,
|
||||||
|
p.qzz_size,
|
||||||
|
p.qzz_generation
|
||||||
|
) AS combined_data
|
||||||
|
ORDER BY
|
||||||
|
manufacture_sort desc,
|
||||||
|
start_time
|
||||||
</select>
|
</select>
|
||||||
<select id="getAllHalfPlan" resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
|
<select id="getAllHalfPlan" resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
|
||||||
WITH RankedData AS (
|
WITH RankedData AS (
|
||||||
|
|||||||
@@ -869,7 +869,6 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
if (tasks.size() == 0) {
|
if (tasks.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
stepErrorInfo.add("存在为" + dto.getResource_name() + "送轴任务,不会继续套轴...");
|
|
||||||
log.info("存在任务,不允许套轴{}", dto);
|
log.info("存在任务,不允许套轴{}", dto);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -895,7 +894,8 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
? shafttubeivt.getContainer_name1() : shafttubeivt.getContainer_name2();
|
? shafttubeivt.getContainer_name1() : shafttubeivt.getContainer_name2();
|
||||||
// 获取这个子卷号的分切计划
|
// 获取这个子卷号的分切计划
|
||||||
PdmBiSlittingproductionplan byContainerName = slittingproductionplanService.getByContainerName(containerCode);
|
PdmBiSlittingproductionplan byContainerName = slittingproductionplanService.getByContainerName(containerCode);
|
||||||
String parent = SlitterConstant.SLITTER_TYPE_PAPER.equals(byContainerName.getPaper_tube_or_frp())
|
if (ObjectUtil.isNotEmpty(byContainerName)) {
|
||||||
|
String parent = "1".equals(byContainerName.getOrder_type())
|
||||||
? byContainerName.getParent_container_name()
|
? byContainerName.getParent_container_name()
|
||||||
: byContainerName.getRestruct_container_name();
|
: byContainerName.getRestruct_container_name();
|
||||||
if (byContainerName.getResource_name().equals(dto.getResource_name())) {
|
if (byContainerName.getResource_name().equals(dto.getResource_name())) {
|
||||||
@@ -904,11 +904,10 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
&& byContainerName.getSplit_group().equals(dto.getSplit_group())) {
|
&& byContainerName.getSplit_group().equals(dto.getSplit_group())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
stepStr += ",4";
|
|
||||||
stepErrorInfo.add(">>>穿拔轴机" + shafttubeivt.getPoint_code() + "已经在为" + dto.getResource_name() + "套轴了...");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 校验是否在拔轴暂存位、分切对接位有相同设备的分切计划信息。
|
// 校验是否在拔轴暂存位、分切对接位有相同设备的分切计划信息。
|
||||||
// 有就返回false, 没有就返回true
|
// 有就返回false, 没有就返回true
|
||||||
List<BstIvtCutpointivt> cuts2 = bcutpointivtService.getReallyQzzSameDevice(dto.getResource_name());
|
List<BstIvtCutpointivt> cuts2 = bcutpointivtService.getReallyQzzSameDevice(dto.getResource_name());
|
||||||
@@ -916,10 +915,8 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
List<String> stringList = cuts2.stream().map(BstIvtCutpointivt::getPoint_code).collect(Collectors.toList());
|
List<String> stringList = cuts2.stream().map(BstIvtCutpointivt::getPoint_code).collect(Collectors.toList());
|
||||||
stepErrorInfo.add("设备" + dto.getResource_name() + "检测到暂存架" + stringList + "有套好的管芯,不会进行套轴。");
|
|
||||||
}
|
}
|
||||||
log.info("检查有同母卷不允许套轴:{}", dto);
|
log.info("检查有同母卷不允许套轴:{}", dto);
|
||||||
stepStr += ",4";
|
|
||||||
// 有就返回true
|
// 有就返回true
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package org.nl.b_lms.sch.tasks.slitter.auto;
|
package org.nl.b_lms.sch.tasks.slitter.auto;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||||
@@ -64,6 +66,10 @@ public class AutoSendAirShaftAgvTask {
|
|||||||
List<String> collect = Stream.of(cutPoint.getQzz_no1(), cutPoint.getQzz_no2())
|
List<String> collect = Stream.of(cutPoint.getQzz_no1(), cutPoint.getQzz_no2())
|
||||||
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||||
if (collect.size() == 0) {
|
if (collect.size() == 0) {
|
||||||
|
cutPoint.setRemark("点位数据与状态不符合,气胀轴编码为空!");
|
||||||
|
cutPoint.setIs_used("0");
|
||||||
|
cutPoint.setUpdate_time(DateUtil.now());
|
||||||
|
bcutpointivtService.updateById(cutPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 最多4条分切计划
|
// 最多4条分切计划
|
||||||
@@ -89,6 +95,10 @@ public class AutoSendAirShaftAgvTask {
|
|||||||
sendNBJExceptionPointTask.createTask(exParam);
|
sendNBJExceptionPointTask.createTask(exParam);
|
||||||
} else {
|
} else {
|
||||||
log.info("异常处理位无空位!");
|
log.info("异常处理位无空位!");
|
||||||
|
// 点位禁用
|
||||||
|
cutPoint.setRemark("计划状态已被改变!");
|
||||||
|
cutPoint.setUpdate_time(DateUtil.now());
|
||||||
|
bcutpointivtService.updateById(cutPoint);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -110,6 +120,9 @@ public class AutoSendAirShaftAgvTask {
|
|||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
log.info("还有不同轴,所以不继续");
|
log.info("还有不同轴,所以不继续");
|
||||||
// 还有不同轴,所以不继续
|
// 还有不同轴,所以不继续
|
||||||
|
cutPoint.setRemark("还有不同轴,暂时不送轴!");
|
||||||
|
cutPoint.setUpdate_time(DateUtil.now());
|
||||||
|
bcutpointivtService.updateById(cutPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,6 +136,9 @@ public class AutoSendAirShaftAgvTask {
|
|||||||
area));
|
area));
|
||||||
if (emptyPoint.size() == 0) {
|
if (emptyPoint.size() == 0) {
|
||||||
log.warn("当前分切机找不到空闲的对接位置!");
|
log.warn("当前分切机找不到空闲的对接位置!");
|
||||||
|
cutPoint.setRemark("找不到当前分切机空闲的对接位置,暂时不送轴!");
|
||||||
|
cutPoint.setUpdate_time(DateUtil.now());
|
||||||
|
bcutpointivtService.updateById(cutPoint);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 创建任务
|
// 创建任务
|
||||||
|
|||||||
Reference in New Issue
Block a user