opt: 套轴优先托盘上的管芯

This commit is contained in:
2025-05-08 15:21:27 +08:00
parent 3eeb8a09bb
commit 61c3972edb
5 changed files with 72 additions and 1 deletions

View File

@@ -56,4 +56,11 @@ public interface IMdPbPapervehicleService extends IService<MdPbPapervehicle> {
List<GxQtyDto> getGxPoints(String pointLocation, List<String> tubes);
Integer checkHaveTaskByPoints(List<String> pointCodes);
/**
* 获取对接位的所有管芯信息
* @param location
* @return
*/
List<MdPbPapervehicle> getAllTubesByPoint(String location);
}

View File

@@ -19,4 +19,6 @@ public interface MdPbPapervehicleMapper extends BaseMapper<MdPbPapervehicle> {
List<GxQtyDto> getGxPoints(String pointLocation, List<String> tubes);
Integer checkHaveTaskByPoints(List<String> pointCodes);
List<MdPbPapervehicle> getAllTubesByPoint(String location);
}

View File

@@ -32,7 +32,7 @@
#{code}
</foreach>
AND mp.qty > 0
AND bs.point_location = '0'
AND bs.point_location = #{pointLocation}
GROUP BY bs.point_code, bs.point_type
</select>
<select id="checkHaveTaskByPoints" resultType="java.lang.Integer">
@@ -60,4 +60,14 @@
)
)
</select>
<select id="getAllTubesByPoint"
resultType="org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle">
SELECT p.*
FROM bst_ivt_stockingivt bs
LEFT JOIN md_pb_papervehicle p ON p.vehicle_code = bs.vehicle_code
WHERE bs.point_type = '1'
AND bs.point_location = #{location}
AND bs.is_used = '1'
AND p.qty > 0
</select>
</mapper>

View File

@@ -96,4 +96,9 @@ public class MdPbPapervehicleServiceImpl extends ServiceImpl<MdPbPapervehicleMap
return mdPbPapervehicleMapper.checkHaveTaskByPoints(pointCodes);
}
@Override
public List<MdPbPapervehicle> getAllTubesByPoint(String location) {
return mdPbPapervehicleMapper.getAllTubesByPoint(location);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.b_lms.sch.tasks.slitter.auto;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
@@ -90,6 +91,8 @@ public class AutoCallAirShaftTask {
private ISysParamService paramService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private IMdPbPapervehicleService papervehicleService;
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA";
public final static String IS_ONLY_PULLING = "IS_ONLY_PULLING";
@@ -157,6 +160,43 @@ public class AutoCallAirShaftTask {
makePullShaft(empty, specification);
return;
}
// 过滤相比当前时间大于1小时
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime cutoffTime = LocalDateTime.now().minusHours(1);
List<SlitterPlanDistinctDto> filteredList = planAll.stream()
.filter(p -> {
try {
LocalDateTime startTime = LocalDateTime.parse(p.getStart_time(), formatter);
return startTime.isBefore(cutoffTime);
} catch (Exception e) {
return false;
}
})
.collect(Collectors.toList());
List<PdmBiSlittingproductionplan> filterCheckPlans = null;
if (filteredList.size() > 0) {
log.info("过滤时间之后的数据:{}", filteredList);
// 获取当前三个位置的所有管芯信息
List<MdPbPapervehicle> papers = papervehicleService.getAllTubesByPoint(location);
if (CollectionUtil.isNotEmpty(papers)) {
List<String> tubeCodes = papers.stream()
.map(MdPbPapervehicle::getMaterial_code)
.distinct()
.collect(Collectors.toList());
// 获取所有dto中的分切计划信息
List<String> parents = filteredList.stream()
.map(SlitterPlanDistinctDto::getParent_container_name)
.distinct()
.collect(Collectors.toList());
List<PdmBiSlittingproductionplan> checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
.in(PdmBiSlittingproductionplan::getParent_container_name, parents)
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
filterCheckPlans = checkPlans.stream()
.filter(p -> tubeCodes.contains("1".equals(p.getPaper_tube_or_FRP()) ? p.getPaper_tube_material() : p.getFRP_material()))
.collect(Collectors.toList());
}
}
log.info("获取过滤后的分切计划数据:{}", JSON.toJSONString(plans));
// 查看套轴对接位是否满了
// todo: 这里需要注意不要去校验071的任务不然提前释放货位没意义。
@@ -237,6 +277,10 @@ public class AutoCallAirShaftTask {
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
}
// 如果过滤出来的需要套轴的信息,则直接获取
if (CollectionUtil.isNotEmpty(filterCheckPlans)) {
needPlans = filterCheckPlans;
}
log.info("通过dto获取的分切计划{}", needPlans);
// 获取其中一条
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
@@ -361,6 +405,9 @@ public class AutoCallAirShaftTask {
* @return
*/
public boolean havaEmptyShaft(SlitterPlanDistinctDto planD, BstIvtShafttubeivt empty) {
if (true) {
return true;
}
String qzzSize = planD.getQzz_size();
String qzzGeneration = planD.getQzz_generation();
String location = empty.getPoint_location();