4 changed files with 0 additions and 434 deletions
@ -1,97 +0,0 @@ |
|||
package org.nl.b_lms.sch.tasks.slitter.auto; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt; |
|||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownAgvTask; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; |
|||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.redisson.api.RLock; |
|||
import org.redisson.api.RedissonClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务 |
|||
* 先去套轴对接位,(标箔,套轴对接位不够的情况下是去分切缓存位) |
|||
* 改成:先去暂存位,手持送到内包间 |
|||
* |
|||
* 分切对接位和分切缓存位公用类 |
|||
* @Date: 2024/2/1 |
|||
* @see SlitterDownAgvTask#createTask(JSONObject) |
|||
*/ |
|||
@Slf4j |
|||
@Deprecated |
|||
@Component |
|||
public class AutoSlitterCacheDownAgvTask { |
|||
|
|||
@Autowired |
|||
private IBstIvtCutpointivtService cutpointivtService; |
|||
@Autowired |
|||
private SlitterDownAgvTask slitterDownAgvTask; |
|||
@Autowired |
|||
private SlitterMapper slitterMapper; |
|||
@Autowired |
|||
private RedissonClient redissonClient; |
|||
/** |
|||
* 业务: |
|||
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。 |
|||
* 先往套轴对接位送,不够再送分切缓存位(针对B2,B4车间) |
|||
*/ |
|||
public void run() { |
|||
log.info("自动分切下料创建AGV任务开始执行..."); |
|||
// 获取分切对接位满轴数据 todo: 先不考虑区域,后期添加
|
|||
// todo: 后面换 slitterService.getAreaFullVolumeByArea("B2", "B4"); 的数据
|
|||
// bct.point_type IN ('2', '3') -> bct.point_type = '3'
|
|||
List<BstIvtCutpointivt> cutPointIvts = slitterMapper.getAreaFullVolume(); |
|||
cutPointIvts.forEach(cut -> { |
|||
// cut是起点
|
|||
// todo: B2已经满足,B4需要根据车间改动区域 (0 or 1)
|
|||
// remove: 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
|||
// update: 1、去分切缓存位,在由手持下发到内包间
|
|||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("2", "1", "0","0"); |
|||
if (areaEmptyNotTaskPoint.size() == 0) { |
|||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴"); |
|||
return; |
|||
} |
|||
// 生成任务
|
|||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0); |
|||
RLock lock = redissonClient.getLock(endPoint.getPoint_code()); |
|||
boolean tryLock; |
|||
try { |
|||
tryLock = lock.tryLock(0, TimeUnit.SECONDS); |
|||
} catch (InterruptedException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
try { |
|||
if (tryLock) { |
|||
toCreateTask(cut, endPoint); |
|||
} else { |
|||
throw new BadRequestException("系统繁忙,稍后在试!"); |
|||
} |
|||
} finally { |
|||
if (tryLock) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void toCreateTask(BstIvtCutpointivt cut, BstIvtCutpointivt endPoint) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("point_code1", cut.getPoint_code()); |
|||
param.put("point_code2", endPoint.getPoint_code()); |
|||
param.put("vehicle_code1", cut.getQzz_no1()); |
|||
param.put("vehicle_code2", cut.getQzz_no2()); |
|||
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV任务")); |
|||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|||
slitterDownAgvTask.createTask(param); |
|||
} |
|||
} |
@ -1,106 +0,0 @@ |
|||
package org.nl.b_lms.sch.tasks.slitter.auto; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt; |
|||
import org.nl.b_lms.sch.task.dao.SchBaseTask; |
|||
import org.nl.b_lms.sch.task.service.IschBaseTaskService; |
|||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownAgvTask; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; |
|||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.redisson.api.RLock; |
|||
import org.redisson.api.RedissonClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.TimeUnit; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.Stream; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务 |
|||
* 先去套轴对接位,(标箔,套轴对接位不够的情况下是去分切缓存位) |
|||
* update: 业务不需要 |
|||
* 分切对接位和分切缓存位公用类 |
|||
* @Date: 2024/2/1 |
|||
* @see SlitterDownAgvTask#createTask(JSONObject) |
|||
*/ |
|||
@Slf4j |
|||
@Deprecated |
|||
@Component |
|||
public class AutoSlitterDownAgvTask { |
|||
|
|||
@Autowired |
|||
private IBstIvtCutpointivtService cutpointivtService; |
|||
@Autowired |
|||
private SlitterDownAgvTask slitterDownAgvTask; |
|||
@Autowired |
|||
private IschBaseTaskService taskService; |
|||
@Autowired |
|||
private SlitterMapper slitterMapper; |
|||
@Autowired |
|||
private RedissonClient redissonClient; |
|||
/** |
|||
* 业务: |
|||
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。 |
|||
* 先往套轴对接位送,不够再送分切缓存位(针对B2,B4车间) |
|||
*/ |
|||
public void run() { |
|||
// 获取满轴数据 todo: 先不考虑区域,后期添加
|
|||
List<BstIvtCutpointivt> cutPointIvts = slitterMapper.getAreaFullVolume(); |
|||
cutPointIvts.forEach(cut -> { |
|||
// cut是起点
|
|||
// 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
|||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0", "2"); |
|||
if (areaEmptyNotTaskPoint.size() > 0) { |
|||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0); |
|||
RLock lock = redissonClient.getLock(endPoint.getPoint_code()); |
|||
boolean tryLock; |
|||
try { |
|||
tryLock = lock.tryLock(0, TimeUnit.SECONDS); |
|||
} catch (InterruptedException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
try { |
|||
if (tryLock) { |
|||
toCreateTask(cut, endPoint); |
|||
return; |
|||
} else { |
|||
throw new BadRequestException("系统繁忙,稍后在试!!"); |
|||
} |
|||
} finally { |
|||
if (tryLock) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} else if ("3".equals(cut.getPoint_type())) { |
|||
// 2、没有位置,就去分切缓存位
|
|||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("2", "1", "0","0"); |
|||
} |
|||
if (areaEmptyNotTaskPoint.size() == 0) { |
|||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴"); |
|||
return; |
|||
} |
|||
// 生成任务
|
|||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0); |
|||
toCreateTask(cut, endPoint); |
|||
}); |
|||
} |
|||
|
|||
private void toCreateTask(BstIvtCutpointivt cut, BstIvtCutpointivt endPoint) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("point_code1", cut.getPoint_code()); |
|||
param.put("point_code2", endPoint.getPoint_code()); |
|||
param.put("vehicle_code1", cut.getQzz_no1()); |
|||
param.put("vehicle_code2", cut.getQzz_no2()); |
|||
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV任务")); |
|||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|||
slitterDownAgvTask.createTask(param); |
|||
} |
|||
} |
@ -1,90 +0,0 @@ |
|||
package org.nl.b_lms.sch.tasks.slitter.auto; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt; |
|||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownAgvTask; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; |
|||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.redisson.api.RLock; |
|||
import org.redisson.api.RedissonClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务 |
|||
* 直接送到内包间穿拔轴位置 |
|||
* B1、B3车间使用 |
|||
* 不需要自动送 |
|||
* @Date: 2024/7/5 |
|||
* @see SlitterDownAgvTask#createTask(JSONObject) |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@Deprecated |
|||
public class AutoSlitterNbjDownAgvTask { |
|||
|
|||
@Autowired |
|||
private IBstIvtCutpointivtService cutpointivtService; |
|||
@Autowired |
|||
private SlitterDownAgvTask slitterDownAgvTask; |
|||
@Autowired |
|||
private SlitterService slitterService; |
|||
@Autowired |
|||
private RedissonClient redissonClient; |
|||
/** |
|||
* 业务: |
|||
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。 |
|||
* 先往套轴对接位送,不够再送分切缓存位(针对B1,B3车间) |
|||
*/ |
|||
public void run() { |
|||
// 获取B1,B3满轴数据
|
|||
List<BstIvtCutpointivt> cutPointIvts = slitterService.getAreaFullVolumeByArea("B1", "B3"); |
|||
cutPointIvts.forEach(cut -> { |
|||
// cut是起点
|
|||
// 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
|||
// todo: 先考虑上区域 point_location
|
|||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0", "2"); |
|||
if (areaEmptyNotTaskPoint.size() > 0) { |
|||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0); |
|||
RLock lock = redissonClient.getLock(endPoint.getPoint_code()); |
|||
boolean tryLock; |
|||
try { |
|||
tryLock = lock.tryLock(0, TimeUnit.SECONDS); |
|||
} catch (InterruptedException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
try { |
|||
if (tryLock) { |
|||
toCreateTask(cut, endPoint); |
|||
} else { |
|||
throw new BadRequestException("系统繁忙,稍后在试!!"); |
|||
} |
|||
} finally { |
|||
if (tryLock) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private void toCreateTask(BstIvtCutpointivt cut, BstIvtCutpointivt endPoint) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("point_code1", cut.getPoint_code()); |
|||
param.put("point_code2", endPoint.getPoint_code()); |
|||
param.put("vehicle_code1", cut.getQzz_no1()); |
|||
param.put("vehicle_code2", cut.getQzz_no2()); |
|||
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV任务")); |
|||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|||
slitterDownAgvTask.createTask(param); |
|||
} |
|||
} |
|||
|
@ -1,141 +0,0 @@ |
|||
package org.nl.b_lms.sch.tasks.slitter.auto; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt; |
|||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService; |
|||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan; |
|||
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt; |
|||
import org.nl.b_lms.sch.point.service.IstIvtCutpointivtService; |
|||
import org.nl.b_lms.sch.task.dao.SchBaseTask; |
|||
import org.nl.b_lms.sch.task.service.IschBaseTaskService; |
|||
import org.nl.b_lms.sch.tasks.slitter.UpShaftTrussTask; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; |
|||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; |
|||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.Stream; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: 自动任务 分切机下料位上套轴气涨轴,桁架任务(头一次调用,上单/上双) |
|||
* @Date: 2024/2/1 |
|||
*/ |
|||
@Slf4j |
|||
@Deprecated |
|||
@Component |
|||
public class AutoUpShaftTrussTask { |
|||
@Autowired |
|||
private IstIvtCutpointivtService cutpointivtService; |
|||
@Autowired |
|||
private IPdmBiSlittingproductionplanService slittingproductionplanService; |
|||
@Autowired |
|||
private UpShaftTrussTask upShaftTrussTask; |
|||
@Autowired |
|||
private IschBaseTaskService taskService; |
|||
@Autowired |
|||
private SlitterMapper slitterMapper; |
|||
|
|||
/** |
|||
* 运行任务,主要负责校验分切机是否有未处理的任务,如果有则跳过;如果没有,会尝试为分切机创建新的任务。 |
|||
* 该过程包括:查找没有气涨轴的分切机点位,校验是否存在相关任务,寻找备好轴的对接点位,获取下一组分切计划, |
|||
* 并根据计划创建相应的搬运任务。 |
|||
*/ |
|||
public void run() { |
|||
log.info("自动上气胀轴的桁架任务开始执行..."); |
|||
// 获取符合条件的分切机点位信息 hint: (目前暂定B1,B2区域)
|
|||
List<StIvtCutpointivt> devicePoint = cutpointivtService.list(new LambdaQueryWrapper<StIvtCutpointivt>() |
|||
.in(StIvtCutpointivt::getProduct_area, "B2", "B1") |
|||
.and(l1 -> l1.eq(StIvtCutpointivt::getUp_qzzno, "").or().isNull(StIvtCutpointivt::getUp_qzzno)) |
|||
.and(l2 -> l2.eq(StIvtCutpointivt::getDown_qzzno, "").or().isNull(StIvtCutpointivt::getDown_qzzno))); |
|||
|
|||
// 遍历每个分切机点位进行任务的校验和创建
|
|||
devicePoint.forEach(device -> { |
|||
// todo: 区域
|
|||
String productArea = device.getProduct_area(); |
|||
// 校验是否存在未完成的任务
|
|||
List<String> collect = Stream.of(device.getUp_point_code(), device.getDown_point_code()).collect(Collectors.toList()); |
|||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>() |
|||
.lt(SchBaseTask::getTask_status, "07") |
|||
.in(SchBaseTask::getPoint_code1, collect).in(SchBaseTask::getPoint_code2, collect) |
|||
.in(SchBaseTask::getPoint_code3, collect).in(SchBaseTask::getPoint_code4, collect)); |
|||
if (list.size() > 0) { |
|||
// 存在未完成任务,跳过当前点位
|
|||
return; |
|||
} |
|||
|
|||
// 寻找备好轴的对接点位
|
|||
List<BstIvtCutpointivt> cutPointList = slitterMapper.getReadyShaftPoint(device.getExt_code()); |
|||
if (cutPointList.size() == 0) { |
|||
log.warn("分切机【" + device.getExt_code() + "】未找到套好纸管的气涨轴"); |
|||
// 未找到备好轴的对接点位
|
|||
return; |
|||
} |
|||
BstIvtCutpointivt newCutPoint = cutPointList.get(0); |
|||
log.info("找到套好的点位:{}", newCutPoint); |
|||
// 获取下一组分切计划
|
|||
List<String> qzzNos = Stream.of(newCutPoint.getQzz_no1(), newCutPoint.getQzz_no2()) |
|||
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList()); |
|||
if (qzzNos.size() == 0) { |
|||
log.warn("{} - 气胀轴编码未找到,跳到下一个点位!", newCutPoint); |
|||
return; |
|||
} |
|||
List<PdmBiSlittingproductionplan> nextPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>() |
|||
.in(PdmBiSlittingproductionplan::getQzzno, qzzNos) |
|||
.eq(PdmBiSlittingproductionplan::getStatus, "03") |
|||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")); |
|||
if (nextPlans.size() == 0) { |
|||
// notice提示分切计划找不到
|
|||
log.warn("分切机【" + device.getExt_code() + "】未找到套好轴的分切计划"); |
|||
// 未找到分切计划
|
|||
return; |
|||
} |
|||
|
|||
JSONObject param = new JSONObject(); |
|||
// 根据计划筛选上下轴任务,并构建任务参数
|
|||
PdmBiSlittingproductionplan nextUpPlan = nextPlans.stream() |
|||
.filter(p -> SlitterConstant.SLITTER_SHAFT_UP.equals(p.getUp_or_down())).findFirst().orElse(null); |
|||
PdmBiSlittingproductionplan nextDownPlan = nextPlans.stream() |
|||
.filter(p -> SlitterConstant.SLITTER_SHAFT_DOWN.equals(p.getUp_or_down())).findFirst().orElse(null); |
|||
|
|||
if (ObjectUtil.isNotEmpty(nextUpPlan) && ObjectUtil.isNotEmpty(nextDownPlan)) { |
|||
// 双轴任务参数构建
|
|||
param.put("point_code1", newCutPoint.getTruss_point_code2()); |
|||
param.put("point_code2", device.getDown_point_code()); |
|||
param.put("point_code3", newCutPoint.getTruss_point_code1()); |
|||
param.put("point_code4", device.getUp_point_code()); |
|||
param.put("vehicle_code1", newCutPoint.getQzz_no1()); |
|||
param.put("vehicle_code2", newCutPoint.getQzz_no2()); |
|||
} else { |
|||
// 单轴任务参数构建
|
|||
if (ObjectUtil.isNotEmpty(nextUpPlan)) { |
|||
// 上轴任务
|
|||
param.put("point_code1", newCutPoint.getTruss_point_code1()); |
|||
param.put("point_code2", device.getUp_point_code()); |
|||
param.put("vehicle_code1", newCutPoint.getQzz_no1()); |
|||
} else { |
|||
// 下轴任务
|
|||
param.put("point_code1", newCutPoint.getTruss_point_code2()); |
|||
param.put("point_code2", device.getDown_point_code()); |
|||
param.put("vehicle_code2", newCutPoint.getQzz_no2()); |
|||
} |
|||
} |
|||
|
|||
// 构建任务的其他参数
|
|||
param.put("truss_type", "1"); |
|||
param.put("empty_site", "0"); |
|||
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机上气胀轴")); |
|||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|||
|
|||
// 创建任务
|
|||
upShaftTrussTask.createTask(param); |
|||
}); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue