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