fix: 呼叫套轴校验是否可成组合的分切计划,继续套轴

This commit is contained in:
2024-06-12 17:01:45 +08:00
parent c2384e73a4
commit a7f84ba0e2
9 changed files with 137 additions and 6 deletions

View File

@@ -83,4 +83,13 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
* @return
*/
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location);
/**
* 获取一半的点位
* @param type 点位类型1套轴对接位2分切缓存位3分切对接位
* @param pointStatus 点位状态1空位、2有气涨轴、3有子卷
* @param location 区域0上1下
* @return /
*/
List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location);
}

View File

@@ -16,4 +16,6 @@ public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String generation);
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location);
List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location);
}

View File

@@ -63,4 +63,34 @@
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
)
</select>
<select id="getAllHalfPlacePoints"
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
SELECT
bic.*
FROM
bst_ivt_cutpointivt bic
WHERE
bic.point_type = '1'
AND bic.is_used = '1'
AND bic.point_status = '2'
AND bic.point_location = '0'
AND (LENGTH(bic.qzz_no1) = 0 OR LENGTH(bic.qzz_no2) = 0)
AND (LENGTH(bic.qzz_no1) <![CDATA[ > ]]> 0 OR LENGTH(bic.qzz_no2) <![CDATA[ > ]]> 0)
AND 0 = (
SELECT
COUNT(*)
FROM
sch_base_task t
WHERE
t.task_status <![CDATA[ < ]]> '07'
AND (
t.point_code1 = bic.point_code
OR t.point_code2 = bic.point_code
OR t.point_code1 = bic.truss_point_code1
OR t.point_code2 = bic.truss_point_code1
OR t.point_code1 = bic.truss_point_code2
OR t.point_code2 = bic.truss_point_code2
)
)
</select>
</mapper>

View File

@@ -118,4 +118,9 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
public List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location) {
return bstIvtCutpointivtMapper.getAreaNotTaskPointByLocationAreaAndStatus(location);
}
@Override
public List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location) {
return bstIvtCutpointivtMapper.getAllHalfPlacePoints(type, pointStatus, location);
}
}

View File

@@ -63,4 +63,11 @@ public interface IPdmBiSlittingproductionplanService extends IService<PdmBiSlitt
* @return /
*/
List<PdmBiSlittingproductionplan> getByQzzNos(List<String> qzzNo, String status);
/**
* 获取需要的分切计划
* @param qzzs /
* @return /
*/
List<SlitterPlanDistinctDto> getAllHalfPlan(List<String> qzzs);
}

View File

@@ -13,4 +13,6 @@ import java.util.List;
public interface PdmBiSlittingproductionplanMapper extends BaseMapper<PdmBiSlittingproductionplan> {
List<SlitterPlanDistinctDto> getAllCutPlan();
List<SlitterPlanDistinctDto> getAllHalfPlan(List<String> qzzs);
}

View File

@@ -88,4 +88,63 @@
p.split_group,
p.up_or_down
</select>
<select id="getAllHalfPlan" resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
WITH RankedData AS (
SELECT
p1.resource_name,
p1.parent_container_name,
p1.split_group,
p1.up_or_down,
'1' AS num,
p1.qzz_size,
c.qzz_generation,
ROW_NUMBER() OVER (
PARTITION BY p1.parent_container_name, p1.split_group
ORDER BY p1.resource_name
) AS rn
FROM
pdm_bi_slittingproductionplan p1
JOIN
(SELECT DISTINCT
p.qzzno,
p.parent_container_name,
p.split_group,
p.up_or_down
FROM
pdm_bi_slittingproductionplan p
WHERE
p.qzzno IN
<foreach item="item" index="index" collection="qzzs" open="(" separator="," close=")">
#{item}
</foreach>
) p2
ON
p1.parent_container_name = p2.parent_container_name
AND p1.split_group = p2.split_group
AND p1.up_or_down <![CDATA[ <> ]]> p2.up_or_down
AND p1.is_delete = '0'
AND p1.is_paper_ok = '1'
LEFT JOIN
st_ivt_cutpointivt c
ON
c.ext_code = p1.resource_name
WHERE
p1.qzzno NOT IN
<foreach item="item" index="index" collection="qzzs" open="(" separator="," close=")">
#{item}
</foreach>
)
SELECT
resource_name,
parent_container_name,
split_group,
up_or_down,
num,
qzz_size,
qzz_generation
FROM
RankedData
WHERE
rn = 1;
</select>
</mapper>

View File

@@ -99,6 +99,10 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
return pdmBiSlittingproductionplanMapper.selectList(lam);
}
@Override
public List<SlitterPlanDistinctDto> getAllHalfPlan(List<String> qzzs) {
return pdmBiSlittingproductionplanMapper.getAllHalfPlan(qzzs);
}
}

View File

@@ -1,6 +1,5 @@
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.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -23,7 +22,6 @@ import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum;
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
@@ -32,7 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -98,9 +95,25 @@ public class AutoCallAirShaftTask {
"1", location, "0");
// 如果满了就只做拔轴
if (emptyShaftPoint.size() == 0) {
// 如果不需要套轴,就只做拔轴
makePullShaft(empty, specification);
return;
// 校验是否存在半个位置,且有分切计划
// 获取只有一个位置的点位
List<BstIvtCutpointivt> halfPlacePoint = bcutpointivtService.getAllHalfPlacePoints("1",
"1", location);
List<String> qzzs = halfPlacePoint.stream()
.map(p -> ObjectUtil.isNotEmpty(p.getQzz_no1()) ? p.getQzz_no1() : p.getQzz_no2())
.collect(Collectors.toList());
if (qzzs.size() == 0) {
// 如果不需要套轴,就只做拔轴
makePullShaft(empty, specification);
return;
}
// 从寻查找分切计划并放在plans, 没有考虑区域问题
plans = slittingproductionplanService.getAllHalfPlan(qzzs);
if (plans.size() == 0) {
// 如果不需要套轴,就只做拔轴
makePullShaft(empty, specification);
return;
}
}
// 获取一个分切计划的Dto。如果是6寸可以直接使用、如果是3寸需要判断当前位置是否满足
SlitterPlanDistinctDto planDto = plans.stream()